ObjectAddWaypoint Struct Reference

Public Member Functions

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

Detailed Description

Definition at line 229 of file C4Command.cpp.

Constructor & Destructor Documentation

◆ ObjectAddWaypoint()

ObjectAddWaypoint::ObjectAddWaypoint ( C4Object obj)

Definition at line 231 of file C4Command.cpp.

231 : cObj(obj) {}

Member Function Documentation

◆ operator()()

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

Definition at line 232 of file C4Command.cpp.

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

233  {
234  if (!cObj) return false;
236  // Transfer waypoint
237  if (TransferTarget)
238  return cObj->AddCommand(C4CMD_Transfer,TransferTarget,iX,iY,0,nullptr,false);
240  // Solid offset
241  AdjustSolidOffset(iX,iY,cObj->Shape.Wdt/2,cObj->Shape.Hgt/2);
243  // Standard movement waypoint update interval
244  int32_t iUpdate = 25;
245  // Waypoints before transfer zones are not updated (enforce move to that waypoint)
246  if (cObj->Command && (cObj->Command->Command==C4CMD_Transfer)) iUpdate=0;
247  // Add waypoint
248  assert(cObj->Command);
249  if (!cObj->AddCommand(C4CMD_MoveTo,nullptr,iX,iY,iUpdate,nullptr,false,cObj->Command->Data)) return false;
251  return true;
252  }
C4Value Data
Definition: C4Command.h:85
C4Command * Command
Definition: C4Object.h:167
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:2567
bool AdjustSolidOffset(int32_t &rX, int32_t &rY, int32_t iXOff, int32_t iYOff)
Definition: C4Command.cpp:166
int32_t Wdt
Definition: C4Rect.h:30
int32_t Command
Definition: C4Command.h:81
int32_t Hgt
Definition: C4Rect.h:30
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: