aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp4
-rw-r--r--src/game/DynamicObject.cpp14
-rw-r--r--src/game/ObjectAccessor.cpp73
-rw-r--r--src/game/SpellAuras.cpp22
4 files changed, 4 insertions, 109 deletions
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
index 2bdd000e340..bd5b8467608 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
@@ -778,9 +778,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
case EVENT_PARASITIC_SHADOWFIEND:
{
- Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1, 200, true);
- if(!target) target = m_creature->getVictim();
- if(target)
+ if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1, 200, true))
m_creature->CastSpell(target, SPELL_PARASITIC_SHADOWFIEND, true);
Timer[EVENT_PARASITIC_SHADOWFIEND] = 35000 + rand()%10000;
}break;
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
index 18e1d4ee720..dcac7f08a9b 100644
--- a/src/game/DynamicObject.cpp
+++ b/src/game/DynamicObject.cpp
@@ -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;
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index 605d9827a01..7d51c4c0291 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -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);
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 325b686c6b9..46e0dca47cb 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -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: