summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-01-15 11:45:29 +0000
committersmatz <smatz@openttd.org>2008-01-15 11:45:29 +0000
commite0c61a892173d2e72ea8b2b20bc7007f33c6d96f (patch)
tree8fa309e970f3c2222d9c0b52200eac7ddf084b15
parentef704510cd5e648fc6d5b8e053e184185826e897 (diff)
downloadopenttd-e0c61a892173d2e72ea8b2b20bc7007f33c6d96f.tar.xz
(svn r11861) -Fix: do not call rail specific functions when removing road tunnel/bridge
-rw-r--r--src/tunnelbridge_cmd.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 2642addcc..7cebdaf94 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -606,15 +606,19 @@ static CommandCost DoClearTunnel(TileIndex tile, uint32 flags)
/* We first need to request the direction before calling DoClearSquare
* else the direction is always 0.. dah!! ;) */
DiagDirection dir = GetTunnelBridgeDirection(tile);
- Track track;
+ bool rail = GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL;
DoClearSquare(tile);
DoClearSquare(endtile);
- UpdateSignalsOnSegment(tile, ReverseDiagDir(dir));
- UpdateSignalsOnSegment(endtile, dir);
- track = AxisToTrack(DiagDirToAxis(dir));
- YapfNotifyTrackLayoutChange(tile, track);
- YapfNotifyTrackLayoutChange(endtile, track);
+
+ if (rail) {
+ UpdateSignalsOnSegment(tile, ReverseDiagDir(dir));
+ UpdateSignalsOnSegment(endtile, dir);
+
+ Track track = AxisToTrack(DiagDirToAxis(dir));
+ YapfNotifyTrackLayoutChange(tile, track);
+ YapfNotifyTrackLayoutChange(endtile, track);
+ }
}
return CommandCost(EXPENSES_CONSTRUCTION, _price.clear_tunnel * (DistanceManhattan(tile, endtile) + 1));
}
@@ -654,21 +658,24 @@ static CommandCost DoClearBridge(TileIndex tile, uint32 flags)
}
if (flags & DC_EXEC) {
- TileIndex c;
- Track track;
+ /* read this value before actual removal of bridge */
+ bool rail = GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL;
DoClearSquare(tile);
DoClearSquare(endtile);
- for (c = tile + delta; c != endtile; c += delta) {
- ClearBridgeMiddle(c);
+ for (TileIndex c = tile + delta; c != endtile; c += delta) {
+ ClearBridgeMiddle(c);
MarkTileDirtyByTile(c);
}
- UpdateSignalsOnSegment(tile, ReverseDiagDir(direction));
- UpdateSignalsOnSegment(endtile, direction);
- track = AxisToTrack(DiagDirToAxis(direction));
- YapfNotifyTrackLayoutChange(tile, track);
- YapfNotifyTrackLayoutChange(endtile, track);
+ if (rail) {
+ UpdateSignalsOnSegment(tile, ReverseDiagDir(direction));
+ UpdateSignalsOnSegment(endtile, direction);
+
+ Track track = AxisToTrack(DiagDirToAxis(direction));
+ YapfNotifyTrackLayoutChange(tile, track);
+ YapfNotifyTrackLayoutChange(endtile, track);
+ }
}
return CommandCost(EXPENSES_CONSTRUCTION, (DistanceManhattan(tile, endtile) + 1) * _price.clear_bridge);