diff options
author | smatz <smatz@openttd.org> | 2009-07-05 13:21:51 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-07-05 13:21:51 +0000 |
commit | 59f94619c75be0ff4dc5f6edf8e0b365261dc9d6 (patch) | |
tree | ff8099d504f93a338e423ed5c3a36ebf2a4650c6 /src/town_cmd.cpp | |
parent | c861d9b64b2a63fa86ea87ac1e71f8f7341c694b (diff) | |
download | openttd-59f94619c75be0ff4dc5f6edf8e0b365261dc9d6.tar.xz |
(svn r16746) -Codechange: use Town::PostDestructor() instead of not very clean construct for invalidating nearest town for road tiles
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r-- | src/town_cmd.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 734214fa8..aaebfabaf 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -102,8 +102,17 @@ Town::~Town() DeleteSubsidyWithTown(this->index); MarkWholeScreenDirty(); +} + - UpdateNearestTownForRoadTiles(false, this); +/** + * Invalidating of the "nearest town cache" has to be done + * after removing item from the pool. + * @param index index of deleted item + */ +void Town::PostDestructor(size_t index) +{ + UpdateNearestTownForRoadTiles(false); } /** @@ -2694,14 +2703,13 @@ bool CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags) } -Town *CalcClosestTownFromTile(TileIndex tile, uint threshold, const Town *ignore) +Town *CalcClosestTownFromTile(TileIndex tile, uint threshold) { Town *t; uint best = threshold; Town *best_town = NULL; FOR_ALL_TOWNS(t) { - if (t == ignore) continue; uint dist = DistanceManhattan(tile, t->xy); if (dist < best) { best = dist; |