Go to the documentation of this file.
31 #include "table/strings.h"
52 if (!gui_scope)
return;
89 str = STR_INTRO_BASESET;
94 str = STR_INTRO_TRANSLATION;
104 textdim.width -= textdim.width / 2;
105 *size =
maxdim(*size, textdim);
107 size->height =
height + padding.height;
136 ShowNetworkGameWindow();
162 static const NWidgetPart _nested_select_game_widgets[] = {
201 SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
204 SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
207 SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
210 SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
217 NWidget(
WWT_EMPTY, COLOUR_ORANGE,
WID_SGI_BASESET),
SetMinimalSize(316, 12),
SetFill(1, 0),
SetPadding(0, 10, 7, 10),
222 NWidget(
WWT_EMPTY, COLOUR_ORANGE,
WID_SGI_TRANSLATION),
SetMinimalSize(316, 12),
SetFill(1, 0),
SetPadding(0, 10, 7, 10),
260 SetDataTip(STR_INTRO_QUIT, STR_INTRO_TOOLTIP_QUIT),
273 _nested_select_game_widgets,
lengthof(_nested_select_game_widgets)
276 void ShowSelectGameWindow()
281 static void AskExitGameCallback(
Window *w,
bool confirmed)
283 if (confirmed) _exit_game =
true;
290 STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD,
297 static void AskExitToGameMenuCallback(
Window *w,
bool confirmed)
305 void AskExitToGameMenu()
308 STR_ABANDON_GAME_CAPTION,
309 (_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_ABANDON_SCENARIO_QUERY,
311 AskExitToGameMenuCallback
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config)
Setup the NewGRF gui.
@ FT_SCENARIO
old or new scenario
Dimensions (a width and height) of a rectangle in 2D.
byte landscape
the landscape we're currently in
@ WC_SELECT_GAME
Select game window; Window numbers:
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
void ShowNetworkContentListWindow(ContentVector *cv=nullptr, ContentType type1=CONTENT_TYPE_END, ContentType type2=CONTENT_TYPE_END)
Show the content list window with a given set of content.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
bool _ctrl_pressed
Is Ctrl pressed?
void ShowGameOptions()
Open the game options window.
void ShowGameSettings()
Open advanced settings window.
ClientSettings _settings_client
The current settings for this game.
@ SA_CENTER
Center both horizontally and vertically.
void StartScenarioEditor()
Start with a scenario editor.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
static const uint32 GENERATE_NEW_SEED
Create a new random seed.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
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 *textref_stack=nullptr)
Display an error message in a window.
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
GameCreationSettings game_creation
settings used during the creation of a game (map)
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
High level window description.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
void ClearErrorMessages()
Clear all errors from the queue.
@ SLO_LOAD
File is being loaded.
ResizeInfo resize
Resize information.
void ShowGenerateLandscape()
Start with a normal game.
int height
Height of the window (number of pixels down in y direction)
uint _missing_extra_graphics
Number of sprites provided by the fallback extra GRF, i.e. missing in the baseset.
byte missing_strings_threshold
the number of missing strings before showing the warning
const LanguageMetadata * _current_language
The currently loaded language.
Coordinates of a point in 2D.
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop)
Launch save/load dialog in the given mode.
@ FT_SAVEGAME
old or new savegame
void StartNewGameWithoutGUI(uint32 seed)
Start a normal game without the GUI.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
int GetStringHeight(const char *str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
void ShowHighscoreTable(int difficulty=SP_CUSTOM, int8 rank=-1)
Show the highscore table for a given difficulty.
SwitchMode _switch_mode
The next mainloop command.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
Show a modal confirmation window with standard 'yes' and 'no' buttons The window is aligned to the ce...
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
void SetNewLandscapeType(byte landscape)
Changes landscape type and sets genworld window dirty.
@ FT_HEIGHTMAP
heightmap file
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
@ WL_ERROR
Errors (eg. saving/loading failed)
@ SM_MENU
Switch to game intro menu.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
#define lengthof(x)
Return the length of an fixed size array.
Data structure for an opened window.
bool _network_available
is network mode available?
void ShowAIConfigWindow()
Open the AI config window.
Specification of a rectangle with absolute coordinates of all edges.
void OnInit() override
Notification that the nested widget tree gets initialized.
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
@ WDP_CENTER
Center the window.
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
bool _is_network_server
Does this client wants to be a network-server?
GameSettings _settings_newgame
Game settings for new games (updated from the intro screen).
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
GUISettings gui
settings related to the GUI
GRFConfig * _grfconfig_newgame
First item in list of default GRF set up.