diff options
author | rubidium <rubidium@openttd.org> | 2011-02-09 13:21:50 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-02-09 13:21:50 +0000 |
commit | e76465bab90ba1812db9af9a19ef58e1836e1d7f (patch) | |
tree | ce7dd438b78e7b008d13a0a609d77f1b3d7fc713 | |
parent | f4f5de5be17d75a650d2ac1d4c4ad317acdd5a64 (diff) | |
download | openttd-e76465bab90ba1812db9af9a19ef58e1836e1d7f.tar.xz |
(svn r22037) -Codechange: remove some unneeded (hidden) casting
-rw-r--r-- | src/strings.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index 33e93f82c..f9f562f49 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -553,7 +553,7 @@ struct UnitConversion { * @param input The input to convert. * @return The converted value. */ - int ToDisplay(int input) const + int64 ToDisplay(int64 input) const { return (input * this->multiplier) >> this->shift; } @@ -563,7 +563,7 @@ struct UnitConversion { * @param input The input to convert. * @return The converted value. */ - int FromDisplay(int input) const + int64 FromDisplay(int64 input) const { return ((input << this->shift) + this->multiplier / 2) / this->multiplier; } @@ -573,7 +573,7 @@ struct Units { UnitConversion c_velocity; ///< Conversion for velocity StringID velocity; ///< String for velocity UnitConversion c_power; ///< Conversion for power - StringID power; ///< String for velocity + StringID power; ///< String for power UnitConversion c_weight; ///< Conversion for weight StringID s_weight; ///< Short string for weight StringID l_weight; ///< Long string for weight @@ -734,14 +734,14 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case SCC_VELOCITY: { // {VELOCITY} int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = ConvertSpeedToDisplaySpeed(GetInt32(&argv, argve, &argt, SCC_VELOCITY) * 10 / 16); + args[0] = ConvertSpeedToDisplaySpeed(GetInt64(&argv, argve, &argt, SCC_VELOCITY) * 10 / 16); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].velocity), args, endof(args), modifier >> 24, last); modifier = 0; break; } case SCC_HEIGHT: { // {HEIGHT} - int64 args[1] = {_units[_settings_game.locale.units].c_height.ToDisplay(GetInt32(&argv, argve, &argt))}; + int64 args[1] = {_units[_settings_game.locale.units].c_height.ToDisplay(GetInt64(&argv, argve, &argt))}; buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].height), args, endof(args), modifier >> 24, last); modifier = 0; break; @@ -764,7 +764,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case STR_TONS: { int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = _units[_settings_game.locale.units].c_weight.ToDisplay(GetInt32(&argv, argve, &argt)); + args[0] = _units[_settings_game.locale.units].c_weight.ToDisplay(GetInt64(&argv, argve, &argt)); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].l_weight), args, endof(args), modifier >> 24, last); modifier = 0; break; @@ -773,7 +773,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case STR_LITERS: { int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = _units[_settings_game.locale.units].c_volume.ToDisplay(GetInt32(&argv, argve, &argt)); + args[0] = _units[_settings_game.locale.units].c_volume.ToDisplay(GetInt64(&argv, argve, &argt)); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].l_volume), args, endof(args), modifier >> 24, last); modifier = 0; break; @@ -859,7 +859,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case SCC_VOLUME: { // {VOLUME} int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = _units[_settings_game.locale.units].c_volume.ToDisplay(GetInt32(&argv, argve, &argt, SCC_VOLUME)); + args[0] = _units[_settings_game.locale.units].c_volume.ToDisplay(GetInt64(&argv, argve, &argt, SCC_VOLUME)); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].l_volume), args, endof(args), modifier >> 24, last); modifier = 0; break; @@ -917,7 +917,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case SCC_POWER: { // {POWER} int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = _units[_settings_game.locale.units].c_power.ToDisplay(GetInt32(&argv, argve, &argt)); + args[0] = _units[_settings_game.locale.units].c_power.ToDisplay(GetInt64(&argv, argve, &argt)); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].power), args, endof(args), modifier >> 24, last); modifier = 0; break; @@ -926,7 +926,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case SCC_VOLUME_SHORT: { // {VOLUME_S} int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = _units[_settings_game.locale.units].c_volume.ToDisplay(GetInt32(&argv, argve, &argt)); + args[0] = _units[_settings_game.locale.units].c_volume.ToDisplay(GetInt64(&argv, argve, &argt)); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].s_volume), args, endof(args), modifier >> 24, last); modifier = 0; break; @@ -935,7 +935,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case SCC_WEIGHT: { // {WEIGHT} int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = _units[_settings_game.locale.units].c_weight.ToDisplay(GetInt32(&argv, argve, &argt, SCC_WEIGHT)); + args[0] = _units[_settings_game.locale.units].c_weight.ToDisplay(GetInt64(&argv, argve, &argt, SCC_WEIGHT)); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].l_weight), args, endof(args), modifier >> 24, last); modifier = 0; break; @@ -944,7 +944,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case SCC_WEIGHT_SHORT: { // {WEIGHT_S} int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = _units[_settings_game.locale.units].c_weight.ToDisplay(GetInt32(&argv, argve, &argt)); + args[0] = _units[_settings_game.locale.units].c_weight.ToDisplay(GetInt64(&argv, argve, &argt)); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].s_weight), args, endof(args), modifier >> 24, last); modifier = 0; break; @@ -953,7 +953,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in case SCC_FORCE: { // {FORCE} int64 args[1]; assert(_settings_game.locale.units < lengthof(_units)); - args[0] = _units[_settings_game.locale.units].c_force.ToDisplay(GetInt32(&argv, argve, &argt)); + args[0] = _units[_settings_game.locale.units].c_force.ToDisplay(GetInt64(&argv, argve, &argt)); buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].force), args, endof(args), modifier >> 24, last); modifier = 0; break; |