diff options
-rw-r--r-- | src/server/game/Movement/Spline/MoveSpline.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index ccfc40eb67d..3b7939eb038 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -233,20 +233,23 @@ MoveSpline::MoveSpline() : m_Id(0), time_passed(0), bool MoveSplineInitArgs::Validate(Unit* unit) const { -#define CHECK(exp) \ +#define CHECK(exp, verbose) \ if (!(exp))\ {\ - TC_LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '%s' failed for %s Entry: %u", #exp, unit->GetGUID().ToString().c_str(), unit->GetEntry());\ + if (unit)\ + TC_LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '%s' failed for %s", #exp, (verbose ? unit->GetDebugInfo() : unit->GetGUID().ToString()).c_str());\ + else\ + TC_LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '%s' failed for cyclic spline continuation", #exp); \ return false;\ } - CHECK(path.size() > 1); - CHECK(velocity >= 0.01f); - CHECK(time_perc >= 0.f && time_perc <= 1.f); - CHECK(_checkPathLengths()); + CHECK(path.size() > 1, true); + CHECK(velocity >= 0.01f, true); + CHECK(time_perc >= 0.f && time_perc <= 1.f, true); + CHECK(_checkPathLengths(), false); if (spellEffectExtra) { - CHECK(!spellEffectExtra->ProgressCurveId || sCurveStore.LookupEntry(spellEffectExtra->ProgressCurveId)); - CHECK(!spellEffectExtra->ParabolicCurveId || sCurveStore.LookupEntry(spellEffectExtra->ParabolicCurveId)); + CHECK(!spellEffectExtra->ProgressCurveId || sCurveStore.LookupEntry(spellEffectExtra->ProgressCurveId), true); + CHECK(!spellEffectExtra->ParabolicCurveId || sCurveStore.LookupEntry(spellEffectExtra->ParabolicCurveId), true); } return true; #undef CHECK @@ -261,6 +264,7 @@ bool MoveSplineInitArgs::_checkPathLengths() const return false; return true; } + MoveSplineInitArgs::MoveSplineInitArgs(size_t path_capacity /*= 16*/) : path_Idx_offset(0), velocity(0.f), parabolic_amplitude(0.f), vertical_acceleration(0.0f), time_perc(0.f), splineId(0), initialOrientation(0.f), walk(false), HasVelocity(false), TransformForTransport(true) |