1
0
Fork 0

(svn r19936) -Codechange: If there is an enum, also use it.

release/1.1
frosch 2010-06-05 18:44:31 +00:00
parent 0227618324
commit 1d9a84a934
3 changed files with 7 additions and 6 deletions

View File

@ -32,6 +32,7 @@
SmallVector<FiosItem, 32> _fios_items; SmallVector<FiosItem, 32> _fios_items;
static char *_fios_path; static char *_fios_path;
SmallFiosItem _file_to_saveload; 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) */ /* OS-specific functions are taken from their respective files (win32/unix/os2 .c) */
extern bool FiosIsRoot(const char *path); 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 */ /* 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; _savegame_sort_order = SORT_BY_NAME | SORT_ASCENDING;
QSortT(_fios_items.Begin(), _fios_items.Length(), CompareFiosItems); QSortT(_fios_items.Begin(), _fios_items.Length(), CompareFiosItems);
_savegame_sort_order = order; _savegame_sort_order = order;

View File

@ -14,6 +14,7 @@
#include "strings_type.h" #include "strings_type.h"
#include "core/smallvec_type.hpp" #include "core/smallvec_type.hpp"
#include "core/enum_type.hpp"
enum FileSlots { enum FileSlots {
/** /**
@ -86,12 +87,13 @@ enum SortingBits {
SORT_BY_DATE = 0, SORT_BY_DATE = 0,
SORT_BY_NAME = 2 SORT_BY_NAME = 2
}; };
DECLARE_ENUM_AS_BIT_SET(SortingBits)
/* Variables to display file lists */ /* 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 SmallFiosItem _file_to_saveload;
extern SaveLoadDialogMode _saveload_mode; ///< defined in misc_gui.cpp extern SaveLoadDialogMode _saveload_mode;
extern byte _savegame_sort_order; extern SortingBits _savegame_sort_order;
/* Launch save/load dialog */ /* Launch save/load dialog */
void ShowSaveLoadDialog(SaveLoadDialogMode mode); void ShowSaveLoadDialog(SaveLoadDialogMode mode);

View File

@ -405,7 +405,6 @@ void MakeNewgameSettingsLive()
#endif /* ENABLE_AI */ #endif /* ENABLE_AI */
} }
byte _savegame_sort_order;
#if defined(UNIX) && !defined(__MORPHOS__) #if defined(UNIX) && !defined(__MORPHOS__)
extern void DedicatedFork(); extern void DedicatedFork();
#endif #endif
@ -680,7 +679,6 @@ int ttd_main(int argc, char *argv[])
} }
free(musicdriver); free(musicdriver);
_savegame_sort_order = SORT_BY_DATE | SORT_DESCENDING;
/* Initialize the zoom level of the screen to normal */ /* Initialize the zoom level of the screen to normal */
_screen.zoom = ZOOM_LVL_NORMAL; _screen.zoom = ZOOM_LVL_NORMAL;