MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / PostDestructor

Method PostDestructor

src/town_cmd.cpp:174–183  ·  view source on GitHub ↗

* Invalidating of the "nearest town cache" has to be done * after removing item from the pool. */

Source from the content-addressed store, hash-verified

172 * after removing item from the pool.
173 */
174void Town::PostDestructor(size_t)
175{
176 InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_FORCE_REBUILD);
177 UpdateNearestTownForRoadTiles(false);
178
179 /* Give objects a new home! */
180 for (Object *o : Object::Iterate()) {
181 if (o->town == nullptr) o->town = CalcClosestTownFromTile(o->location.tile, UINT_MAX);
182 }
183}
184
185/**
186 * Assign the town layout.

Callers

nothing calls this directly

Calls 3

CalcClosestTownFromTileFunction · 0.85
InvalidateWindowDataFunction · 0.70

Tested by

no test coverage detected