# error.h

Go to the documentation of this file.

    00001 /* $Id: error.h 26241 2014-01-12 18:00:39Z frosch $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef ERROR_H
    00013 #define ERROR_H
    00014
    00015 #include "strings_type.h"
    00016 #include "company_type.h"
    00017 #include "core/geometry_type.hpp"
    00018
    00019 struct GRFFile;
    00020
    00022 enum WarningLevel {
    00023   WL_INFO,
    00024   WL_WARNING,
    00025   WL_ERROR,
    00026   WL_CRITICAL,
    00027 };
    00028
    00030 class ErrorMessageData {
    00031 protected:
    00032   uint duration;
    00033   uint64 decode_params[20];
    00034   const char *strings[20];
    00035   const GRFFile *textref_stack_grffile;
    00036   uint textref_stack_size;
    00037   uint32 textref_stack[16];
    00038   StringID summary_msg;
    00039   StringID detailed_msg;
    00040   Point position;
    00041   CompanyID face;
    00042
    00043 public:
    00044   ErrorMessageData(const ErrorMessageData &data);
    00045   ~ErrorMessageData();
    00046   ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration = 0, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = NULL, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
    00047
    00049   bool HasFace() const { return face != INVALID_COMPANY; }
    00050
    00051   void SetDParam(uint n, uint64 v);
    00052   void SetDParamStr(uint n, const char *str);
    00053
    00054   void CopyOutDParams();
    00055 };
    00056
    00057 void ScheduleErrorMessage(const ErrorMessageData &data);
    00058
    00059 void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = NULL, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
    00060 void ClearErrorMessages();
    00061 void ShowFirstError();
    00062 void UnshowCriticalError();
    00063
    00064 #endif /* ERROR_H */