diff options
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r-- | src/town_cmd.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index a2411f7ce..19cc2ec05 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -404,7 +404,7 @@ static void MakeSingleHouseBigger(TileIndex tile) /* Now that construction is complete, we can add the population of the * building to the town. */ ChangePopulation(GetTownByTile(tile), hs->population); - SetHouseConstructionYear(tile, _cur_year); + ResetHouseAge(tile); } MarkTileDirtyByTile(tile); } @@ -505,7 +505,7 @@ static void TileLoop_Town(TileIndex tile) if (hs->building_flags & BUILDING_HAS_1_TILE && HasBit(t->flags12, TOWN_IS_FUNDED) && CanDeleteHouse(tile) && - max(_cur_year - GetHouseConstructionYear(tile), 0) >= hs->minimum_life && + GetHouseAge(tile) >= hs->minimum_life && --t->time_until_rebuild == 0) { t->time_until_rebuild = GB(r, 16, 8) + 192; @@ -2608,6 +2608,15 @@ void TownsMonthlyLoop() } } +void TownsYearlyLoop() +{ + /* Increment house ages */ + for (TileIndex t = 0; t < MapSize(); t++) { + if (!IsTileType(t, MP_HOUSE)) continue; + IncrementHouseAge(t); + } +} + void InitializeTowns() { /* Clean the town pool and create 1 block in it */ |