summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-06 16:14:13 +0000
committerrubidium <rubidium@openttd.org>2009-12-06 16:14:13 +0000
commita68849fb56bc0d27f26ba7f514255d8f6e0b4bcc (patch)
tree5282e777abbcb8b37d9e5174418c5a3ba355be2c
parentf49491ddcd44c53d1f43686002db747ff0bf8200 (diff)
downloadopenttd-a68849fb56bc0d27f26ba7f514255d8f6e0b4bcc.tar.xz
(svn r18415) -Fix [FS#3332]: on slopes the original and better road layouts did not check their minimum distance requirements
-rw-r--r--src/town_cmd.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 3789cd582..18a4b3646 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -788,19 +788,8 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
}
cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationSlope(tile, NULL) : GetTileSlope(tile, NULL);
- if (cur_slope == SLOPE_FLAT) {
-no_slope:
- /* Tile has no slope */
- switch (t->layout) {
- default: NOT_REACHED();
-
- case TL_ORIGINAL: // Disallow the road if any neighboring tile has a road (distance: 1)
- return !IsNeighborRoadTile(tile, dir, 1);
-
- case TL_BETTER_ROADS: // Disallow the road if any neighboring tile has a road (distance: 1 and 2).
- return !IsNeighborRoadTile(tile, dir, 2);
- }
- }
+ bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2);
+ if (cur_slope == SLOPE_FLAT) return ret;
/* If the tile is not a slope in the right direction, then
* maybe terraform some. */
@@ -815,12 +804,12 @@ no_slope:
}
if (CmdFailed(res) && Chance16(1, 3)) {
/* We can consider building on the slope, though. */
- goto no_slope;
+ return ret;
}
}
return false;
}
- return true;
+ return ret;
}
}