aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2020-03-21 17:39:15 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-30 20:58:53 +0100
commit040af829ca7d1148a99c3ac03a3383c58af9e23c (patch)
treeaaeab682b7573ff7fe9616f113c8597810e96338
parentf83dbb254a6eeb6db881dfaacdd3ced929c98d88 (diff)
Core/Movement: Improve log when starting a spline with invalid arguments
Improve log when starting a spline with invalid arguments, for example when starting a spline with just 1 point. (cherry picked from commit 296f6aab402407a2798f3a300b256cc75d59fec4)
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp20
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)