summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2020-01-03 14:11:33 +0000
committerCharles Pigott <charlespigott@googlemail.com>2020-01-05 20:51:26 +0000
commitd1cead7f251e09e572c73130bad601f7d991ecc6 (patch)
treecf8b1c6b508eccbe0760f1b6b397c6b187f9c801 /src/saveload
parentcddb8a4605570666e076ab0e0f7b1f986f393e17 (diff)
downloadopenttd-d1cead7f251e09e572c73130bad601f7d991ecc6.tar.xz
Fix: When loading old timetabled saves, also reset cached timetable duration
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp10
-rw-r--r--src/saveload/order_sl.cpp4
2 files changed, 10 insertions, 4 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 47d2c7b03..c37c297c5 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2963,6 +2963,16 @@ bool AfterLoadGame()
}
}
+ if (IsSavegameVersionBefore(SLV_190)) {
+ for (Order *order : Order::Iterate()) {
+ order->SetTravelTimetabled(order->GetTravelTime() > 0);
+ order->SetWaitTimetabled(order->GetWaitTime() > 0);
+ }
+ for (OrderList *orderlist : OrderList::Iterate()) {
+ orderlist->RecalculateTimetableDuration();
+ }
+ }
+
/*
* Only keep order-backups for network clients (and when replaying).
* If we are a network server or not networking, then we just loaded a previously
diff --git a/src/saveload/order_sl.cpp b/src/saveload/order_sl.cpp
index 0a9fa2a8c..c8747d36b 100644
--- a/src/saveload/order_sl.cpp
+++ b/src/saveload/order_sl.cpp
@@ -182,10 +182,6 @@ static void Load_ORDR()
while ((index = SlIterateArray()) != -1) {
Order *order = new (index) Order();
SlObject(order, GetOrderDescription());
- if (IsSavegameVersionBefore(SLV_190)) {
- order->SetTravelTimetabled(order->GetTravelTime() > 0);
- order->SetWaitTimetabled(order->GetWaitTime() > 0);
- }
}
}
}