|
@@ -51,54 +51,71 @@ struct SelectGameWindow : public Window
|
|
|
*/
|
|
|
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
|
|
|
{
|
|
|
if (!gui_scope) return;
|
|
|
this->SetWidgetLoweredState(WID_SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
|
|
|
this->SetWidgetLoweredState(WID_SGI_ARCTIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_ARCTIC);
|
|
|
this->SetWidgetLoweredState(WID_SGI_TROPIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TROPIC);
|
|
|
this->SetWidgetLoweredState(WID_SGI_TOYLAND_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TOYLAND);
|
|
|
}
|
|
|
|
|
|
virtual void OnInit()
|
|
|
{
|
|
|
bool missing = _current_language->missing >= _settings_client.gui.missing_strings_threshold && !IsReleasedVersion();
|
|
|
this->GetWidget<NWidgetStacked>(WID_SGI_TRANSLATION_SELECTION)->SetDisplayedPlane(missing ? 0 : SZSP_NONE);
|
|
|
bool missing_sprites = _missing_extra_graphics > 0 && !IsReleasedVersion();
|
|
|
this->GetWidget<NWidgetStacked>(WID_SGI_BASESET_SELECTION)->SetDisplayedPlane(missing_sprites ? 0 : SZSP_NONE);
|
|
|
|
|
|
bool missing_lang = _current_language->missing >= _settings_client.gui.missing_strings_threshold && !IsReleasedVersion();
|
|
|
this->GetWidget<NWidgetStacked>(WID_SGI_TRANSLATION_SELECTION)->SetDisplayedPlane(missing_lang ? 0 : SZSP_NONE);
|
|
|
}
|
|
|
|
|
|
virtual void DrawWidget(const Rect &r, int widget) const
|
|
|
{
|
|
|
switch (widget) {
|
|
|
case WID_SGI_BASESET:
|
|
|
SetDParam(0, _missing_extra_graphics);
|
|
|
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_BASESET, TC_FROMSTRING, SA_CENTER);
|
|
|
break;
|
|
|
|
|
|
case WID_SGI_TRANSLATION:
|
|
|
SetDParam(0, _current_language->missing);
|
|
|
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_TRANSLATION, TC_FROMSTRING, SA_CENTER);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
|
|
{
|
|
|
StringID str = 0;
|
|
|
switch (widget) {
|
|
|
case WID_SGI_TRANSLATION: {
|
|
|
case WID_SGI_BASESET:
|
|
|
SetDParam(0, _missing_extra_graphics);
|
|
|
str = STR_INTRO_BASESET;
|
|
|
break;
|
|
|
|
|
|
case WID_SGI_TRANSLATION:
|
|
|
SetDParam(0, _current_language->missing);
|
|
|
int height = GetStringHeight(STR_INTRO_TRANSLATION, size->width);
|
|
|
if (height > 3 * FONT_HEIGHT_NORMAL) {
|
|
|
/* Don't let the window become too high. */
|
|
|
Dimension textdim = GetStringBoundingBox(STR_INTRO_TRANSLATION);
|
|
|
textdim.height *= 3;
|
|
|
textdim.width -= textdim.width / 2;
|
|
|
*size = maxdim(*size, textdim);
|
|
|
} else {
|
|
|
size->height = height + padding.height;
|
|
|
}
|
|
|
str = STR_INTRO_TRANSLATION;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if (str != 0) {
|
|
|
int height = GetStringHeight(str, size->width);
|
|
|
if (height > 3 * FONT_HEIGHT_NORMAL) {
|
|
|
/* Don't let the window become too high. */
|
|
|
Dimension textdim = GetStringBoundingBox(str);
|
|
|
textdim.height *= 3;
|
|
|
textdim.width -= textdim.width / 2;
|
|
|
*size = maxdim(*size, textdim);
|
|
|
} else {
|
|
|
size->height = height + padding.height;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
/* Do not create a network server when you (just) have closed one of the game
|
|
|
* creation/load windows for the network server. */
|
|
|
if (IsInsideMM(widget, WID_SGI_GENERATE_GAME, WID_SGI_EDIT_SCENARIO + 1)) _is_network_server = false;
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
|
|
@@ -190,24 +207,29 @@ static const NWidgetPart _nested_select_
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_ARCTIC_LANDSCAPE), SetMinimalSize(77, 55),
|
|
|
SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TROPIC_LANDSCAPE), SetMinimalSize(77, 55),
|
|
|
SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
|
|
|
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TOYLAND_LANDSCAPE), SetMinimalSize(77, 55),
|
|
|
SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetFill(1, 0),
|
|
|
EndContainer(),
|
|
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 7),
|
|
|
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SGI_BASESET_SELECTION),
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_SGI_BASESET), SetMinimalSize(316, 12), SetFill(1, 0), SetPadding(0, 10, 7, 10),
|
|
|
EndContainer(),
|
|
|
EndContainer(),
|
|
|
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SGI_TRANSLATION_SELECTION),
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_SGI_TRANSLATION), SetMinimalSize(316, 12), SetFill(1, 0), SetPadding(0, 10, 7, 10),
|
|
|
EndContainer(),
|
|
|
EndContainer(),
|
|
|
|
|
|
/* 'game options' and 'advanced settings' buttons */
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_OPTIONS), SetMinimalSize(158, 12),
|
|
|
SetDataTip(STR_INTRO_GAME_OPTIONS, STR_INTRO_TOOLTIP_GAME_OPTIONS), SetPadding(0, 0, 0, 10), SetFill(1, 0),
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_SETTINGS_OPTIONS), SetMinimalSize(158, 12),
|
|
|
SetDataTip(STR_INTRO_CONFIG_SETTINGS_TREE, STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE), SetPadding(0, 10, 0, 0), SetFill(1, 0),
|