* 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
This commit is contained in:
XTZGZoReX
2009-03-18 21:04:47 +01:00
parent ced575a3f3
commit ae65d36bb4
+21
View File
@@ -159,6 +159,27 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor
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)
{
HashMapHolder<T>::Insert(object);