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
 ============================================================================================ More...
 

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}
 

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

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

FacingInfo Movement::MoveSplineInitArgs::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

◆ time_perc

◆ TransformForTransport

◆ velocity