OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ObjectAddWaypoint Struct Reference

Public Member Functions

 ObjectAddWaypoint (C4Object *obj)
 
bool operator() (int32_t iX, int32_t iY, C4Object *TransferTarget)
 

Detailed Description

Definition at line 230 of file C4Command.cpp.

Constructor & Destructor Documentation

ObjectAddWaypoint::ObjectAddWaypoint ( C4Object obj)
inlineexplicit

Definition at line 232 of file C4Command.cpp.

232 : cObj(obj) {}

Member Function Documentation

bool ObjectAddWaypoint::operator() ( int32_t  iX,
int32_t  iY,
C4Object TransferTarget 
)
inline

Definition at line 233 of file C4Command.cpp.

References C4Object::AddCommand(), AdjustSolidOffset(), C4CMD_MoveTo, C4CMD_Transfer, C4Command::Command, C4Object::Command, C4Command::Data, C4Rect::Hgt, C4Object::Shape, and C4Rect::Wdt.

234  {
235  if (!cObj) return false;
236 
237  // Transfer waypoint
238  if (TransferTarget)
239  return cObj->AddCommand(C4CMD_Transfer,TransferTarget,iX,iY,0,nullptr,false);
240 
241  // Solid offset
242  AdjustSolidOffset(iX,iY,cObj->Shape.Wdt/2,cObj->Shape.Hgt/2);
243 
244  // Standard movement waypoint update interval
245  int32_t iUpdate = 25;
246  // Waypoints before transfer zones are not updated (enforce move to that waypoint)
247  if (cObj->Command && (cObj->Command->Command==C4CMD_Transfer)) iUpdate=0;
248  // Add waypoint
249  assert(cObj->Command);
250  if (!cObj->AddCommand(C4CMD_MoveTo,nullptr,iX,iY,iUpdate,nullptr,false,cObj->Command->Data)) return false;
251 
252  return true;
253  }
C4Value Data
Definition: C4Command.h:85
C4Command * Command
Definition: C4Object.h:166
bool AddCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, int32_t iUpdateInterval=0, C4Object *pTarget2=nullptr, bool fInitEvaluation=true, C4Value iData=C4VNull, bool fAppend=false, int32_t iRetries=0, C4String *szText=nullptr, int32_t iBaseMode=0)
Definition: C4Object.cpp:2577
bool AdjustSolidOffset(int32_t &rX, int32_t &rY, int32_t iXOff, int32_t iYOff)
Definition: C4Command.cpp:167
int32_t Wdt
Definition: C4Rect.h:32
int32_t Command
Definition: C4Command.h:81
int32_t Hgt
Definition: C4Rect.h:32
C4Shape Shape
Definition: C4Object.h:148

Here is the call graph for this function:


The documentation for this struct was generated from the following file: