|
|
|
@ -32,6 +32,7 @@
|
|
|
|
|
#include "modules/Constructions.h"
|
|
|
|
|
#include "modules/Buildings.h"
|
|
|
|
|
#include "modules/Maps.h"
|
|
|
|
|
#include "modules/MapCache.h"
|
|
|
|
|
|
|
|
|
|
#include "TileTypes.h"
|
|
|
|
|
#include "df/job_item.h"
|
|
|
|
@ -460,19 +461,27 @@ static bool is_valid_building_site(building_site &site, bool orthogonal_check, b
|
|
|
|
|
|
|
|
|
|
if (material == tiletype_material::CONSTRUCTION)
|
|
|
|
|
{
|
|
|
|
|
// Check this is not a 'constructed floor over X':
|
|
|
|
|
// those have something else than open space as *basic* tile types: stonefloor, smoothstonefloor, ...
|
|
|
|
|
MapExtras::MapCache mc;
|
|
|
|
|
auto btt = mc.baseTiletypeAt(site.pos);
|
|
|
|
|
auto bshape = tileShape(btt);
|
|
|
|
|
if (bshape != tiletype_shape_basic::Open)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// Can build on top of a wall, but not on a constructed floor
|
|
|
|
|
df::coord pos_below = site.pos;
|
|
|
|
|
pos_below.z--;
|
|
|
|
|
if (!Maps::isValidTilePos(pos_below))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
auto ttype = Maps::getTileType(pos_below);
|
|
|
|
|
if (!ttype)
|
|
|
|
|
auto ttype_below = Maps::getTileType(pos_below);
|
|
|
|
|
if (!ttype_below)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
auto shape = tileShape(*ttype);
|
|
|
|
|
auto shapeBasic = tileShapeBasic(shape);
|
|
|
|
|
if (tileShapeBasic(shape) != tiletype_shape_basic::Wall)
|
|
|
|
|
auto shape_below = tileShape(*ttype_below);
|
|
|
|
|
auto shapeBasic_below = tileShapeBasic(shape_below);
|
|
|
|
|
if (tileShapeBasic(shape_below) != tiletype_shape_basic::Wall)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|