summaryrefslogtreecommitdiff
path: root/src/subsidy.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-04-25 20:50:13 +0000
committerrubidium <rubidium@openttd.org>2012-04-25 20:50:13 +0000
commit41e5c839e08bfc811b1e8d7272996567776b788f (patch)
treeeb8a74437dd42a7a57e157c6218e96b9df7fbd87 /src/subsidy.cpp
parentcd50c862944098753c959cc272d62a2ddc212ca8 (diff)
downloadopenttd-41e5c839e08bfc811b1e8d7272996567776b788f.tar.xz
(svn r24179) -Codechange: move some variables of Town to TownCache
Diffstat (limited to 'src/subsidy.cpp')
-rw-r--r--src/subsidy.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/subsidy.cpp b/src/subsidy.cpp
index d4a102f46..d6ad2666d 100644
--- a/src/subsidy.cpp
+++ b/src/subsidy.cpp
@@ -121,7 +121,7 @@ static inline void SetPartOfSubsidyFlag(SourceType type, SourceID index, PartOfS
{
switch (type) {
case ST_INDUSTRY: Industry::Get(index)->part_of_subsidy |= flag; return;
- case ST_TOWN: Town::Get(index)->part_of_subsidy |= flag; return;
+ case ST_TOWN: Town::Get(index)->cache.part_of_subsidy |= flag; return;
default: NOT_REACHED();
}
}
@@ -130,7 +130,7 @@ static inline void SetPartOfSubsidyFlag(SourceType type, SourceID index, PartOfS
void RebuildSubsidisedSourceAndDestinationCache()
{
Town *t;
- FOR_ALL_TOWNS(t) t->part_of_subsidy = POS_NONE;
+ FOR_ALL_TOWNS(t) t->cache.part_of_subsidy = POS_NONE;
Industry *i;
FOR_ALL_INDUSTRIES(i) i->part_of_subsidy = POS_NONE;
@@ -297,13 +297,13 @@ bool FindSubsidyPassengerRoute()
if (!Subsidy::CanAllocateItem()) return false;
const Town *src = Town::GetRandom();
- if (src->population < SUBSIDY_PAX_MIN_POPULATION ||
+ if (src->cache.population < SUBSIDY_PAX_MIN_POPULATION ||
src->GetPercentTransported(CT_PASSENGERS) > SUBSIDY_MAX_PCT_TRANSPORTED) {
return false;
}
const Town *dst = Town::GetRandom();
- if (dst->population < SUBSIDY_PAX_MIN_POPULATION || src == dst) {
+ if (dst->cache.population < SUBSIDY_PAX_MIN_POPULATION || src == dst) {
return false;
}
@@ -534,7 +534,7 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type,
if (!(Industry::Get(src)->part_of_subsidy & POS_SRC)) return false;
break;
case ST_TOWN:
- if (!( Town::Get(src)->part_of_subsidy & POS_SRC)) return false;
+ if (!(Town::Get(src)->cache.part_of_subsidy & POS_SRC)) return false;
break;
default: return false;
}
@@ -557,7 +557,7 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type,
TileIndex tile = TileXY(x, y);
if (!IsTileType(tile, MP_HOUSE)) continue;
const Town *t = Town::GetByTile(tile);
- if (t->part_of_subsidy & POS_DST) towns_near.Include(t);
+ if (t->cache.part_of_subsidy & POS_DST) towns_near.Include(t);
}
}
break;
@@ -584,7 +584,7 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type,
case ST_TOWN:
for (const Town * const *tp = towns_near.Begin(); tp != towns_near.End(); tp++) {
if (s->dst == (*tp)->index) {
- assert((*tp)->part_of_subsidy & POS_DST);
+ assert((*tp)->cache.part_of_subsidy & POS_DST);
subsidised = true;
if (!s->IsAwarded()) s->AwardTo(company);
}