summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-06-21 19:45:05 +0000
committerhackykid <hackykid@openttd.org>2005-06-21 19:45:05 +0000
commit5119cce2a83dc163663f548cdcfdaac3e82347fa (patch)
treed65d28f0fe690d458230bbaf392a4499e837101e /rail_cmd.c
parentaa7334a3eca674131dc1198c592c7e4a925f1d56 (diff)
downloadopenttd-5119cce2a83dc163663f548cdcfdaac3e82347fa.tar.xz
(svn r2469) - Add: When removing tracks with the 'remove' tool, have it automatically remove signals on the tracks.
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 09f61344b..02856ab87 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -403,6 +403,7 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
uint tileh;
TileIndex tile;
byte m5;
+ int32 cost = _price.remove_rail;
if (!ValParamTrackOrientation(p2)) return CMD_ERROR;
trackbit = TrackToTrackBits(track);
@@ -474,12 +475,12 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!(GetTrackBits(tile) & trackbit))
return CMD_ERROR;
- /* don't allow remove if there are signals on the track */
+ /* Charge extra to remove signals on the track, if they are there */
if (HasSignalOnTrack(tile, track))
- return CMD_ERROR;
+ cost += DoCommand(x, y, track, 0, flags, CMD_REMOVE_SIGNALS);
if (!(flags & DC_EXEC))
- return _price.remove_rail;
+ return cost;
/* We remove the trackbit here. */
_map5[tile] &= ~trackbit;
@@ -502,7 +503,7 @@ skip_mark_dirty:;
SetSignalsOnBothDir(tile, track);
- return _price.remove_rail;
+ return cost;
}
static const struct {