function Road::_IsSlopedRoadEfficient(start, middle, end, map_size_x = Road._map_size_x, _AITile = AITile) { local NW = middle - map_size_x; local NE = middle - 1; local SE = middle + map_size_x; local SW = middle + 1; NW = NW == start || NW == end; //Set to true if we want to build a road to / from the north-west NE = NE == start || NE == end; //Set to true if we want to build a road to / from the north-east SE = SE == start || SE == end; //Set to true if we want to build a road to / from the south-west SW = SW == start || SW == end; //Set to true if we want to build a road to / from the south-east /* If there is a turn in the current tile, it can't be sloped. */ if ((NW || SE) && (NE || SW)) return false; local slope = _AITile.GetSlope(middle); /* A road on a steep slope is always sloped. */ if (_AITile.IsSteepSlope(slope)) return true; /* If only one corner is raised, the road is sloped. */ if (slope == _AITile.SLOPE_N || slope == _AITile.SLOPE_W) return true; if (slope == _AITile.SLOPE_S || slope == _AITile.SLOPE_E) return true; if (NW && (slope == _AITile.SLOPE_NW || slope == _AITile.SLOPE_SE)) return true; if (NE && (slope == _AITile.SLOPE_NE || slope == _AITile.SLOPE_SW)) return true; return false; } function Road::_IsSlopedRoad(start, middle, end) { local NW = 0; //Set to true if we want to build a road to / from the north-west local NE = 0; //Set to true if we want to build a road to / from the north-east local SW = 0; //Set to true if we want to build a road to / from the south-west local SE = 0; //Set to true if we want to build a road to / from the south-east if (middle - AIMap.GetMapSizeX() == start || middle - AIMap.GetMapSizeX() == end) NW = 1; if (middle - 1 == start || middle - 1 == end) NE = 1; if (middle + AIMap.GetMapSizeX() == start || middle + AIMap.GetMapSizeX() == end) SE = 1; if (middle + 1 == start || middle + 1 == end) SW = 1; /* If there is a turn in the current tile, it can't be sloped. */ if ((NW || SE) && (NE || SW)) return false; local slope = AITile.GetSlope(middle); /* A road on a steep slope is always sloped. */ if (AITile.IsSteepSlope(slope)) return true; /* If only one corner is raised, the road is sloped. */ if (slope == AITile.SLOPE_N || slope == AITile.SLOPE_W) return true; if (slope == AITile.SLOPE_S || slope == AITile.SLOPE_E) return true; if (NW && (slope == AITile.SLOPE_NW || slope == AITile.SLOPE_SE)) return true; if (NE && (slope == AITile.SLOPE_NE || slope == AITile.SLOPE_SW)) return true; return false; }