PlayerPointer Channel::GetPlayer(const char* name) { if (m_area_dependant) { Player* plr = sObjectAccessor.FindPlayerByNameNotInWorld(name); return PlayerPointer(plr ? new PlayerWrapper<Player>(plr) : NULL); } MasterPlayer* plr = sObjectAccessor.FindMasterPlayer(name); return PlayerPointer(plr ? new PlayerWrapper<MasterPlayer>(plr) : NULL); }
PlayerPointer Channel::GetPlayer(ObjectGuid guid) { if (m_area_dependant) { Player* plr = sObjectAccessor.FindPlayerNotInWorld(guid); return PlayerPointer(plr ? new PlayerWrapper<Player>(plr) : NULL); } MasterPlayer* plr = sObjectAccessor.FindMasterPlayer(guid); return PlayerPointer(plr ? new PlayerWrapper<MasterPlayer>(plr) : NULL); }
void DnDController::user_add_resp (DnDClient*, Uuid uuid, const QString& name) { bool is_me = _player_map.isEmpty (); _player_map.insert (uuid, PlayerPointer (new Player (uuid, name, is_me))); _player_map[uuid]->serialize (); if (is_me) _me = _player_map[uuid]; player_connected (_player_map[uuid]); }
PlayerPointer DnDController::lookup_player (const QString& name) { return [&] () -> PlayerPointer { auto b = _player_map.begin (); auto e = _player_map.end (); for (; b != e; ++b) { if ((*b)->get_name () == name) return *b; } return PlayerPointer (); } (); }