OpenTTD Source 20241224-master-gf74b0cf984
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.
 
 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.
 
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.
 
void SetDParamStr (uint n, const char *str)
 Set a rawstring parameter.
 
void SetDParamStr (uint n, const std::string &str)
 Set a rawstring parameter.
 
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.

References INVALID_STRING_ID, MemCpyT(), position, summary_msg, textref_stack, and textref_stack_size.

Member Function Documentation

◆ CopyOutDParams()

void ErrorMessageData::CopyOutDParams ( )

◆ HasFace()

bool ErrorMessageData::HasFace ( ) const
inline

Check whether error window shall display a company manager face.

Definition at line 52 of file error.h.

References face, and INVALID_COMPANY.

◆ 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 openttd_main(), 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.

Field Documentation

◆ detailed_msg

StringID ErrorMessageData::detailed_msg
protected

Detailed error message showed in second line. Can be INVALID_STRING_ID.

Definition at line 39 of file error.h.

Referenced by CopyOutDParams(), ErrmsgWindow::DrawWidget(), and ErrmsgWindow::UpdateWidgetSize().

◆ extra_msg

StringID ErrorMessageData::extra_msg
protected

Extra error message shown in third line. Can be INVALID_STRING_ID.

Definition at line 40 of file error.h.

Referenced by ErrmsgWindow::DrawWidget(), and ErrmsgWindow::UpdateWidgetSize().

◆ face

CompanyID ErrorMessageData::face
protected

Company belonging to the face being shown. INVALID_COMPANY if no face present.

Definition at line 42 of file error.h.

Referenced by CopyOutDParams(), ErrmsgWindow::DrawWidget(), HasFace(), and ErrmsgWindow::OnInvalidateData().

◆ is_critical

bool ErrorMessageData::is_critical
protected

Whether the error message is critical.

Definition at line 33 of file error.h.

Referenced by ErrmsgWindow::IsCritical(), and ErrmsgWindow::OnMouseLoop().

◆ params

std::vector<StringParameterData> ErrorMessageData::params
protected

◆ position

Point ErrorMessageData::position
protected

Position of the error message window.

Definition at line 41 of file error.h.

Referenced by ErrorMessageData(), and ErrmsgWindow::OnInitialPosition().

◆ summary_msg

StringID ErrorMessageData::summary_msg
protected

General error message showed in first line. Must be valid.

Definition at line 38 of file error.h.

Referenced by ErrmsgWindow::DrawWidget(), ErrorMessageData(), and ErrmsgWindow::UpdateWidgetSize().

◆ textref_stack

uint32_t ErrorMessageData::textref_stack[16]
protected

Values to put on the TextRefStack for the error message.

Definition at line 37 of file error.h.

Referenced by CopyOutDParams(), ErrmsgWindow::DrawWidget(), ErrorMessageData(), ErrorMessageData(), and ErrmsgWindow::UpdateWidgetSize().

◆ textref_stack_grffile

const GRFFile* ErrorMessageData::textref_stack_grffile
protected

NewGRF that filled the TextRefStack for the error message.

Definition at line 35 of file error.h.

Referenced by CopyOutDParams(), ErrmsgWindow::DrawWidget(), and ErrmsgWindow::UpdateWidgetSize().

◆ textref_stack_size

uint ErrorMessageData::textref_stack_size
protected

Number of uint32_t values to put on the TextRefStack for the error message.

Definition at line 36 of file error.h.

Referenced by CopyOutDParams(), ErrmsgWindow::DrawWidget(), ErrorMessageData(), and ErrmsgWindow::UpdateWidgetSize().


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