src/newgrf_house.cpp
branchnoai
changeset 9701 d1ac22c62f64
parent 9694 e72987579514
child 9703 d2a6acdbd665
--- a/src/newgrf_house.cpp	Sun Aug 19 14:04:13 2007 +0000
+++ b/src/newgrf_house.cpp	Sun Sep 02 11:17:33 2007 +0000
@@ -33,6 +33,8 @@
 
 void CheckHouseIDs()
 {
+	InitializeBuildingCounts();
+
 	for (TileIndex t = 0; t < MapSize(); t++) {
 		HouseID house_id;
 
@@ -42,13 +44,11 @@
 		if (!GetHouseSpecs(house_id)->enabled && house_id >= NEW_HOUSE_OFFSET) {
 			/* The specs for this type of house are not available any more, so
 			 * replace it with the substitute original house type. */
-			SetHouseType(t, _house_mngr.GetSubstituteID(house_id));
+			house_id = _house_mngr.GetSubstituteID(house_id);
+			SetHouseType(t, house_id);
 		}
+		IncreaseBuildingCount(GetTownByTile(t), house_id);
 	}
-
-	InitializeBuildingCounts();
-	AfterLoadCountBuildings();
-
 }
 
 HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid)