diff options
author | XTZGZoReX <none@none> | 2009-03-18 21:04:47 +0100 |
---|---|---|
committer | XTZGZoReX <none@none> | 2009-03-18 21:04:47 +0100 |
commit | ae65d36bb4ecca988c5635f493b5f957b51c5870 (patch) | |
tree | 60d36172ffb1e5646bc00e7be4326284bd02cdec /src/game/ObjectAccessor.h | |
parent | ced575a3f3b458191273f0baa1d0761ff6aa31db (diff) |
* Implemented new ObjectAccessor functions: GetCreatures, GetUnits, GetGameObjects, and GetWorldObjects. These can be used for loopong over objects in the world.
* Note: GetWorldObjects is (probably) heavy and should be used very sparingly. Always use the function corresponding to the type of object you're looping over.
--HG--
branch : trunk
Diffstat (limited to 'src/game/ObjectAccessor.h')
-rw-r--r-- | src/game/ObjectAccessor.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index fea2331695c..218d1d91995 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -154,9 +154,30 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor Player* FindPlayerByName(const char *name) ; - HashMapHolder<Player>::MapType& GetPlayers() - { - return HashMapHolder<Player>::GetContainer(); + HashMapHolder<Player>::MapType& GetPlayers()
+ {
+ return HashMapHolder<Player>::GetContainer();
+ }
+
+ HashMapHolder<Creature>::MapType& GetCreatures()
+ {
+ return HashMapHolder<Creature>::GetContainer();
+ }
+
+ HashMapHolder<Unit>::MapType& GetUnits()
+ {
+ return HashMapHolder<Unit>::GetContainer();
+ }
+
+ HashMapHolder<GameObject>::MapType& GetGameObjects()
+ {
+ return HashMapHolder<GameObject>::GetContainer();
+ }
+
+ // note: possibly very heavy
+ HashMapHolder<WorldObject>::MapType& GetWorldObjects()
+ {
+ return HashMapHolder<WorldObject>::GetContainer();
} template<class T> void AddObject(T *object) |