Data Structures | Typedefs | Functions | Variables

error_gui.cpp File Reference

GUI related to errors. More...

#include "stdafx.h"
#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_manager_face.h"
#include "strings_func.h"
#include "zoom_func.h"
#include "window_func.h"
#include "console_func.h"
#include "window_gui.h"
#include "widgets/error_widget.h"
#include "table/strings.h"
#include <list>

Go to the source code of this file.

Data Structures

class  ErrorMessageData
 The data of the error message. More...
struct  ErrmsgWindow
 Window class for displaying an error message window. More...

Typedefs

typedef std::list
< ErrorMessageData
ErrorList
 Define a queue with errors.

Functions

void ClearErrorMessages ()
 Clear all errors from the queue.
void ShowFirstError ()
 Show the first error of the queue.
void UnshowCriticalError ()
 Unshow the critical error.
void ShowErrorMessage (StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x, int y, uint textref_stack_size, const uint32 *textref_stack)
 Display an error message in a window.

Variables

static const NWidgetPart _nested_errmsg_widgets []
static const WindowDesc _errmsg_desc (WDP_MANUAL, 0, 0, WC_ERRMSG, WC_NONE, 0, _nested_errmsg_widgets, lengthof(_nested_errmsg_widgets))
static const NWidgetPart _nested_errmsg_face_widgets []
static const WindowDesc _errmsg_face_desc (WDP_MANUAL, 0, 0, WC_ERRMSG, WC_NONE, 0, _nested_errmsg_face_widgets, lengthof(_nested_errmsg_face_widgets))
ErrorList _error_list
 The actual queue with errors.
bool _window_system_initialized = false
 Whether the window system is initialized or not.

Detailed Description

GUI related to errors.

Definition in file error_gui.cpp.


Typedef Documentation

typedef std::list<ErrorMessageData> ErrorList

Define a queue with errors.

Definition at line 135 of file error_gui.cpp.


Function Documentation

void ShowErrorMessage ( StringID  summary_msg,
StringID  detailed_msg,
WarningLevel  wl,
int  x,
int  y,
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_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 338 of file error_gui.cpp.

References _settings_client, CC_WARNING, 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 ClientNetworkContentSocketHandler::AfterDownload(), AfterLoadGame(), ClientNetworkContentSocketHandler::BeforeDownload(), CcBuildIndustry(), ChangeDynamicEngines(), ClientNetworkGameSocketHandler::CheckConnection(), AISettingsWindow::CheckDifficultyLevel(), CheckForMissingGlyphs(), CheckForMissingSprites(), CheckTrainsLengths(), NetworkGameSocketHandler::CloseConnection(), AIInstance::Died(), DoAutosave(), DoCommandP(), ErrorUnknownCallbackResult(), GenerateTowns(), GetSavegameFormat(), GRFLoadConfig(), IndustryProductionCallback(), IniLoadSettings(), MakeScreenshot(), TownViewWindow::OnClick(), GameDifficultyWindow::OnClick(), GameOptionsWindow::OnClick(), SelectGameWindow::OnClick(), BuildIndustryWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), AIConfigWindow::OnClick(), NetworkContentListWindow::OnConnect(), BuildIndustryWindow::OnPlaceObject(), SelectCompanyManagerFaceWindow::OnQueryTextFinished(), 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(), StringToVal(), and WarnCorruptSprite().

void ShowFirstError (  ) 

Show the first error of the queue.

Definition at line 304 of file error_gui.cpp.

Referenced by CleanupGeneration(), and InitWindowSystem().

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

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

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


Variable Documentation

The actual queue with errors.

Definition at line 137 of file error_gui.cpp.

const NWidgetPart _nested_errmsg_face_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_RED),
    NWidget(WWT_CAPTION, COLOUR_RED, WID_EM_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_NULL),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_RED),
    NWidget(NWID_HORIZONTAL), SetPIP(2, 1, 2),
      NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_FACE), SetMinimalSize(92, 119), SetFill(0, 1), SetPadding(2, 0, 1, 0),
      NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_MESSAGE), SetFill(0, 1), SetMinimalSize(238, 123),
    EndContainer(),
  EndContainer(),
}

Definition at line 49 of file error_gui.cpp.

const NWidgetPart _nested_errmsg_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_RED),
    NWidget(WWT_CAPTION, COLOUR_RED, WID_EM_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION, STR_NULL),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_RED),
    NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_MESSAGE), SetPadding(0, 2, 0, 2), SetMinimalSize(236, 32),
  EndContainer(),
}

Definition at line 32 of file error_gui.cpp.

Whether the window system is initialized or not.

Definition at line 139 of file error_gui.cpp.