*Do not let Illidan cast parasite on Akama.

*Some cell visit update.

--HG--
branch : trunk
This commit is contained in:
megamage committed 2008-12-13 10:50:45 -06:00
1 parent fc75674217
commit 32dc92b2cd
4 files changed
+4 -109

No files matched your search

-73
View File
@@ -488,79 +488,6 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid)
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)
{
if(iter->second->IsInWorld())
{
iter->second->Update(diff);
}
}
// TODO: move this to Map::Update
// clone the active object list, because update might remove from it
std::set<WorldObject *> activeobjects(i_activeobjects);
std::set<WorldObject *>::iterator itr, next;
for(itr = activeobjects.begin(); itr != activeobjects.end(); itr = next)
{
next = itr;
++next;
if((*itr)->IsInWorld())
(*itr)->GetMap()->resetMarkedCells();
else
activeobjects.erase(itr);
}
Map *map;
Trinity::ObjectUpdater updater(diff);
// for creature
TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater);
// for pets
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater);
for(itr = activeobjects.begin(); itr != activeobjects.end(); ++itr)
{
WorldObject *obj = (*itr);
map = obj->GetMap();
CellPair standing_cell(Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()));
// Check for correctness of standing_cell, it also avoids problems with update_cell
if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
continue;
// the overloaded operators handle range checking
// so ther's no need for range checking inside the loop
CellPair begin_cell(standing_cell), end_cell(standing_cell);
begin_cell << 1; begin_cell -= 1; // upper left
end_cell >> 1; end_cell += 1; // lower right
for(uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; x++)
{
for(uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; y++)
{
uint32 cell_id = (y * TOTAL_NUMBER_OF_CELLS_PER_MAP) + x;
if( !map->isCellMarked(cell_id) )
{
CellPair cell_pair(x,y);
map->markCell(cell_id);
Cell cell(cell_pair);
cell.data.Part.reserved = CENTER_DISTRICT;
cell.SetNoCreate();
CellLock<NullGuard> cell_lock(cell, cell_pair);
cell_lock->Visit(cell_lock, grid_object_update, *map);
cell_lock->Visit(cell_lock, world_object_update, *map);
}
}
}
}
}*/
UpdateDataMapType update_players;
{
Guard guard(i_updateGuard);