diff --git a/src/station.cpp b/src/station.cpp index b416879499..60a8ebcf57 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -428,10 +428,10 @@ bool Station::CatchmentCoversTown(TownID t) const * Recompute tiles covered in our catchment area. * This will additionally recompute nearby towns and industries. */ -void Station::RecomputeCatchment() +void Station::RecomputeCatchment(bool no_clear_nearby_lists) { this->industries_near.clear(); - this->RemoveFromAllNearbyLists(); + if (!no_clear_nearby_lists) this->RemoveFromAllNearbyLists(); if (this->rect.IsEmpty()) { this->catchment_tiles.Reset(); @@ -498,8 +498,12 @@ void Station::RecomputeCatchment() */ /* static */ void Station::RecomputeCatchmentForAll() { + Town *t; + FOR_ALL_TOWNS(t) { t->stations_near.clear(); } + Industry *i; + FOR_ALL_INDUSTRIES(i) { i->stations_near.clear(); } Station *st; - FOR_ALL_STATIONS(st) { st->RecomputeCatchment(); } + FOR_ALL_STATIONS(st) { st->RecomputeCatchment(true); } } /************************************************************************/ diff --git a/src/station_base.h b/src/station_base.h index e75b051cc0..26fe5c03b1 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -504,7 +504,7 @@ public: uint GetPlatformLength(TileIndex tile, DiagDirection dir) const override; uint GetPlatformLength(TileIndex tile) const override; - void RecomputeCatchment(); + void RecomputeCatchment(bool no_clear_nearby_lists = false); static void RecomputeCatchmentForAll(); uint GetCatchmentRadius() const;