[11202] Schedule AI notify at adding to world

This fixes the problem, that creatures, added at grid loading, do not start attack each other
More shedule -> schedule fixes added, removed unused Map::PlayerRelocationNotify function
This commit is contained in:
SilverIce 2011-02-23 17:04:54 +02:00
parent 6529e69924
commit fcc09483ad
5 changed files with 10 additions and 48 deletions

View file

@ -218,7 +218,7 @@ Unit::Unit()
m_AuraFlags = 0;
m_Visibility = VISIBILITY_ON;
m_AINotifySheduled = false;
m_AINotifyScheduled = false;
m_detectInvisibilityMask = 0;
m_invisibilityMask = 0;
@ -9355,6 +9355,7 @@ uint32 Unit::GetCreatePowers( Powers power ) const
void Unit::AddToWorld()
{
Object::AddToWorld();
ScheduleAINotify(0);
}
void Unit::RemoveFromWorld()
@ -10831,7 +10832,7 @@ class RelocationNotifyEvent : public BasicEvent
public:
RelocationNotifyEvent(Unit& owner) : BasicEvent(), m_owner(owner)
{
m_owner._SetAINotifySheduled(true);
m_owner._SetAINotifyScheduled(true);
}
bool Execute(uint64 /*e_time*/, uint32 /*p_time*/)
@ -10847,13 +10848,13 @@ public:
MaNGOS::CreatureRelocationNotifier notify((Creature&)m_owner);
Cell::VisitAllObjects(&m_owner,notify,radius);
}
m_owner._SetAINotifySheduled(false);
m_owner._SetAINotifyScheduled(false);
return true;
}
void Abort(uint64)
{
m_owner._SetAINotifySheduled(false);
m_owner._SetAINotifyScheduled(false);
}
private:
@ -10862,7 +10863,7 @@ private:
void Unit::ScheduleAINotify(uint32 delay)
{
if (!IsAINotifySheduled())
if (!IsAINotifyScheduled())
m_Events.AddEvent(new RelocationNotifyEvent(*this), m_Events.CalculateTime(delay));
}