summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-02-14 17:06:49 +0000
committerrubidium <rubidium@openttd.org>2013-02-14 17:06:49 +0000
commit369a6f9d1b6856eee47df08b1aae8049eaf4b2fa (patch)
treeac8fea57b2d4156c4c1a7e9ca361bde23c56d99c /src/saveload
parentc77cd1f409698a5c3c0dc89f2cd1930b20b90554 (diff)
downloadopenttd-369a6f9d1b6856eee47df08b1aae8049eaf4b2fa.tar.xz
(svn r24995) -Codechange: Add flags to vehicle service interval for custom & ispercent (peter1138)
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/vehicle_sl.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index c1e07bf3c..aebde2bb0 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -17,6 +17,8 @@
#include "../aircraft.h"
#include "../station_base.h"
#include "../effectvehicle_base.h"
+#include "../company_base.h"
+#include "../company_func.h"
#include "saveload.h"
@@ -349,6 +351,19 @@ void AfterLoadVehicles(bool part_of_load)
v->cargo_age_counter = _age_cargo_skip_counter;
}
}
+
+ if (IsSavegameVersionBefore(180)) {
+ /* Set service interval flags */
+ FOR_ALL_VEHICLES(v) {
+ if (!v->IsPrimaryVehicle()) continue;
+
+ const Company *c = Company::Get(v->owner);
+ int interval = CompanyServiceInterval(c, v->type);
+
+ v->SetServiceIntervalIsCustom(v->GetServiceInterval() != interval);
+ v->SetServiceIntervalIsPercent(c->settings.vehicle.servint_ispercent);
+ }
+ }
}
CheckValidVehicles();