414 return false; |
414 return false; |
415 } |
415 } |
416 |
416 |
417 slope = GetTileSlope(tile, NULL); |
417 slope = GetTileSlope(tile, NULL); |
418 if (slope == 0) { |
418 if (slope == 0) { |
|
419 no_slope: |
419 // Tile has no slope |
420 // Tile has no slope |
420 // Disallow the road if any neighboring tile has a road. |
421 // Disallow the road if any neighboring tile has a road. |
421 if (HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+1])), dir^2) || |
422 if (HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+1])), dir^2) || |
422 HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+3])), dir^2) || |
423 HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+3])), dir^2) || |
423 HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+1] + _roadblock_tileadd[dir+2])), dir) || |
424 HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+1] + _roadblock_tileadd[dir+2])), dir) || |
432 // maybe terraform some. |
433 // maybe terraform some. |
433 if ((k = (dir&1)?0xC:0x9) != slope && (k^0xF) != slope) { |
434 if ((k = (dir&1)?0xC:0x9) != slope && (k^0xF) != slope) { |
434 uint32 r = Random(); |
435 uint32 r = Random(); |
435 |
436 |
436 if (CHANCE16I(1,8, r) && !_generating_world) { |
437 if (CHANCE16I(1,8, r) && !_generating_world) { |
|
438 int32 res; |
|
439 |
437 if (CHANCE16I(1,16,r)) |
440 if (CHANCE16I(1,16,r)) |
438 DoCommandByTile(tile, slope, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND); |
441 res = DoCommandByTile(tile, slope, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, |
|
442 CMD_TERRAFORM_LAND); |
439 else |
443 else |
440 DoCommandByTile(tile, slope^0xF, 1, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND); |
444 res = DoCommandByTile(tile, slope^0xF, 1, DC_EXEC | DC_AUTO | DC_NO_WATER, |
|
445 CMD_TERRAFORM_LAND); |
|
446 if (res == CMD_ERROR && CHANCE16I(1,3,r)) |
|
447 // We can consider building on the slope, though. |
|
448 goto no_slope; |
441 } |
449 } |
442 return false; |
450 return false; |
443 } |
451 } |
444 |
452 |
445 tile = TILE_ADD(tile, _roadblock_tileadd[dir]); |
453 tile = TILE_ADD(tile, _roadblock_tileadd[dir]); |