*Do not let Illidan cast parasite on Akama.
*Some cell visit update. --HG-- branch : trunk
This commit is contained in:
@@ -115,20 +115,8 @@ void DynamicObject::Update(uint32 p_time)
|
||||
|
||||
if(m_updateTimer < p_time)
|
||||
{
|
||||
CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::DynamicObjectUpdater notifier(*this,caster);
|
||||
|
||||
TypeContainerVisitor<Trinity::DynamicObjectUpdater, WorldTypeMapContainer > world_object_notifier(notifier);
|
||||
TypeContainerVisitor<Trinity::DynamicObjectUpdater, GridTypeMapContainer > grid_object_notifier(notifier);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, world_object_notifier, *GetMap());
|
||||
cell_lock->Visit(cell_lock, grid_object_notifier, *GetMap());
|
||||
|
||||
GetMap()->VisitAll(GetPositionX(), GetPositionY(), GetRadius(), notifier);
|
||||
m_updateTimer = 500; // is this official-like?
|
||||
}else m_updateTimer -= p_time;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
+2
-20
@@ -640,34 +640,16 @@ void AreaAura::Update(uint32 diff)
|
||||
}
|
||||
case AREA_AURA_FRIEND:
|
||||
{
|
||||
CellPair p(Trinity::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(caster, owner, m_radius);
|
||||
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(targets, u_check);
|
||||
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster));
|
||||
cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster));
|
||||
caster->GetMap()->VisitAll(caster->GetPositionX(), caster->GetPositionY(), m_radius, searcher);
|
||||
break;
|
||||
}
|
||||
case AREA_AURA_ENEMY:
|
||||
{
|
||||
CellPair p(Trinity::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(caster, owner, m_radius); // No GetCharmer in searcher
|
||||
Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(targets, u_check);
|
||||
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster));
|
||||
cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster));
|
||||
caster->GetMap()->VisitAll(caster->GetPositionX(), caster->GetPositionY(), m_radius, searcher);
|
||||
break;
|
||||
}
|
||||
case AREA_AURA_OWNER:
|
||||
|
||||
Reference in New Issue
Block a user