当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerList::clear方法代码示例

本文整理汇总了C++中PlayerList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerList::clear方法的具体用法?C++ PlayerList::clear怎么用?C++ PlayerList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerList的用法示例。


在下文中一共展示了PlayerList::clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RemoveOfflinePlayers

bool LfgGroup::RemoveOfflinePlayers()  // Return true if group is empty after check
{
    sLfgMgr.LfgLog("Remove Offline %u, premade %u", GetId(), premadePlayers.empty() ? 0 : 1);
    if (m_memberSlots.empty())
    {
        sLfgMgr.LfgLog("Group %u add to delete", GetId());
        sLfgMgr.AddGroupToDelete(this);
        return true;
    }
    PlayerList toRemove;
    for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
    {
        sLfgMgr.LfgLog("guid %u", citr->guid);
        Player *plr = sObjectMgr.GetPlayer(citr->guid);
        if (!plr || (!plr->GetSession() && !plr->IsBeingTeleported()) ||
           (plr->GetGroup() && plr->GetGroup() != this && plr->GetGroup()->isLfgGroup() &&
           ((LfgGroup*)plr->GetGroup())->IsInDungeon()))
        {
            sLfgMgr.LfgLog("Add to remove");
            toRemove.insert(citr->guid);
        }
    }
    for(PlayerList::iterator itr = toRemove.begin(); itr != toRemove.end(); ++itr)
    {
        sLfgMgr.LfgLog("Check for premade %u", *itr);
        PlayerList::iterator premade = premadePlayers.find(*itr);
        if(premade != premadePlayers.end())
        {
            sLfgMgr.LfgLog("premade yes");
            for(PlayerList::iterator prm = premadePlayers.begin(); prm != premadePlayers.end(); ++prm)
            {
                Player *plr = sObjectMgr.GetPlayer(*prm);
                if(!plr || !plr->GetSession())
                    continue;
                Group* group = plr->GetGroup();
                if(group)
                {
                    sLfgMgr.RemoveFromQueue(plr, false);
                    return true;
                }
            }
            for(PlayerList::iterator prm = premadePlayers.begin(); prm != premadePlayers.end(); ++prm)
                RemoveMember(*prm, 0);
        }
    }
    for(PlayerList::iterator itr = toRemove.begin(); itr != toRemove.end(); ++itr)
    {
        sLfgMgr.LfgLog("Remove %u", *itr);
        RemoveMember(*itr, 0);
    }
    toRemove.clear();
    //flush empty group
    if (GetMembersCount() == 0)
    {
        sLfgMgr.LfgLog("Group %u add to delete 2", GetId());
        sLfgMgr.AddGroupToDelete(this);
        return true;
    }
    return false;
}
开发者ID:Tasssadar,项目名称:catcore,代码行数:60,代码来源:LfgGroup.cpp

示例2: stopAll

void QBSoundWin::stopAll()
{
//printf("stopAll\n");
	QBSoundLocker locker(&mMutex);
#ifdef __USE_OGG_VORBIS__
  {
    PlayerList::iterator it = streamTrack.begin();
    while(it != streamTrack.end()) {
      delete (*it).second;
      ++it;
    }
    streamTrack.clear();
  }
  {
    EffectList::iterator it = sharedList().begin();
    while(it != sharedList().end())
    {
      delete (*it).second;
      ++it;
    }
    sharedList().clear();
  }
#endif
	return QBSound::stopAll();
}
开发者ID:yamagame,项目名称:PicoPicoGameEngine,代码行数:25,代码来源:QBSoundWin.cpp

示例3: streamReset

void QBSoundMac::streamReset()
{
	QBSoundLocker locker(&mMutex,"streamReset");
  streamTrack.clear();
//  PlayerList::iterator it = streamTrack.begin();
//  while(it != streamTrack.end()) {
//    ++it;
//  }
}
开发者ID:yamagame,项目名称:PicoPicoGameEngine,代码行数:9,代码来源:QBSoundMac.cpp

示例4: SelectRandomDungeon

