@@ -708,49 +708,49 @@ static bool IsRoadAllowedHere(TileIndex
* if that fails clear the land, and if that fails exit.
* This is to make sure that we can build a road here later. */
if (CmdFailed(DoCommand(tile, ((dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_X : ROAD_Y), 0, DC_AUTO, CMD_BUILD_ROAD)) &&
CmdFailed(DoCommand(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR)))
return false;
}
cur_slope = GetTileSlope(tile, NULL);
if (cur_slope == SLOPE_FLAT) {
no_slope:
/* Tile has no slope */
switch (_patches.town_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);
/* If the tile is not a slope in the right direction, then
* maybe terraform some. */
desired_slope = (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? SLOPE_NE : SLOPE_NW;
desired_slope = (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? SLOPE_NW : SLOPE_NE;
if (desired_slope != cur_slope && ComplementSlope(desired_slope) != cur_slope) {
uint32 r = Random();
if (CHANCE16I(1, 8, r)) {
CommandCost res = CMD_ERROR;
if (!_generating_world && CHANCE16I(1, 10, r >> 4)) {
/* Note: Do not replace " ^ 0xF" with ComplementSlope(). The slope might be steep. */
res = DoCommand(tile, CHANCE16I(1, 16, r >> 8) ? cur_slope : cur_slope ^ 0xF, 0,
DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
if (CmdFailed(res) && CHANCE16I(1, 3, r >> 16)) {
/* We can consider building on the slope, though. */
goto no_slope;
return true;
static bool TerraformTownTile(TileIndex tile, int edges, int dir)
{
CommandCost r;
Status change: