/** * Tests if at least one surrounding tile is non-desert * @param tile tile to check * @return does this tile have at least one non-desert tile around? */ static inline bool NeighbourIsNormal(TileIndex tile) { for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) { TileIndex t = tile + TileOffsByDiagDir(dir); if (!IsValidTile(t)) continue; if (GetTropicZone(t) != TROPICZONE_DESERT) return true; if (HasTileWaterClass(t) && GetWaterClass(t) == WATER_CLASS_SEA) return true; } return false; }
/** * Determine the effective #WaterClass for a ship travelling on a tile. * @param tile Tile of interest * @return the waterclass to be used by the ship. */ WaterClass GetEffectiveWaterClass(TileIndex tile) { if (HasTileWaterClass(tile)) return GetWaterClass(tile); if (IsTileType(tile, MP_TUNNELBRIDGE)) { assert(GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER); return WATER_CLASS_CANAL; } if (IsTileType(tile, MP_RAILWAY)) { assert(GetRailGroundType(tile) == RAIL_GROUND_WATER); return WATER_CLASS_SEA; } NOT_REACHED(); }