mirror of
https://github.com/mangosfour/server.git
synced 2025-12-20 16:37:04 +00:00
[7123] Cleanup in using STD's containers erase method.
Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
8171c9c61a
commit
ce384c5278
9 changed files with 23 additions and 69 deletions
|
|
@ -57,9 +57,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)
|
||||
|
|
@ -174,16 +172,22 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue