summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-07-13 14:12:14 +0000
committerrubidium <rubidium@openttd.org>2013-07-13 14:12:14 +0000
commite6eede841a0f86b93826b930f2189f50218b3eee (patch)
tree354d8829f490db88b4658184b95afa0c7338b49c
parent94d48eb27fd4cc6aed401140e60bb1e80fede021 (diff)
downloadopenttd-e6eede841a0f86b93826b930f2189f50218b3eee.tar.xz
(svn r25604) -Fix [FS#5550]: Only the front engine's date of last service was updated
-rw-r--r--src/vehicle.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 4b5ecfc12..0ed769b76 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -87,14 +87,24 @@ bool Vehicle::NeedsAutorenewing(const Company *c, bool use_renew_setting) const
return true;
}
+/**
+ * Service a vehicle and all subsequent vehicles in the consist
+ *
+ * @param *v The vehicle or vehicle chain being serviced
+ */
void VehicleServiceInDepot(Vehicle *v)
{
- v->date_of_last_service = _date;
- v->breakdowns_since_last_service = 0;
- v->reliability = v->GetEngine()->reliability;
- /* Prevent vehicles from breaking down directly after exiting the depot. */
- v->breakdown_chance /= 4;
+ assert(v != NULL);
SetWindowDirty(WC_VEHICLE_DETAILS, v->index); // ensure that last service date and reliability are updated
+
+ do {
+ v->date_of_last_service = _date;
+ v->breakdowns_since_last_service = 0;
+ v->reliability = v->GetEngine()->reliability;
+ /* Prevent vehicles from breaking down directly after exiting the depot. */
+ v->breakdown_chance /= 4;
+ v = v->Next();
+ } while (v != NULL && v->HasEngineType());
}
/**