--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-16 11:48:25 -06:00
9 changed files with 19 additions and 155 deletions
+1 -1
View File
@@ -598,8 +598,8 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
}
if(i_AI) delete i_AI;
i_AI = ai ? ai : FactorySelector::selectAI(this);
i_motionMaster.Initialize();
i_AI = ai ? ai : FactorySelector::selectAI(this);
IsAIEnabled = true;
return true;
}
+4 -4
View File
@@ -594,14 +594,14 @@ void Map::RelocationNotify()
for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
{
Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL);
if(!unit)
if(!unit || !unit->IsInWorld() || !unit->GetMapId() == GetId())
{
*iter = 0;
continue;
}
unit->m_Notified = true;
if(!unit->IsInWorld())
continue;
if(unit->GetTypeId() == TYPEID_PLAYER)
{
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
+8
View File
@@ -460,6 +460,14 @@ MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
return top()->GetMovementGeneratorType();
}
MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const
{
if(!Impl[slot])
return NULL_MOTION_TYPE;
else
return Impl[slot]->GetMovementGeneratorType();
}
void MotionMaster::InitTop()
{
top()->Initialize(*i_owner);
+3 -1
View File
@@ -45,6 +45,7 @@ enum MovementGeneratorType
POINT_MOTION_TYPE = 8, // PointMovementGenerator.h
FLEEING_MOTION_TYPE = 9, // FleeingMovementGenerator.h
DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h
NULL_MOTION_TYPE = 11,
};
enum MovementSlot
@@ -94,7 +95,7 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *>
int size() const { return i_top + 1; }
_Ty top() const { return Impl[i_top]; }
_Ty GetMotionSlot(int slot) { return Impl[slot]; }
_Ty GetMotionSlot(int slot) const { return Impl[slot]; }
void DirectDelete(_Ty curr);
void DelayedDelete(_Ty curr);
@@ -141,6 +142,7 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *>
void MovePath(uint32 path_id, bool repeatable);
MovementGeneratorType GetCurrentMovementGeneratorType() const;
MovementGeneratorType GetMotionSlotType(int slot) const;
void propagateSpeedChange();
+1 -1
View File
@@ -4589,7 +4589,7 @@ void Spell::EffectInterruptCast(uint32 i)
if (unitTarget->m_currentSpells[i])
{
// check if we can interrupt spell
if ( unitTarget->m_currentSpells[i]->m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && unitTarget->m_currentSpells[i]->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE )
if ( (unitTarget->m_currentSpells[i]->getState() == SPELL_STATE_CASTING || (unitTarget->m_currentSpells[i]->getState() == SPELL_STATE_PREPARING && unitTarget->m_currentSpells[i]->GetCastTime() > 0.0f)) && unitTarget->m_currentSpells[i]->m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && unitTarget->m_currentSpells[i]->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE )
{
if(m_originalCaster)
{
+1 -1
View File
@@ -9886,7 +9886,7 @@ void Unit::SetInCombatState(bool PvP)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
if(GetTypeId() != TYPEID_PLAYER)
if(GetTypeId() != TYPEID_PLAYER && GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_IDLE) != IDLE_MOTION_TYPE)
((Creature*)this)->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
if(GetTypeId() != TYPEID_PLAYER && ((Creature*)this)->isPet())