openttd updated to 1.5.0-beta2
--HG-- branch : openttd
This commit is contained in:
+28
-16
@@ -1,4 +1,4 @@
|
||||
/* $Id: fios_gui.cpp 25668 2013-08-05 20:36:24Z michi_cc $ */
|
||||
/* $Id: fios_gui.cpp 26960 2014-10-05 11:20:02Z peter1138 $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
SaveLoadDialogMode _saveload_mode;
|
||||
LoadCheckData _load_check_data; ///< Data loaded from save during SL_LOAD_CHECK.
|
||||
|
||||
@@ -133,9 +135,11 @@ static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = {
|
||||
SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_CONTENT_DOWNLOAD), SetResize(1, 0),
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_CONTENT_DOWNLOAD), SetResize(1, 0), SetFill(1, 0),
|
||||
SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_LOAD_BUTTON), SetResize(1, 0), SetFill(1, 0),
|
||||
SetDataTip(STR_SAVELOAD_LOAD_BUTTON, STR_SAVELOAD_LOAD_HEIGHTMAP_TOOLTIP),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@@ -294,17 +298,17 @@ public:
|
||||
switch (_saveload_mode) {
|
||||
case SLD_SAVE_GAME:
|
||||
case SLD_LOAD_GAME:
|
||||
FioGetDirectory(o_dir.name, lengthof(o_dir.name), SAVE_DIR);
|
||||
FioGetDirectory(o_dir.name, lastof(o_dir.name), SAVE_DIR);
|
||||
break;
|
||||
|
||||
case SLD_SAVE_SCENARIO:
|
||||
case SLD_LOAD_SCENARIO:
|
||||
FioGetDirectory(o_dir.name, lengthof(o_dir.name), SCENARIO_DIR);
|
||||
FioGetDirectory(o_dir.name, lastof(o_dir.name), SCENARIO_DIR);
|
||||
break;
|
||||
|
||||
case SLD_SAVE_HEIGHTMAP:
|
||||
case SLD_LOAD_HEIGHTMAP:
|
||||
FioGetDirectory(o_dir.name, lengthof(o_dir.name), HEIGHTMAP_DIR);
|
||||
FioGetDirectory(o_dir.name, lastof(o_dir.name), HEIGHTMAP_DIR);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -479,7 +483,7 @@ public:
|
||||
case WID_SL_SORT_BYNAME:
|
||||
case WID_SL_SORT_BYDATE: {
|
||||
Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
|
||||
d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better.
|
||||
d.width += padding.width + Window::SortButtonWidth() * 2; // Doubled since the string is centred and it also looks better.
|
||||
d.height += padding.height;
|
||||
*size = maxdim(*size, d);
|
||||
break;
|
||||
@@ -521,16 +525,21 @@ public:
|
||||
break;
|
||||
|
||||
case WID_SL_LOAD_BUTTON:
|
||||
if (this->selected != NULL && !_load_check_data.HasErrors() && (_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs())) {
|
||||
_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
|
||||
|
||||
if (this->selected != NULL && !_load_check_data.HasErrors()) {
|
||||
const char *name = FiosBrowseTo(this->selected);
|
||||
SetFiosType(this->selected->type);
|
||||
|
||||
strecpy(_file_to_saveload.name, name, lastof(_file_to_saveload.name));
|
||||
strecpy(_file_to_saveload.title, this->selected->title, lastof(_file_to_saveload.title));
|
||||
ClearErrorMessages();
|
||||
delete this;
|
||||
|
||||
if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
|
||||
delete this;
|
||||
ShowHeightmapLoad();
|
||||
} else if (!_load_check_data.HasNewGrfs() || _load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()) {
|
||||
_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
|
||||
ClearErrorMessages();
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -543,7 +552,7 @@ public:
|
||||
case WID_SL_MISSING_NEWGRFS:
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||
} else {
|
||||
} else if (_load_check_data.HasNewGrfs()) {
|
||||
#if defined(ENABLE_NETWORK)
|
||||
ShowMissingContentWindow(_load_check_data.grfconfig);
|
||||
#endif
|
||||
@@ -645,10 +654,10 @@ public:
|
||||
} else if (this->IsWidgetLowered(WID_SL_SAVE_GAME)) { // Save button clicked
|
||||
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
|
||||
_switch_mode = SM_SAVE_GAME;
|
||||
FiosMakeSavegameName(_file_to_saveload.name, this->filename_editbox.text.buf, sizeof(_file_to_saveload.name));
|
||||
FiosMakeSavegameName(_file_to_saveload.name, this->filename_editbox.text.buf, lastof(_file_to_saveload.name));
|
||||
} else {
|
||||
_switch_mode = SM_SAVE_HEIGHTMAP;
|
||||
FiosMakeHeightmapName(_file_to_saveload.name, this->filename_editbox.text.buf, sizeof(_file_to_saveload.name));
|
||||
FiosMakeHeightmapName(_file_to_saveload.name, this->filename_editbox.text.buf, lastof(_file_to_saveload.name));
|
||||
}
|
||||
|
||||
/* In the editor set up the vehicle engines correctly (date might have changed) */
|
||||
@@ -679,9 +688,12 @@ public:
|
||||
case 1:
|
||||
/* Selection changes */
|
||||
if (!gui_scope) break;
|
||||
if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
|
||||
this->SetWidgetDisabledState(WID_SL_LOAD_BUTTON, this->selected == NULL || _load_check_data.HasErrors());
|
||||
}
|
||||
if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) {
|
||||
this->SetWidgetDisabledState(WID_SL_LOAD_BUTTON,
|
||||
this->selected == NULL || _load_check_data.HasErrors() || !(_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()));
|
||||
this->selected == NULL || _load_check_data.HasErrors() || !(!_load_check_data.HasNewGrfs() || _load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()));
|
||||
this->SetWidgetDisabledState(WID_SL_NEWGRF_INFO,
|
||||
!_load_check_data.HasNewGrfs());
|
||||
this->SetWidgetDisabledState(WID_SL_MISSING_NEWGRFS,
|
||||
|
||||
Reference in New Issue
Block a user