本文整理汇总了C++中PlayerList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerList::begin方法的具体用法?C++ PlayerList::begin怎么用?C++ PlayerList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerList
的用法示例。
在下文中一共展示了PlayerList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: refreshTooltips
void MyAvatarLabel::refreshTooltips()
{
boost::shared_ptr<Game> currentGame = myW->myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int seatPlace;
PlayerList seatsList = currentGame->getSeatsList();
for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) {
if((*it_c)->getMyStayOnTableStatus() == TRUE || (*it_c)->getMyActiveStatus()) {
bool computerPlayer = false;
if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) {
computerPlayer = true;
}
if(!computerPlayer && getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str()))!="" && seatPlace!=0) {
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText(QString("<a style='text-decoration: none; color: #"+myW->getMyGameTableStyle()->getPlayerInfoHintTextColor()+"; font-size: 14px; font-weight: bold; font-family:serif;' href=\'")+QString::fromUtf8((*it_c)->getMyName().c_str())+"\'>i</a>");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip( getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str())) );
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip( getPlayerTip(QString::fromUtf8((*it_c)->getMyName().c_str())) );
} else {
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText("");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip("");
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip("");
}
} else {
myW->playerTipLabelArray[(*it_c)->getMyID()]->setText("");
myW->playerTipLabelArray[(*it_c)->getMyID()]->setToolTip("");
myW->playerAvatarLabelArray[(*it_c)->getMyID()]->setToolTip("");
}
}
refreshStars();
}
示例3: removeInactivePlayers
void Mud::removeInactivePlayers()
{
PlayerList toRemove = PlayerList();
for (auto iterator : mudPlayers)
{
// Proceed only if the player is not connected and is closing.
if (!iterator->checkConnection() || iterator->closing)
{
// Add the player to the list of players that have to be removed.
toRemove.insert(iterator);
}
}
for (auto iterator = toRemove.begin(); iterator != toRemove.end(); ++iterator)
{
// Get the player at the given position.
Player * player = *iterator;
// Log the action of removing.
Logger::log(LogLevel::Global, "Removing inactive player : " + player->getName());
// Only if the player has successfully logged in, save its state on DB.
if (player->logged_in)
{
SQLiteDbms::instance().beginTransaction();
player->updateOnDB();
SQLiteDbms::instance().endTransaction();
}
// Remove the player from the list of players.
remPlayer(player);
// Delete the player.
delete (player);
}
}
示例4: reportBadAvatar
void MyAvatarLabel::reportBadAvatar()
{
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
int j=0;
PlayerListConstIterator it_c;
PlayerList seatList = currentGame->getSeatsList();
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
if(myId == j) {
QString avatar = QString::fromUtf8((*it_c)->getMyAvatar().c_str());
if(!avatar.isEmpty()) {
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
int ret = MyMessageBox::question(this, tr("PokerTH - Question"),
tr("Are you sure you want to report the avatar of \"%1\" as inappropriate?").arg(nick), QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes) {
QFileInfo fi(avatar);
myW->getSession()->reportBadAvatar((*it_c)->getMyUniqueID(), fi.baseName().toStdString());
}
}
break;
}
j++;
}
}
示例5: paintEvent
void MyAvatarLabel::paintEvent(QPaintEvent*)
{
QPainter painter(this);
if(transparent)
painter.setOpacity(0.4);
else
painter.setOpacity(1.0);
//hide avatar if player is on ignore list
boost::shared_ptr<Game> currentGame = myW->myStartWindow->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int seatPlace;
PlayerList seatsList = currentGame->getSeatsList();
for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) {
if(seatPlace == myId) {
if(!playerIsOnIgnoreList(QString::fromUtf8((*it_c)->getMyName().c_str()))) {
painter.drawPixmap(0,0,myPixmap);
return;
}
else if(myW->getMyConfig()->readConfigInt("DontHideAvatarsOfIgnored")) {
painter.drawPixmap(0,0,myPixmap);
return;
}
}
}
}
示例6: set_descriptors
int set_descriptors()
{
FD_ZERO(&in_set);
FD_ZERO(&out_set);
int max_socket = ircSocket;
// We want IO from irc
FD_SET(ircSocket, &in_set);
if (!ircOutBuf.empty()) {
FD_SET(ircSocket, &out_set);
}
// And IO from players
for (PlayerListIterator i = playerList.begin(); i != playerList.end(); ++i) {
if ((*i)->socket != NO_SOCKET) {
max_socket = max ((*i)->socket, max_socket);
FD_SET((*i)->socket, &in_set);
if (!(*i)->out_buf.empty()) {
FD_SET((*i)->socket, &out_set);
}
}
}
return max_socket;
}
示例7: _processIsmGroupLootMasterResponse
void GroupManager::_processIsmGroupLootMasterResponse(Message* message)
{
gLogger->logMsg("_processIsmGroupLootMasterResponse");
PlayerObject* playerObject = gWorldManager->getPlayerByAccId(message->getUint32()); // the player whos group_id has changed
if(playerObject == NULL)
{
gLogger->logMsg("GroupManager::_processIsmGroupLootMasterResponse PlayerAccId not found");
return;
}
//send the SUI
gLogger->logMsg("ok\n");
PlayerList inRangeMembers = playerObject->getInRangeGroupMembers(true);
PlayerList::iterator it = inRangeMembers.begin();
BStringVector namesArray;
while(it != inRangeMembers.end())
{
namesArray.push_back((*it)->getFirstName().getAnsi());
++it;
}
gUIManager->createNewPlayerSelectListBox(playerObject,"handleSetLootMaster","@group:master_looter_sui_title","@group:set_loot_type_text",namesArray,inRangeMembers,playerObject);
}
示例8: 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();
}
示例9: _sendToInstancedPlayersUnreliable
//======================================================================================================================
//
// Broadcasts a message to players in group and in range of the given object, used by tutorial and other instances
//
void MessageLib::_sendToInstancedPlayersUnreliable(Message* message,uint16 priority, const PlayerObject* const playerObject) const
{
if (!_checkPlayer(playerObject))
{
mMessageFactory->DestroyMessage(message);
return;
}
PlayerList const inRangeMembers = playerObject->getInRangeGroupMembers(true);
PlayerList::const_iterator playerIt = inRangeMembers.begin();
while (playerIt != inRangeMembers.end())
{
if (_checkPlayer(*playerIt))
{
// Clone the message.
mMessageFactory->StartMessage();
mMessageFactory->addData(message->getData(),message->getSize());
((*playerIt)->getClient())->SendChannelAUnreliable(mMessageFactory->EndMessage(),(*playerIt)->getAccountId(),CR_Client,static_cast<uint8>(priority));
}
++playerIt;
}
mMessageFactory->DestroyMessage(message);
}
示例10: players_process_lines
void players_process_lines()
{
for (PlayerListIterator i = playerList.begin(); i != playerList.end(); ++i) {
if ((*i)->socket != NO_SOCKET) {
player_process_lines((*i));
}
}
}
示例11: 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;
}
示例12: return
IrcPlayer *get_player_from_nick(string nick)
{
for (PlayerListIterator i = playerList.begin(); i != playerList.end(); ++i) {
if ((*i)->socket != NO_SOCKET) {
if (boost::iequals((*i)->nick, nick)) {
return (*i);
}
}
}
return NULL;
}
示例13: startEditTip
void MyAvatarLabel::startEditTip()
{
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
int j=0;
PlayerListConstIterator it_c;
PlayerList seatList = currentGame->getSeatsList();
for (it_c=seatList->begin(); it_c!=seatList->end(); ++it_c) {
if(myId == j) {
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
startChangePlayerTip(nick);
break;
}
j++;
}
}
示例14: remove_disconnected_players
void remove_disconnected_players()
{
PlayerListIterator i = playerList.begin ();
while (i != playerList.end ()) {
IrcPlayer *player = (*i);
PlayerListIterator prev = i;
i++;
if (player->socket == NO_SOCKET) {
say_to(player->nick, "You are now disconnected from uMUD");
playerList.erase(prev);
delete player;
player = 0;
}
} /* end of looping through players */
}
示例15: 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);
}
}