AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
PlayerNameMapHolder Namespace Reference

Typedefs

typedef std::unordered_map< std::string, Player * > MapType
 

Functions

void Insert (Player *p)
 
void Remove (Player *p)
 
void RemoveByName (std::string const &name)
 
PlayerFind (std::string const &name)
 

Variables

static MapType PlayerNameMap
 

Typedef Documentation

◆ MapType

typedef std::unordered_map<std::string, Player*> PlayerNameMapHolder::MapType

Function Documentation

◆ Find()

Player * PlayerNameMapHolder::Find ( std::string const &  name)
107 {
108 std::string charName(name);
109 if (!normalizePlayerName(charName))
110 return nullptr;
111
112 auto itr = PlayerNameMap.find(charName);
113 return (itr != PlayerNameMap.end()) ? itr->second : nullptr;
114 }
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:262
static MapType PlayerNameMap
Definition: ObjectAccessor.cpp:89

References normalizePlayerName(), and PlayerNameMap.

Referenced by ObjectAccessor::FindPlayerByName().

◆ Insert()

void PlayerNameMapHolder::Insert ( Player p)
92 {
93 PlayerNameMap[p->GetName()] = p;
94 }
std::string const & GetName() const
Definition: Object.h:446

References WorldObject::GetName(), and PlayerNameMap.

Referenced by ObjectAccessor::AddObject(), and ObjectAccessor::UpdatePlayerNameMapReference().

◆ Remove()

void PlayerNameMapHolder::Remove ( Player p)
97 {
98 PlayerNameMap.erase(p->GetName());
99 }

References WorldObject::GetName(), and PlayerNameMap.

Referenced by ObjectAccessor::RemoveObject().

◆ RemoveByName()

void PlayerNameMapHolder::RemoveByName ( std::string const &  name)
102 {
103 PlayerNameMap.erase(name);
104 }

References PlayerNameMap, and RemoveByName().

Referenced by RemoveByName(), and ObjectAccessor::UpdatePlayerNameMapReference().

Variable Documentation

◆ PlayerNameMap

MapType PlayerNameMapHolder::PlayerNameMap
static

Referenced by Find(), Insert(), Remove(), and RemoveByName().