diff --git a/src/strings.cpp b/src/strings.cpp index bfb868da2d..869ebbac42 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -798,6 +798,20 @@ uint ConvertSpeedToDisplaySpeed(uint speed) return _units_velocity[_settings_game.locale.units_velocity].c.ToDisplay(speed, false); } +/** + * Convert the given (internal) speed to the display speed, in units (not decimal values). + * @param speed the speed to convert + * @return the converted speed. + */ +uint ConvertSpeedToUnitDisplaySpeed(uint speed) +{ + uint result = ConvertSpeedToDisplaySpeed(speed); + for (uint i = 0; i < _units_velocity[_settings_game.locale.units_velocity].decimal_places; i++) { + result /= 10; + } + return result; +} + /** * Convert the given display speed to the (internal) speed. * @param speed the speed to convert diff --git a/src/unit_conversion.h b/src/unit_conversion.h index 7ca3bca424..beed23807b 100644 --- a/src/unit_conversion.h +++ b/src/unit_conversion.h @@ -8,6 +8,7 @@ /** @file unit_conversion.h Functions related to unit conversion. */ uint ConvertSpeedToDisplaySpeed(uint speed); +uint ConvertSpeedToUnitDisplaySpeed(uint speed); uint ConvertDisplaySpeedToSpeed(uint speed); uint ConvertWeightToDisplayWeight(uint weight); uint ConvertDisplayWeightToWeight(uint weight);