summaryrefslogtreecommitdiff
path: root/saveload.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-01-12 15:52:18 +0000
committerpeter1138 <peter1138@openttd.org>2006-01-12 15:52:18 +0000
commit90aff7a026c8e833d78e932575995485c2da9e47 (patch)
tree2a159338918aa7b1a61fab6e18f4e28ae2b27950 /saveload.c
parent28ca056d56bb716e125745c16876408527fdc278 (diff)
downloadopenttd-90aff7a026c8e833d78e932575995485c2da9e47.tar.xz
(svn r3396) - Autoreplace changes:
- Change fixed array per player to a single pool. This avoids future problems with vehicle numbers and decreases savegame size. Engine replacements from previous savegames will be lost. - Move engine replacement code from players.c to engine.c. (thanks to blathijs for rewriting this)
Diffstat (limited to 'saveload.c')
-rw-r--r--saveload.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/saveload.c b/saveload.c
index 827abe697..fb141cc91 100644
--- a/saveload.c
+++ b/saveload.c
@@ -29,7 +29,7 @@
#include <setjmp.h>
enum {
- SAVEGAME_VERSION = 18,
+ SAVEGAME_VERSION = 19,
};
@@ -1051,6 +1051,7 @@ static void UninitWriteZlib(void)
// these define the chunks
extern const ChunkHandler _misc_chunk_handlers[];
extern const ChunkHandler _player_chunk_handlers[];
+extern const ChunkHandler _engine_chunk_handlers[];
extern const ChunkHandler _veh_chunk_handlers[];
extern const ChunkHandler _waypoint_chunk_handlers[];
extern const ChunkHandler _depot_chunk_handlers[];
@@ -1059,7 +1060,6 @@ extern const ChunkHandler _town_chunk_handlers[];
extern const ChunkHandler _sign_chunk_handlers[];
extern const ChunkHandler _station_chunk_handlers[];
extern const ChunkHandler _industry_chunk_handlers[];
-extern const ChunkHandler _engine_chunk_handlers[];
extern const ChunkHandler _economy_chunk_handlers[];
extern const ChunkHandler _animated_tile_chunk_handlers[];
@@ -1107,6 +1107,7 @@ static uint ReferenceToInt(const void *obj, SLRefType rt)
case REF_TOWN: return ((const Town*)obj)->index + 1;
case REF_ORDER: return ((const Order*)obj)->index + 1;
case REF_ROADSTOPS: return ((const RoadStop*)obj)->index + 1;
+ case REF_ENGINE_RENEWS: return ((const EngineRenew*)obj)->index + 1;
default: NOT_REACHED();
}
@@ -1162,6 +1163,11 @@ static void *IntToReference(uint index, SLRefType rt)
error("RoadStops: failed loading savegame: too many RoadStops");
return GetRoadStop(index);
}
+ case REF_ENGINE_RENEWS: {
+ if (!AddBlockIfNeeded(&_engine_renew_pool, index))
+ error("EngineRenews: failed loading savegame: too many EngineRenews");
+ return GetEngineRenew(index);
+ }
case REF_VEHICLE_OLD: {
/* Old vehicles were saved differently: