Add wrappers to get and update the current effective day length factor

This commit is contained in:
Jonathan G Rennison
2024-02-09 19:39:58 +00:00
parent db8b77a72e
commit 516e8defb5
20 changed files with 66 additions and 42 deletions

View File

@@ -2731,13 +2731,13 @@ void UpdateCargoScalers()
{
uint town_scale = _settings_game.economy.town_cargo_scale;
if (_settings_game.economy.town_cargo_scale_mode == CSM_DAYLENGTH) {
town_scale = Clamp<uint>(town_scale * _settings_game.economy.day_length_factor, 1, 5000);
town_scale = Clamp<uint>(town_scale * DayLengthFactor(), 1, 5000);
}
_town_cargo_scaler.SetScale((town_scale << 16) / 100);
uint industry_scale = _settings_game.economy.industry_cargo_scale;
if (_settings_game.economy.industry_cargo_scale_mode == CSM_DAYLENGTH) {
industry_scale = Clamp<uint>(industry_scale * _settings_game.economy.day_length_factor, 5, 3000);
industry_scale = Clamp<uint>(industry_scale * DayLengthFactor(), 5, 3000);
}
_industry_cargo_scaler.SetScale((industry_scale << 16) / 100);
_industry_inverse_cargo_scaler.SetScale((100 << 16) / std::max<uint>(1, industry_scale));