OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4TransferZone.cpp File Reference
Include dependency graph for C4TransferZone.cpp:

Go to the source code of this file.

Functions

void AdjustMoveToTarget (int32_t &rX, int32_t &rY, bool fFreeMove, int32_t iShapeHgt)
 

Function Documentation

void AdjustMoveToTarget ( int32_t &  rX,
int32_t &  rY,
bool  fFreeMove,
int32_t  iShapeHgt 
)

Definition at line 143 of file C4Command.cpp.

References GBackSemiSolid(), GBackSolid(), C4Landscape::GetHeight(), and Landscape.

Referenced by C4TransferZone::GetEntryPoint(), C4Command::InitEvaluation(), and C4Command::JumpControl().

144 {
145  // Above solid (always)
146  int32_t iY=std::min(rY, ::Landscape.GetHeight());
147  while ((iY>=0) && GBackSolid(rX,iY)) iY--;
148  if (iY>=0) rY=iY;
149  // No-free-move adjustments (i.e. if walking)
150  if (!fFreeMove)
151  {
152  // Drop down to bottom of free space
153  if (!GBackSemiSolid(rX,rY))
154  {
155  for (iY=rY; (iY<::Landscape.GetHeight()) && !GBackSemiSolid(rX,iY+1); iY++) {}
156  if (iY<::Landscape.GetHeight()) rY=iY;
157  }
158  // Vertical shape offset above solid
159  if (GBackSolid(rX,rY+1) || GBackSolid(rX,rY+5))
160  if (!GBackSemiSolid(rX,rY-iShapeHgt/2))
161  rY-=iShapeHgt/2;
162  }
163 
164 }
C4Landscape Landscape
int32_t GetHeight() const
bool GBackSemiSolid(int32_t x, int32_t y)
Definition: C4Landscape.h:236
bool GBackSolid(int32_t x, int32_t y)
Definition: C4Landscape.h:231

Here is the call graph for this function:

Here is the caller graph for this function: