From 369a6f9d1b6856eee47df08b1aae8049eaf4b2fa Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 14 Feb 2013 17:06:49 +0000 Subject: (svn r24995) -Codechange: Add flags to vehicle service interval for custom & ispercent (peter1138) --- src/saveload/vehicle_sl.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/saveload') 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(); -- cgit v1.2.3-54-g00ecf