From dfb566331390a87f01d048f57ed6d51b2f329d65 Mon Sep 17 00:00:00 2001 From: zuu Date: Sat, 12 Oct 2013 22:07:58 +0000 Subject: (svn r25849) -Codechange: Introduce IsTileFlat to not compute full slope information for situations when we only want to know if a tile is flat or not (cirdan, LordAro) --- src/town_cmd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/town_cmd.cpp') diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 6d469ba06..7ab9dcdad 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1411,7 +1411,7 @@ static bool GrowTown(Town *t) tile = t->xy; for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) { /* Only work with plain land that not already has a house */ - if (!IsTileType(tile, MP_HOUSE) && GetTileSlope(tile) == SLOPE_FLAT) { + if (!IsTileType(tile, MP_HOUSE) && IsTileFlat(tile)) { if (DoCommand(tile, 0, 0, DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR).Succeeded()) { DoCommand(tile, GenRandomRoadBits(), t->index, DC_EXEC | DC_AUTO, CMD_BUILD_ROAD); cur_company.Restore(); @@ -1574,7 +1574,7 @@ static CommandCost TownCanBePlacedHere(TileIndex tile) } /* Can only build on clear flat areas, possibly with trees. */ - if ((!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) || GetTileSlope(tile) != SLOPE_FLAT) { + if ((!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) || !IsTileFlat(tile)) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } @@ -1775,7 +1775,7 @@ static bool FindFurthestFromWater(TileIndex tile, void *user_data) uint dist = GetClosestWaterDistance(tile, true); if (IsTileType(tile, MP_CLEAR) && - GetTileSlope(tile) == SLOPE_FLAT && + IsTileFlat(tile) && IsTileAlignedToGrid(tile, sp->layout) && dist > sp->max_dist) { sp->tile = tile; -- cgit v1.2.3-54-g00ecf