Codechange: Use SQInteger for generic numbers in script_cargo
This commit is contained in:
@@ -70,9 +70,12 @@
|
||||
return (ScriptCargo::TownEffect)::CargoSpec::Get(cargo_type)->town_effect;
|
||||
}
|
||||
|
||||
/* static */ Money ScriptCargo::GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit)
|
||||
/* static */ Money ScriptCargo::GetCargoIncome(CargoID cargo_type, SQInteger distance, SQInteger days_in_transit)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return -1;
|
||||
|
||||
distance = Clamp<SQInteger>(distance, 0, UINT32_MAX);
|
||||
|
||||
return ::GetTransportedGoodsIncome(1, distance, Clamp(days_in_transit * 2 / 5, 0, 255), cargo_type);
|
||||
}
|
||||
|
||||
@@ -82,8 +85,11 @@
|
||||
return (ScriptCargo::DistributionType)_settings_game.linkgraph.GetDistributionType(cargo_type);
|
||||
}
|
||||
|
||||
/* static */ int64 ScriptCargo::GetWeight(CargoID cargo_type, uint32 amount)
|
||||
/* static */ SQInteger ScriptCargo::GetWeight(CargoID cargo_type, SQInteger amount)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return -1;
|
||||
|
||||
amount = Clamp<SQInteger>(amount, 0, UINT32_MAX);
|
||||
|
||||
return ::CargoSpec::Get(cargo_type)->WeightOfNUnits(amount);
|
||||
}
|
||||
|
Reference in New Issue
Block a user