mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
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:
@@ -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]()
|
||||
{
|
||||
|
||||
@@ -218,6 +218,7 @@ class TC_GAME_API MotionMaster
|
||||
MotionMasterUnitStatesContainer _baseUnitStatesMap;
|
||||
std::deque<DelayedAction> _delayedActions;
|
||||
uint8 _flags;
|
||||
bool _defaultInitialized;
|
||||
};
|
||||
|
||||
#endif // MOTIONMASTER_H
|
||||
|
||||
Reference in New Issue
Block a user