mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spline: Improve error output for SpineInitArgs check
by Schmoozerd
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "MoveSpline.h"
|
||||
#include <sstream>
|
||||
#include "Log.h"
|
||||
#include "Unit.h"
|
||||
|
||||
namespace Movement{
|
||||
|
||||
@@ -195,12 +196,12 @@ MoveSpline::MoveSpline() : m_Id(0), time_passed(0),
|
||||
|
||||
/// ============================================================================================
|
||||
|
||||
bool MoveSplineInitArgs::Validate() const
|
||||
bool bool MoveSplineInitArgs::Validate(Unit* unit) const
|
||||
{
|
||||
#define CHECK(exp) \
|
||||
if (!(exp))\
|
||||
{\
|
||||
sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::Validate: expression '%s' failed", #exp);\
|
||||
sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::Validate: expression '%s' failed for %u", #exp, unit->GetGUIDLow());\
|
||||
return false;\
|
||||
}
|
||||
CHECK(path.size() > 1);
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Movement
|
||||
if (!args.HasVelocity)
|
||||
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
|
||||
|
||||
if (!args.Validate())
|
||||
if (!args.Validate(&unit))
|
||||
return;
|
||||
|
||||
if (moveFlags & MOVEMENTFLAG_ROOT)
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "MoveSplineFlag.h"
|
||||
#include <G3D/Vector3.h>
|
||||
|
||||
class Unit;
|
||||
|
||||
namespace Movement
|
||||
{
|
||||
typedef std::vector<Vector3> PointsArray;
|
||||
@@ -61,7 +63,7 @@ namespace Movement
|
||||
bool TransformForTransport;
|
||||
|
||||
/** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */
|
||||
bool Validate() const;
|
||||
bool Validate(Unit* unit) const;
|
||||
private:
|
||||
bool _checkPathBounds() const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user