From 20f1f48983b989a68d1ef2429ab1e0f7522b868a Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 16 Aug 2015 17:31:34 +0100 Subject: [PATCH] Fix add/removing signals on bridges/tunnels not checking train occupancy. Fix compiler warning. --- src/rail_cmd.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index d1255fc827..c8f0adaa27 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1016,7 +1016,9 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, if (IsTileType(tile, MP_TUNNELBRIDGE)) { if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) return CMD_ERROR; CommandCost ret = EnsureNoTrainOnTrack(GetOtherTunnelBridgeEnd(tile), track); - //if (ret.Failed()) return ret; + if (ret.Failed()) return ret; + ret = EnsureNoTrainOnTrack(tile, track); + if (ret.Failed()) return ret; } else if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) || !HasTrack(tile, track)) { return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); } @@ -1483,6 +1485,8 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1 CommandCost ret = EnsureNoTrainOnTrack(GetOtherTunnelBridgeEnd(tile), track); if (ret.Failed()) return ret; + ret = EnsureNoTrainOnTrack(tile, track); + if (ret.Failed()) return ret; } else { if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) || !HasTrack(tile, track)) { return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);