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)
104 {
105 std::string charName(name);
106 if (!normalizePlayerName(charName))
107 return nullptr;
108
109 auto itr = PlayerNameMap.find(charName);
110 return (itr != PlayerNameMap.end()) ? itr->second : nullptr;
111 }
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:208
static MapType PlayerNameMap
Definition: ObjectAccessor.cpp:86

References normalizePlayerName(), and PlayerNameMap.

Referenced by ObjectAccessor::FindPlayerByName().

◆ Insert()

void PlayerNameMapHolder::Insert ( Player p)
89 {
90 PlayerNameMap[p->GetName()] = p;
91 }
std::string const & GetName() const
Definition: Object.h:463

References WorldObject::GetName(), and PlayerNameMap.

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

◆ Remove()

void PlayerNameMapHolder::Remove ( Player p)
94 {
95 PlayerNameMap.erase(p->GetName());
96 }

References WorldObject::GetName(), and PlayerNameMap.

Referenced by ObjectAccessor::RemoveObject().

◆ RemoveByName()

void PlayerNameMapHolder::RemoveByName ( std::string const &  name)
99 {
100 PlayerNameMap.erase(name);
101 }

References PlayerNameMap, and RemoveByName().

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

Variable Documentation

◆ PlayerNameMap

MapType PlayerNameMapHolder::PlayerNameMap
static

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