OpenTTD Source 20241224-master-gf74b0cf984
|
Helper for unit conversion. More...
Public Member Functions | |
int64_t | ToDisplay (int64_t input, bool round=true) const |
Convert value from OpenTTD's internal unit into the displayed value. | |
int64_t | FromDisplay (int64_t input, bool round=true, int64_t divider=1) const |
Convert the displayed value back into a value of OpenTTD's internal unit. | |
Data Fields | |
double | factor |
Amount to multiply or divide upon conversion. | |
Helper for unit conversion.
Definition at line 725 of file strings.cpp.
|
inline |
Convert the displayed value back into a value of OpenTTD's internal unit.
input | The input to convert. |
round | Whether to round the value up or not. |
divider | Divide the return value by this. |
Definition at line 748 of file strings.cpp.
Referenced by ConvertDisplaySpeedToKmhishSpeed(), and ConvertDisplaySpeedToSpeed().
|
inline |
Convert value from OpenTTD's internal unit into the displayed value.
input | The input to convert. |
round | Whether to round the value or not. |
Definition at line 734 of file strings.cpp.
Referenced by ConvertKmhishSpeedToDisplaySpeed(), ConvertSpeedToDisplaySpeed(), and FormatString().
double UnitConversion::factor |
Amount to multiply or divide upon conversion.
Definition at line 726 of file strings.cpp.