From e9d6f1b23a14ee50437b5949deca7ae97b388bb2 Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 21 Nov 2008 15:41:18 -0600 Subject: *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 --- src/game/ObjectAccessor.cpp | 44 +++----------------------------------------- 1 file changed, 3 insertions(+), 41 deletions(-) (limited to 'src/game/ObjectAccessor.cpp') diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 8d9f3f63fc2..75f0d697771 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -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::MapType& playerMap = HashMapHolder::GetContainer(); for(HashMapHolder::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::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) { -- cgit v1.2.3