diff options
author | megamage <none@none> | 2009-01-20 19:59:43 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-01-20 19:59:43 -0600 |
commit | 68c0bcd06980cbc5babc842d990d1b8eb564e388 (patch) | |
tree | 0dbed1b4453a0361cecd2608325107902696ab22 /src/game/ObjectAccessor.h | |
parent | 1bbd8968615e4b89fe4549bd1cccd089f6ad38f0 (diff) |
*Update to Mangos 7125.
--HG--
branch : trunk
Diffstat (limited to 'src/game/ObjectAccessor.h')
-rw-r--r-- | src/game/ObjectAccessor.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 3cb743be573..5d5568c536f 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -59,9 +59,7 @@ class HashMapHolder static void Remove(T* o) { Guard guard(i_lock); - typename MapType::iterator itr = m_objectMap.find(o->GetGUID()); - if (itr != m_objectMap.end()) - m_objectMap.erase(itr); + m_objectMap.erase(o->GetGUID()); } static T* Find(uint64 guid) @@ -176,16 +174,22 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor HashMapHolder<Player>::Remove(pl); Guard guard(i_updateGuard); - - std::set<Object *>::iterator iter2 = std::find(i_objects.begin(), i_objects.end(), (Object *)pl); - if( iter2 != i_objects.end() ) - i_objects.erase(iter2); + i_objects.erase((Object *)pl); } void SaveAllPlayers(); - void AddUpdateObject(Object *obj); - void RemoveUpdateObject(Object *obj); + void AddUpdateObject(Object *obj) + { + Guard guard(i_updateGuard); + i_objects.insert(obj); + } + + void RemoveUpdateObject(Object *obj) + { + Guard guard(i_updateGuard); + i_objects.erase( obj ); + } void Update(uint32 diff); void UpdatePlayers(uint32 diff); |