Fix speed reduction after critical breakdowns.

Previous code set vcache.cached_max_speed directly (and incorrectly),
which did not survive across save/load or network joins.
Instead add a struct Train field to store the number
of critical breakdowns since last service and do the speed reduction
properly in Train::ConsistChanged.
Slightly tweak algorithm for speed reduction.
This commit is contained in:
Jonathan G Rennison
2016-01-18 18:27:51 +00:00
parent b652d1c42a
commit 5e924262f4
5 changed files with 20 additions and 16 deletions

View File

@@ -726,6 +726,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_CONDNULL(2, 2, 19),
SLE_CONDVAR(Train, gv_flags, SLE_UINT16, 139, SL_MAX_VERSION),
SLE_CONDNULL(11, 2, 143), // old reserved space
SLE_CONDVAR(Train, critical_breakdown_count, SLE_UINT8, SL_IB, SL_MAX_VERSION),
SLE_END()
};