2 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOS_GRIDNOTIFIERS_H
20 #define MANGOS_GRIDNOTIFIERS_H
22 #include "ObjectGridLoader.h"
23 #include "ByteBuffer.h"
24 #include "UpdateData.h"
29 #include "DynamicObject.h"
30 #include "GameObject.h"
40 struct MANGOS_DLL_DECL PlayerNotifier
42 explicit PlayerNotifier(Player
&pl
) : i_player(pl
) {}
43 void Visit(PlayerMapType
&);
44 template<class SKIP
> void Visit(GridRefManager
<SKIP
> &) {}
48 struct MANGOS_DLL_DECL VisibleNotifier
52 UpdateDataMapType i_data_updates
;
53 Player::ClientGUIDs i_clientGUIDs
;
54 std::set
<WorldObject
*> i_visibleNow
;
56 explicit VisibleNotifier(Player
&player
) : i_player(player
),i_clientGUIDs(player
.m_clientGUIDs
) {}
57 template<class T
> void Visit(GridRefManager
<T
> &m
);
58 void Visit(PlayerMapType
&);
62 struct MANGOS_DLL_DECL VisibleChangesNotifier
64 WorldObject
&i_object
;
66 explicit VisibleChangesNotifier(WorldObject
&object
) : i_object(object
) {}
67 template<class T
> void Visit(GridRefManager
<T
> &) {}
68 void Visit(PlayerMapType
&);
71 struct MANGOS_DLL_DECL GridUpdater
75 GridUpdater(GridType
&grid
, uint32 diff
) : i_grid(grid
), i_timeDiff(diff
) {}
77 template<class T
> void updateObjects(GridRefManager
<T
> &m
)
79 for(typename GridRefManager
<T
>::iterator iter
= m
.begin(); iter
!= m
.end(); ++iter
)
80 iter
->getSource()->Update(i_timeDiff
);
83 void Visit(PlayerMapType
&m
) { updateObjects
<Player
>(m
); }
84 void Visit(CreatureMapType
&m
){ updateObjects
<Creature
>(m
); }
85 void Visit(GameObjectMapType
&m
) { updateObjects
<GameObject
>(m
); }
86 void Visit(DynamicObjectMapType
&m
) { updateObjects
<DynamicObject
>(m
); }
87 void Visit(CorpseMapType
&m
) { updateObjects
<Corpse
>(m
); }
90 struct MANGOS_DLL_DECL MessageDeliverer
93 WorldPacket
*i_message
;
95 MessageDeliverer(Player
&pl
, WorldPacket
*msg
, bool to_self
) : i_player(pl
), i_message(msg
), i_toSelf(to_self
) {}
96 void Visit(PlayerMapType
&m
);
97 template<class SKIP
> void Visit(GridRefManager
<SKIP
> &) {}
100 struct MANGOS_DLL_DECL ObjectMessageDeliverer
103 WorldPacket
*i_message
;
104 explicit ObjectMessageDeliverer(WorldObject
& obj
, WorldPacket
*msg
)
105 : i_phaseMask(obj
.GetPhaseMask()), i_message(msg
) {}
106 void Visit(PlayerMapType
&m
);
107 template<class SKIP
> void Visit(GridRefManager
<SKIP
> &) {}
110 struct MANGOS_DLL_DECL MessageDistDeliverer
113 WorldPacket
*i_message
;
117 MessageDistDeliverer(Player
&pl
, WorldPacket
*msg
, float dist
, bool to_self
, bool ownTeamOnly
) : i_player(pl
), i_message(msg
), i_dist(dist
), i_toSelf(to_self
), i_ownTeamOnly(ownTeamOnly
) {}
118 void Visit(PlayerMapType
&m
);
119 template<class SKIP
> void Visit(GridRefManager
<SKIP
> &) {}
122 struct MANGOS_DLL_DECL ObjectMessageDistDeliverer
124 WorldObject
&i_object
;
125 WorldPacket
*i_message
;
127 ObjectMessageDistDeliverer(WorldObject
&obj
, WorldPacket
*msg
, float dist
) : i_object(obj
), i_message(msg
), i_dist(dist
) {}
128 void Visit(PlayerMapType
&m
);
129 template<class SKIP
> void Visit(GridRefManager
<SKIP
> &) {}
132 struct MANGOS_DLL_DECL ObjectUpdater
135 explicit ObjectUpdater(const uint32
&diff
) : i_timeDiff(diff
) {}
136 template<class T
> void Visit(GridRefManager
<T
> &m
);
137 void Visit(PlayerMapType
&) {}
138 void Visit(CorpseMapType
&) {}
139 void Visit(CreatureMapType
&);
143 struct MANGOS_DLL_DECL ObjectAccessorNotifier
148 ObjectAccessorNotifier(T
* &obj
, uint64 id
) : i_object(obj
), i_id(id
)
153 void Visit(GridRefManager
<T
> &m
)
155 if( i_object
== NULL
)
157 GridRefManager
<T
> *iter
= m
.find(i_id
);
158 if( iter
!= m
.end() )
160 assert( iter
->second
!= NULL
);
161 i_object
= iter
->second
;
166 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
169 struct MANGOS_DLL_DECL PlayerRelocationNotifier
172 PlayerRelocationNotifier(Player
&pl
) : i_player(pl
) {}
173 template<class T
> void Visit(GridRefManager
<T
> &) {}
174 void Visit(PlayerMapType
&);
175 void Visit(CreatureMapType
&);
178 struct MANGOS_DLL_DECL CreatureRelocationNotifier
180 Creature
&i_creature
;
181 CreatureRelocationNotifier(Creature
&c
) : i_creature(c
) {}
182 template<class T
> void Visit(GridRefManager
<T
> &) {}
184 template<> void Visit(PlayerMapType
&);
188 struct MANGOS_DLL_DECL DynamicObjectUpdater
190 DynamicObject
&i_dynobject
;
192 DynamicObjectUpdater(DynamicObject
&dynobject
, Unit
* caster
) : i_dynobject(dynobject
)
195 Unit
* owner
= i_check
->GetOwner();
200 template<class T
> inline void Visit(GridRefManager
<T
> &) {}
202 template<> inline void Visit
<Player
>(PlayerMapType
&);
203 template<> inline void Visit
<Creature
>(CreatureMapType
&);
206 void VisitHelper(Unit
* target
);
209 // SEARCHERS & LIST SEARCHERS & WORKERS
211 // WorldObject searchers & workers
213 template<class Check
>
214 struct MANGOS_DLL_DECL WorldObjectSearcher
217 WorldObject
* &i_object
;
220 WorldObjectSearcher(WorldObject
const* searcher
, WorldObject
* & result
, Check
& check
)
221 : i_phaseMask(searcher
->GetPhaseMask()), i_object(result
),i_check(check
) {}
223 void Visit(GameObjectMapType
&m
);
224 void Visit(PlayerMapType
&m
);
225 void Visit(CreatureMapType
&m
);
226 void Visit(CorpseMapType
&m
);
227 void Visit(DynamicObjectMapType
&m
);
229 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
232 template<class Check
>
233 struct MANGOS_DLL_DECL WorldObjectListSearcher
236 std::list
<WorldObject
*> &i_objects
;
239 WorldObjectListSearcher(WorldObject
const* searcher
, std::list
<WorldObject
*> &objects
, Check
& check
)
240 : i_phaseMask(searcher
->GetPhaseMask()), i_objects(objects
),i_check(check
) {}
242 void Visit(PlayerMapType
&m
);
243 void Visit(CreatureMapType
&m
);
244 void Visit(CorpseMapType
&m
);
245 void Visit(GameObjectMapType
&m
);
246 void Visit(DynamicObjectMapType
&m
);
248 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
252 struct MANGOS_DLL_DECL WorldObjectWorker
257 WorldObjectWorker(WorldObject
const* searcher
, Do
const& _do
)
258 : i_phaseMask(searcher
->GetPhaseMask()), i_do(_do
) {}
260 void Visit(GameObjectMapType
&m
)
262 for(GameObjectMapType::iterator itr
=m
.begin(); itr
!= m
.end(); ++itr
)
263 if(itr
->getSource()->InSamePhase(i_phaseMask
))
264 i_do(itr
->getSource());
267 void Visit(PlayerMapType
&m
)
269 for(PlayerMapType::iterator itr
=m
.begin(); itr
!= m
.end(); ++itr
)
270 if(itr
->getSource()->InSamePhase(i_phaseMask
))
271 i_do(itr
->getSource());
273 void Visit(CreatureMapType
&m
)
275 for(CreatureMapType::iterator itr
=m
.begin(); itr
!= m
.end(); ++itr
)
276 if(itr
->getSource()->InSamePhase(i_phaseMask
))
277 i_do(itr
->getSource());
280 void Visit(CorpseMapType
&m
)
282 for(CorpseMapType::iterator itr
=m
.begin(); itr
!= m
.end(); ++itr
)
283 if(itr
->getSource()->InSamePhase(i_phaseMask
))
284 i_do(itr
->getSource());
287 void Visit(DynamicObjectMapType
&m
)
289 for(DynamicObjectMapType::iterator itr
=m
.begin(); itr
!= m
.end(); ++itr
)
290 if(itr
->getSource()->InSamePhase(i_phaseMask
))
291 i_do(itr
->getSource());
294 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
297 // Gameobject searchers
299 template<class Check
>
300 struct MANGOS_DLL_DECL GameObjectSearcher
303 GameObject
* &i_object
;
306 GameObjectSearcher(WorldObject
const* searcher
, GameObject
* & result
, Check
& check
)
307 : i_phaseMask(searcher
->GetPhaseMask()), i_object(result
),i_check(check
) {}
309 void Visit(GameObjectMapType
&m
);
311 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
314 // Last accepted by Check GO if any (Check can change requirements at each call)
315 template<class Check
>
316 struct MANGOS_DLL_DECL GameObjectLastSearcher
319 GameObject
* &i_object
;
322 GameObjectLastSearcher(WorldObject
const* searcher
, GameObject
* & result
, Check
& check
)
323 : i_phaseMask(searcher
->GetPhaseMask()), i_object(result
), i_check(check
) {}
325 void Visit(GameObjectMapType
&m
);
327 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
330 template<class Check
>
331 struct MANGOS_DLL_DECL GameObjectListSearcher
334 std::list
<GameObject
*> &i_objects
;
337 GameObjectListSearcher(WorldObject
const* searcher
, std::list
<GameObject
*> &objects
, Check
& check
)
338 : i_phaseMask(searcher
->GetPhaseMask()), i_objects(objects
), i_check(check
) {}
340 void Visit(GameObjectMapType
&m
);
342 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
347 // First accepted by Check Unit if any
348 template<class Check
>
349 struct MANGOS_DLL_DECL UnitSearcher
355 UnitSearcher(WorldObject
const* searcher
, Unit
* & result
, Check
& check
)
356 : i_phaseMask(searcher
->GetPhaseMask()), i_object(result
),i_check(check
) {}
358 void Visit(CreatureMapType
&m
);
359 void Visit(PlayerMapType
&m
);
361 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
364 // Last accepted by Check Unit if any (Check can change requirements at each call)
365 template<class Check
>
366 struct MANGOS_DLL_DECL UnitLastSearcher
372 UnitLastSearcher(WorldObject
const* searcher
, Unit
* & result
, Check
& check
)
373 : i_phaseMask(searcher
->GetPhaseMask()), i_object(result
),i_check(check
) {}
375 void Visit(CreatureMapType
&m
);
376 void Visit(PlayerMapType
&m
);
378 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
381 // All accepted by Check units if any
382 template<class Check
>
383 struct MANGOS_DLL_DECL UnitListSearcher
386 std::list
<Unit
*> &i_objects
;
389 UnitListSearcher(WorldObject
const* searcher
, std::list
<Unit
*> &objects
, Check
& check
)
390 : i_phaseMask(searcher
->GetPhaseMask()), i_objects(objects
),i_check(check
) {}
392 void Visit(PlayerMapType
&m
);
393 void Visit(CreatureMapType
&m
);
395 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
398 // Creature searchers
400 template<class Check
>
401 struct MANGOS_DLL_DECL CreatureSearcher
407 CreatureSearcher(WorldObject
const* searcher
, Creature
* & result
, Check
& check
)
408 : i_phaseMask(searcher
->GetPhaseMask()), i_object(result
),i_check(check
) {}
410 void Visit(CreatureMapType
&m
);
412 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
415 // Last accepted by Check Creature if any (Check can change requirements at each call)
416 template<class Check
>
417 struct MANGOS_DLL_DECL CreatureLastSearcher
423 CreatureLastSearcher(WorldObject
const* searcher
, Creature
* & result
, Check
& check
)
424 : i_phaseMask(searcher
->GetPhaseMask()), i_object(result
),i_check(check
) {}
426 void Visit(CreatureMapType
&m
);
428 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
431 template<class Check
>
432 struct MANGOS_DLL_DECL CreatureListSearcher
435 std::list
<Creature
*> &i_objects
;
438 CreatureListSearcher(WorldObject
const* searcher
, std::list
<Creature
*> &objects
, Check
& check
)
439 : i_phaseMask(searcher
->GetPhaseMask()), i_objects(objects
),i_check(check
) {}
441 void Visit(CreatureMapType
&m
);
443 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
448 template<class Check
>
449 struct MANGOS_DLL_DECL PlayerSearcher
455 PlayerSearcher(WorldObject
const* searcher
, Player
* & result
, Check
& check
)
456 : i_phaseMask(searcher
->GetPhaseMask()), i_object(result
),i_check(check
) {}
458 void Visit(PlayerMapType
&m
);
460 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
464 struct MANGOS_DLL_DECL PlayerWorker
469 PlayerWorker(WorldObject
const* searcher
, Do
& _do
)
470 : i_phaseMask(searcher
->GetPhaseMask()), i_do(_do
) {}
472 void Visit(PlayerMapType
&m
)
474 for(PlayerMapType::iterator itr
=m
.begin(); itr
!= m
.end(); ++itr
)
475 if(itr
->getSource()->InSamePhase(i_phaseMask
))
476 i_do(itr
->getSource());
479 template<class NOT_INTERESTED
> void Visit(GridRefManager
<NOT_INTERESTED
> &) {}
482 // CHECKS && DO classes
484 // WorldObject check classes
485 class CannibalizeObjectCheck
488 CannibalizeObjectCheck(Unit
* funit
, float range
) : i_funit(funit
), i_range(range
) {}
489 bool operator()(Player
* u
)
491 if( i_funit
->IsFriendlyTo(u
) || u
->isAlive() || u
->isInFlight() )
494 if(i_funit
->IsWithinDistInMap(u
, i_range
) )
499 bool operator()(Corpse
* u
);
500 bool operator()(Creature
* u
)
502 if( i_funit
->IsFriendlyTo(u
) || u
->isAlive() || u
->isInFlight() ||
503 (u
->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD
)==0)
506 if(i_funit
->IsWithinDistInMap(u
, i_range
) )
511 template<class NOT_INTERESTED
> bool operator()(NOT_INTERESTED
*) { return false; }
517 // WorldObject do classes
523 void operator()(Creature
* u
) const { u
->Respawn(); }
524 void operator()(GameObject
* u
) const { u
->Respawn(); }
525 void operator()(WorldObject
*) const {}
526 void operator()(Corpse
*) const {}
531 class GameObjectFocusCheck
534 GameObjectFocusCheck(Unit
const* unit
,uint32 focusId
) : i_unit(unit
), i_focusId(focusId
) {}
535 bool operator()(GameObject
* go
) const
537 if(go
->GetGOInfo()->type
!= GAMEOBJECT_TYPE_SPELL_FOCUS
)
540 if(go
->GetGOInfo()->spellFocus
.focusId
!= i_focusId
)
543 float dist
= go
->GetGOInfo()->spellFocus
.dist
;
545 return go
->IsWithinDistInMap(i_unit
, dist
);
552 // Find the nearest Fishing hole and return true only if source object is in range of hole
553 class NearestGameObjectFishingHole
556 NearestGameObjectFishingHole(WorldObject
const& obj
, float range
) : i_obj(obj
), i_range(range
) {}
557 bool operator()(GameObject
* go
)
559 if(go
->GetGOInfo()->type
== GAMEOBJECT_TYPE_FISHINGHOLE
&& go
->isSpawned() && i_obj
.IsWithinDistInMap(go
, i_range
) && i_obj
.IsWithinDistInMap(go
, go
->GetGOInfo()->fishinghole
.radius
))
561 i_range
= i_obj
.GetDistance(go
);
566 float GetLastRange() const { return i_range
; }
568 WorldObject
const& i_obj
;
572 NearestGameObjectFishingHole(NearestGameObjectFishingHole
const&);
575 // Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO)
576 class NearestGameObjectEntryInObjectRangeCheck
579 NearestGameObjectEntryInObjectRangeCheck(WorldObject
const& obj
,uint32 entry
, float range
) : i_obj(obj
), i_entry(entry
), i_range(range
) {}
580 bool operator()(GameObject
* go
)
582 if(go
->GetEntry() == i_entry
&& i_obj
.IsWithinDistInMap(go
, i_range
))
584 i_range
= i_obj
.GetDistance(go
); // use found GO range as new range limit for next check
589 float GetLastRange() const { return i_range
; }
591 WorldObject
const& i_obj
;
595 // prevent clone this object
596 NearestGameObjectEntryInObjectRangeCheck(NearestGameObjectEntryInObjectRangeCheck
const&);
599 class GameObjectWithDbGUIDCheck
602 GameObjectWithDbGUIDCheck(WorldObject
const& obj
,uint32 db_guid
) : i_obj(obj
), i_db_guid(db_guid
) {}
603 bool operator()(GameObject
const* go
) const
605 return go
->GetDBTableGUIDLow() == i_db_guid
;
608 WorldObject
const& i_obj
;
614 class AnyUnfriendlyUnitInObjectRangeCheck
617 AnyUnfriendlyUnitInObjectRangeCheck(WorldObject
const* obj
, Unit
const* funit
, float range
) : i_obj(obj
), i_funit(funit
), i_range(range
) {}
618 bool operator()(Unit
* u
)
620 if(u
->isAlive() && i_obj
->IsWithinDistInMap(u
, i_range
) && !i_funit
->IsFriendlyTo(u
))
626 WorldObject
const* i_obj
;
631 class AnyFriendlyUnitInObjectRangeCheck
634 AnyFriendlyUnitInObjectRangeCheck(WorldObject
const* obj
, Unit
const* funit
, float range
) : i_obj(obj
), i_funit(funit
), i_range(range
) {}
635 bool operator()(Unit
* u
)
637 if(u
->isAlive() && i_obj
->IsWithinDistInMap(u
, i_range
) && i_funit
->IsFriendlyTo(u
))
643 WorldObject
const* i_obj
;
648 class AnyUnitInObjectRangeCheck
651 AnyUnitInObjectRangeCheck(WorldObject
const* obj
, float range
) : i_obj(obj
), i_range(range
) {}
652 bool operator()(Unit
* u
)
654 if(u
->isAlive() && i_obj
->IsWithinDistInMap(u
, i_range
))
660 WorldObject
const* i_obj
;
664 // Success at unit in range, range update for next check (this can be use with UnitLastSearcher to find nearest unit)
665 class NearestAttackableUnitInObjectRangeCheck
668 NearestAttackableUnitInObjectRangeCheck(WorldObject
const* obj
, Unit
const* funit
, float range
) : i_obj(obj
), i_funit(funit
), i_range(range
) {}
669 bool operator()(Unit
* u
)
671 if( u
->isTargetableForAttack() && i_obj
->IsWithinDistInMap(u
, i_range
) &&
672 !i_funit
->IsFriendlyTo(u
) && u
->isVisibleForOrDetect(i_funit
,false) )
674 i_range
= i_obj
->GetDistance(u
); // use found unit range as new range limit for next check
681 WorldObject
const* i_obj
;
685 // prevent clone this object
686 NearestAttackableUnitInObjectRangeCheck(NearestAttackableUnitInObjectRangeCheck
const&);
689 class AnyAoETargetUnitInObjectRangeCheck
692 AnyAoETargetUnitInObjectRangeCheck(WorldObject
const* obj
, Unit
const* funit
, float range
)
693 : i_obj(obj
), i_funit(funit
), i_range(range
)
695 Unit
const* check
= i_funit
;
696 Unit
const* owner
= i_funit
->GetOwner();
699 i_targetForPlayer
= ( check
->GetTypeId()==TYPEID_PLAYER
);
701 bool operator()(Unit
* u
)
703 // Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
704 if (!u
->isTargetableForAttack())
706 if(u
->GetTypeId()==TYPEID_UNIT
&& ((Creature
*)u
)->isTotem())
709 if(( i_targetForPlayer
? !i_funit
->IsFriendlyTo(u
) : i_funit
->IsHostileTo(u
) )&& i_obj
->IsWithinDistInMap(u
, i_range
))
715 bool i_targetForPlayer
;
716 WorldObject
const* i_obj
;
721 struct AnyDeadUnitCheck
723 bool operator()(Unit
* u
) { return !u
->isAlive(); }
726 struct AnyStealthedCheck
728 bool operator()(Unit
* u
) { return u
->GetVisibility()==VISIBILITY_GROUP_STEALTH
; }
733 class InAttackDistanceFromAnyHostileCreatureCheck
736 explicit InAttackDistanceFromAnyHostileCreatureCheck(Unit
* funit
) : i_funit(funit
) {}
737 bool operator()(Creature
* u
)
739 if(u
->isAlive() && u
->IsHostileTo(i_funit
) && i_funit
->IsWithinDistInMap(u
, u
->GetAttackDistance(i_funit
)))
748 class AnyAssistCreatureInRangeCheck
751 AnyAssistCreatureInRangeCheck(Unit
* funit
, Unit
* enemy
, float range
)
752 : i_funit(funit
), i_enemy(enemy
), i_range(range
)
755 bool operator()(Creature
* u
)
760 if ( !u
->CanAssistTo(i_funit
, i_enemy
) )
764 if( !i_funit
->IsWithinDistInMap(u
, i_range
) )
767 // only if see assisted creature
768 if( !i_funit
->IsWithinLOSInMap(u
) )
779 // Success at unit in range, range update for next check (this can be use with CreatureLastSearcher to find nearest creature)
780 class NearestCreatureEntryWithLiveStateInObjectRangeCheck
783 NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject
const& obj
,uint32 entry
, bool alive
, float range
)
784 : i_obj(obj
), i_entry(entry
), i_alive(alive
), i_range(range
) {}
786 bool operator()(Creature
* u
)
788 if(u
->GetEntry() == i_entry
&& u
->isAlive()==i_alive
&& i_obj
.IsWithinDistInMap(u
, i_range
))
790 i_range
= i_obj
.GetDistance(u
); // use found unit range as new range limit for next check
795 float GetLastRange() const { return i_range
; }
797 WorldObject
const& i_obj
;
802 // prevent clone this object
803 NearestCreatureEntryWithLiveStateInObjectRangeCheck(NearestCreatureEntryWithLiveStateInObjectRangeCheck
const&);
806 class AnyPlayerInObjectRangeCheck
809 AnyPlayerInObjectRangeCheck(WorldObject
const* obj
, float range
) : i_obj(obj
), i_range(range
) {}
810 bool operator()(Player
* u
)
812 if(u
->isAlive() && i_obj
->IsWithinDistInMap(u
, i_range
))
818 WorldObject
const* i_obj
;
823 template<> void PlayerRelocationNotifier::Visit
<Creature
>(CreatureMapType
&);
824 template<> void PlayerRelocationNotifier::Visit
<Player
>(PlayerMapType
&);
825 template<> void CreatureRelocationNotifier::Visit
<Player
>(PlayerMapType
&);
826 template<> void CreatureRelocationNotifier::Visit
<Creature
>(CreatureMapType
&);
827 template<> inline void DynamicObjectUpdater::Visit
<Creature
>(CreatureMapType
&);
828 template<> inline void DynamicObjectUpdater::Visit
<Player
>(PlayerMapType
&);