(svn r27633) -Codechange: Extract _saveload_mode use from BuildFileList

This commit is contained in:
alberth 2016-09-04 12:44:42 +00:00
parent f46996243b
commit 55c7c21c5d
3 changed files with 9 additions and 9 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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 */