Core/Movement: Prevent IdleMovementGenerator being put into MOTION_SLOT_IDLE and MOTION_SLOT_ACTIVE simultaneously

This commit is contained in:
Machiavelli
2012-01-13 16:43:49 +01:00
parent e9b243991e
commit 2293d2d7df
7 changed files with 12 additions and 11 deletions

View File

@@ -715,7 +715,7 @@ void Creature::Motion_Initialize()
i_motionMaster.Initialize();
}
else if (m_formation->isFormed())
i_motionMaster.MoveIdle(MOTION_SLOT_IDLE); //wait the order of leader
i_motionMaster.MoveIdle(); //wait the order of leader
else
i_motionMaster.Initialize();
}

View File

@@ -203,7 +203,7 @@ void CreatureGroup::FormationReset(bool dismiss)
if (dismiss)
itr->first->GetMotionMaster()->Initialize();
else
itr->first->GetMotionMaster()->MoveIdle(MOTION_SLOT_IDLE);
itr->first->GetMotionMaster()->MoveIdle();
sLog->outDebug(LOG_FILTER_UNITS, "Set %s movement for member GUID: %u", dismiss ? "default" : "idle", itr->first->GetGUIDLow());
}
}

View File

@@ -175,12 +175,11 @@ void MotionMaster::DelayedExpire()
--i_top;
}
void MotionMaster::MoveIdle(MovementSlot slot)
void MotionMaster::MoveIdle()
{
//if (empty() || !isStatic(top()))
// push(&si_idleMovement);
if (!isStatic(Impl[slot]))
Mutate(&si_idleMovement, slot);
//! Should be preceded by MovementExpired or Clear if there's an overlying movementgenerator active
if (empty() || !isStatic(top()))
Mutate(&si_idleMovement, MOTION_SLOT_IDLE);
}
void MotionMaster::MoveRandom(float spawndist)

View File

@@ -142,7 +142,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
DirectExpire(reset);
}
void MoveIdle(MovementSlot slot = MOTION_SLOT_ACTIVE);
void MoveIdle();
void MoveTargetedHome();
void MoveRandom(float spawndist = 0.0f);
void MoveFollow(Unit* target, float dist, float angle, MovementSlot slot = MOTION_SLOT_ACTIVE);

View File

@@ -155,6 +155,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
case COMMAND_STAY: //flat=1792 //STAY
pet->AttackStop();
pet->InterruptNonMeleeSpells(false);
pet->GetMotionMaster()->Clear(false);
pet->GetMotionMaster()->MoveIdle();
charmInfo->SetCommandState(COMMAND_STAY);

View File

@@ -638,7 +638,7 @@ class npc_spinestalker : public CreatureScript
float moveTime = me->GetExactDist(&SpinestalkerFlyPos) / (me->GetSpeed(MOVE_FLIGHT) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
me->SetDefaultMovementType(IDLE_MOTION_TYPE);
me->GetMotionMaster()->MoveIdle(MOTION_SLOT_IDLE);
me->GetMotionMaster()->MoveIdle();
me->StopMoving();
me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, SpinestalkerFlyPos);
}
@@ -753,7 +753,7 @@ class npc_rimefang : public CreatureScript
float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_FLIGHT) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
me->SetDefaultMovementType(IDLE_MOTION_TYPE);
me->GetMotionMaster()->MoveIdle(MOTION_SLOT_IDLE);
me->GetMotionMaster()->MoveIdle();
me->StopMoving();
me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, RimefangFlyPos);
}

View File

@@ -1656,7 +1656,8 @@ class npc_strangulate_vehicle : public CreatureScript
switch (eventId)
{
case EVENT_TELEPORT:
me->GetMotionMaster()->MoveIdle(MOTION_SLOT_ACTIVE);
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveIdle();
if (TempSummon* summ = me->ToTempSummon())
{
if (Unit* summoner = summ->GetSummoner())