diff options
author | rubidium <rubidium@openttd.org> | 2007-06-21 17:25:17 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-21 17:25:17 +0000 |
commit | 9c0944aa09b1d36a60d81c41088a906064086bfb (patch) | |
tree | 9b6fd14e50d7ab0c8fb901cfad2e00092a6b0470 /src/tunnelbridge_cmd.cpp | |
parent | c5225992c168b3546d37f5309b668d9fe5f4af1d (diff) | |
download | openttd-9c0944aa09b1d36a60d81c41088a906064086bfb.tar.xz |
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
-Fix: some displays of money were wrong.
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index c705bb28d..ce2a0a380 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -491,6 +491,13 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 * position, because of increased-cost-by-length: 'cost += cost >> 3' */ delta = TileOffsByDiagDir(direction); + DiagDirection tunnel_in_way_dir; + if (OtherAxis(DiagDirToAxis(direction)) == AXIS_X) { + tunnel_in_way_dir = (TileX(start_tile) < (MapMaxX() / 2)) ? DIAGDIR_SW : DIAGDIR_NE; + } else { + tunnel_in_way_dir = (TileY(start_tile) < (MapMaxX() / 2)) ? DIAGDIR_SE : DIAGDIR_NW; + } + end_tile = start_tile; for (;;) { end_tile += delta; @@ -498,13 +505,14 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 if (start_z == end_z) break; - if (!_cheats.crossing_tunnels.value && IsTunnelInWay(end_tile, start_z)) { + if (!_cheats.crossing_tunnels.value && IsTunnelInWayDir(end_tile, start_z, tunnel_in_way_dir)) { return_cmd_error(STR_5003_ANOTHER_TUNNEL_IN_THE_WAY); } cost.AddCost(_price.build_tunnel); cost.AddCost(cost.GetCost() >> 3); // add a multiplier for longer tunnels } + cost.MultiplyCost(0); /* Add the cost of the entrance */ cost.AddCost(_price.build_tunnel); |