summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-09 21:40:32 +0000
committerfrosch <frosch@openttd.org>2011-02-09 21:40:32 +0000
commitb7713a7e8540aaf8d1181be8535132ba561f4364 (patch)
tree520a42af547affbdfd7948a67ec4318b8e0898fe /src/saveload
parent3a787f5a0b83c1bac9680a80b657601ce2d3bf5b (diff)
downloadopenttd-b7713a7e8540aaf8d1181be8535132ba561f4364.tar.xz
(svn r22046) -Fix [FS#4487]: Make sure order indices stay in range when copying, sharing, unsharing or deleting all orders.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 17ac9bc81..fe99e3c3e 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2564,6 +2564,9 @@ bool AfterLoadGame()
FOR_ALL_VEHICLES(v) {
if (!v->IsPrimaryVehicle()) continue;
+ /* Older versions are less strict with indices being in range and fix them on the fly */
+ if (v->cur_auto_order_index >= v->GetNumOrders()) v->cur_auto_order_index = 0;
+
v->cur_real_order_index = v->cur_auto_order_index;
v->UpdateRealOrderIndex();
}