diff options
author | yexo <yexo@openttd.org> | 2010-03-05 19:19:29 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-03-05 19:19:29 +0000 |
commit | 0bfd06245b57aa1276cc321fc8d841fd655f7b79 (patch) | |
tree | 3fc786ac61e3909a9c66eaab166c47dbc0ff7d0a | |
parent | c4cf153c52f517db1fe0f34bf14a5d017078ef1e (diff) | |
download | openttd-0bfd06245b57aa1276cc321fc8d841fd655f7b79.tar.xz |
(svn r19318) -Fix [FS#3661](r19198): crash when building an airport at a station where a plane was headed
-rw-r--r-- | src/station_cmd.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index e2e62b91b..51072e4c9 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2162,15 +2162,6 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint st->rect.BeforeAddRect(tile, w, h, StationRect::ADD_TRY); - /* if airport was demolished while planes were en-route to it, the - * positions can no longer be the same (v->u.air.pos), since different - * airports have different indexes. So update all planes en-route to this - * airport. Only update if - * 1. airport is upgraded - * 2. airport is added to existing station (unfortunately unavoideable) - */ - if (airport_upgrade) UpdateAirplanesOnNewStation(st); - const AirportTileTable *it = as->table[0]; do { TileIndex cur_tile = tile + ToTileIndexDiff(it->ti); @@ -2188,6 +2179,15 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint AirportTileAnimationTrigger(st, cur_tile, AAT_BUILT); } while ((++it)->ti.x != -0x80); + /* if airport was demolished while planes were en-route to it, the + * positions can no longer be the same (v->u.air.pos), since different + * airports have different indexes. So update all planes en-route to this + * airport. Only update if + * 1. airport is upgraded + * 2. airport is added to existing station (unfortunately unavoideable) + */ + if (airport_upgrade) UpdateAirplanesOnNewStation(st); + st->UpdateVirtCoord(); UpdateStationAcceptance(st, false); st->RecomputeIndustriesNear(); |