From 55c7c21c5d6f6b72408cb67ed7e663216226105f Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 4 Sep 2016 12:44:42 +0000 Subject: [PATCH] (svn r27633) -Codechange: Extract _saveload_mode use from BuildFileList --- src/console_cmds.cpp | 4 ++-- src/fios.h | 2 +- src/fios_gui.cpp | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 8d9e04113d..8df5b15cde 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -324,7 +324,7 @@ DEF_CONSOLE_CMD(ConSaveConfig) static const FiosItem *GetFiosItem(const char *file) { _saveload_mode = SLD_LOAD_GAME; - BuildFileList(); + BuildFileList(_saveload_mode); for (const FiosItem *item = _fios_items.Begin(); item != _fios_items.End(); item++) { if (strcmp(file, item->name) == 0) return item; @@ -415,7 +415,7 @@ DEF_CONSOLE_CMD(ConListFiles) return true; } - BuildFileList(); + BuildFileList(_saveload_mode); for (uint i = 0; i < _fios_items.Length(); i++) { IConsolePrintF(CC_DEFAULT, "%d) %s", i, _fios_items[i].title); diff --git a/src/fios.h b/src/fios.h index b26fe00925..b9bf390bb8 100644 --- a/src/fios.h +++ b/src/fios.h @@ -179,7 +179,7 @@ int CDECL CompareFiosItems(const FiosItem *a, const FiosItem *b); extern const TextColour _fios_colours[]; -void BuildFileList(); +void BuildFileList(SaveLoadDialogMode mode); void SetFiosType(const byte fiostype); #endif /* FIOS_H */ diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 9316deb658..401cb82545 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -193,20 +193,20 @@ const TextColour _fios_colours[] = { TC_ORANGE, TC_LIGHT_BROWN, TC_ORANGE, TC_ORANGE, TC_YELLOW }; -void BuildFileList() +void BuildFileList(SaveLoadDialogMode mode) { _fios_path_changed = true; FiosFreeSavegameList(); - switch (_saveload_mode) { + switch (mode) { case SLD_LOAD_SCENARIO: case SLD_SAVE_SCENARIO: - FiosGetScenarioList(_saveload_mode); break; + FiosGetScenarioList(mode); break; case SLD_SAVE_HEIGHTMAP: case SLD_LOAD_HEIGHTMAP: - FiosGetHeightmapList(_saveload_mode); break; + FiosGetHeightmapList(mode); break; - default: FiosGetSavegameList(_saveload_mode); break; + default: FiosGetSavegameList(mode); break; } /* Invalidate saveload window */ @@ -683,7 +683,7 @@ public: this->selected = NULL; _load_check_data.Clear(); if (!gui_scope) break; - BuildFileList(); + BuildFileList(_saveload_mode); /* FALL THROUGH */ case 1: /* Selection changes */