diff options
author | Spp- <u84280@epreinf21.(none)> | 2011-07-12 13:30:33 +0200 |
---|---|---|
committer | Spp- <u84280@epreinf21.(none)> | 2011-07-12 13:30:33 +0200 |
commit | f37a2030c00571aa882345843b68ae2bb9db7976 (patch) | |
tree | e9df93c547142225851c73179cd2c5ae593c413f | |
parent | f441a159b1305647f1304ed22d30fe4818ec1358 (diff) |
Core: Minor optimization in AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck
-rwxr-xr-x | src/server/game/Grids/Notifiers/GridNotifiers.h | 15 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 80cebaf413f..e64db7cb065 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -90,14 +90,14 @@ namespace Trinity void Visit(PlayerMapType &); }; - struct AIRelocationNotifier - { + struct AIRelocationNotifier + { Unit &i_unit; bool isCreature; explicit AIRelocationNotifier(Unit &unit) : i_unit(unit), isCreature(unit.GetTypeId() == TYPEID_UNIT) {} template<class T> void Visit(GridRefManager<T> &) {} void Visit(CreatureMapType &); - }; + }; struct GridUpdater { @@ -824,20 +824,19 @@ namespace Trinity class AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck { public: - AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) - : i_obj(obj), i_funit(funit), i_range(range) {} + AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck(Unit const* funit, float range) + : i_funit(funit), i_range(range) {} - bool operator()(Unit* u) + bool operator()(const Unit* u) { return u->isAlive() - && i_obj->IsWithinDistInMap(u, i_range) + && i_funit->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u) && i_funit->canAttack(u) && u->GetCreatureType() != CREATURE_TYPE_CRITTER && i_funit->canSeeOrDetect(u); } private: - WorldObject const* i_obj; Unit const* i_funit; float i_range; }; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index cb89a04bca6..17940a3b16a 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5686,7 +5686,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - Trinity::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck u_check(target, target, radius); + Trinity::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck u_check(target, radius); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck> checker(target, targets, u_check); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); |