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

Function ConvertSpeedToDisplaySpeed

src/strings.cpp:968–974  ·  view source on GitHub ↗

* Convert the given (internal) speed to the display speed. * @param speed the speed to convert * @return the converted speed. */

Source from the content-addressed store, hash-verified

966 * @return the converted speed.
967 */
968uint ConvertSpeedToDisplaySpeed(uint speed, VehicleType type)
969{
970 /* For historical reasons we don't want to mess with the
971 * conversion for speed. So, don't round it and keep the
972 * original conversion factors instead of the real ones. */
973 return GetVelocityUnits(type).c.ToDisplay(speed, false);
974}
975
976/**
977 * Convert the given display speed to the (internal) speed.

Callers 3

DrawOrderStringFunction · 0.85
GetWidgetStringMethod · 0.85
OnClickMethod · 0.85

Calls 2

GetVelocityUnitsFunction · 0.85
ToDisplayMethod · 0.80

Tested by

no test coverage detected