(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.

pull/155/head
rubidium 16 years ago
parent 698a51a41e
commit 793ac8baa4

@ -72,11 +72,19 @@ struct SmallFiosItem {
char title[255]; ///< internal name of the game
};
enum {
SORT_ASCENDING = 0,
SORT_DESCENDING = 1,
SORT_BY_DATE = 0,
SORT_BY_NAME = 2
};
/* Variables to display file lists */
extern FiosItem *_fios_list; ///< defined in misc_gui.cpp
extern int _fios_num; ///< defined in fios.cpp, read_only version of _fios_count
extern SmallFiosItem _file_to_saveload;
extern SaveLoadDialogMode _saveload_mode; ///< defined in misc_gui.cpp
extern byte _savegame_sort_order;
/* Launch save/load dialog */
void ShowSaveLoadDialog(SaveLoadDialogMode mode);

@ -39,7 +39,7 @@ void StartupEconomy();
void StartupPlayers();
void StartupDisasters();
void InitializeGame(int mode, uint size_x, uint size_y);
void InitializeGame(uint size_x, uint size_y, bool reset_date);
/* Please only use this variable in genworld.h and genworld.c and
* nowhere else. For speed improvements we need it to be global, but
@ -253,7 +253,7 @@ void HandleGeneratingWorldAbortion()
* @param size_x The X-size of the map.
* @param size_y The Y-size of the map.
*/
void GenerateWorld(int mode, uint size_x, uint size_y)
void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y)
{
if (_gw.active) return;
_gw.mode = mode;
@ -279,7 +279,7 @@ void GenerateWorld(int mode, uint size_x, uint size_y)
GfxLoadSprites();
LoadStringWidthTable();
InitializeGame(IG_NONE, _gw.size_x, _gw.size_y);
InitializeGame(_gw.size_x, _gw.size_y, false);
PrepareGenerateWorldProgress();
/* Re-init the windowing system */

@ -18,6 +18,14 @@ enum {
GENERATE_NEW_SEED = (uint)-1, ///< Create a new random seed
};
/* Modes for GenerateWorld */
enum GenerateWorldMode {
GW_NEWGAME = 0, /* Generate a map for a new game */
GW_EMPTY = 1, /* Generate an empty map (sea-level) */
GW_RANDOM = 2, /* Generate a random map for SE */
GW_HEIGHTMAP = 3, /* Generate a newgame from a heightmap */
};
typedef void gw_done_proc();
typedef void gw_abort_proc();
@ -27,7 +35,7 @@ struct gw_info {
bool wait_for_draw; ///< Are we waiting on a draw event
bool quit_thread; ///< Do we want to quit the active thread
bool threaded; ///< Whether we run _GenerateWorld threaded
int mode; ///< What mode are we making a world in
GenerateWorldMode mode;///< What mode are we making a world in
PlayerID lp; ///< The local_player before generating
uint size_x; ///< X-size of the map
uint size_y; ///< Y-size of the map
@ -67,7 +75,7 @@ bool IsGenerateWorldThreaded();
void GenerateWorldSetCallback(gw_done_proc *proc);
void GenerateWorldSetAbortCallback(gw_abort_proc *proc);
void WaitTillGeneratedWorld();
void GenerateWorld(int mode, uint size_x, uint size_y);
void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y);
void AbortGeneratingWorld();
bool IsGeneratingWorldAborted();
void HandleGeneratingWorldAbortion();

@ -55,7 +55,7 @@ void InitializeCheats();
void InitializeNPF();
void InitializeOldNames();
void InitializeGame(int mode, uint size_x, uint size_y)
void InitializeGame(uint size_x, uint size_y, bool reset_date)
{
AllocateMap(size_x, size_y);
@ -69,7 +69,7 @@ void InitializeGame(int mode, uint size_x, uint size_y)
_cur_tileloop_tile = 0;
_settings = _settings_newgame;
if ((mode & IG_DATE_RESET) == IG_DATE_RESET) {
if (reset_date) {
SetDate(ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1));
InitializeOldNames();
}

@ -29,21 +29,6 @@ enum SwitchModes {
SM_LOAD_HEIGHTMAP = 12,
};
/* Modes for GenerateWorld */
enum GenerateWorldModes {
GW_NEWGAME = 0, /* Generate a map for a new game */
GW_EMPTY = 1, /* Generate an empty map (sea-level) */
GW_RANDOM = 2, /* Generate a random map for SE */
GW_HEIGHTMAP = 3, /* Generate a newgame from a heightmap */
};
/* Modes for InitializeGame, those are _bits_! */
enum InitializeGameModes {
IG_NONE = 0, /* Don't do anything special */
IG_DATE_RESET = 1, /* Reset the date when initializing a game */
};
/* Display Options */
enum {
DO_SHOW_TOWN_NAMES = 0,
@ -54,15 +39,6 @@ enum {
DO_WAYPOINTS = 6,
};
enum {
SORT_ASCENDING = 0,
SORT_DESCENDING = 1,
SORT_BY_DATE = 0,
SORT_BY_NAME = 2
};
extern byte _savegame_sort_order;
/* In certain windows you navigate with the arrow keys. Do not scroll the
* gameview when here. Bitencoded variable that only allows scrolling if all
* elements are zero */

@ -1471,7 +1471,7 @@ static const SaveLoadFormat *GetSavegameFormat(const char *s)
}
/* actual loader/saver function */
void InitializeGame(int mode, uint size_x, uint size_y);
void InitializeGame(uint size_x, uint size_y, bool reset_date);
extern bool AfterLoadGame();
extern void BeforeSaveGame();
extern bool LoadOldSaveGame(const char *file);
@ -1634,7 +1634,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb)
/* Load a TTDLX or TTDPatch game */
if (mode == SL_OLD_LOAD) {
InitializeGame(IG_DATE_RESET, 256, 256); // set a mapsize of 256x256 for TTDPatch games or it might get confused
InitializeGame(256, 256, true); // set a mapsize of 256x256 for TTDPatch games or it might get confused
if (!LoadOldSaveGame(filename)) return SL_REINIT;
_sl_version = 0;
_sl_minor_version = 0;
@ -1747,7 +1747,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb)
/* Old maps were hardcoded to 256x256 and thus did not contain
* any mapsize information. Pre-initialize to 256x256 to not to
* confuse old games */
InitializeGame(IG_DATE_RESET, 256, 256);
InitializeGame(256, 256, true);
SlLoadChunks();
fmt->uninit_read();

Loading…
Cancel
Save