summaryrefslogtreecommitdiff
path: root/src/saveload/saveload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/saveload/saveload.cpp')
-rw-r--r--src/saveload/saveload.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index a21f6242a..da3dab7c9 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -41,6 +41,7 @@
#include "../string_func.h"
#include "../fios.h"
#include "../error.h"
+#include "../cargodest_base.h"
#include "table/strings.h"
@@ -245,7 +246,7 @@
* 179 24810
* 180 24998
*/
-extern const uint16 SAVEGAME_VERSION = 180; ///< Current savegame version of OpenTTD.
+extern const uint16 SAVEGAME_VERSION = SL_TTSEP_VER; ///< Current savegame version of OpenTTD.
SavegameType _savegame_type; ///< type of savegame we are loading
@@ -426,6 +427,7 @@ extern const ChunkHandler _autoreplace_chunk_handlers[];
extern const ChunkHandler _labelmaps_chunk_handlers[];
extern const ChunkHandler _airport_chunk_handlers[];
extern const ChunkHandler _object_chunk_handlers[];
+extern const ChunkHandler _routelink_chunk_handlers[];
extern const ChunkHandler _persistent_storage_chunk_handlers[];
/** Array of all chunks in a savegame, \c NULL terminated. */
@@ -460,6 +462,7 @@ static const ChunkHandler * const _chunk_handlers[] = {
_labelmaps_chunk_handlers,
_airport_chunk_handlers,
_object_chunk_handlers,
+ _routelink_chunk_handlers,
_persistent_storage_chunk_handlers,
NULL,
};
@@ -1214,6 +1217,7 @@ static size_t ReferenceToInt(const void *obj, SLRefType rt)
case REF_ENGINE_RENEWS: return ((const EngineRenew*)obj)->index + 1;
case REF_CARGO_PACKET: return ((const CargoPacket*)obj)->index + 1;
case REF_ORDERLIST: return ((const OrderList*)obj)->index + 1;
+ case REF_ROUTE_LINK: return ((const RouteLink*)obj)->index + 1;
case REF_STORAGE: return ((const PersistentStorage*)obj)->index + 1;
default: NOT_REACHED();
}
@@ -1284,6 +1288,10 @@ static void *IntToReference(size_t index, SLRefType rt)
if (CargoPacket::IsValidID(index)) return CargoPacket::Get(index);
SlErrorCorrupt("Referencing invalid CargoPacket");
+ case REF_ROUTE_LINK:
+ if (RouteLink::IsValidID(index)) return RouteLink::Get(index);
+ SlErrorCorrupt("Referencing invalid RouteLink");
+
case REF_STORAGE:
if (PersistentStorage::IsValidID(index)) return PersistentStorage::Get(index);
SlErrorCorrupt("Referencing invalid PersistentStorage");