mirror of https://github.com/OpenTTD/OpenTTD
(svn r22037) -Codechange: remove some unneeded (hidden) casting
parent
f4f5de5be1
commit
e76465bab9
|
@ -553,7 +553,7 @@ struct UnitConversion {
|
||||||
* @param input The input to convert.
|
* @param input The input to convert.
|
||||||
* @return The converted value.
|
* @return The converted value.
|
||||||
*/
|
*/
|
||||||
int ToDisplay(int input) const
|
int64 ToDisplay(int64 input) const
|
||||||
{
|
{
|
||||||
return (input * this->multiplier) >> this->shift;
|
return (input * this->multiplier) >> this->shift;
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ struct UnitConversion {
|
||||||
* @param input The input to convert.
|
* @param input The input to convert.
|
||||||
* @return The converted value.
|
* @return The converted value.
|
||||||
*/
|
*/
|
||||||
int FromDisplay(int input) const
|
int64 FromDisplay(int64 input) const
|
||||||
{
|
{
|
||||||
return ((input << this->shift) + this->multiplier / 2) / this->multiplier;
|
return ((input << this->shift) + this->multiplier / 2) / this->multiplier;
|
||||||
}
|
}
|
||||||
|
@ -573,7 +573,7 @@ struct Units {
|
||||||
UnitConversion c_velocity; ///< Conversion for velocity
|
UnitConversion c_velocity; ///< Conversion for velocity
|
||||||
StringID velocity; ///< String for velocity
|
StringID velocity; ///< String for velocity
|
||||||
UnitConversion c_power; ///< Conversion for power
|
UnitConversion c_power; ///< Conversion for power
|
||||||
StringID power; ///< String for velocity
|
StringID power; ///< String for power
|
||||||
UnitConversion c_weight; ///< Conversion for weight
|
UnitConversion c_weight; ///< Conversion for weight
|
||||||
StringID s_weight; ///< Short string for weight
|
StringID s_weight; ///< Short string for weight
|
||||||
StringID l_weight; ///< Long 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}
|
case SCC_VELOCITY: { // {VELOCITY}
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].velocity), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SCC_HEIGHT: { // {HEIGHT}
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].height), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -764,7 +764,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
|
||||||
case STR_TONS: {
|
case STR_TONS: {
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].l_weight), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -773,7 +773,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
|
||||||
case STR_LITERS: {
|
case STR_LITERS: {
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].l_volume), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -859,7 +859,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
|
||||||
case SCC_VOLUME: { // {VOLUME}
|
case SCC_VOLUME: { // {VOLUME}
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].l_volume), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -917,7 +917,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
|
||||||
case SCC_POWER: { // {POWER}
|
case SCC_POWER: { // {POWER}
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].power), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -926,7 +926,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
|
||||||
case SCC_VOLUME_SHORT: { // {VOLUME_S}
|
case SCC_VOLUME_SHORT: { // {VOLUME_S}
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].s_volume), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -935,7 +935,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
|
||||||
case SCC_WEIGHT: { // {WEIGHT}
|
case SCC_WEIGHT: { // {WEIGHT}
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].l_weight), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -944,7 +944,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
|
||||||
case SCC_WEIGHT_SHORT: { // {WEIGHT_S}
|
case SCC_WEIGHT_SHORT: { // {WEIGHT_S}
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].s_weight), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -953,7 +953,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
|
||||||
case SCC_FORCE: { // {FORCE}
|
case SCC_FORCE: { // {FORCE}
|
||||||
int64 args[1];
|
int64 args[1];
|
||||||
assert(_settings_game.locale.units < lengthof(_units));
|
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);
|
buff = FormatString(buff, GetStringPtr(_units[_settings_game.locale.units].force), args, endof(args), modifier >> 24, last);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue