mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
*Move object update from objectaccessor to map
*Move activeobject list from objectaccessor to map *Open grid for all active creatures (previously only for possessed ones) --HG-- branch : trunk
This commit is contained in:
@@ -486,25 +486,11 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid)
|
||||
return bones;
|
||||
}
|
||||
|
||||
void
|
||||
ObjectAccessor::AddActiveObject( WorldObject * obj )
|
||||
{
|
||||
i_activeobjects.insert(obj);
|
||||
}
|
||||
|
||||
void
|
||||
ObjectAccessor::RemoveActiveObject( WorldObject * obj )
|
||||
{
|
||||
i_activeobjects.erase(obj);
|
||||
}
|
||||
|
||||
void
|
||||
ObjectAccessor::Update(uint32 diff)
|
||||
{
|
||||
|
||||
{
|
||||
/* {
|
||||
//Player update now in MapManager -> UpdatePlayers
|
||||
/*
|
||||
// player update might remove the player from grid, and that causes crashes. We HAVE to update players first, and then the active objects.
|
||||
HashMapHolder<Player>::MapType& playerMap = HashMapHolder<Player>::GetContainer();
|
||||
for(HashMapHolder<Player>::MapType::iterator iter = playerMap.begin(); iter != playerMap.end(); ++iter)
|
||||
@@ -513,7 +499,7 @@ ObjectAccessor::Update(uint32 diff)
|
||||
{
|
||||
iter->second->Update(diff);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// TODO: move this to Map::Update
|
||||
// clone the active object list, because update might remove from it
|
||||
@@ -574,7 +560,7 @@ ObjectAccessor::Update(uint32 diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
UpdateDataMapType update_players;
|
||||
{
|
||||
@@ -608,30 +594,6 @@ ObjectAccessor::UpdatePlayers(uint32 diff)
|
||||
iter->second->Update(diff);
|
||||
}
|
||||
|
||||
bool
|
||||
ObjectAccessor::ActiveObjectsNearGrid(uint32 x, uint32 y, uint32 m_id, uint32 i_id) const
|
||||
{
|
||||
CellPair cell_min(x*MAX_NUMBER_OF_CELLS, y*MAX_NUMBER_OF_CELLS);
|
||||
CellPair cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS);
|
||||
cell_min << 2;
|
||||
cell_min -= 2;
|
||||
cell_max >> 2;
|
||||
cell_max += 2;
|
||||
|
||||
for(std::set<WorldObject*>::const_iterator itr = i_activeobjects.begin(); itr != i_activeobjects.end(); ++itr)
|
||||
{
|
||||
if( m_id != (*itr)->GetMapId() || i_id != (*itr)->GetInstanceId() )
|
||||
continue;
|
||||
|
||||
CellPair p = Trinity::ComputeCellPair((*itr)->GetPositionX(), (*itr)->GetPositionY());
|
||||
if( (cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
|
||||
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ObjectAccessor::WorldObjectChangeAccumulator::Visit(PlayerMapType &m)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user