Codechange: Reduced indentation in SaveLoadWindow::OnClick

This commit is contained in:
Juriy Petrochenkov 2019-08-14 13:13:11 +03:00 committed by Charles Pigott
parent f0aea2d246
commit d986f01d07
1 changed files with 50 additions and 49 deletions

View File

@ -605,8 +605,9 @@ public:
this->InvalidateData(SLIWD_RESCAN_FILES);
break;
case WID_SL_LOAD_BUTTON:
if (this->selected != nullptr && !_load_check_data.HasErrors()) {
case WID_SL_LOAD_BUTTON: {
if (this->selected == nullptr || _load_check_data.HasErrors()) break;
const char *name = FiosBrowseTo(this->selected);
_file_to_saveload.SetMode(this->selected->type);
_file_to_saveload.SetName(name);
@ -615,14 +616,13 @@ public:
if (this->abstract_filetype == FT_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;
}
case WID_SL_NEWGRF_INFO:
if (_load_check_data.HasNewGrfs()) {
@ -651,7 +651,12 @@ public:
const FiosItem *file = this->fios_items.Get(y);
const char *name = FiosBrowseTo(file);
if (name != nullptr) {
if (name == nullptr) {
/* Changed directory, need refresh. */
this->InvalidateData(SLIWD_RESCAN_FILES);
break;
}
if (click_count == 1) {
if (this->selected != file) {
this->selected = file;
@ -685,10 +690,6 @@ public:
}
}
}
} else {
/* Changed directory, need refresh. */
this->InvalidateData(SLIWD_RESCAN_FILES);
}
break;
}