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)
128 {
129 std::string charName(name);
130 if (!normalizePlayerName(charName))
131 return nullptr;
132
133 auto itr = PlayerNameMap.find(charName);
134 return (itr != PlayerNameMap.end()) ? itr->second : nullptr;
135 }
bool normalizePlayerName(std::string &name)
Definition ObjectMgr.cpp:209
static MapType PlayerNameMap
Definition ObjectAccessor.cpp:110

References normalizePlayerName(), and PlayerNameMap.

Referenced by ObjectAccessor::FindPlayerByName().

◆ Insert()

void PlayerNameMapHolder::Insert ( Player p)
113 {
114 PlayerNameMap[p->GetName()] = p;
115 }
std::string const & GetName() const
Definition Object.h:529

References WorldObject::GetName(), and PlayerNameMap.

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

◆ Remove()

void PlayerNameMapHolder::Remove ( Player p)
118 {
119 PlayerNameMap.erase(p->GetName());
120 }

References WorldObject::GetName(), and PlayerNameMap.

Referenced by ObjectAccessor::RemoveObject().

◆ RemoveByName()

void PlayerNameMapHolder::RemoveByName ( std::string const &  name)
123 {
124 PlayerNameMap.erase(name);
125 }

References PlayerNameMap, and RemoveByName().

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

Variable Documentation

◆ PlayerNameMap

MapType PlayerNameMapHolder::PlayerNameMap
static

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