From 18d79cc30f1a4946abce0cf31f8a0469f1bdadfa Mon Sep 17 00:00:00 2001 From: tron Date: Fri, 22 Jul 2005 06:31:31 +0000 Subject: (svn r2672) Move saving/loading related declarations to saveload.h --- console_cmds.c | 1 + functions.h | 14 -------------- misc_gui.c | 1 + network_client.c | 1 + network_server.c | 1 + openttd.c | 1 + saveload.c | 4 ++-- saveload.h | 16 ++++++++++++++++ win32.c | 1 + 9 files changed, 24 insertions(+), 16 deletions(-) diff --git a/console_cmds.c b/console_cmds.c index bc66d47f1..2cac5c3e0 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -4,6 +4,7 @@ #include "debug.h" #include "engine.h" #include "functions.h" +#include "saveload.h" #include "string.h" #include "variables.h" #include "network_data.h" diff --git a/functions.h b/functions.h index ea755ab76..ae5e9b27b 100644 --- a/functions.h +++ b/functions.h @@ -236,20 +236,6 @@ void ShowHighscoreTable(int difficulty, int8 rank); void ShowEndGameChart(void); TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng); -enum SaveOrLoadResult { - SL_OK = 0, // completed successfully - SL_ERROR = 1, // error that was caught before internal structures were modified - SL_REINIT = 2, // error that was caught in the middle of updating game state, need to clear it. (can only happen during load) -}; -enum SaveOrLoadMode { - SL_INVALID = -1, - SL_LOAD = 0, - SL_SAVE = 1, - SL_OLD_LOAD = 2, -}; - -int SaveOrLoad(const char *filename, int mode); - void AfterLoadTown(void); void GenRandomNewGame(uint32 rnd1, uint32 rnd2); void StartScenarioEditor(uint32 rnd1, uint32 rnd2); diff --git a/misc_gui.c b/misc_gui.c index fb2cf75f1..cd277e837 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "openttd.h" #include "debug.h" +#include "saveload.h" #include "spritecache.h" #include "strings.h" #include "table/sprites.h" diff --git a/network_client.c b/network_client.c index 0bb0a8673..2288f9b05 100644 --- a/network_client.c +++ b/network_client.c @@ -9,6 +9,7 @@ #include "table/strings.h" #include "network_client.h" #include "network_gamelist.h" +#include "saveload.h" #include "command.h" #include "gfx.h" #include "window.h" diff --git a/network_server.c b/network_server.c index 6cad02896..ff0f05094 100644 --- a/network_server.c +++ b/network_server.c @@ -12,6 +12,7 @@ #include "console.h" #include "command.h" #include "gfx.h" +#include "saveload.h" #include "vehicle.h" #include "station.h" #include "settings.h" diff --git a/openttd.c b/openttd.c index 85a65d800..5e1a91e06 100644 --- a/openttd.c +++ b/openttd.c @@ -2,6 +2,7 @@ #include "string.h" #include "table/strings.h" #include "debug.h" +#include "saveload.h" #include "strings.h" #include "map.h" #include "tile.h" diff --git a/saveload.c b/saveload.c index 1bba25281..e6fcca30e 100644 --- a/saveload.c +++ b/saveload.c @@ -1196,7 +1196,7 @@ extern void BeforeSaveGame(void); extern bool LoadOldSaveGame(const char *file); /** Small helper function to close the to be loaded savegame an signal error */ -static inline int AbortSaveLoad(void) +static inline SaveOrLoadResult AbortSaveLoad(void) { if (_sl.fh != NULL) fclose(_sl.fh); @@ -1300,7 +1300,7 @@ static bool SaveFileToDisk(void *ptr) * @param mode Save or load. Load can also be a TTD(Patch) game. Use SL_LOAD, SL_OLD_LOAD or SL_SAVE * @return Return the results of the action. SL_OK, SL_ERROR or SL_REINIT ("unload" the game) */ -int SaveOrLoad(const char *filename, int mode) +SaveOrLoadResult SaveOrLoad(const char *filename, int mode) { uint32 hdr[2]; const SaveLoadFormat *fmt; diff --git a/saveload.h b/saveload.h index 603259a71..6a50b40d7 100644 --- a/saveload.h +++ b/saveload.h @@ -3,6 +3,22 @@ #include +typedef enum SaveOrLoadResult { + SL_OK = 0, // completed successfully + SL_ERROR = 1, // error that was caught before internal structures were modified + SL_REINIT = 2, // error that was caught in the middle of updating game state, need to clear it. (can only happen during load) +} SaveOrLoadResult; + +typedef enum SaveOrLoadMode { + SL_INVALID = -1, + SL_LOAD = 0, + SL_SAVE = 1, + SL_OLD_LOAD = 2, +} SaveOrLoadMode; + +SaveOrLoadResult SaveOrLoad(const char *filename, int mode); + + typedef void ChunkSaveLoadProc(void); typedef void AutolengthProc(void *arg); diff --git a/win32.c b/win32.c index a1afbe2e6..65cef9048 100644 --- a/win32.c +++ b/win32.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "openttd.h" #include "debug.h" +#include "saveload.h" #include "string.h" #include "table/strings.h" #include "gfx.h" -- cgit v1.2.3-54-g00ecf