aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2019-10-19 23:05:22 +0200
committerjackpoz <giacomopoz@gmail.com>2019-10-19 23:05:22 +0200
commit9941b4c2edcf63e6e521249a6660b590f23cd08d (patch)
treeb6726c53c76737f2460c68e60c56d2fe229d838f
parent580f40769c6c446284dd1f5738f67fb3ee802956 (diff)
Core/Movement: Fix a crash on login
Fix a crash in MotionMaster happening when logging in with an aura of type SPELL_AURA_MOD_CONFUSE
-rw-r--r--src/server/game/Movement/MotionMaster.cpp5
-rw-r--r--src/server/game/Movement/MotionMaster.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 687fbca4471..446ed1f97b7 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -83,7 +83,7 @@ bool MovementGeneratorComparator::operator()(MovementGenerator const* a, Movemen
MovementGeneratorInformation::MovementGeneratorInformation(MovementGeneratorType type, ObjectGuid targetGUID, std::string const& targetName) : Type(type), TargetGUID(targetGUID), TargetName(targetName) { }
-MotionMaster::MotionMaster(Unit* unit) : _owner(unit), _defaultGenerator(nullptr), _flags(MOTIONMASTER_FLAG_NONE) { }
+MotionMaster::MotionMaster(Unit* unit) : _owner(unit), _defaultGenerator(nullptr), _flags(MOTIONMASTER_FLAG_NONE), _defaultInitialized(false) { }
MotionMaster::~MotionMaster()
{
@@ -110,6 +110,7 @@ void MotionMaster::Initialize()
void MotionMaster::InitializeDefault()
{
+ _defaultInitialized = true;
Add(FactorySelector::SelectMovementGenerator(_owner), MOTION_SLOT_DEFAULT);
}
@@ -322,7 +323,7 @@ void MotionMaster::Add(MovementGenerator* movement, MovementSlot slot/* = MOTION
return;
}
- if (HasFlag(MOTIONMASTER_FLAG_UPDATE))
+ if (HasFlag(MOTIONMASTER_FLAG_UPDATE) || !_defaultInitialized)
{
DelayedActionDefine action = [this, movement, slot]()
{
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index 4db648d7d1f..911ac0b29fb 100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -218,6 +218,7 @@ class TC_GAME_API MotionMaster
MotionMasterUnitStatesContainer _baseUnitStatesMap;
std::deque<DelayedAction> _delayedActions;
uint8 _flags;
+ bool _defaultInitialized;
};
#endif // MOTIONMASTER_H