From fd8b0800958078afb417bb4356866593695bacca Mon Sep 17 00:00:00 2001 From: cirdan Date: Thu, 10 Aug 2017 20:10:20 +0200 Subject: [PATCH] Simplify FileList::BuildFileList operation parameter Use a boolean flag for the FileList::BuildFileList operation parameter, as its argument was always either SLO_SAVE or SLO_LOAD. --- src/console_cmds.cpp | 2 +- src/fios.cpp | 11 +++++------ src/fios.h | 2 +- src/fios_gui.cpp | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 2775a5975..12bde5458 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -66,7 +66,7 @@ public: void ValidateFileList(bool force_reload = false) { if (force_reload || !this->file_list_valid) { - this->BuildFileList(FT_SAVEGAME, SLO_LOAD); + this->BuildFileList (FT_SAVEGAME, false); this->file_list_valid = true; } } diff --git a/src/fios.cpp b/src/fios.cpp index 7a3d4c7cc..ffeff50bb 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -67,27 +67,26 @@ FileList::~FileList() /** * Construct a file list with the given kind of files, for the stated purpose. * @param abstract_filetype Kind of files to collect. - * @param fop Purpose of the collection, either #SLO_LOAD or #SLO_SAVE. + * @param save Purpose of the collection, true for saving. */ -void FileList::BuildFileList(AbstractFileType abstract_filetype, SaveLoadOperation fop) +void FileList::BuildFileList (AbstractFileType abstract_filetype, bool save) { this->Clear(); - assert(fop == SLO_LOAD || SLO_SAVE); switch (abstract_filetype) { case FT_NONE: break; case FT_SAVEGAME: - FiosGetSavegameList(fop, *this); + FiosGetSavegameList (save ? SLO_SAVE : SLO_LOAD, *this); break; case FT_SCENARIO: - FiosGetScenarioList(fop, *this); + FiosGetScenarioList (save ? SLO_SAVE : SLO_LOAD, *this); break; case FT_HEIGHTMAP: - FiosGetHeightmapList(fop, *this); + FiosGetHeightmapList (save ? SLO_SAVE : SLO_LOAD, *this); break; default: diff --git a/src/fios.h b/src/fios.h index 3a339a26f..4e3c1e33f 100644 --- a/src/fios.h +++ b/src/fios.h @@ -189,7 +189,7 @@ public: this->files.Compact(); } - void BuildFileList(AbstractFileType abstract_filetype, SaveLoadOperation fop); + void BuildFileList (AbstractFileType abstract_filetype, bool save); SmallVector files; ///< The list of files. }; diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 192b41aea..bb7be8c5e 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -697,7 +697,7 @@ public: if (!gui_scope) break; _fios_path_changed = true; - this->fios_items.BuildFileList (this->abstract_filetype, this->save ? SLO_SAVE : SLO_LOAD); + this->fios_items.BuildFileList (this->abstract_filetype, this->save); this->vscroll->SetCount(this->fios_items.Length()); this->selected = NULL; _load_check_data.Clear(); -- 2.11.4.GIT