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
This commit is contained in:
jackpoz
2019-10-19 23:05:22 +02:00
parent 580f40769c
commit 9941b4c2ed
2 changed files with 4 additions and 2 deletions

View File

@@ -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]()
{

View File

@@ -218,6 +218,7 @@ class TC_GAME_API MotionMaster
MotionMasterUnitStatesContainer _baseUnitStatesMap;
std::deque<DelayedAction> _delayedActions;
uint8 _flags;
bool _defaultInitialized;
};
#endif // MOTIONMASTER_H