guest avatar menu

This commit is contained in:
doitux
2011-01-03 21:26:49 +00:00
parent 6952ad8a70
commit 493081a764
+62 -31
View File
@@ -46,52 +46,83 @@ MyAvatarLabel::~MyAvatarLabel()
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) { void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
assert(myW->getSession()->getCurrentGame()); assert(myW->getSession()->getCurrentGame());
if (myW->getSession()->isNetworkClientRunning() && !myW->getGuestMode()) { if (myW->getSession()->isNetworkClientRunning()) {
PlayerListIterator it = myW->getSession()->getCurrentGame()->getSeatsList()->begin(); PlayerListIterator it = myW->getSession()->getCurrentGame()->getSeatsList()->begin();
//only active players are allowed to start a vote //only active players are allowed to start a vote
if((*it)->getMyActiveStatus()) { if((*it)->getMyActiveStatus()) {
Game *currentGame = myW->getSession()->getCurrentGame(); if(myW->getGuestMode()) {
//excpetions for client is logged in as guest
PlayerListConstIterator it_c; Game *currentGame = myW->getSession()->getCurrentGame();
int activePlayerCounter=0; PlayerListConstIterator it_c;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) { int activePlayerCounter=0;
if((*it_c)->getMyActiveStatus()) activePlayerCounter++;
}
GameInfo info(myW->getSession()->getClientGameInfo(myW->getSession()->getClientCurrentGameId()));
if(activePlayerCounter > 2 && !voteRunning && info.data.gameType != GAME_TYPE_RANKING) setVoteOnKickContextMenuEnabled(TRUE); setVoteOnKickContextMenuEnabled(FALSE);
else setVoteOnKickContextMenuEnabled(FALSE); action_IgnorePlayer->setEnabled(FALSE);
action_IgnorePlayer->setEnabled(true); if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) {
action_ReportBadAvatar->setVisible(TRUE);
int j=0; }
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) { else {
action_ReportBadAvatar->setVisible(FALSE);
if(myId == j && myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest) {
action_IgnorePlayer->setDisabled(true);
} }
j++;
}
int i=0; int i=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) { for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
//also inactive player which stays on table can be voted to kick //also inactive player which stays on table can be voted to kick
if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER && ( (*it_c)->getMyActiveStatus() || (*it_c)->getMyStayOnTableStatus() ) ) if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER && ( (*it_c)->getMyActiveStatus() || (*it_c)->getMyStayOnTableStatus() ) )
showContextMenu(event->globalPos()); showContextMenu(event->globalPos());
i++; i++;
} }
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) {
action_ReportBadAvatar->setVisible(TRUE);
} }
else { else {
action_ReportBadAvatar->setVisible(FALSE); //normal player mode in internet game
}
Game *currentGame = myW->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int activePlayerCounter=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) activePlayerCounter++;
}
GameInfo info(myW->getSession()->getClientGameInfo(myW->getSession()->getClientCurrentGameId()));
if(activePlayerCounter > 2 && !voteRunning && info.data.gameType != GAME_TYPE_RANKING) setVoteOnKickContextMenuEnabled(TRUE);
else setVoteOnKickContextMenuEnabled(FALSE);
action_IgnorePlayer->setEnabled(true);
int j=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
if(myId == j && myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest) {
action_IgnorePlayer->setDisabled(true);
}
j++;
}
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) {
action_ReportBadAvatar->setVisible(TRUE);
}
else {
action_ReportBadAvatar->setVisible(FALSE);
}
int i=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
//also inactive player which stays on table can be voted to kick
if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER && ( (*it_c)->getMyActiveStatus() || (*it_c)->getMyStayOnTableStatus() ) )
showContextMenu(event->globalPos());
i++;
}
}
} }
} }
} }