OpenTTD Source 20241224-master-gee860a5c8e
|
Functions related to errors. More...
#include "strings_type.h"
#include "company_type.h"
#include "command_type.h"
#include "core/geometry_type.hpp"
#include <chrono>
Go to the source code of this file.
Data Structures | |
class | ErrorMessageData |
The data of the error message. More... | |
Typedefs | |
typedef std::list< ErrorMessageData > | ErrorList |
Define a queue with errors. | |
Enumerations | |
enum | WarningLevel { WL_INFO , WL_WARNING , WL_ERROR , WL_CRITICAL } |
Message severity/type. More... | |
Functions | |
void | ScheduleErrorMessage (ErrorList &datas) |
Schedule a list of errors. | |
void | ScheduleErrorMessage (const ErrorMessageData &data) |
Schedule an error. | |
void | ShowErrorMessage (StringID summary_msg, int x, int y, CommandCost cc) |
Display an error message in a window. | |
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_t *textref_stack=nullptr, StringID extra_msg=INVALID_STRING_ID) |
Display an error message in a window. | |
bool | HideActiveErrorMessage () |
Close active error message window. | |
void | ClearErrorMessages () |
Clear all errors from the queue. | |
void | ShowFirstError () |
Show the first error of the queue. | |
void | UnshowCriticalError () |
Unshow the critical error. | |
Functions related to errors.
Definition in file error.h.
typedef std::list<ErrorMessageData> ErrorList |
enum WarningLevel |
void ClearErrorMessages | ( | ) |
Clear all errors from the queue.
Definition at line 328 of file error_gui.cpp.
References _error_list, and UnshowCriticalError().
Referenced by SaveLoadWindow::OnClick(), and ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE().
bool HideActiveErrorMessage | ( | ) |
Close active error message window.
Definition at line 439 of file error_gui.cpp.
References ErrmsgWindow::Close(), FindWindowById(), and WC_ERRMSG.
Referenced by MainWindow::OnHotkey().
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.
data | Error message data; cleared afterwards |
Definition at line 462 of file error_gui.cpp.
References _error_list.
void ScheduleErrorMessage | ( | ErrorList & | datas | ) |
Schedule a list of errors.
Note: This does not try to display the error now. This is useful if the window system is not yet running.
datas | Error message datas; cleared afterwards |
Definition at line 452 of file error_gui.cpp.
References _error_list.
Referenced by LoadFromConfig(), openttd_main(), and DriverFactoryBase::SelectDriverImpl().
void ShowErrorMessage | ( | StringID | summary_msg, |
int | x, | ||
int | y, | ||
CommandCost | cc | ||
) |
Display an error message in a window.
Note: CommandCost errors are always severity level WL_INFO.
summary_msg | General error message showed in first line. Must be valid. |
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. |
cc | CommandCost containing the optional detailed and extra error messages shown in the second and third lines (can be INVALID_STRING_ID) and TextRefStack info. |
Definition at line 367 of file error_gui.cpp.
References CommandCost::GetErrorMessage(), CommandCost::GetExtraErrorMessage(), CommandCost::GetTextRefStack(), CommandCost::GetTextRefStackGRF(), CommandCost::GetTextRefStackSize(), ShowErrorMessage(), and WL_INFO.
Referenced by NewGRFWindow::AddGRFToActive(), ClientNetworkContentSocketHandler::AfterDownload(), AfterLoadGame(), ClientNetworkContentSocketHandler::BeforeDownload(), CcBuildIndustry(), ClientNetworkGameSocketHandler::CheckConnection(), CheckDynamicEngines(), CheckEngines(), CheckForMissingGlyphs(), CheckIndustries(), CheckTownRoadTypes(), CheckTrainsLengths(), ClickChangeMaxHlCheat(), NetworkGameSocketHandler::CloseConnection(), CmdBuildIndustry(), AIInstance::Died(), GameInstance::Died(), DoAutoOrNetsave(), ErrorUnknownCallbackResult(), GenerateTowns(), GetOrderCmdFromTile(), GetSavegameFormat(), GraphicsSetLoadConfig(), GRFLoadConfig(), IndustryProductionCallback(), CommandHelperBase::InternalPostBefore(), CommandHelperBase::InternalPostResult(), LoadTownData(), NetworkValidateClientName(), NetworkValidateServerName(), AIConfigWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), SaveLoadWindow::OnClick(), GSConfigWindow::OnClick(), SelectGameWindow::OnClick(), NewGRFWindow::OnClick(), GameOptionsWindow::OnClick(), FoundTownWindow::OnClick(), NetworkContentListWindow::OnConnect(), GameOptionsWindow::OnDropdownSelect(), BuildIndustryWindow::OnPlaceObject(), SelectCompanyManagerFaceWindow::OnQueryTextFinished(), SaveLoadWindow::OnTimeout(), DepotWindow::OnVehicleSelect(), OrdersWindow::OnVehicleSelect(), ReadHeightmapBMP(), ReadHeightmapPNG(), RealMakeScreenshot(), ClientNetworkCoordinatorSocketHandler::Receive_GC_ERROR(), ClientNetworkCoordinatorSocketHandler::Receive_GC_REGISTER_ACK(), ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(), ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(), ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(), ClientNetworkGameSocketHandler::Receive_SERVER_ERROR(), ClientNetworkGameSocketHandler::Receive_SERVER_FULL(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(), ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(), ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(), SaveFileError(), SaveOrLoad(), ShowBuildBridgeWindow(), ShowErrorMessage(), ShowEstimatedCostOrIncome(), ShowNetworkContentListWindow(), ShowNewGRFError(), ShowNewGrfVehicleError(), ShowScriptDebugWindow(), TownActionBribe(), and WarnCorruptSprite().
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_t * | textref_stack, | ||
StringID | extra_msg | ||
) |
Display an error message in a window.
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_t 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. |
extra_msg | Extra error message shown in third line. Can be INVALID_STRING_ID. |
Definition at line 384 of file error_gui.cpp.
References _error_list, _settings_client, AppendStringInPlace(), CC_ERROR, CC_WARNING, ErrmsgWindow::Close(), ErrorMessageData::CopyOutDParams(), GUISettings::errmsg_duration, FindWindowById(), GetString(), ClientSettings::gui, IConsolePrint(), INVALID_STRING_ID, ErrmsgWindow::IsCritical(), StartTextRefStackUsage(), StopTextRefStackUsage(), WC_ERRMSG, WL_CRITICAL, WL_INFO, and WL_WARNING.
void ShowFirstError | ( | ) |
Show the first error of the queue.
Definition at line 335 of file error_gui.cpp.
References _error_list, and _window_system_initialized.
Referenced by CleanupGeneration(), ErrmsgWindow::Close(), 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 349 of file error_gui.cpp.
References _error_list, _window_system_initialized, ErrmsgWindow::Close(), FindWindowById(), ErrmsgWindow::IsCritical(), and WC_ERRMSG.
Referenced by ClearErrorMessages(), GenerateWorld(), and UnInitWindowSystem().