Fix various narrowing cast warnings

pull/642/head
Jonathan G Rennison 3 months ago
parent 5f7034f23c
commit f1073d20e9

@ -365,7 +365,7 @@ public:
*/
inline uint Monthly(uint base) const
{
return (static_cast<uint64_t>(base) * 30 * DAY_TICKS * _settings_game.economy.day_length_factor) / std::max<uint64_t>((_scaled_date_ticks - this->last_compression).base(), DAY_TICKS);
return (uint)((static_cast<uint64_t>(base) * 30 * DAY_TICKS * _settings_game.economy.day_length_factor) / std::max<uint64_t>((_scaled_date_ticks - this->last_compression).base(), DAY_TICKS));
}
NodeID AddNode(const Station *st);

@ -224,7 +224,7 @@ void GRFParameterInfo::SetValue(struct GRFConfig *config, uint32_t value)
} else {
SB(config->param[this->param_nr], this->first_bit, this->num_bit, value);
}
config->num_params = std::max<uint>(config->num_params, this->param_nr + 1);
config->num_params = (uint8_t)std::max<uint>(config->num_params, this->param_nr + 1);
SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
}

@ -1281,8 +1281,8 @@ CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta)
/* determine new size of train station region.. */
int x = std::min(TileX(cur_ta.tile), TileX(new_ta.tile));
int y = std::min(TileY(cur_ta.tile), TileY(new_ta.tile));
new_ta.w = std::max(TileX(cur_ta.tile) + cur_ta.w, TileX(new_ta.tile) + new_ta.w) - x;
new_ta.h = std::max(TileY(cur_ta.tile) + cur_ta.h, TileY(new_ta.tile) + new_ta.h) - y;
new_ta.w = (uint16_t)std::max(TileX(cur_ta.tile) + cur_ta.w, TileX(new_ta.tile) + new_ta.w) - x;
new_ta.h = (uint16_t)std::max(TileY(cur_ta.tile) + cur_ta.h, TileY(new_ta.tile) + new_ta.h) - y;
new_ta.tile = TileXY(x, y);
/* make sure the final size is not too big. */

Loading…
Cancel
Save