57 for (pZone=
First; pZone; pZone=pNext) { pNext=pZone->
Next;
delete pZone; }
65 if (pZone->Object==pObj)
66 pZone->Object=
nullptr;
77 if ((pZone=
Find(pObj)))
79 pZone->
X=iX; pZone->
Y=iY;
80 pZone->
Wdt=iWdt; pZone->
Hgt=iHgt;
84 Add(iX,iY,iWdt,iHgt,pObj);
94 pZone->
X=iX; pZone->
Y=iY;
95 pZone->
Wdt=iWdt; pZone->
Hgt=iHgt;
112 if (Inside<int32_t>(iX-pZone->X,0,pZone->Wdt-1))
113 if (Inside<int32_t>(iY-pZone->Y,0,pZone->Hgt-1))
126 if (
Used) fHighlight=
true;
130 fHighlight ?
C4RGB(0, 0xca, 0) :
C4RGB(0xca, 0, 0));
135 return (Inside<int32_t>(iX-
X,0,
Wdt-1) && Inside<int32_t>(iY-
Y,0,
Hgt-1));
142 for (pZone=
First; pZone; pZone=pNext)
148 if (pPrev) pPrev->
Next=pNext;
163 if (Inside<int32_t>(iToX-
X,0,
Wdt-1) && Inside<int32_t>(iToY-
Y,0,
Hgt-1))
165 if (iToX<
X+
Wdt/2) iToX=
X-1;
169 rX=Clamp<int32_t>(iToX,
X-1,
X+
Wdt);
170 rY=Clamp<int32_t>(iToY,
Y-1,
Y+
Hgt);
172 int32_t iX1=rX,iY1=rY,iX2=rX,iY2=rY;
173 int32_t iXIncr1=0,iYIncr1=-1,iXIncr2=0,iYIncr2=+1;
175 for (cnt=0; cnt<2*
Wdt+2*
Hgt; cnt++)
178 if (!
GBackSolid(iX1,iY1)) { rX=iX1; rY=iY1;
break; }
179 if (!
GBackSolid(iX2,iY2)) { rX=iX2; rY=iY2;
break; }
181 iX1+=iXIncr1; iY1+=iYIncr1;
182 iX2+=iXIncr2; iY2+=iYIncr2;
184 if (iY1<
Y-1) { iY1=
Y-1; iXIncr1=+1; iYIncr1=0; }
185 if (iX1>
X+
Wdt) { iX1=
X+
Wdt; iXIncr1=0; iYIncr1=+1; }
186 if (iY1>
Y+
Hgt) { iY1=
Y+
Hgt; iXIncr1=-1; iYIncr1=0; }
187 if (iX1<
X-1) { iX1=
X-1; iXIncr1=0; iYIncr1=-1; }
188 if (iY2<
Y-1) { iY2=
Y-1; iXIncr2=-1; iYIncr2=0; }
189 if (iX2>
X+
Wdt) { iX2=
X+
Wdt; iXIncr2=0; iYIncr2=-1; }
190 if (iY2>
Y+
Hgt) { iY2=
Y+
Hgt; iXIncr2=+1; iYIncr2=0; }
191 if (iX2<
X-1) { iX2=
X-1; iXIncr2=0; iYIncr2=+1; }
194 if (cnt>=2*
Wdt+2*
Hgt)
return false;
196 if (!Inside<int32_t>(rX-
X,0,
Wdt-1))
211 if (pZone->Object==pObj)
bool GBackSolid(int32_t x, int32_t y)
void AdjustMoveToTarget(int32_t &rX, int32_t &rY, bool fFreeMove, int32_t iShapeHgt)
void DrawFrameDw(C4Surface *sfcDest, int x1, int y1, int x2, int y2, DWORD dwClr, float width=1.0f)
bool GetEntryPoint(int32_t &rX, int32_t &rY, int32_t iToX, int32_t iToY)
bool At(int32_t iX, int32_t iY)
void Draw(C4TargetFacet &cgo, bool fHighlight=false)
void ClearPointers(C4Object *pObj)
bool Set(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, C4Object *pObj)
void Draw(C4TargetFacet &cgo)
int32_t RemoveNullZones()
C4TransferZone * Find(C4Object *pObj)
bool Add(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, C4Object *pObj)