Reset layout error counters after town construction
This commit is contained in:
@@ -22,6 +22,10 @@ namespace event {
|
||||
|
||||
struct NewMonth {};
|
||||
|
||||
struct TownBiilt {
|
||||
Town *town;
|
||||
};
|
||||
|
||||
struct TownGrowthSucceeded {
|
||||
Town *town;
|
||||
TileIndex tile;
|
||||
|
||||
@@ -27,6 +27,11 @@ Game::Game() {
|
||||
this->towns_growth_tiles_last_month = this->towns_growth_tiles;
|
||||
this->towns_growth_tiles.clear();
|
||||
});
|
||||
this->events.listen<event::TownBuilt>(event::Slot::GAME, [this] (const event::TownBuilt &event) {
|
||||
t->cm.hs_total = t->cm.hs_last_month = t->cm.hs_total_prev = 0;
|
||||
t->cm.cs_total = t->cm.cs_last_month = t->cm.cs_total_prev = 0;
|
||||
t->cm.hr_total = t->cm.hr_last_month = t->cm.hr_total_prev = 0;
|
||||
});
|
||||
|
||||
this->events.listen<event::TownGrowthSucceeded>(event::Slot::GAME, [this] (const event::TownGrowthSucceeded &event) {
|
||||
if (event.town->cache.num_houses <= event.prev_houses) {
|
||||
|
||||
@@ -1763,6 +1763,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize
|
||||
UpdateTownGrowthRate(t);
|
||||
UpdateTownMaxPass(t);
|
||||
UpdateAirportsNoise();
|
||||
citymania::Emit(citymania::event::TownBuilt{t});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user