rail_cmd.c
changeset 1963 8a398139fb87
parent 1954 58fee2f9eb81
child 1977 4392ae3d8e31
--- a/rail_cmd.c	Tue Jun 21 16:28:17 2005 +0000
+++ b/rail_cmd.c	Tue Jun 21 19:45:05 2005 +0000
@@ -403,6 +403,7 @@
 	uint tileh;
 	TileIndex tile;
 	byte m5;
+	int32 cost = _price.remove_rail;
 
 	if (!ValParamTrackOrientation(p2)) return CMD_ERROR;
 	trackbit = TrackToTrackBits(track);
@@ -474,12 +475,12 @@
 			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 @@
 
 	SetSignalsOnBothDir(tile, track);
 
-	return _price.remove_rail;
+	return cost;
 }
 
 static const struct {