summaryrefslogtreecommitdiff
path: root/town_cmd.c
diff options
context:
space:
mode:
authorpasky <pasky@openttd.org>2004-11-20 01:08:41 +0000
committerpasky <pasky@openttd.org>2004-11-20 01:08:41 +0000
commit7a8fb5d2fd84be604b54d0bb0b6eb53dbccdfff8 (patch)
treea5c8140f97295610641b520a61316c05975afdf3 /town_cmd.c
parentd9096f9ea4131d5093807e37a0e8bf80c8654808 (diff)
downloadopenttd-7a8fb5d2fd84be604b54d0bb0b6eb53dbccdfff8.tar.xz
(svn r694) Make the town sometimes build streets on slopes.
Diffstat (limited to 'town_cmd.c')
-rw-r--r--town_cmd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/town_cmd.c b/town_cmd.c
index 640ce048b..7fc734620 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -416,6 +416,7 @@ static bool IsRoadAllowedHere(uint tile, int dir)
slope = GetTileSlope(tile, NULL);
if (slope == 0) {
+no_slope:
// Tile has no slope
// Disallow the road if any neighboring tile has a road.
if (HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+1])), dir^2) ||
@@ -434,10 +435,17 @@ static bool IsRoadAllowedHere(uint tile, int dir)
uint32 r = Random();
if (CHANCE16I(1,8, r) && !_generating_world) {
+ int32 res;
+
if (CHANCE16I(1,16,r))
- DoCommandByTile(tile, slope, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
+ res = DoCommandByTile(tile, slope, 0, DC_EXEC | DC_AUTO | DC_NO_WATER,
+ CMD_TERRAFORM_LAND);
else
- DoCommandByTile(tile, slope^0xF, 1, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
+ res = DoCommandByTile(tile, slope^0xF, 1, DC_EXEC | DC_AUTO | DC_NO_WATER,
+ CMD_TERRAFORM_LAND);
+ if (res == CMD_ERROR && CHANCE16I(1,3,r))
+ // We can consider building on the slope, though.
+ goto no_slope;
}
return false;
}