mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-10 00:11:31 +00:00
(svn r21092) -Codechange: Merge max speed functions.
This commit is contained in:
parent
d699c4a345
commit
766bf140db
@ -27,7 +27,7 @@ void GroundVehicle<T, Type>::PowerChanged()
|
|||||||
uint32 total_power = 0;
|
uint32 total_power = 0;
|
||||||
uint32 max_te = 0;
|
uint32 max_te = 0;
|
||||||
uint32 number_of_parts = 0;
|
uint32 number_of_parts = 0;
|
||||||
uint16 max_track_speed = v->GetInitialMaxSpeed();
|
uint16 max_track_speed = v->GetDisplayMaxSpeed();
|
||||||
|
|
||||||
for (const T *u = v; u != NULL; u = u->Next()) {
|
for (const T *u = v; u != NULL; u = u->Next()) {
|
||||||
uint32 current_power = u->GetPower();
|
uint32 current_power = u->GetPower();
|
||||||
|
@ -61,7 +61,7 @@ enum GroundVehicleFlags {
|
|||||||
* virtual uint32 GetRollingFriction() const = 0;
|
* virtual uint32 GetRollingFriction() const = 0;
|
||||||
* virtual int GetAccelerationType() const = 0;
|
* virtual int GetAccelerationType() const = 0;
|
||||||
* virtual int32 GetSlopeSteepness() const = 0;
|
* virtual int32 GetSlopeSteepness() const = 0;
|
||||||
* virtual uint16 GetInitialMaxSpeed() const = 0;
|
* virtual int GetDisplayMaxSpeed() const = 0;
|
||||||
* virtual uint16 GetMaxTrackSpeed() const = 0;
|
* virtual uint16 GetMaxTrackSpeed() const = 0;
|
||||||
* virtual bool TileMayHaveSlopedTrack() const = 0;
|
* virtual bool TileMayHaveSlopedTrack() const = 0;
|
||||||
*/
|
*/
|
||||||
|
@ -279,16 +279,6 @@ protected: // These functions should not be called outside acceleration code.
|
|||||||
return 20 * _settings_game.vehicle.roadveh_slope_steepness; // 1% slope * slope steepness
|
return 20 * _settings_game.vehicle.roadveh_slope_steepness; // 1% slope * slope steepness
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the maximum speed of the vehicle, ignoring the limitations of the kind of track the vehicle is on.
|
|
||||||
* @return Maximum speed of the vehicle.
|
|
||||||
*/
|
|
||||||
FORCEINLINE uint16 GetInitialMaxSpeed() const
|
|
||||||
{
|
|
||||||
/* Road vehicles use a *2 conversion factor. */
|
|
||||||
return this->max_speed / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum speed allowed by the track for this vehicle.
|
* Gets the maximum speed allowed by the track for this vehicle.
|
||||||
* @return Since roads don't limit road vehicle speed, it returns always zero.
|
* @return Since roads don't limit road vehicle speed, it returns always zero.
|
||||||
|
@ -500,15 +500,6 @@ protected: // These functions should not be called outside acceleration code.
|
|||||||
return 20 * _settings_game.vehicle.train_slope_steepness; // 1% slope * slope steepness
|
return 20 * _settings_game.vehicle.train_slope_steepness; // 1% slope * slope steepness
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the maximum speed of the vehicle, ignoring the limitations of the kind of track the vehicle is on.
|
|
||||||
* @return Maximum speed of the vehicle.
|
|
||||||
*/
|
|
||||||
FORCEINLINE uint16 GetInitialMaxSpeed() const
|
|
||||||
{
|
|
||||||
return this->tcache.cached_max_speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum speed allowed by the track for this vehicle.
|
* Gets the maximum speed allowed by the track for this vehicle.
|
||||||
* @return Maximum speed allowed.
|
* @return Maximum speed allowed.
|
||||||
|
Loading…
Reference in New Issue
Block a user