diff --git a/src/engine/local_engine/localbero.cpp b/src/engine/local_engine/localbero.cpp index 660ae913..f3c36347 100644 --- a/src/engine/local_engine/localbero.cpp +++ b/src/engine/local_engine/localbero.cpp @@ -103,15 +103,20 @@ void LocalBeRo::run() { // not first round in heads up (for headsup dealer is smallblind so it is dealers turn) // naechsten Spieler ermitteln - do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); - } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6); + int i; + for(i=0; (igetPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6) || i==0; i++) { + playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); + } } else { firstHeadsUpRound = 0; } //Spieler-Position vor SmallBlind-Position ermitteln int activePlayerBeforeSmallBlind = smallBlindPosition; - do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); - } while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6); + + for(i=0; (igetPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6) || i==0; i++) { + + activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); + } myHand->getPlayerArray()[playersTurn]->setMyTurn(1); //highlight active players groupbox and clear action diff --git a/src/engine/local_engine/localberopreflop.cpp b/src/engine/local_engine/localberopreflop.cpp index ede8838c..bd60ce97 100644 --- a/src/engine/local_engine/localberopreflop.cpp +++ b/src/engine/local_engine/localberopreflop.cpp @@ -31,7 +31,9 @@ LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, int qP, int dP, in // // BigBlind ermitteln bigBlindPosition = getDealerPosition(); - while (getMyHand()->getPlayerArray()[bigBlindPosition]->getMyButton() != BUTTON_BIG_BLIND) { + + int i; + for(i=0; igetPlayerArray()[bigBlindPosition]->getMyButton() != BUTTON_BIG_BLIND; i++) { bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS); } @@ -63,7 +65,8 @@ void LocalBeRoPreflop::run() { // BigBlind ermitteln bigBlindPosition = getDealerPosition(); - while (getMyHand()->getPlayerArray()[bigBlindPosition]->getMyButton() != BUTTON_BIG_BLIND) { + + for(i=0; igetPlayerArray()[bigBlindPosition]->getMyButton() != BUTTON_BIG_BLIND; i++) { bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS); } @@ -93,13 +96,13 @@ void LocalBeRoPreflop::run() { // Preflop ist wirklich dran // naechsten Spieler ermitteln - do { + for(i=0; (MAX_NUMBER_OF_PLAYERS && (!(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyActiveStatus()) || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_FOLD || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_ALLIN)) || i==0; i++) { setPlayersTurn((getPlayersTurn()+1)%(MAX_NUMBER_OF_PLAYERS)); // falls BigBlind, dann PreflopFirstRound zuende if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND) setFirstRound(0); - } while(!(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyActiveStatus()) || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_FOLD || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_ALLIN); + } getMyHand()->getPlayerArray()[getPlayersTurn()]->setMyTurn(1); //highlight active players groupbox and clear action diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 51a5ea60..1b74f0b9 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -190,7 +190,7 @@ void LocalHand::start() { void LocalHand::assignButtons() { - int i; + int i,j; //Aktive Spieler zählen int activePlayersCounter = 0; @@ -206,26 +206,26 @@ void LocalHand::assignButtons() { // assign Small Blind next to dealer. ATTENTION: in heads up it is big blind i = dealerPosition; - do { + + for(j=0; (jgetMyActiveStatus())) || j==0; j++) { + i = (i+1)%(MAX_NUMBER_OF_PLAYERS); if(playerArray[i]->getMyActiveStatus()) { if(activePlayersCounter > 2) playerArray[i]->setMyButton(2); //small blind normal - else playerArray[i]->setMyButton(3); //big blind in heads up - + else playerArray[i]->setMyButton(3); //big blind in heads up } - - } while(!(playerArray[i]->getMyActiveStatus())); + } // assign big blind next to small blind. ATTENTION: in heads up it is small blind - do { + for(j=0; (jgetMyActiveStatus())) || j==0; j++) { + i = (i+1)%(MAX_NUMBER_OF_PLAYERS); if(playerArray[i]->getMyActiveStatus()) { if(activePlayersCounter > 2) playerArray[i]->setMyButton(3); //big blind normal else playerArray[i]->setMyButton(2); //small blind in heads up } - - } while(!(playerArray[i]->getMyActiveStatus())); + } //do sets for (i=0; isetMyW(this); + // //ShortCuts // QShortcut *quitPokerTHKeys = new QShortcut(QKeySequence(Qt::Key_Control + Qt::Key_Q), this); // connect( quitPokerTHKeys, SIGNAL(activated() ), actionQuit, SLOT( trigger() ) ); diff --git a/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp b/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp index 23172389..40a0b1e1 100644 --- a/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp +++ b/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp @@ -23,7 +23,7 @@ #include startNetworkGameDialogImpl::startNetworkGameDialogImpl(QWidget *parent, ConfigFile *config) - : QDialog(parent), myConfig(config), isAdmin(false) + : QDialog(parent), myConfig(config), isAdmin(false), myW(0) { setupUi(this); @@ -64,6 +64,8 @@ void startNetworkGameDialogImpl::addConnectedPlayer(QString playerName, int righ QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget,0); item->setData(0, 0, playerName); +// myW->getMySDLPlayer()->playSound("call", 0); + checkPlayerQuantity(); } @@ -104,11 +106,16 @@ void startNetworkGameDialogImpl::kickPlayer() { void startNetworkGameDialogImpl::checkPlayerQuantity() { - if (treeWidget->topLevelItemCount() >= 2 && isAdmin) + if (treeWidget->topLevelItemCount() >= 2 && isAdmin) { pushButton_startGame->setEnabled(TRUE); - else + } + else { pushButton_startGame->setEnabled(FALSE); - + } + + if(treeWidget->topLevelItemCount() == maxPlayerNumber) { +// myW->getMySDLPlayer()->playSound("raise", 0); + } } void startNetworkGameDialogImpl::setSession(Session *session) diff --git a/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h b/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h index cc13ce0f..1627389e 100644 --- a/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h +++ b/src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h @@ -24,6 +24,8 @@ #include #include +#include "sdlplayer.h" +#include "mainwindowimpl.h" class Session; class ConfigFile; @@ -35,6 +37,9 @@ public: public slots: + void setMyW ( mainWindowImpl* theValue ) { myW = theValue; } + + void startGame(); void cancel(); void refresh(int actionID); @@ -55,6 +60,7 @@ public slots: private: + mainWindowImpl* myW; int maxPlayerNumber; bool isAdmin; ConfigFile *myConfig;