summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-10-01 16:45:25 +0000
committerfrosch <frosch@openttd.org>2011-10-01 16:45:25 +0000
commit804090b317aad7c53a59ef68a40dd913f4618c95 (patch)
treec10c780495ededa468af0f8c3dc2476ff20a7c5b /src/ai
parentbf12ba49877525ba4fe6f3eac6ad8d40c07ca2a3 (diff)
downloadopenttd-804090b317aad7c53a59ef68a40dd913f4618c95.tar.xz
(svn r22968) -Feature: Allow road corners on steep slopes.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/api/ai_road.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/ai/api/ai_road.cpp b/src/ai/api/ai_road.cpp
index 7c6663157..784ca69b7 100644
--- a/src/ai/api/ai_road.cpp
+++ b/src/ai/api/ai_road.cpp
@@ -193,21 +193,9 @@ static RoadBits NeighbourToRoadBits(int32 neighbour)
*/
static int32 LookupWithBuildOnSlopes(::Slope slope, Array *existing, int32 start, int32 end)
{
- if (::IsSteepSlope(slope)) {
- switch (slope) {
- /* On steep slopes one can only build straight roads that will be
- * automatically expanded to a straight road. Just check that the existing
- * road parts are in the same direction. */
- case SLOPE_STEEP_S:
- case SLOPE_STEEP_W:
- case SLOPE_STEEP_N:
- case SLOPE_STEEP_E:
- return CheckAutoExpandedRoadBits(existing, start, end) ? (existing->size == 0 ? 2 : 1) : 0;
-
- /* All other slopes are invalid slopes!. */
- default:
- return -1;
- }
+ /* Steep slopes behave the same as slopes with one corner raised. */
+ if (IsSteepSlope(slope)) {
+ slope = SlopeWithOneCornerRaised(GetHighestSlopeCorner(slope));
}
/* The slope is not steep. Furthermore lots of slopes are generally the