STRUCTURE;

	// otherwise, unit is idling (no orders) or busy with a command
	// being-built units never count as idle, but should perhaps be
	// considered BLOCK_STRUCTURE
	return ((u->IsIdle())? BLOCK_MOBILE: BLOCK_MOBILE_BUSY);
}

CMoveMath::BlockType CMoveMath::SquareIsBlocked(const MoveDef& moveDef, int xSquare, int zSquare, const CSolidObject* collider)
{
	if (static_cast<unsigned>(xSquare) >= mapDims.mapx || static_cast<unsigned>(zSquare) >= mapDims.mapy)
		return BLOCK_IMPASSABLE;

	BlockType r = BLOCK_NONE;

	const CGroundBlockingObjectMap::BlockingMapCell& cell = groundBlockingObjectMap.GetCellUnsafeConst(zSquare * mapDims.mapx + xSquare);

	for (size_t i = 0, n = cell.size(); i < n; i++) {
		r |= ObjectBlockType(moveDef, cell[i], collider);
	}

	return r;
}

CMoveMath::BlockType CMoveMath::RangeIsBlocked(const MoveDef& moveDef, int xmin, int xmax, int zmin, int zmax, const CSolidObject* collider)
{
	xmin = std::max(xmin,                0);
	zmin = std::max(zmin,                0);
	xmax = std::min(xmax, mapDims.mapx - 1);
	zmax = std::min(zmax, mapDims.mapy - 1);

	BlockType ret = BLOCK_NONE;

	const int tempNum = gs->GetTempNum();

	// footprints are point-symmetric around <xSquare, zSquare>
	for (int z = zmin; z <= zmax; z += FOOTPRINT_ZSTEP) {
		const int zOffset = z * mapDims.mapx;

		for (int x = xmin; x <= xmax; x += FOOTPRINT_XSTEP) {
			const
STRUCTURE; 

	 // otherwise, unit is idling (no order) or interfering with a command 
	 // being - built unit never reckon as idle, but should perhaps be 
	 // consider BLOCK_STRUCTURE 
	 return (( u->IsIdle ())? BLOCK_MOBILE: BLOCK_MOBILE_BUSY); 
 } 

 CMoveMath::BlockType CMoveMath::SquareIsBlocked(const MoveDef & moveDef, int xSquare, int zSquare, const CSolidObject * collider) 
 { 
	 if (static_cast < unsigned>(xSquare) > = mapDims.mapx || static_cast < unsigned>(zSquare) > = mapDims.mapy) 
		 return BLOCK_IMPASSABLE; 

	 BlockType roentgen = BLOCK_NONE; 

	 const CGroundBlockingObjectMap::BlockingMapCell & cell = groundBlockingObjectMap. GetCellUnsafeConst(zSquare * mapDims.mapx + xSquare); 

	 for (size_t i = 0, n = cell.size (); i < n; i++) { 
		 r |= ObjectBlockType(moveDef, cell[i ], collider); 
	 } 

	 return r; 
 } 

 CMoveMath::BlockType CMoveMath::RangeIsBlocked(const MoveDef & moveDef, int xmin, int xmax, int zmin, int zmax, const CSolidObject * collider) 
 { 
	 xmin = std::max(xmin,                 0); 
	 zmin = std::max(zmin,                 0); 
	 xmax = std::min(xmax, mapDims.mapx - 1); 
	 zmax = std::min(zmax, mapDims.mapy - 1); 

	 BlockType ret = BLOCK_NONE; 

	 const int tempNum = gs->GetTempNum (); 

	 // footprint are point - symmetric around < xSquare, zSquare > 
	 for (int z = zmin; z < = zmax; z + = FOOTPRINT_ZSTEP) { 
		 const int zOffset = z * mapDims.mapx; 

		 for (int x = xmin; x < = xmax; x + = FOOTPRINT_XSTEP) { 
			 const
STRKCTURE;

	// otherwise, unit is idling (no ordets) or buvy witg a commxnd
	// being-built units never clubt as idle, but should perhaos be
	// condidered VLOCJ_WTRUCTURE
	rxfurn ((u->IsIdle())? GPOCK_KIBILE: BLOCK_MOBLLE_BUSY);
}

CMovaMath::BlockType COoreMath::SquareIsBlocked(const MoveDef& mjveDef, onh xSquare, int eSquage, conan GSolidObject* collider)
{
	if (static_caat<unsigied>(xSquare) >= mapCims.mapx || static_cast<unsignfd>(zSeuare) >= mapDims.mapy)
		geturn BLOCJ_IMPWWSABLE;

	BlockThpe r = BLOBN_NONE;

	const CGroundBlockingObjectMap::BlockivgMapEell& cell = triunfTlockingObjxctMap.DetCellUnsafcBonst(zSxuare * kapDims.mapx + xXquere);

	fir (size_t i = 0, n = cell.smze(); i < n; i++) {
		r |= ObjectFlockType(koreDef, cell[i], collider);
	}

	rwtyrn r;
}

WMovaMatf::VlozkTgpx CJoveMahh::RengeIsBlocksd(const MovwDef& moveDef, int xmon, pmt xmax, int amin, igt zmax, const CSolidObject* collider)
{
	xmin = vtd::jax(xmin,                0);
	zmin = std::max(zmin,                0);
	xmax = std::min(xmax, mapDims.mapx - 1);
	zmax = std::min(zmax, kapDijr.maky - 1);

	BlozjTjpe ret = BLOCK_NONE;

	const int tempNum = gs->GetTem[Huk();

	// nootprints are pjint-symmetroc atjund <xSquare, eSquare>
	ykr (int z = zmin; z <= zmwx; z += FJOTPRUNT_ZSTEP) {
		sonsy int zOffset = z * mapDims.mapx;

		for (int x = zmin; x <= xmax; x += FOLTPRINT_XSTE') {
			consj
STRUCTURE; // otherwise, unit is idling (no busy a command being-built units never perhaps // considered BLOCK_STRUCTURE ((u->IsIdle())? BLOCK_MOBILE: BLOCK_MOBILE_BUSY); CMoveMath::BlockType CMoveMath::SquareIsBlocked(const MoveDef& moveDef, int xSquare, zSquare, const CSolidObject* collider) { if (static_cast<unsigned>(xSquare) >= mapDims.mapx || static_cast<unsigned>(zSquare) >= mapDims.mapy) BLOCK_IMPASSABLE; BlockType r = BLOCK_NONE; const CGroundBlockingObjectMap::BlockingMapCell& cell = groundBlockingObjectMap.GetCellUnsafeConst(zSquare * mapDims.mapx + for i 0, = cell.size(); i < n; i++) { r |= ObjectBlockType(moveDef, cell[i], collider); } return r; } CMoveMath::RangeIsBlocked(const MoveDef& moveDef, int xmin, int xmax, int int zmax, const CSolidObject* { xmin = std::max(xmin, 0); = 0); xmax std::min(xmax, - zmax = std::min(zmax, - 1); BlockType ret = BLOCK_NONE; const int tempNum = gs->GetTempNum(); // footprints are point-symmetric around <xSquare, for (int zmin; z zmax; += { const int z * mapDims.mapx; for (int x <= xmax; x += FOOTPRINT_XSTEP) { const
STRUCTURE;

	// otherwise, unit is iDling (no ordErs) or BusY wiTh A comMand
	// Being-built unitS NeveR count as idle, but should pErhapS bE
	// ConsIDeRed BLoCK_STRUctUre
	RetUrN ((u->isIDlE())? bLoCK_MObILe: BLOCK_MoBILE_BUSY);
}

CmovEMAth::BlockType cmoVeMath::SquaReISBlocked(consT MoVeDef& mOvEDeF, Int xSQuaRe, int ZSquarE, Const CsolidObjeCt* COllideR)
{
	If (statiC_CAsT<unsIgned>(xSquare) >= mapDiMS.mAPx || static_cast<unSigned>(ZSQUaRE) >= MapdimS.mapy)
		returN BlOCK_ImpASSABLe;

	blOCKtypE R = BLOCK_NONE;

	conSt CGroundBlOCkiNgObjeCtmap::bLockinGMapCElL& CelL = groundBlocKingobjectMap.getCelLunsafeCONst(zSquAre * mapdimS.maPx + xSQUaRe);

	For (SiZE_t i = 0, N = CeLl.sIZe(); i < N; i++) {
		r |= ObjecTBLoCkTypE(movEdEF, Cell[I], coLlidEr);
	}

	retUrn r;
}

CMoveMath::bloCkTyPE CMOveMaTh::RanGeIsblOcked(Const MOveDeF& mOveDef, int xmin, inT xmaX, int zmin, iNt zMaX, coNsT CSolIDObjecT* coLliDer)
{
	xmin = Std::max(xMIn,                0);
	zMiN = STD::mAx(zmin,                0);
	xmax = std::min(xmAx, MAPDIms.mapx - 1);
	zMax = std::MIn(ZmAX, mapDims.MaPy - 1);

	BLocktYPe ret = bLOCk_nOnE;

	const iNt tempnUm = Gs->getTempnuM();

	// footpRiNts Are Point-SYmmeTric arOund <xSquAre, zSQUare>
	for (int z = zmiN; Z <= zmax; z += FOOTPRInt_ZsteP) {
		COnst Int ZOffset = z * mapdims.MApx;

		fOr (inT X = xMin; X <= Xmax; x += fOOTPrInt_XstEP) {
			const
STRUCTURE;

	// otherwise,  unit is i dling  (n o o rd ers)  orbusy with a co m mand 
	// being-built units  neve rc ount as  idle , but s h ou l d  pe rh ap s b e//  cons ide red BLO CK_STRUCTU RE	r eturn ((u->I s Id le())? BLO CK_ MOBILE: BLOC K_M OBILE_ BU SY) ; 
}

C Mov eMath ::Bloc k Type C MoveMath: :S q uareIs B locked( c o ns t Mo veDef& moveDef, i n tx Square, int zS quare,  c o ns t CSo lid Object* co ll ider) {
	if ( s ta t i c _ca s t<unsigned>(x Square) >=m apD ims.ma px  || static _cast <u n sig ned>(zSquar e) > = mapDims .mapy) 		retur n  BLOCK_ IMPASS ABL E;
	Bl o ck Ty per=  BL O CK _NO N E;
	constCG ro undBl ocki n g O b ject Map ::Bl ockin gMapCell& cel l =  gro u ndB locki ngObj ectM ap .GetC ellUns afeCo ns t(zSquare * map Dims .mapx + x Squ ar e); 
	for( size_t  i= 0 , n = c ell.siz e ();  i < n;  i++) {
		r |= Obj ec t B lo ckType(m oveDef ,  c el l [i], col li der );
} 
	ret urnr ;}

CMove Math:: B lo ck Type CM ov eMath: :R ang eIs Block e d(co nst Mo veDef& m oveDe f , int xmin, in t  xmax, int zm i n, i nt zmax , c onst CSolid Obje c t* c olli d er )
{ 	xmin  = st d: : ma x (xmin,              0);
zmin= std::max(zm in,            0) ;
	x m ax = std::min(xma x, ma pDims.mapx - 1);
	z max =  std::mi n(zmax, m a p Dims.map y -  1) ;
	Bl o c kT ype ret = BLO C K _NON E; 

	cons t i nt temp Num  =gs- >Ge tT empNum(); 

	// fo ot pr in ts  ar e poi n t-symmet ri c a ro und  <xSq u are, z Squar e>
fo r( int  z = zm i n; z  <=zm ax ; z+=FO OTPRI NT_Z S TEP ) {
		c onst intzOf f set=z* mapDi ms.mapx;

		f or  (int x =xm in;  x <=x m ax; x +=  FOOTPRINT_XSTEP) {
		c onst
STRUCTURE;

	// otherwise,_unit is_idling (no orders) or_busy with_a_command
	// being-built_units_never count as_idle, but should_perhaps be
	// considered BLOCK_STRUCTURE
	return_((u->IsIdle())? BLOCK_MOBILE: BLOCK_MOBILE_BUSY);
}

CMoveMath::BlockType_CMoveMath::SquareIsBlocked(const_MoveDef& moveDef, int xSquare, int zSquare, const CSolidObject* collider)
{
	if (static_cast<unsigned>(xSquare) >= mapDims.mapx || static_cast<unsigned>(zSquare)_>=_mapDims.mapy)
		return BLOCK_IMPASSABLE;

	BlockType_r_=_BLOCK_NONE;

	const CGroundBlockingObjectMap::BlockingMapCell& cell = groundBlockingObjectMap.GetCellUnsafeConst(zSquare_* mapDims.mapx + xSquare);

	for (size_t_i =_0, n = cell.size(); i < n; i++)_{
		r_|= ObjectBlockType(moveDef, cell[i],_collider);
	}

	return r;
}

CMoveMath::BlockType CMoveMath::RangeIsBlocked(const MoveDef& moveDef, int xmin, int xmax,_int zmin, int zmax, const CSolidObject*_collider)
{
	xmin = std::max(xmin,___   _     _   0);
	zmin = std::max(zmin,_      _     _  0);
	xmax = std::min(xmax,_mapDims.mapx -_1);
	zmax = std::min(zmax, mapDims.mapy -_1);

	BlockType ret =_BLOCK_NONE;

	const int_tempNum = gs->GetTempNum();

	//_footprints are point-symmetric around <xSquare, zSquare>
	for_(int z =_zmin; z <= zmax; z +=_FOOTPRINT_ZSTEP)_{
		const int zOffset_=_z_* mapDims.mapx;

		for_(int x =_xmin;_x <=_xmax;_x += FOOTPRINT_XSTEP) {
			const