OpenTTD Source  20241109-master-g5e4f8db7d6
ErrorMessageData Class Reference

The data of the error message. More...

#include <error.h>

Inheritance diagram for ErrorMessageData:
ErrmsgWindow

Public Member Functions

 ErrorMessageData (const ErrorMessageData &data)
 Copy the given data into our instance. More...
 
 ErrorMessageData (StringID summary_msg, StringID detailed_msg, bool is_critical=false, int x=0, int y=0, const GRFFile *textref_stack_grffile=nullptr, uint textref_stack_size=0, const uint32_t *textref_stack=nullptr, StringID extra_msg=INVALID_STRING_ID)
 Display an error message in a window. More...
 
ErrorMessageDataoperator= (ErrorMessageData &rhs)=delete
 
bool HasFace () const
 Check whether error window shall display a company manager face.
 
void SetDParam (uint n, uint64_t v)
 Set a error string parameter. More...
 
void SetDParamStr (uint n, const char *str)
 Set a rawstring parameter. More...
 
void SetDParamStr (uint n, const std::string &str)
 Set a rawstring parameter. More...
 
void CopyOutDParams ()
 Copy error parameters from current DParams.
 

Protected Attributes

bool is_critical
 Whether the error message is critical.
 
std::vector< StringParameterData > params
 Backup of parameters of the message strings.
 
const GRFFiletextref_stack_grffile
 NewGRF that filled the TextRefStack for the error message.
 
uint textref_stack_size
 Number of uint32_t values to put on the TextRefStack for the error message.
 
uint32_t textref_stack [16]
 Values to put on the TextRefStack for the error message.
 
StringID summary_msg
 General error message showed in first line. Must be valid.
 
StringID detailed_msg
 Detailed error message showed in second line. Can be INVALID_STRING_ID.
 
StringID extra_msg
 Extra error message shown in third line. Can be INVALID_STRING_ID.
 
Point position
 Position of the error message window.
 
CompanyID face
 Company belonging to the face being shown. INVALID_COMPANY if no face present.
 

Detailed Description

The data of the error message.

Definition at line 31 of file error.h.

Constructor & Destructor Documentation

◆ ErrorMessageData() [1/2]

ErrorMessageData::ErrorMessageData ( const ErrorMessageData data)

Copy the given data into our instance.

Parameters
dataThe data to copy.

Definition at line 77 of file error_gui.cpp.

References textref_stack.

◆ ErrorMessageData() [2/2]

ErrorMessageData::ErrorMessageData ( StringID  summary_msg,
StringID  detailed_msg,
bool  is_critical = false,
int  x = 0,
int  y = 0,
const GRFFile textref_stack_grffile = nullptr,
uint  textref_stack_size = 0,
const uint32_t *  textref_stack = nullptr,
StringID  extra_msg = INVALID_STRING_ID 
)

Display an error message in a window.

Parameters
summary_msgGeneral error message showed in first line. Must be valid.
detailed_msgDetailed error message showed in second line. Can be INVALID_STRING_ID.
is_criticalWhether the error is critical. Critical messages never go away on their own.
xWorld X position (TileVirtX) of the error location. Set both x and y to 0 to just center the message when there is no related error tile.
yWorld Y position (TileVirtY) of the error location. Set both x and y to 0 to just center the message when there is no related error tile.
textref_stack_grffileNewGRF that provides the TextRefStack for the error message.
textref_stack_sizeNumber of uint32_t values to put on the TextRefStack for the error message; 0 if the TextRefStack shall not be used.
textref_stackValues to put on the TextRefStack.
extra_msgExtra error message showed in third line. Can be INVALID_STRING_ID.

Definition at line 96 of file error_gui.cpp.

Member Function Documentation

◆ SetDParam()

void ErrorMessageData::SetDParam ( uint  n,
uint64_t  v 
)

Set a error string parameter.

Parameters
nParameter index
vParameter value

Definition at line 135 of file error_gui.cpp.

References params.

◆ SetDParamStr() [1/2]

void ErrorMessageData::SetDParamStr ( uint  n,
const char *  str 
)

Set a rawstring parameter.

Parameters
nParameter index
strRaw string

Definition at line 146 of file error_gui.cpp.

References params.

Referenced by IntSettingDesc::ParseValue(), BoolSettingDesc::ParseValue(), OneOfManySettingDesc::ParseValue(), ManyOfManySettingDesc::ParseValue(), and ListSettingDesc::ParseValue().

◆ SetDParamStr() [2/2]

void ErrorMessageData::SetDParamStr ( uint  n,
const std::string &  str 
)

Set a rawstring parameter.

Parameters
nParameter index
strRaw string

Definition at line 157 of file error_gui.cpp.

References params.


The documentation for this class was generated from the following files: