* Invalidating of the "nearest town cache" has to be done * after removing item from the pool. */
| 172 | * after removing item from the pool. |
| 173 | */ |
| 174 | void 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. |
nothing calls this directly
no test coverage detected