OpenTTD: src/error.h Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

error.h
Go to the documentation of this file.
1 /* $Id: error.h 26241 2014-01-12 18:00:39Z frosch $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
9
12 #ifndef ERROR_H
13 #define ERROR_H
14
15 #include "strings_type.h"
16 #include "company_type.h"
17 #include "core/geometry_type.hpp"
18
19 struct GRFFile;
20
22 enum WarningLevel {
23 WL_INFO,
24 WL_WARNING,
25 WL_ERROR,
26 WL_CRITICAL,
27 };
28
30 class ErrorMessageData {
31 protected:
32 uint duration;
33 uint64 decode_params[20];
34 const char *strings[20];
35 const GRFFile *textref_stack_grffile;
36 uint textref_stack_size;
37 uint32 textref_stack[16];
38 StringID summary_msg;
39 StringID detailed_msg;
40 Point position;
41 CompanyID face;
42
43 public:
44 ErrorMessageData(const ErrorMessageData &data);
45 ~ErrorMessageData();
46 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);
47
49 bool HasFace() const { return face != INVALID_COMPANY; }
50
51 void SetDParam(uint n, uint64 v);
52 void SetDParamStr(uint n, const char *str);
53
54 void CopyOutDParams();
55 };
56
57 void ScheduleErrorMessage(const ErrorMessageData &data);
58
59 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);
60 void ClearErrorMessages();
61 void ShowFirstError();
62 void UnshowCriticalError();
63
64 #endif /* ERROR_H */