summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-18 12:32:50 +0000
committeryexo <yexo@openttd.org>2010-01-18 12:32:50 +0000
commitab68f08886743fd32ac52bdc666cbf2da9b53287 (patch)
tree59d999df01a07669be733777d5161b2ca30f2abf /src/station_cmd.cpp
parent84bc831e324071b252202e6bac472fe95686d462 (diff)
downloadopenttd-ab68f08886743fd32ac52bdc666cbf2da9b53287.tar.xz
(svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 2ed623ea6..1e24a70fc 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2066,7 +2066,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
int w = as->size_x;
int h = as->size_y;
- CommandCost cost(EXPENSES_CONSTRUCTION, w * h * _price[PR_CLEAR_STATION_AIRPORT]);
+ CommandCost cost(EXPENSES_CONSTRUCTION);
const Aircraft *a;
FOR_ALL_AIRCRAFT(a) {
@@ -2077,6 +2077,10 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
TILE_LOOP(tile_cur, w, h, tile) {
if (!EnsureNoVehicleOnGround(tile_cur)) return CMD_ERROR;
+ if (!st->TileBelongsToAirport(tile_cur)) continue;
+
+ cost.AddCost(_price[PR_CLEAR_STATION_AIRPORT]);
+
if (flags & DC_EXEC) {
DeleteAnimatedTile(tile_cur);
DoClearSquare(tile_cur);