Chunnel patch 28394: Codechange: Rework IsTunnelInWay proc.

https://www.tt-forums.net/viewtopic.php?p=1183416#p1183416
This commit is contained in:
HackaLittleBit
2017-03-04 11:45:06 +00:00
committed by Jonathan G Rennison
parent 67e7d12eb7
commit f7ced74c22
3 changed files with 17 additions and 32 deletions

View File

@@ -663,12 +663,6 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1,
* position, because of increased-cost-by-length: 'cost += cost >> 3' */
TileIndexDiff delta = TileOffsByDiagDir(direction);
DiagDirection tunnel_in_way_dir;
if (DiagDirToAxis(direction) == AXIS_Y) {
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;
}
TileIndex end_tile = start_tile;
@@ -688,7 +682,7 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1,
if (start_z == end_z) break;
if (!_cheats.crossing_tunnels.value && IsTunnelInWayDir(end_tile, start_z, tunnel_in_way_dir)) {
if (!_cheats.crossing_tunnels.value && IsTunnelInWay(end_tile, start_z)) {
return_cmd_error(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY);
}