Data Structures | Enumerations | Functions
error.h File Reference

Functions related to errors. More...

#include "strings_type.h"
#include "company_type.h"
#include "core/geometry_type.hpp"

Go to the source code of this file.

Data Structures

class  ErrorMessageData
 The data of the error message. More...


 Message severity/type. More...


void ScheduleErrorMessage (const ErrorMessageData &data)
 Schedule an error. More...
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)
 Display an error message in a window. More...
void ClearErrorMessages ()
 Clear all errors from the queue.
void ShowFirstError ()
 Show the first error of the queue. More...
void UnshowCriticalError ()
 Unshow the critical error. More...

Detailed Description

Functions related to errors.

Definition in file error.h.

Enumeration Type Documentation

◆ WarningLevel

Message severity/type.


Used for DoCommand-like (and some non-fatal AI GUI) errors/information.


Other information.


Errors (eg. saving/loading failed)


Critical errors, the MessageBox is shown in all cases.

Definition at line 22 of file error.h.

Function Documentation

◆ ScheduleErrorMessage()

void ScheduleErrorMessage ( const ErrorMessageData data)

Schedule an error.

Note: This does not try to display the error now. This is useful if the window system is not yet running.

dataError message data; cleared afterwards

Definition at line 440 of file error_gui.cpp.

Referenced by ErrorMessageData::HasFace().

◆ ShowErrorMessage()

void ShowErrorMessage ( StringID  summary_msg,
StringID  detailed_msg,
WarningLevel  wl,
int  x,
int  y,
const GRFFile textref_stack_grffile,
uint  textref_stack_size,
const uint32 *  textref_stack 

Display an error message in a window.

summary_msgGeneral error message showed in first line. Must be valid.
detailed_msgDetailed error message showed in second line. Can be INVALID_STRING_ID.
wlMessage severity.
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 providing the TextRefStack for the error message.
textref_stack_sizeNumber of uint32 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.

Definition at line 378 of file error_gui.cpp.

Referenced by NewGRFWindow::AddGRFToActive(), CcBuildIndustry(), ClientNetworkGameSocketHandler::CheckConnection(), CheckIndustries(), ClickChangeMaxHlCheat(), NetworkGameSocketHandler::CloseConnection(), GameInstance::Died(), AIInstance::Died(), ErrorUnknownCallbackResult(), GetSavegameFormat(), GRFLoadConfig(), ErrorMessageData::HasFace(), SelectGameWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), NetworkContentListWindow::OnConnect(), SelectCompanyManagerFaceWindow::OnQueryTextFinished(), SaveLoadWindow::OnTimeout(), ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(), ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(), ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(), ClientNetworkGameSocketHandler::Receive_SERVER_FULL(), ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(), ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(), SaveFileError(), SaveOrLoad(), ShowAIDebugWindow(), ShowNewGrfVehicleError(), and WarnCorruptSprite().

◆ ShowFirstError()

void ShowFirstError ( )

Show the first error of the queue.

Definition at line 343 of file error_gui.cpp.

Referenced by InitWindowSystem(), and ErrmsgWindow::OnHundredthTick().

◆ UnshowCriticalError()

void UnshowCriticalError ( )

Unshow the critical error.

This has to happen when a critical error is shown and we uninitialise the window system, i.e. remove all the windows.

Definition at line 357 of file error_gui.cpp.

References FindWindowById(), ErrmsgWindow::IsCritical(), and WC_ERRMSG.

Referenced by ClearErrorMessages(), and UnInitWindowSystem().