1
0
Fork 0

(svn r26652) [1.4] -Backport from trunk:

- Fix: Segmentation fault when encountering a .obg/.obs/.obm with empty string/zero length MD5 checksums [FS#6038] (r26637)
- Fix: The 'Load' button was not properly enabled/disabled for old savegames without NewGRF information (r26634)
- Fix: If the video driver fails to supply a list of resolutions, display an error message [FS#6012] (r26629)
release/1.4
frosch 2014-06-17 19:08:07 +00:00
parent bcfc0ec957
commit 324e17d827
5 changed files with 11 additions and 4 deletions

View File

@ -100,7 +100,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
/* Then find the MD5 checksum */ /* Then find the MD5 checksum */
item = md5s->GetItem(filename, false); item = md5s->GetItem(filename, false);
if (item == NULL) { if (item == NULL || item->value == NULL) {
DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename); DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename);
return false; return false;
} }

View File

@ -533,7 +533,7 @@ public:
if (_saveload_mode == SLD_LOAD_HEIGHTMAP) { if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
delete this; delete this;
ShowHeightmapLoad(); ShowHeightmapLoad();
} else if (_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()) { } 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; _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
ClearErrorMessages(); ClearErrorMessages();
delete this; delete this;
@ -550,7 +550,7 @@ public:
case WID_SL_MISSING_NEWGRFS: case WID_SL_MISSING_NEWGRFS:
if (!_network_available) { if (!_network_available) {
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR); ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else { } else if (_load_check_data.HasNewGrfs()) {
#if defined(ENABLE_NETWORK) #if defined(ENABLE_NETWORK)
ShowMissingContentWindow(_load_check_data.grfconfig); ShowMissingContentWindow(_load_check_data.grfconfig);
#endif #endif
@ -691,7 +691,7 @@ public:
} }
if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) { if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) {
this->SetWidgetDisabledState(WID_SL_LOAD_BUTTON, 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, this->SetWidgetDisabledState(WID_SL_NEWGRF_INFO,
!_load_check_data.HasNewGrfs()); !_load_check_data.HasNewGrfs());
this->SetWidgetDisabledState(WID_SL_MISSING_NEWGRFS, this->SetWidgetDisabledState(WID_SL_MISSING_NEWGRFS,

View File

@ -969,6 +969,7 @@ STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP :{BLACK}Select t
STR_GAME_OPTIONS_BASE_MUSIC_STATUS :{RED}{NUM} corrupted file{P "" s} STR_GAME_OPTIONS_BASE_MUSIC_STATUS :{RED}{NUM} corrupted file{P "" s}
STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}Additional information about the base music set STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}Additional information about the base music set
STR_ERROR_RESOLUTION_LIST_FAILED :{WHITE}Failed to retrieve a list of supported resolutions
STR_ERROR_FULLSCREEN_FAILED :{WHITE}Fullscreen mode failed STR_ERROR_FULLSCREEN_FAILED :{WHITE}Fullscreen mode failed
# Custom currency window # Custom currency window

View File

@ -265,6 +265,8 @@ struct GameOptionsWindow : Window {
} }
case WID_GO_RESOLUTION_DROPDOWN: // Setup resolution dropdown case WID_GO_RESOLUTION_DROPDOWN: // Setup resolution dropdown
if (_num_resolutions == 0) break;
list = new DropDownList(); list = new DropDownList();
*selected_index = GetCurRes(); *selected_index = GetCurRes();
for (int i = 0; i < _num_resolutions; i++) { for (int i = 0; i < _num_resolutions; i++) {
@ -440,6 +442,8 @@ struct GameOptionsWindow : Window {
DropDownList *list = this->BuildDropDownList(widget, &selected); DropDownList *list = this->BuildDropDownList(widget, &selected);
if (list != NULL) { if (list != NULL) {
ShowDropDownList(this, list, selected, widget); ShowDropDownList(this, list, selected, widget);
} else {
if (widget == WID_GO_RESOLUTION_DROPDOWN) ShowErrorMessage(STR_ERROR_RESOLUTION_LIST_FAILED, INVALID_STRING_ID, WL_ERROR);
} }
break; break;
} }

View File

@ -114,6 +114,8 @@ struct DropdownWindow : Window {
DropdownWindow(Window *parent, const DropDownList *list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll) DropdownWindow(Window *parent, const DropDownList *list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll)
: Window(&_dropdown_desc) : Window(&_dropdown_desc)
{ {
assert(list->Length() > 0);
this->position = position; this->position = position;
this->CreateNestedTree(); this->CreateNestedTree();