|  |  |  | @ -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" | 
		
	
	
		
			
				
					|  |  |  | @ -459,20 +460,28 @@ static bool is_valid_building_site(building_site &site, bool orthogonal_check, b | 
		
	
		
			
				|  |  |  |  |                 return false; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             if (material == tiletype_material::CONSTRUCTION) | 
		
	
		
			
				|  |  |  |  |             { | 
		
	
		
			
				|  |  |  |  |                 // Can build on top of a wall, but not on a constructed floor
 | 
		
	
		
			
				|  |  |  |  |             {		 | 
		
	
		
			
				|  |  |  |  |                 // 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; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | 
 |