TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Movement::MoveSplineInitArgs Struct Reference

#include <MoveSplineInitArgs.h>

Public Member Functions

 MoveSplineInitArgs (size_t path_capacity=16)
 
bool Validate (Unit *unit) const
 ============================================================================================ More...
 

Public Attributes

PointsArray path
 
FacingInfo facing
 
MoveSplineFlag flags
 
int32 path_Idx_offset
 
float velocity
 
float parabolic_amplitude
 
float time_perc
 
uint32 splineId
 
float initialOrientation
 
bool HasVelocity
 
bool TransformForTransport
 

Private Member Functions

bool _checkPathBounds () const
 

Constructor & Destructor Documentation

Movement::MoveSplineInitArgs::MoveSplineInitArgs ( size_t  path_capacity = 16)
inline
43  : path_Idx_offset(0), velocity(0.f),
46  {
47  path.reserve(path_capacity);
48  }
bool HasVelocity
Definition: MoveSplineInitArgs.h:59
float initialOrientation
Definition: MoveSplineInitArgs.h:58
int32 path_Idx_offset
Definition: MoveSplineInitArgs.h:53
float parabolic_amplitude
Definition: MoveSplineInitArgs.h:55
float time_perc
Definition: MoveSplineInitArgs.h:56
bool TransformForTransport
Definition: MoveSplineInitArgs.h:60
PointsArray path
Definition: MoveSplineInitArgs.h:50
float velocity
Definition: MoveSplineInitArgs.h:54
uint32 splineId
Definition: MoveSplineInitArgs.h:57

Member Function Documentation

bool Movement::MoveSplineInitArgs::_checkPathBounds ( ) const
private
219 {
220  if (!(flags & MoveSplineFlag::Catmullrom) && path.size() > 2)
221  {
222  enum{
223  MAX_OFFSET = (1 << 11) / 2
224  };
225  Vector3 middle = (path.front()+path.back()) / 2;
226  Vector3 offset;
227  for (uint32 i = 1; i < path.size()-1; ++i)
228  {
229  offset = path[i] - middle;
230  if (std::fabs(offset.x) >= MAX_OFFSET || std::fabs(offset.y) >= MAX_OFFSET || std::fabs(offset.z) >= MAX_OFFSET)
231  {
232  TC_LOG_ERROR("misc", "MoveSplineInitArgs::_checkPathBounds check failed");
233  return false;
234  }
235  }
236  }
237  return true;
238 }
MoveSplineFlag flags
Definition: MoveSplineInitArgs.h:52
Definition: MoveSplineFlag.h:43
PointsArray path
Definition: MoveSplineInitArgs.h:50
uint32_t uint32
Definition: Define.h:150
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool Movement::MoveSplineInitArgs::Validate ( Unit unit) const

============================================================================================

Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed.

201 {
202 #define CHECK(exp) \
203  if (!(exp))\
204  {\
205  TC_LOG_ERROR("misc", "MoveSplineInitArgs::Validate: expression '%s' failed for %s Entry: %u", #exp, unit->GetGUID().ToString().c_str(), unit->GetEntry());\
206  return false;\
207  }
208  CHECK(path.size() > 1);
209  CHECK(velocity > 0.1f);
210  CHECK(time_perc >= 0.f && time_perc <= 1.f);
211  //CHECK(_checkPathBounds());
212  return true;
213 #undef CHECK
214 }
#define CHECK(exp)
float time_perc
Definition: MoveSplineInitArgs.h:56
PointsArray path
Definition: MoveSplineInitArgs.h:50
float velocity
Definition: MoveSplineInitArgs.h:54

+ Here is the caller graph for this function:

Member Data Documentation

FacingInfo Movement::MoveSplineInitArgs::facing
MoveSplineFlag Movement::MoveSplineInitArgs::flags
bool Movement::MoveSplineInitArgs::HasVelocity
float Movement::MoveSplineInitArgs::initialOrientation
float Movement::MoveSplineInitArgs::parabolic_amplitude
PointsArray Movement::MoveSplineInitArgs::path
int32 Movement::MoveSplineInitArgs::path_Idx_offset
uint32 Movement::MoveSplineInitArgs::splineId
float Movement::MoveSplineInitArgs::time_perc
bool Movement::MoveSplineInitArgs::TransformForTransport
float Movement::MoveSplineInitArgs::velocity

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