From 1d9a84a934f680094bddc18f730067d757d27444 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 5 Jun 2010 18:44:31 +0000 Subject: (svn r19936) -Codechange: If there is an enum, also use it. --- src/fios.cpp | 3 ++- src/fios.h | 8 +++++--- src/openttd.cpp | 2 -- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/fios.cpp b/src/fios.cpp index e58ddd9bd..398c7c7e3 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -32,6 +32,7 @@ SmallVector _fios_items; static char *_fios_path; SmallFiosItem _file_to_saveload; +SortingBits _savegame_sort_order = SORT_BY_DATE | SORT_DESCENDING; /* OS-specific functions are taken from their respective files (win32/unix/os2 .c) */ extern bool FiosIsRoot(const char *path); @@ -306,7 +307,7 @@ static void FiosGetFileList(SaveLoadDialogMode mode, fios_getlist_callback_proc /* Sort the subdirs always by name, ascending, remember user-sorting order */ { - byte order = _savegame_sort_order; + SortingBits order = _savegame_sort_order; _savegame_sort_order = SORT_BY_NAME | SORT_ASCENDING; QSortT(_fios_items.Begin(), _fios_items.Length(), CompareFiosItems); _savegame_sort_order = order; diff --git a/src/fios.h b/src/fios.h index 42c50a9ba..c03ed9aab 100644 --- a/src/fios.h +++ b/src/fios.h @@ -14,6 +14,7 @@ #include "strings_type.h" #include "core/smallvec_type.hpp" +#include "core/enum_type.hpp" enum FileSlots { /** @@ -86,12 +87,13 @@ enum SortingBits { SORT_BY_DATE = 0, SORT_BY_NAME = 2 }; +DECLARE_ENUM_AS_BIT_SET(SortingBits) /* Variables to display file lists */ -extern SmallVector _fios_items; ///< defined in fios.cpp +extern SmallVector _fios_items; extern SmallFiosItem _file_to_saveload; -extern SaveLoadDialogMode _saveload_mode; ///< defined in misc_gui.cpp -extern byte _savegame_sort_order; +extern SaveLoadDialogMode _saveload_mode; +extern SortingBits _savegame_sort_order; /* Launch save/load dialog */ void ShowSaveLoadDialog(SaveLoadDialogMode mode); diff --git a/src/openttd.cpp b/src/openttd.cpp index 554e7dbf1..1aa9348b9 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -405,7 +405,6 @@ void MakeNewgameSettingsLive() #endif /* ENABLE_AI */ } -byte _savegame_sort_order; #if defined(UNIX) && !defined(__MORPHOS__) extern void DedicatedFork(); #endif @@ -680,7 +679,6 @@ int ttd_main(int argc, char *argv[]) } free(musicdriver); - _savegame_sort_order = SORT_BY_DATE | SORT_DESCENDING; /* Initialize the zoom level of the screen to normal */ _screen.zoom = ZOOM_LVL_NORMAL; -- cgit v1.2.3-70-g09d2