diff options
author | rubidium <rubidium@openttd.org> | 2007-08-09 05:25:33 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-08-09 05:25:33 +0000 |
commit | 2bff32afb078791d8d4cf238ccd2c1136fae84bb (patch) | |
tree | fc3560bf58f5437dd4726b79260ea12e717424fb /src/road_cmd.cpp | |
parent | c4a30877238d15bd8e3c5d794449e372dc787bcb (diff) | |
download | openttd-2bff32afb078791d8d4cf238ccd2c1136fae84bb.tar.xz |
(svn r10833) -Fix [FS#1115]: assertion (different cost between test and execution) of overbuilding road tunnels with tram tracks (and vice versa) when the dragged area contains both ends of the tunnel.
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r-- | src/road_cmd.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 621338ea9..c79d263d9 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -588,6 +588,7 @@ CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 TileIndex start_tile, tile; CommandCost cost, ret; bool had_bridge = false; + bool had_tunnel = false; bool had_success = false; DisallowedRoadDirections drd = DRD_NORTHBOUND; @@ -633,12 +634,19 @@ CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 _error_message = INVALID_STRING_ID; } else { had_success = true; - /* Only pay for the upgrade on one side of the bridge */ - if (IsBridgeTile(tile)) { - if ((!had_bridge || GetBridgeRampDirection(tile) == DIAGDIR_SE || GetBridgeRampDirection(tile) == DIAGDIR_SW)) { - cost.AddCost(ret); + /* Only pay for the upgrade on one side of the bridges and tunnels */ + if (IsTileType(tile, MP_TUNNELBRIDGE)) { + if (IsBridge(tile)) { + if ((!had_bridge || GetBridgeRampDirection(tile) == DIAGDIR_SE || GetBridgeRampDirection(tile) == DIAGDIR_SW)) { + cost.AddCost(ret); + } + had_bridge = true; + } else { + if ((!had_tunnel || GetTunnelDirection(tile) == DIAGDIR_SE || GetTunnelDirection(tile) == DIAGDIR_SW)) { + cost.AddCost(ret); + } + had_tunnel = true; } - had_bridge = true; } else { cost.AddCost(ret); } |