Merge remote-tracking branch 'myk002/quickfort_civzones' into develop

develop
lethosor 2020-08-21 00:34:26 -04:00
commit 8779ca0659
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
3 changed files with 13 additions and 5 deletions

@ -1619,11 +1619,13 @@ General
using width and height for flexible dimensions.
Returns *is_flexible, width, height, center_x, center_y*.
* ``dfhack.buildings.checkFreeTiles(pos,size[,extents,change_extents,allow_occupied])``
* ``dfhack.buildings.checkFreeTiles(pos,size[,extents,change_extents,allow_occupied,allow_wall])``
Checks if the rectangle defined by ``pos`` and ``size``, and possibly extents,
can be used for placing a building. If ``change_extents`` is true, bad tiles
are removed from extents. If ``allow_occupied``, the occupancy test is skipped.
Set ``allow_wall`` to true if the building is unhindered by walls (such as an
activity zone).
* ``dfhack.buildings.countExtentTiles(extents,defval)``

@ -141,7 +141,9 @@ DFHACK_EXPORT bool getCorrectSize(df::coord2d &size, df::coord2d &center,
*/
DFHACK_EXPORT bool checkFreeTiles(df::coord pos, df::coord2d size,
df::building_extents *ext = NULL,
bool create_ext = false, bool allow_occupied = false);
bool create_ext = false,
bool allow_occupied = false,
bool allow_wall = false);
/**
* Returns the number of tiles included by the extent, or defval.

@ -574,7 +574,9 @@ bool Buildings::getCorrectSize(df::coord2d &size, df::coord2d &center,
bool Buildings::checkFreeTiles(df::coord pos, df::coord2d size,
df::building_extents *ext,
bool create_ext, bool allow_occupied)
bool create_ext,
bool allow_occupied,
bool allow_wall)
{
bool found_any = false;
@ -609,7 +611,7 @@ bool Buildings::checkFreeTiles(df::coord pos, df::coord2d size,
else
{
auto tile = block->tiletype[btile.x][btile.y];
if (!HighPassable(tile))
if (!allow_wall && !HighPassable(tile))
allowed = false;
}
@ -659,7 +661,9 @@ static bool checkBuildingTiles(df::building *bld, bool can_change)
return Buildings::checkFreeTiles(psize.first, psize.second, &bld->room,
can_change && bld->isExtentShaped(),
!bld->isSettingOccupancy());
!bld->isSettingOccupancy(),
bld->getType() ==
df::building_type::Civzone);
}
int Buildings::countExtentTiles(df::building_extents *ext, int defval)