summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-09-06 09:56:12 +0000
committersmatz <smatz@openttd.org>2009-09-06 09:56:12 +0000
commitf9257fabea43beccab438bd43cecf464607cd76c (patch)
tree947f7f5d9875ca3f104cbadf83872ee87d165872 /src/saveload
parentbc5241600a33f7271a839105c4752ad24f202c1c (diff)
downloadopenttd-f9257fabea43beccab438bd43cecf464607cd76c.tar.xz
(svn r17429) -Fix (r16378): conversion of TTO/TTD savegames failed when vehicle 0 was a wagon
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/oldloader_sl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 1620ea169..f47b43b15 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -169,7 +169,11 @@ void FixOldVehicles()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->next != NULL) v->next = Vehicle::Get((size_t)v->next);
+ if ((size_t)v->next == 0xFFFF) {
+ v->next = NULL;
+ } else {
+ v->next = Vehicle::GetIfValid((size_t)v->next);
+ }
/* For some reason we need to correct for this */
switch (v->spritenum) {
@@ -1396,7 +1400,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
}
v->current_order.AssignOrder(UnpackOldOrder(_old_order));
- if (_old_next_ptr != 0xFFFF) v->next = (Vehicle *)(size_t)_old_next_ptr;
+ v->next = (Vehicle *)(size_t)_old_next_ptr;
if (_cargo_count != 0) {
CargoPacket *cp = new CargoPacket((_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, _cargo_count);