31 |
31 |
32 HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, HOUSE_MAX, INVALID_HOUSE_ID); |
32 HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, HOUSE_MAX, INVALID_HOUSE_ID); |
33 |
33 |
34 void CheckHouseIDs() |
34 void CheckHouseIDs() |
35 { |
35 { |
|
36 InitializeBuildingCounts(); |
|
37 |
36 for (TileIndex t = 0; t < MapSize(); t++) { |
38 for (TileIndex t = 0; t < MapSize(); t++) { |
37 HouseID house_id; |
39 HouseID house_id; |
38 |
40 |
39 if (!IsTileType(t, MP_HOUSE)) continue; |
41 if (!IsTileType(t, MP_HOUSE)) continue; |
40 |
42 |
41 house_id = GetHouseType(t); |
43 house_id = GetHouseType(t); |
42 if (!GetHouseSpecs(house_id)->enabled && house_id >= NEW_HOUSE_OFFSET) { |
44 if (!GetHouseSpecs(house_id)->enabled && house_id >= NEW_HOUSE_OFFSET) { |
43 /* The specs for this type of house are not available any more, so |
45 /* The specs for this type of house are not available any more, so |
44 * replace it with the substitute original house type. */ |
46 * replace it with the substitute original house type. */ |
45 SetHouseType(t, _house_mngr.GetSubstituteID(house_id)); |
47 house_id = _house_mngr.GetSubstituteID(house_id); |
46 } |
48 SetHouseType(t, house_id); |
47 } |
49 } |
48 |
50 IncreaseBuildingCount(GetTownByTile(t), house_id); |
49 InitializeBuildingCounts(); |
51 } |
50 AfterLoadCountBuildings(); |
|
51 |
|
52 } |
52 } |
53 |
53 |
54 HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid) |
54 HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid) |
55 { |
55 { |
56 /* Start from 1 because 0 means that no class has been assigned. */ |
56 /* Start from 1 because 0 means that no class has been assigned. */ |