OpenTTD Source
20241121-master-g67a0fccfad
|
GUI related to errors. More...
#include "stdafx.h"
#include "core/geometry_func.hpp"
#include "core/mem_func.hpp"
#include "landscape.h"
#include "newgrf_text.h"
#include "error.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "string_func.h"
#include "company_base.h"
#include "company_func.h"
#include "company_manager_face.h"
#include "strings_func.h"
#include "zoom_func.h"
#include "window_func.h"
#include "console_func.h"
#include "window_gui.h"
#include "timer/timer.h"
#include "timer/timer_window.h"
#include "widgets/error_widget.h"
#include "table/strings.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | ErrmsgWindow |
Window class for displaying an error message window. More... | |
Functions | |
void | ClearErrorMessages () |
Clear all errors from the queue. | |
void | ShowFirstError () |
Show the first error of the queue. | |
void | UnshowCriticalError () |
Unshow the critical error. More... | |
void | ShowErrorMessage (StringID summary_msg, int x, int y, CommandCost cc) |
Display an error message in a window. More... | |
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. More... | |
bool | HideActiveErrorMessage () |
Close active error message window. More... | |
void | ScheduleErrorMessage (ErrorList &datas) |
Schedule a list of errors. More... | |
void | ScheduleErrorMessage (const ErrorMessageData &data) |
Schedule an error. More... | |
Variables | |
static constexpr NWidgetPart | _nested_errmsg_widgets [] |
static WindowDesc | _errmsg_desc (WDP_MANUAL, nullptr, 0, 0, WC_ERRMSG, WC_NONE, 0, _nested_errmsg_widgets) |
static constexpr NWidgetPart | _nested_errmsg_face_widgets [] |
static WindowDesc | _errmsg_face_desc (WDP_MANUAL, nullptr, 0, 0, WC_ERRMSG, WC_NONE, 0, _nested_errmsg_face_widgets) |
static ErrorList | _error_list |
The actual queue with errors. | |
bool | _window_system_initialized = false |
Whether the window system is initialized or not. | |
GUI related to errors.
Definition in file error_gui.cpp.
bool HideActiveErrorMessage | ( | ) |
Close active error message window.
Definition at line 439 of file error_gui.cpp.
References FindWindowById(), and WC_ERRMSG.
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 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.
Referenced by NewGRFWindow::AddGRFToActive(), ClientNetworkContentSocketHandler::BeforeDownload(), ClientNetworkGameSocketHandler::CheckConnection(), CheckEngines(), CheckIndustries(), CheckTownRoadTypes(), CheckTrainsLengths(), ClickChangeMaxHlCheat(), NetworkGameSocketHandler::CloseConnection(), DoAutoOrNetsave(), GetOrderCmdFromTile(), GetSavegameFormat(), GraphicsSetLoadConfig(), GRFLoadConfig(), CommandHelperBase::InternalPostBefore(), LoadTownData(), NetworkValidateClientName(), NetworkValidateServerName(), SaveLoadWindow::OnTimeout(), DepotWindow::OnVehicleSelect(), OrdersWindow::OnVehicleSelect(), 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_FULL(), ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(), ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(), SaveFileError(), SaveOrLoad(), ShowNetworkContentListWindow(), 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.
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, FindWindowById(), ErrmsgWindow::IsCritical(), and WC_ERRMSG.
Referenced by ClearErrorMessages(), and UnInitWindowSystem().
|
staticconstexpr |
Definition at line 53 of file error_gui.cpp.
|
staticconstexpr |
Definition at line 36 of file error_gui.cpp.