Fix road vehicles not being limited by the road type max speed

This commit is contained in:
Jonathan G Rennison
2019-07-21 17:19:03 +01:00
parent 8a01fba216
commit 6f840a5c80

View File

@@ -468,7 +468,7 @@ int RoadVehicle::GetEffectiveMaxSpeed() const
*/
inline int RoadVehicle::GetCurrentMaxSpeed() const
{
int max_speed = this->GetEffectiveMaxSpeed();
int max_speed = min(this->GetEffectiveMaxSpeed(), this->gcache.cached_max_track_speed);
/* Limit speed to 50% while reversing, 75% in curves. */
for (const RoadVehicle *u = this; u != nullptr; u = u->Next()) {