MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetVelocityUnits

Function GetVelocityUnits

src/strings.cpp:951–961  ·  view source on GitHub ↗

* Get the correct velocity units depending on the vehicle type and whether we're using real-time units. * @param type VehicleType to convert velocity for. * @return The Units for the proper vehicle and time mode. */

Source from the content-addressed store, hash-verified

949 * @return The Units for the proper vehicle and time mode.
950 */
951static const Units GetVelocityUnits(VehicleType type)
952{
953 uint8_t setting = (type == VEH_SHIP || type == VEH_AIRCRAFT) ? _settings_game.locale.units_velocity_nautical : _settings_game.locale.units_velocity;
954
955 assert(setting < lengthof(_units_velocity_calendar));
956 assert(setting < lengthof(_units_velocity_realtime));
957
958 if (TimerGameEconomy::UsingWallclockUnits()) return _units_velocity_realtime[setting];
959
960 return _units_velocity_calendar[setting];
961}
962
963/**
964 * Convert the given (internal) speed to the display speed.

Callers 5

FormatStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected