Fix #416: Division by zero for trains of 0 mass
In maximum achievable speed estimator
This commit is contained in:
@@ -7320,11 +7320,13 @@ int GetTrainRealisticAccelerationAtSpeed(const int speed, const int mass, const
|
||||
return acceleration;
|
||||
}
|
||||
|
||||
int GetTrainEstimatedMaxAchievableSpeed(const Train *train, const int mass, const int speed_cap)
|
||||
int GetTrainEstimatedMaxAchievableSpeed(const Train *train, int mass, const int speed_cap)
|
||||
{
|
||||
int max_speed = 0;
|
||||
int acceleration;
|
||||
|
||||
if (mass < 1) mass = 1;
|
||||
|
||||
do
|
||||
{
|
||||
max_speed++;
|
||||
|
Reference in New Issue
Block a user