summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-20 13:57:49 +0000
committerrubidium <rubidium@openttd.org>2010-11-20 13:57:49 +0000
commit3f1de4926e8d093845e533c190391b97b6331658 (patch)
treea2ee9c91ada38cc566e307f019f715d1b64204b2 /src/station_cmd.cpp
parent9d899b3758ee007fdd66b383cf5866133dfa5135 (diff)
downloadopenttd-3f1de4926e8d093845e533c190391b97b6331658.tar.xz
(svn r21268) -Fix (r21266): crash (or rather a triggered assertion) in some cases
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 19c414b73..39d22384b 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1413,6 +1413,12 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
quantity++;
+ if (keep_rail || IsStationTileBlocked(tile)) {
+ /* Don't refund the 'steel' of the track when we keep the
+ * rail, or when the tile didn't have any rail at all. */
+ total_cost.AddCost(-_price[PR_CLEAR_RAIL]);
+ }
+
if (flags & DC_EXEC) {
/* read variables before the station tile is removed */
uint specindex = GetCustomStationSpecIndex(tile);
@@ -1455,11 +1461,6 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(v->GetVehicleTrackdir())), true);
}
}
- if (keep_rail || IsStationTileBlocked(tile)) {
- /* Don't refund the 'steel' of the track when we keep the
- * rail, or when the tile didn't have any rail at all. */
- total_cost.AddCost(-_price[PR_CLEAR_RAIL]);
- }
}
if (quantity == 0) return_cmd_error(STR_ERROR_THERE_IS_NO_STATION);