Changeset - r19279:d7fabdafbecb
[Not reviewed]
master
0 1 0
frosch - 12 years ago 2012-04-26 21:03:34
frosch@openttd.org
(svn r24182) -Fix [FS#5169-ish]: The population of a town was computed incorrectly for overridden houses when loading a game.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/saveload/town_sl.cpp
Show inline comments
 
@@ -26,25 +26,25 @@ void RebuildTownCaches()
 
	Town *town;
 
	InitializeBuildingCounts();
 

	
 
	/* Reset town population and num_houses */
 
	FOR_ALL_TOWNS(town) {
 
		town->cache.population = 0;
 
		town->cache.num_houses = 0;
 
	}
 

	
 
	for (TileIndex t = 0; t < MapSize(); t++) {
 
		if (!IsTileType(t, MP_HOUSE)) continue;
 

	
 
		HouseID house_id = GetCleanHouseType(t);
 
		HouseID house_id = GetHouseType(t);
 
		town = Town::GetByTile(t);
 
		IncreaseBuildingCount(town, house_id);
 
		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->cache.num_houses++;
 
	}
 

	
 
	/* Update the population and num_house dependant values */
 
	FOR_ALL_TOWNS(town) {
 
		UpdateTownRadius(town);
 
		UpdateTownCargoes(town);
0 comments (0 inline, 0 general)