mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r2672) Move saving/loading related declarations to saveload.h
This commit is contained in:
parent
ad97673399
commit
18d79cc30f
|
@ -4,6 +4,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include "saveload.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
#include "network_data.h"
|
#include "network_data.h"
|
||||||
|
|
14
functions.h
14
functions.h
|
@ -236,20 +236,6 @@ void ShowHighscoreTable(int difficulty, int8 rank);
|
||||||
void ShowEndGameChart(void);
|
void ShowEndGameChart(void);
|
||||||
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
|
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 AfterLoadTown(void);
|
||||||
void GenRandomNewGame(uint32 rnd1, uint32 rnd2);
|
void GenRandomNewGame(uint32 rnd1, uint32 rnd2);
|
||||||
void StartScenarioEditor(uint32 rnd1, uint32 rnd2);
|
void StartScenarioEditor(uint32 rnd1, uint32 rnd2);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "openttd.h"
|
#include "openttd.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "saveload.h"
|
||||||
#include "spritecache.h"
|
#include "spritecache.h"
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "network_client.h"
|
#include "network_client.h"
|
||||||
#include "network_gamelist.h"
|
#include "network_gamelist.h"
|
||||||
|
#include "saveload.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
|
#include "saveload.h"
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
#include "station.h"
|
#include "station.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "saveload.h"
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "tile.h"
|
#include "tile.h"
|
||||||
|
|
|
@ -1196,7 +1196,7 @@ extern void BeforeSaveGame(void);
|
||||||
extern bool LoadOldSaveGame(const char *file);
|
extern bool LoadOldSaveGame(const char *file);
|
||||||
|
|
||||||
/** Small helper function to close the to be loaded savegame an signal error */
|
/** 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);
|
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
|
* @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)
|
* @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];
|
uint32 hdr[2];
|
||||||
const SaveLoadFormat *fmt;
|
const SaveLoadFormat *fmt;
|
||||||
|
|
16
saveload.h
16
saveload.h
|
@ -3,6 +3,22 @@
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
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 ChunkSaveLoadProc(void);
|
||||||
typedef void AutolengthProc(void *arg);
|
typedef void AutolengthProc(void *arg);
|
||||||
|
|
||||||
|
|
1
win32.c
1
win32.c
|
@ -1,6 +1,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "openttd.h"
|
#include "openttd.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "saveload.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
|
|
Loading…
Reference in New Issue