mirror of https://github.com/OpenTTD/OpenTTD
(svn r22706) -Cleanup: A loop is no loop, if it never iterates.
parent
7b418502ab
commit
ae8f53a403
|
@ -776,26 +776,24 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
|
||||||
{
|
{
|
||||||
if (DistanceFromEdge(tile) == 0) return false;
|
if (DistanceFromEdge(tile) == 0) return false;
|
||||||
|
|
||||||
Slope cur_slope, desired_slope;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
/* Check if there already is a road at this point? */
|
/* Check if there already is a road at this point? */
|
||||||
if (GetTownRoadBits(tile) == ROAD_NONE) {
|
if (GetTownRoadBits(tile) == ROAD_NONE) {
|
||||||
/* No, try if we are able to build a road piece there.
|
/* No, try if we are able to build a road piece there.
|
||||||
* If that fails clear the land, and if that fails exit.
|
* If that fails clear the land, and if that fails exit.
|
||||||
* This is to make sure that we can build a road here later. */
|
* This is to make sure that we can build a road here later. */
|
||||||
if (DoCommand(tile, ((dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_Y : ROAD_X), 0, DC_AUTO, CMD_BUILD_ROAD).Failed() &&
|
if (DoCommand(tile, ((dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_Y : ROAD_X), 0, DC_AUTO, CMD_BUILD_ROAD).Failed() &&
|
||||||
DoCommand(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR).Failed())
|
DoCommand(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR).Failed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationSlope(tile, NULL) : GetTileSlope(tile, NULL);
|
Slope cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationSlope(tile, NULL) : GetTileSlope(tile, NULL);
|
||||||
bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2);
|
bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2);
|
||||||
if (cur_slope == SLOPE_FLAT) return ret;
|
if (cur_slope == SLOPE_FLAT) return ret;
|
||||||
|
|
||||||
/* If the tile is not a slope in the right direction, then
|
/* If the tile is not a slope in the right direction, then
|
||||||
* maybe terraform some. */
|
* maybe terraform some. */
|
||||||
desired_slope = (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? SLOPE_NW : SLOPE_NE;
|
Slope desired_slope = (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? SLOPE_NW : SLOPE_NE;
|
||||||
if (desired_slope != cur_slope && ComplementSlope(desired_slope) != cur_slope) {
|
if (desired_slope != cur_slope && ComplementSlope(desired_slope) != cur_slope) {
|
||||||
if (Chance16(1, 8)) {
|
if (Chance16(1, 8)) {
|
||||||
CommandCost res = CMD_ERROR;
|
CommandCost res = CMD_ERROR;
|
||||||
|
@ -813,7 +811,6 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static bool TerraformTownTile(TileIndex tile, int edges, int dir)
|
static bool TerraformTownTile(TileIndex tile, int edges, int dir)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue