* Is there a tunnel in the way in the given direction? * @param tile the tile to search from. * @param z the 'z' to search on. * @param dir the direction to start searching to. * @return true if and only if there is a tunnel. */
| 46 | * @return true if and only if there is a tunnel. |
| 47 | */ |
| 48 | bool IsTunnelInWayDir(TileIndex tile, int z, DiagDirection dir) |
| 49 | { |
| 50 | TileIndexDiff delta = TileOffsByDiagDir(dir); |
| 51 | int height; |
| 52 | |
| 53 | do { |
| 54 | tile -= delta; |
| 55 | if (!IsValidTile(tile)) return false; |
| 56 | height = GetTileZ(tile); |
| 57 | } while (z < height); |
| 58 | |
| 59 | return z == height && IsTunnelTile(tile) && GetTunnelBridgeDirection(tile) == dir; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Is there a tunnel in the way in any direction? |
no test coverage detected