summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index f0b79a070..7440f86ac 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -503,7 +503,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Track track = (Track)p2;
- CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_RAIL] );
+ CommandCost cost(EXPENSES_CONSTRUCTION);
bool crossing = false;
if (!ValParamTrackOrientation((Track)p2)) return CMD_ERROR;
@@ -533,6 +533,8 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
if (ret.Failed()) return ret;
}
+ cost.AddCost(RailClearCost(GetRailType(tile)));
+
if (flags & DC_EXEC) {
if (HasReservedTracks(tile, trackbit)) {
v = GetTrainForReservation(tile, track);
@@ -563,6 +565,8 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
if ((present & trackbit) == 0) return CMD_ERROR;
if (present == (TRACK_BIT_X | TRACK_BIT_Y)) crossing = true;
+ cost.AddCost(RailClearCost(GetRailType(tile)));
+
/* Charge extra to remove signals on the track, if they are there */
if (HasSignalOnTrack(tile, track))
cost.AddCost(DoCommand(tile, track, 0, flags, CMD_REMOVE_SIGNALS));