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

@@ -106,6 +106,7 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
TrackBitsByte track;
TrainForceProceedingByte force_proceed;
RailTypeByte railtype;
byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service
RailTypes compatible_railtypes;
/** Ticks waiting in front of a signal, ticks being stuck or a counter for forced proceeding through signals. */