summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-07-16 20:40:06 +0000
committersmatz <smatz@openttd.org>2009-07-16 20:40:06 +0000
commit77d13eae6194387ca6ce2b0eb835b7f97f67d085 (patch)
treea15b28b9384b9590cf11866a877097709db4d89d /src/ai/api
parent665fa7f9c170774f6a640ecf381f714b50b6b174 (diff)
downloadopenttd-77d13eae6194387ca6ce2b0eb835b7f97f67d085.tar.xz
(svn r16852) -Codechange: use FOR_ALL_CARGOSPECS for iterating over all valid CargoSpecs
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_cargo.cpp2
-rw-r--r--src/ai/api/ai_cargolist.cpp8
2 files changed, 4 insertions, 6 deletions
diff --git a/src/ai/api/ai_cargo.cpp b/src/ai/api/ai_cargo.cpp
index 4b1593d26..cf9868e2f 100644
--- a/src/ai/api/ai_cargo.cpp
+++ b/src/ai/api/ai_cargo.cpp
@@ -46,7 +46,7 @@
{
if (!IsValidCargo(cargo_type)) return TE_NONE;
- return (AICargo::TownEffect)CargoSpec::Get(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)
diff --git a/src/ai/api/ai_cargolist.cpp b/src/ai/api/ai_cargolist.cpp
index ebf664dee..b5b04c3ea 100644
--- a/src/ai/api/ai_cargolist.cpp
+++ b/src/ai/api/ai_cargolist.cpp
@@ -10,11 +10,9 @@
AICargoList::AICargoList()
{
- for (byte i = 0; i < NUM_CARGO; i++) {
- const CargoSpec *c = ::CargoSpec::Get(i);
- if (c->IsValid()) {
- this->AddItem(i);
- }
+ const CargoSpec *cs;
+ FOR_ALL_CARGOSPECS(cs) {
+ this->AddItem(cs->Index());
}
}