示例#1
0
文件: Channel.cpp 项目: Maduse/server
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);
}
示例#2
0
文件: Channel.cpp 项目: Maduse/server
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);
}
示例#3
0
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]);
}
示例#4
0
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 ();
  } ();
}