Merge branch 'improved_breakdowns' into jgrpp
Update German and Korean language strings # Conflicts: # src/saveload/extended_ver_sl.cpp
This commit is contained in:
@@ -436,13 +436,29 @@ void RoadVehicle::UpdateDeltaXY(Direction direction)
|
||||
this->z_extent = 6;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the maximum speed of the vehicle, taking into account speed reductions following critical breakdowns
|
||||
* @return Maximum speed of the vehicle.
|
||||
*/
|
||||
int RoadVehicle::GetEffectiveMaxSpeed() const
|
||||
{
|
||||
int max_speed = this->vcache.cached_max_speed;
|
||||
|
||||
for (uint i = 0; i < this->critical_breakdown_count; i++) {
|
||||
max_speed = min(max_speed - (max_speed / 3) + 1, max_speed);
|
||||
}
|
||||
|
||||
/* clamp speed to be no less than lower of 5mph and 1/8 of base speed */
|
||||
return max<uint16>(max_speed, min<uint16>(10, (this->vcache.cached_max_speed + 7) >> 3));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the maximum speed of the vehicle under its current conditions.
|
||||
* @return Maximum speed of the vehicle.
|
||||
*/
|
||||
inline int RoadVehicle::GetCurrentMaxSpeed() const
|
||||
{
|
||||
int max_speed = this->vcache.cached_max_speed;
|
||||
int max_speed = this->GetEffectiveMaxSpeed();
|
||||
|
||||
/* Limit speed to 50% while reversing, 75% in curves. */
|
||||
for (const RoadVehicle *u = this; u != NULL; u = u->Next()) {
|
||||
|
Reference in New Issue
Block a user