bool LfgGroup::SelectRandomDungeon()
{
    m_originalInfo = m_dungeonInfo;
    m_lfgFlags |= LFG_GRP_RANDOM;
    LfgLocksMap *groupLocks = GetLocksList();
    std::vector<LFGDungeonEntry const*> options;
    LFGDungeonEntry const *currentRow = NULL;
    //Possible dungeons
    LfgDungeonList* list = sLfgMgr.GetRandomOptions(m_dungeonInfo->ID);
    for(LfgDungeonList::iterator itr = list->begin(); itr != list->end(); ++itr)
        options.push_back(*itr);

    //And now get only without locks
    for(LfgLocksMap::iterator itr = groupLocks->begin(); itr != groupLocks->end(); ++itr)
    {
        for(LfgLocksList::iterator itr2 = itr->second->begin(); itr2 != itr->second->end(); ++itr2)
        {
            for(std::vector<LFGDungeonEntry const*>::iterator itrDung = options.begin(); itrDung != options.end(); ++itrDung)
            {
                if ((*itrDung)->ID != (*itr2)->dungeonInfo->ID)
                    continue;
                DungeonInfo* dungeonInfo = sLfgMgr.GetDungeonInfo((*itr2)->dungeonInfo->ID);
                if (dungeonInfo->locked || (*itr2)->lockType != LFG_LOCKSTATUS_RAID_LOCKED)
                {
                    options.erase(itrDung);
                    break;
                }
            }
        }
    }
    //This should not happen
    if (options.empty())
    {
        PlayerList toRemove;
        for(member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
        {
            Player *plr = sObjectMgr.GetPlayer(itr->guid);
            if (!plr)
                continue;
            sLfgMgr.SendLfgUpdatePlayer(plr, LFG_UPDATETYPE_GROUP_DISBAND);
            sLog.outError("LfgMgr: Cannot find any random dungeons for player %s", plr->GetName());
            plr->GetSession()->SendNotification("Cannot find any random dungeons for this group, you have to find new group. We are sorry");
            toRemove.insert(plr->GetGUID());     
        }
        for(PlayerList::iterator itr = toRemove.begin(); itr != toRemove.end(); ++itr)
            RemoveMember(*itr, 0);
        toRemove.clear();
        sLfgMgr.AddGroupToDelete(this);
        return false;
    }
    //Select dungeon, there should be also bind check
    uint32 tmp = time(NULL)%options.size();
    m_dungeonInfo = options[tmp];
    return true;
}
开发者ID:Tasssadar,项目名称:catcore,代码行数:55,代码来源:LfgGroup.cpp

示例5: close_comms

void close_comms()
{
  // Disconnect players
  for (PlayerListIterator i = playerList.begin(); i != playerList.end(); ++i) {
    if ((*i)->socket != NO_SOCKET) {
      close((*i)->socket);
      delete (*i);
    }
  }
  playerList.clear();

  // Disconnect irc
  if (ircSocket != NO_SOCKET) {
    close(ircSocket);
  }
}
开发者ID:JoelHough,项目名称:uMUD,代码行数:16,代码来源:umud_bot.cpp

示例6: stopAll

void QBSoundMac::stopAll()
{
	QBSoundLocker locker(&mMutex,"stopAll");
#ifdef __USE_OGG_VORBIS__
  {
    PlayerList::iterator it = streamTrack.begin();
    while(it != streamTrack.end()) {
      delete (*it).second;
      ++it;
    }
    streamTrack.clear();
  }
  {
    EffectList::iterator it = effectTrack.begin();
    while(it != effectTrack.end())
    {
      delete (*it).second;
      ++it;
    }
    effectTrack.clear();
  }
#endif
	return QBSound::stopAll();
}
开发者ID:yamagame,项目名称:PicoPicoGameEngine,代码行数:24,代码来源:QBSoundMac.cpp

示例7: streamReset

void QBSoundWin::streamReset()
{
	QBSoundLocker locker(&mMutex,"streamReset");
  streamTrack.clear();
}
开发者ID:yamagame,项目名称:PicoPicoGameEngine,代码行数:5,代码来源:QBSoundWin.cpp


注:本文中的PlayerList::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。