guest avatar menu

This commit is contained in:
doitux
2011-01-03 21:26:49 +00:00
parent 6952ad8a70
commit 493081a764
+39 -8
View File
@@ -46,16 +46,46 @@ MyAvatarLabel::~MyAvatarLabel()
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
assert(myW->getSession()->getCurrentGame());
if (myW->getSession()->isNetworkClientRunning() && !myW->getGuestMode()) {
if (myW->getSession()->isNetworkClientRunning()) {
PlayerListIterator it = myW->getSession()->getCurrentGame()->getSeatsList()->begin();
//only active players are allowed to start a vote
if((*it)->getMyActiveStatus()) {
Game *currentGame = myW->getSession()->getCurrentGame();
if(myW->getGuestMode()) {
//excpetions for client is logged in as guest
Game *currentGame = myW->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int activePlayerCounter=0;
setVoteOnKickContextMenuEnabled(FALSE);
action_IgnorePlayer->setEnabled(FALSE);
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++;
}
}
else {
//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++;
}
@@ -75,6 +105,13 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
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++) {
@@ -85,13 +122,7 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
i++;
}
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) {
action_ReportBadAvatar->setVisible(TRUE);
}
else {
action_ReportBadAvatar->setVisible(FALSE);
}
}
}
}