summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-29 09:54:47 +0000
committerrubidium <rubidium@openttd.org>2008-05-29 09:54:47 +0000
commit793ac8baa4b88508c21717abd7f44808f15eac98 (patch)
treecccf15d8a59031edb6cb85fccdfdf7895b781b06
parent698a51a41eae0e2d0975a24e0a893381729f4377 (diff)
downloadopenttd-793ac8baa4b88508c21717abd7f44808f15eac98.tar.xz
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
-rw-r--r--src/fios.h8
-rw-r--r--src/genworld.cpp6
-rw-r--r--src/genworld.h12
-rw-r--r--src/misc.cpp4
-rw-r--r--src/openttd.h24
-rw-r--r--src/saveload.cpp6
6 files changed, 26 insertions, 34 deletions
diff --git a/src/fios.h b/src/fios.h
index ca95b3578..ca4fa1361 100644
--- a/src/fios.h
+++ b/src/fios.h
@@ -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);
diff --git a/src/genworld.cpp b/src/genworld.cpp
index a660abcfd..fab5c3c15 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -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 */
diff --git a/src/genworld.h b/src/genworld.h
index 9cd09a701..c0a192333 100644
--- a/src/genworld.h
+++ b/src/genworld.h
@@ -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();
diff --git a/src/misc.cpp b/src/misc.cpp
index e53e2f140..9919768f7 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -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();
}
diff --git a/src/openttd.h b/src/openttd.h
index 1f3468159..a603a62e8 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -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 */
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 8b346d75c..76267236a 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -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();