(svn r16849) -Codechange: replace GetCargo() by CargoSpec::Get()

This commit is contained in:
smatz
2009-07-16 19:00:13 +00:00
parent b6889daf8d
commit 1f29e38b83
28 changed files with 99 additions and 90 deletions

View File

@@ -11,13 +11,13 @@
/* static */ bool AICargo::IsValidCargo(CargoID cargo_type)
{
return (cargo_type < NUM_CARGO && ::GetCargo(cargo_type)->IsValid());
return (cargo_type < NUM_CARGO && ::CargoSpec::Get(cargo_type)->IsValid());
}
/* static */ char *AICargo::GetCargoLabel(CargoID cargo_type)
{
if (!IsValidCargo(cargo_type)) return NULL;
const CargoSpec *cargo = ::GetCargo(cargo_type);
const CargoSpec *cargo = ::CargoSpec::Get(cargo_type);
/* cargo->label is a uint32 packing a 4 character non-terminated string,
* like "PASS", "COAL", "OIL_". New ones can be defined by NewGRFs */
@@ -32,7 +32,7 @@
/* static */ bool AICargo::IsFreight(CargoID cargo_type)
{
if (!IsValidCargo(cargo_type)) return false;
const CargoSpec *cargo = ::GetCargo(cargo_type);
const CargoSpec *cargo = ::CargoSpec::Get(cargo_type);
return cargo->is_freight;
}
@@ -46,7 +46,7 @@
{
if (!IsValidCargo(cargo_type)) return TE_NONE;
return (AICargo::TownEffect)GetCargo(cargo_type)->town_effect;
return (AICargo::TownEffect)CargoSpec::Get(cargo_type)->town_effect;
}
/* static */ Money AICargo::GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit)

View File

@@ -11,7 +11,7 @@
AICargoList::AICargoList()
{
for (byte i = 0; i < NUM_CARGO; i++) {
const CargoSpec *c = ::GetCargo(i);
const CargoSpec *c = ::CargoSpec::Get(i);
if (c->IsValid()) {
this->AddItem(i);
}

View File

@@ -57,8 +57,8 @@
{
if (!IsValidSubsidy(subsidy_id) || IsAwarded(subsidy_id)) return false;
return GetCargo(GetCargoType(subsidy_id))->town_effect == TE_PASSENGERS ||
GetCargo(GetCargoType(subsidy_id))->town_effect == TE_MAIL;
return CargoSpec::Get(GetCargoType(subsidy_id))->town_effect == TE_PASSENGERS ||
CargoSpec::Get(GetCargoType(subsidy_id))->town_effect == TE_MAIL;
}
/* static */ int32 AISubsidy::GetSource(SubsidyID subsidy_id)
@@ -72,7 +72,7 @@
{
if (!IsValidSubsidy(subsidy_id) || IsAwarded(subsidy_id)) return false;
switch (GetCargo(GetCargoType(subsidy_id))->town_effect) {
switch (CargoSpec::Get(GetCargoType(subsidy_id))->town_effect) {
case TE_PASSENGERS:
case TE_MAIL:
case TE_GOODS: