OpenTTD: src/error.h File Reference

OpenTTD

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

- File List
- Globals

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...

## Enumerations
enum | WarningLevel { WL_INFO, WL_WARNING, WL_ERROR, WL_CRITICAL }
| Message severity/type. More...

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

## Detailed Description

Functions related to errors.

Definition in file error.h.

## Enumeration Type Documentation

enum WarningLevel

Message severity/type.

Enumerator:

  WL_INFO | Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
  WL_WARNING | Other information.
  WL_ERROR | Errors (eg. saving/loading failed)
  WL_CRITICAL | Critical errors, the MessageBox is shown in all cases.

Definition at line 22 of file error.h.

## Function Documentation

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.

Parameters

  data | Error message data; cleared afterwards

Definition at line 431 of file error_gui.cpp.

Referenced by LoadFromConfig(), and openttd_main().

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.

Parameters

  summary_msg | General error message showed in first line. Must be valid.
  detailed_msg | Detailed error message showed in second line. Can be INVALID_STRING_ID.
  wl | Message severity.
  x | World 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.
  y | World 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_grffile | NewGRF providing the TextRefStack for the error message.
  textref_stack_size | Number of uint32 values to put on the TextRefStack for the error message; 0 if the TextRefStack shall not be used.
  textref_stack | Values to put on the TextRefStack.

Definition at line 369 of file error_gui.cpp.

References _settings_client, CC_WARNING, ErrorMessageData::CopyOutDParams(), DRAW_STRING_BUFFER, GUISettings::errmsg_duration, FindWindowById(), ClientSettings::gui, IConsoleError(), IConsolePrint(), INVALID_STRING_ID, ErrmsgWindow::IsCritical(), lastof, seprintf(), StartTextRefStackUsage(), StopTextRefStackUsage(), WC_ERRMSG, WL_CRITICAL, WL_INFO, and WL_WARNING.

Referenced by NewGRFWindow::AddGRFToActive(), ClientNetworkContentSocketHandler::AfterDownload(), AfterLoadGame(), ClientNetworkContentSocketHandler::BeforeDownload(), CcBuildIndustry(), ChangeDynamicEngines(), ClientNetworkGameSocketHandler::CheckConnection(), CheckEngines(), CheckForMissingGlyphs(), CheckForMissingSprites(), CheckIndustries(), CheckTrainsLengths(), ClickChangeMaxHlCheat(), NetworkGameSocketHandler::CloseConnection(), DoAutosave(), DoCommandP(), ErrorUnknownCallbackResult(), GenerateTowns(), GetSavegameFormat(), GRFLoadConfig(), IndustryProductionCallback(), MakeScreenshot(), SelectGameWindow::OnClick(), TownViewWindow::OnClick(), GameOptionsWindow::OnClick(), BuildIndustryWindow::OnClick(), SaveLoadWindow::OnClick(), AIConfigWindow::OnClick(), NewGRFWindow::OnClick(), FoundTownWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), BuildIndustryWindow::OnPlaceObject(), SelectCompanyManagerFaceWindow::OnQueryTextFinished(), SaveLoadWindow::OnTimeout(), ReadHeightmapBMP(), ReadHeightmapPNG(), ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(), ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(), ClientNetworkGameSocketHandler::Receive_SERVER_ERROR(), ClientNetworkGameSocketHandler::Receive_SERVER_FULL(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(), ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(), ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(), SaveFileError(), SaveOrLoad(), ShowAIDebugWindow(), ShowBuildBridgeWindow(), ShowEstimatedCostOrIncome(), ShowNetworkContentListWindow(), ShowNewGRFError(), ShowNewGrfVehicleError(), and WarnCorruptSprite().

void ShowFirstError | ( |  | ) |

Show the first error of the queue.

Definition at line 334 of file error_gui.cpp.

Referenced by CleanupGeneration(), InitWindowSystem(), and LoadFromConfig().

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 348 of file error_gui.cpp.

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

Referenced by ClearErrorMessages(), GenerateWorld(), and UnInitWindowSystem().