[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

@ -199,23 +199,6 @@ void Map::DeleteFromWorld(Player* pl)
delete pl;
}
template<class T>
void Map::AddNotifier(T* , Cell const& , CellPair const& )
{
}
template<>
void Map::AddNotifier(Player* obj, Cell const& cell, CellPair const& cellpair)
{
obj->ScheduleAINotify(0);
}
template<>
void Map::AddNotifier(Creature* obj, Cell const&, CellPair const&)
{
obj->ScheduleAINotify(0);
}
void
Map::EnsureGridCreated(const GridPair &p)
{
@ -317,8 +300,6 @@ bool Map::Add(Player *player)
player->GetViewPoint().Event_AddedToWorld(&(*grid)(cell.CellX(), cell.CellY()));
UpdateObjectVisibility(player,cell,p);
AddNotifier(player,cell,p);
if (i_data)
i_data->OnPlayerEnter(player);
@ -359,8 +340,6 @@ Map::Add(T *obj)
obj->GetViewPoint().Event_AddedToWorld(&(*grid)(cell.CellX(), cell.CellY()));
UpdateObjectVisibility(obj,cell,p);
AddNotifier(obj,cell,p);
}
void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self)
@ -953,19 +932,6 @@ void Map::UpdateObjectVisibility( WorldObject* obj, Cell cell, CellPair cellpair
cell.Visit(cellpair, player_notifier, *this, *obj, GetVisibilityDistance());
}
void Map::PlayerRelocationNotify( Player* player, Cell cell, CellPair cellpair )
{
MaNGOS::PlayerRelocationNotifier relocationNotifier(*player);
TypeContainerVisitor<MaNGOS::PlayerRelocationNotifier, GridTypeMapContainer > p2grid_relocation(relocationNotifier);
TypeContainerVisitor<MaNGOS::PlayerRelocationNotifier, WorldTypeMapContainer > p2world_relocation(relocationNotifier);
float radius = MAX_CREATURE_ATTACK_RADIUS * sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_AGGRO);
cell.Visit(cellpair, p2grid_relocation, *this, *player, radius);
cell.Visit(cellpair, p2world_relocation, *this, *player, radius);
}
void Map::SendInitSelf( Player * player )
{
DETAIL_LOG("Creating player data for himself %u", player->GetGUIDLow());