Mercurial > hg > openttd
changeset 15297:ece58c0a3946 draft
(svn r19936) -Codechange: If there is an enum, also use it.
author | frosch <frosch@openttd.org> |
---|---|
date | Sat, 05 Jun 2010 18:44:31 +0000 |
parents | b4822d9955c3 |
children | 1028938fd078 |
files | src/fios.cpp src/fios.h src/openttd.cpp |
diffstat | 3 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fios.cpp +++ b/src/fios.cpp @@ -32,6 +32,7 @@ SmallVector<FiosItem, 32> _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 @@ /* 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;
--- 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 @@ SORT_BY_DATE = 0, SORT_BY_NAME = 2 }; +DECLARE_ENUM_AS_BIT_SET(SortingBits) /* Variables to display file lists */ -extern SmallVector<FiosItem, 32> _fios_items; ///< defined in fios.cpp +extern SmallVector<FiosItem, 32> _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);
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -405,7 +405,6 @@ #endif /* ENABLE_AI */ } -byte _savegame_sort_order; #if defined(UNIX) && !defined(__MORPHOS__) extern void DedicatedFork(); #endif @@ -680,7 +679,6 @@ } free(musicdriver); - _savegame_sort_order = SORT_BY_DATE | SORT_DESCENDING; /* Initialize the zoom level of the screen to normal */ _screen.zoom = ZOOM_LVL_NORMAL;