OpenTTD
error.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef ERROR_H
11 #define ERROR_H
12 
13 #include "strings_type.h"
14 #include "company_type.h"
15 #include "core/geometry_type.hpp"
16 
17 struct GRFFile;
18 
25 };
26 
29 protected:
30  uint duration;
31  uint64 decode_params[20];
32  const char *strings[20];
35  uint32 textref_stack[16];
40 
41 public:
44  ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration = 0, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = nullptr, uint textref_stack_size = 0, const uint32 *textref_stack = nullptr);
45 
47  bool HasFace() const { return face != INVALID_COMPANY; }
48 
49  void SetDParam(uint n, uint64 v);
50  void SetDParamStr(uint n, const char *str);
51 
52  void CopyOutDParams();
53 };
54 
55 void ScheduleErrorMessage(const ErrorMessageData &data);
56 
57 void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = nullptr, uint textref_stack_size = 0, const uint32 *textref_stack = nullptr);
58 void ClearErrorMessages();
59 void ShowFirstError();
60 void UnshowCriticalError();
61 
62 #endif /* ERROR_H */
Owner
Enum for all companies/owners.
Definition: company_type.h:18
uint textref_stack_size
Number of uint32 values to put on the TextRefStack for the error message.
Definition: error.h:34
void SetDParamStr(uint n, const char *str)
Set a rawstring parameter.
Definition: error_gui.cpp:160
ErrorMessageData(const ErrorMessageData &data)
Copy the given data into our instance.
Definition: error_gui.cpp:73
void SetDParam(uint n, uint64 v)
Set a error string parameter.
Definition: error_gui.cpp:150
CompanyID face
Company belonging to the face being shown. INVALID_COMPANY if no face present.
Definition: error.h:39
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=nullptr, uint textref_stack_size=0, const uint32 *textref_stack=nullptr)
Display an error message in a window.
Definition: error_gui.cpp:380
void CopyOutDParams()
Copy error parameters from current DParams.
Definition: error_gui.cpp:127
~ErrorMessageData()
Free all the strings.
Definition: error_gui.cpp:89
uint32 textref_stack[16]
Values to put on the TextRefStack for the error message.
Definition: error.h:35
Critical errors, the MessageBox is shown in all cases.
Definition: error.h:24
Other information.
Definition: error.h:22
StringID detailed_msg
Detailed error message showed in second line. Can be INVALID_STRING_ID.
Definition: error.h:37
void ScheduleErrorMessage(const ErrorMessageData &data)
Schedule an error.
Definition: error_gui.cpp:442
StringID summary_msg
General error message showed in first line. Must be valid.
Definition: error.h:36
const char * strings[20]
Copies of raw strings that were used.
Definition: error.h:32
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
bool HasFace() const
Check whether error window shall display a company manager face.
Definition: error.h:47
void UnshowCriticalError()
Unshow the critical error.
Definition: error_gui.cpp:359
An invalid company.
Definition: company_type.h:30
The data of the error message.
Definition: error.h:28
void ClearErrorMessages()
Clear all errors from the queue.
Definition: error_gui.cpp:338
uint duration
Length of display of the message. 0 means forever,.
Definition: error.h:30
const GRFFile * textref_stack_grffile
NewGRF that filled the TextRefStack for the error message.
Definition: error.h:33
All geometry types in OpenTTD.
Coordinates of a point in 2D.
Types related to companies.
Types related to strings.
Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
Definition: error.h:21
uint64 decode_params[20]
Parameters of the message strings.
Definition: error.h:31
Errors (eg. saving/loading failed)
Definition: error.h:23
Point position
Position of the error message window.
Definition: error.h:38
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:105
WarningLevel
Message severity/type.
Definition: error.h:20
void ShowFirstError()
Show the first error of the queue.
Definition: error_gui.cpp:345