Codechange: rename CargoID to CargoType and amend related variables/comments
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptCargo::IsValidCargo(CargoID cargo_type)
|
||||
/* static */ bool ScriptCargo::IsValidCargo(CargoType cargo_type)
|
||||
{
|
||||
return (cargo_type < NUM_CARGO && ::CargoSpec::Get(cargo_type)->IsValid());
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
return (towneffect_type >= (TownEffect)TAE_BEGIN && towneffect_type < (TownEffect)TAE_END);
|
||||
}
|
||||
|
||||
/* static */ std::optional<std::string> ScriptCargo::GetName(CargoID cargo_type)
|
||||
/* static */ std::optional<std::string> ScriptCargo::GetName(CargoType cargo_type)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return std::nullopt;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
return GetString(STR_JUST_CARGO_LIST);
|
||||
}
|
||||
|
||||
/* static */ std::optional<std::string> ScriptCargo::GetCargoLabel(CargoID cargo_type)
|
||||
/* static */ std::optional<std::string> ScriptCargo::GetCargoLabel(CargoType cargo_type)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return std::nullopt;
|
||||
const CargoSpec *cargo = ::CargoSpec::Get(cargo_type);
|
||||
@@ -50,27 +50,27 @@
|
||||
return cargo_label;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCargo::IsFreight(CargoID cargo_type)
|
||||
/* static */ bool ScriptCargo::IsFreight(CargoType cargo_type)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return false;
|
||||
const CargoSpec *cargo = ::CargoSpec::Get(cargo_type);
|
||||
return cargo->is_freight;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCargo::HasCargoClass(CargoID cargo_type, CargoClass cargo_class)
|
||||
/* static */ bool ScriptCargo::HasCargoClass(CargoType cargo_type, CargoClass cargo_class)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return false;
|
||||
return ::IsCargoInClass(cargo_type, (::CargoClass)cargo_class);
|
||||
}
|
||||
|
||||
/* static */ ScriptCargo::TownEffect ScriptCargo::GetTownEffect(CargoID cargo_type)
|
||||
/* static */ ScriptCargo::TownEffect ScriptCargo::GetTownEffect(CargoType cargo_type)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return TE_NONE;
|
||||
|
||||
return (ScriptCargo::TownEffect)::CargoSpec::Get(cargo_type)->town_acceptance_effect;
|
||||
}
|
||||
|
||||
/* static */ Money ScriptCargo::GetCargoIncome(CargoID cargo_type, SQInteger distance, SQInteger days_in_transit)
|
||||
/* static */ Money ScriptCargo::GetCargoIncome(CargoType cargo_type, SQInteger distance, SQInteger days_in_transit)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return -1;
|
||||
|
||||
@@ -79,13 +79,13 @@
|
||||
return ::GetTransportedGoodsIncome(1, distance, Clamp(days_in_transit * 2 / 5, 0, UINT16_MAX), cargo_type);
|
||||
}
|
||||
|
||||
/* static */ ScriptCargo::DistributionType ScriptCargo::GetDistributionType(CargoID cargo_type)
|
||||
/* static */ ScriptCargo::DistributionType ScriptCargo::GetDistributionType(CargoType cargo_type)
|
||||
{
|
||||
if (!ScriptCargo::IsValidCargo(cargo_type)) return INVALID_DISTRIBUTION_TYPE;
|
||||
return (ScriptCargo::DistributionType)_settings_game.linkgraph.GetDistributionType(cargo_type);
|
||||
}
|
||||
|
||||
/* static */ SQInteger ScriptCargo::GetWeight(CargoID cargo_type, SQInteger amount)
|
||||
/* static */ SQInteger ScriptCargo::GetWeight(CargoType cargo_type, SQInteger amount)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user