Fix excessive amounts of vehicle smoke when reversing at waypoints.

This commit is contained in:
Jonathan G Rennison
2015-10-29 00:55:12 +00:00
parent 7bcd090a0f
commit 79da755c45
2 changed files with 17 additions and 9 deletions

View File

@@ -2395,6 +2395,8 @@ static void SpawnAdvancedVisualEffect(const Vehicle *v)
}
}
uint16 ReversingDistanceTargetSpeed(const Train *v);
/**
* Draw visual effects (smoke and/or sparks) for a vehicle chain.
* @pre this->IsPrimaryVehicle()
@@ -2423,10 +2425,12 @@ void Vehicle::ShowVisualEffect() const
/* For trains, do not show any smoke when:
* - the train is reversing
* - is entering a station with an order to stop there and its speed is equal to maximum station entering speed
* - is approaching a reversing point and its speed is equal to maximum approach speed
*/
if (HasBit(t->flags, VRF_REVERSING) ||
(IsRailStationTile(t->tile) && t->IsFrontEngine() && t->current_order.ShouldStopAtStation(t, GetStationIndex(t->tile)) &&
t->cur_speed >= max_speed)) {
t->cur_speed >= max_speed) ||
(t->reverse_distance >= 1 && t->cur_speed >= ReversingDistanceTargetSpeed(t))) {
return;
}
}