(svn r24179) -Codechange: move some variables of Town to TownCache

This commit is contained in:
rubidium
2012-04-25 20:50:13 +00:00
parent cd50c86294
commit 41e5c839e0
13 changed files with 108 additions and 102 deletions

View File

@@ -32,8 +32,8 @@ void UpdateHousesAndTowns()
/* Reset town population and num_houses */
FOR_ALL_TOWNS(town) {
town->population = 0;
town->num_houses = 0;
town->cache.population = 0;
town->cache.num_houses = 0;
}
for (TileIndex t = 0; t < MapSize(); t++) {
@@ -88,10 +88,10 @@ void UpdateHousesAndTowns()
HouseID house_id = GetCleanHouseType(t);
town = Town::GetByTile(t);
IncreaseBuildingCount(town, house_id);
if (IsHouseCompleted(t)) town->population += HouseSpec::Get(house_id)->population;
if (IsHouseCompleted(t)) town->cache.population += HouseSpec::Get(house_id)->population;
/* Increase the number of houses for every house, but only once. */
if (GetHouseNorthPart(house_id) == 0) town->num_houses++;
if (GetHouseNorthPart(house_id) == 0) town->cache.num_houses++;
}
/* Update the population and num_house dependant values */