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:
@@ -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. */
|
||||
|
Reference in New Issue
Block a user