AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Movement::MoveSplineInitArgs Struct Reference

#include "MoveSplineInitArgs.h"

Public Member Functions

 MoveSplineInitArgs (std::size_t path_capacity=16)
 
bool Validate (Unit *unit) const
 ============================================================================================
 

Public Attributes

PointsArray path
 
FacingInfo facing
 
MoveSplineFlag flags
 
int32 path_Idx_offset {0}
 
float velocity {0.f}
 
float parabolic_amplitude {0.f}
 
float time_perc {0.f}
 
uint32 splineId {0}
 
float initialOrientation {0.f}
 
bool HasVelocity {false}
 
bool TransformForTransport {true}
 
bool walk
 

Private Member Functions

bool _checkPathBounds () const
 

Detailed Description

Constructor & Destructor Documentation

◆ MoveSplineInitArgs()

Movement::MoveSplineInitArgs::MoveSplineInitArgs ( std::size_t  path_capacity = 16)
inline
47 {
48 path.reserve(path_capacity);
49 }
PointsArray path
Definition MoveSplineInitArgs.h:51

References path.

Member Function Documentation

◆ _checkPathBounds()

bool Movement::MoveSplineInitArgs::_checkPathBounds ( ) const
private
224 {
225 if (!(flags & MoveSplineFlag::Mask_CatmullRom) && path.size() > 2)
226 {
227 constexpr auto MAX_OFFSET = (1 << 11) / 2;
228 Vector3 middle = (path.front() + path.back()) / 2;
229 Vector3 offset;
230 for (uint32 i = 1; i < path.size() - 1; ++i)
231 {
232 offset = path[i] - middle;
233 if (std::fabs(offset.x) >= MAX_OFFSET || std::fabs(offset.y) >= MAX_OFFSET || std::fabs(offset.z) >= MAX_OFFSET)
234 {
235 LOG_ERROR("movement", "MoveSplineInitArgs::_checkPathBounds check failed");
236 return false;
237 }
238 }
239 }
240 return true;
241 }
std::uint32_t uint32
Definition Define.h:107
#define LOG_ERROR(filterType__,...)
Definition Log.h:158
@ Mask_CatmullRom
Definition MoveSplineFlag.h:71
MoveSplineFlag flags
Definition MoveSplineInitArgs.h:53

References flags, LOG_ERROR, Movement::MoveSplineFlag::Mask_CatmullRom, and path.

◆ Validate()

bool Movement::MoveSplineInitArgs::Validate ( Unit unit) const

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

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

203 {
204#define CHECK(exp) \
205 if (!(exp)) \
206 { \
207 if (unit) \
208 LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '{}' failed for {}", #exp, unit->GetGUID().ToString()); \
209 else \
210 LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '{}' failed for cyclic spline continuation", #exp); \
211 return false;\
212 }
213 CHECK(path.size() > 1);
214 CHECK(velocity > 0.01f);
215 CHECK(time_perc >= 0.f && time_perc <= 1.f);
216 //CHECK(_checkPathBounds());
217 return true;
218#undef CHECK
219 }
#define CHECK(exp)
float velocity
Definition MoveSplineInitArgs.h:55
float time_perc
Definition MoveSplineInitArgs.h:57

References CHECK, path, time_perc, and velocity.

Referenced by Movement::MoveSplineInit::Launch().

Member Data Documentation

◆ facing

◆ flags

◆ HasVelocity

bool Movement::MoveSplineInitArgs::HasVelocity {false}

◆ initialOrientation

float Movement::MoveSplineInitArgs::initialOrientation {0.f}

◆ parabolic_amplitude

float Movement::MoveSplineInitArgs::parabolic_amplitude {0.f}

◆ path

◆ path_Idx_offset

◆ splineId

uint32 Movement::MoveSplineInitArgs::splineId {0}

◆ time_perc

float Movement::MoveSplineInitArgs::time_perc {0.f}

◆ TransformForTransport

◆ velocity

◆ walk


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