diff --git a/src/engine/berointerface.h b/src/engine/berointerface.h index 072da5a8..46deb2d0 100644 --- a/src/engine/berointerface.h +++ b/src/engine/berointerface.h @@ -34,6 +34,9 @@ public: virtual void setHighestCardsValue(int theValue) =0; virtual int getHighestCardsValue() const =0; + virtual void setLastActionPlayer( int theValue ) =0; + virtual int getLastActionPlayer() const =0; + virtual void resetFirstRun() =0; virtual void nextPlayer() =0; diff --git a/src/engine/local_engine/localbero.h b/src/engine/local_engine/localbero.h index cdea8ba0..cb8dbbfc 100644 --- a/src/engine/local_engine/localbero.h +++ b/src/engine/local_engine/localbero.h @@ -57,6 +57,9 @@ protected: void setSmallBlind(int theValue) { smallBlind = theValue; } int getSmallBlind() const { return smallBlind; } + + void setLastActionPlayer ( int theValue ) { lastActionPlayer = theValue; } + int getLastActionPlayer() const { return lastActionPlayer; } private: @@ -79,6 +82,8 @@ private: bool logBoardCardsDone; + int lastActionPlayer; + }; diff --git a/src/engine/local_engine/localberopostriver.cpp b/src/engine/local_engine/localberopostriver.cpp index 9d863e17..05cde435 100644 --- a/src/engine/local_engine/localberopostriver.cpp +++ b/src/engine/local_engine/localberopostriver.cpp @@ -25,7 +25,7 @@ using namespace std; -LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB, GAME_STATE_POST_RIVER) +LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB, GAME_STATE_POST_RIVER), highestCardsValue(0) { } diff --git a/src/engine/local_engine/localberopostriver.h b/src/engine/local_engine/localberopostriver.h index b38f9db8..868b4837 100644 --- a/src/engine/local_engine/localberopostriver.h +++ b/src/engine/local_engine/localberopostriver.h @@ -36,7 +36,7 @@ public: void run(); void distributePot(); - + private: int highestCardsValue; diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index ca90a2a7..6058284f 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -100,72 +100,78 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // !!!!!!!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // -// // int temp5Array[5]; -// // -// // tempBoardArray[0] = 8; -// // tempBoardArray[1] = 9; -// // tempBoardArray[2] = 10; -// // tempBoardArray[3] = 11; -// // tempBoardArray[4] = 13; -// // -// // myBoard->setMyCards(tempBoardArray); -// // -// // tempPlayerAndBoardArray[2] = tempBoardArray[0]; -// // tempPlayerAndBoardArray[3] = tempBoardArray[1]; -// // tempPlayerAndBoardArray[4] = tempBoardArray[2]; -// // tempPlayerAndBoardArray[5] = tempBoardArray[3]; -// // tempPlayerAndBoardArray[6] = tempBoardArray[4]; -// // -// // tempPlayerArray[0] = 13; -// // tempPlayerArray[1] = 25; -// // tempPlayerAndBoardArray[0] = tempPlayerArray[0]; -// // tempPlayerAndBoardArray[1] = tempPlayerArray[1]; -// // -// // playerArray[0]->setMyCards(tempPlayerArray); -// // playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); -// // -// // playerArray[0]->setMyBestHandPosition(temp5Array); -// // -// // // for(i=0; i<5; i++) { -// // // cout << temp5Array[i] << " "; -// // // } -// // // cout << endl; -// // -// // tempPlayerArray[0] = 31; -// // tempPlayerArray[1] = 18; -// // tempPlayerAndBoardArray[0] = tempPlayerArray[0]; -// // tempPlayerAndBoardArray[1] = tempPlayerArray[1]; -// // -// // playerArray[1]->setMyCards(tempPlayerArray); -// // playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); -// // -// // playerArray[1]->setMyBestHandPosition(temp5Array); -// // -// // tempPlayerArray[0] = 20; -// // tempPlayerArray[1] = 38; -// // tempPlayerAndBoardArray[0] = tempPlayerArray[0]; -// // tempPlayerAndBoardArray[1] = tempPlayerArray[1]; -// // -// // playerArray[2]->setMyCards(tempPlayerArray); -// // playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); -// // -// // playerArray[2]->setMyBestHandPosition(temp5Array); -// // -// // tempPlayerArray[0] = 19; -// // tempPlayerArray[1] = 51; -// // tempPlayerAndBoardArray[0] = tempPlayerArray[0]; -// // tempPlayerAndBoardArray[1] = tempPlayerArray[1]; -// // -// // playerArray[3]->setMyCards(tempPlayerArray); -// // playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); -// // -// // playerArray[3]->setMyBestHandPosition(temp5Array); -// // -// // // for(i=0; i<4; i++) { -// // // cout << i << ": " << playerArray[i]->getMyCardsValueInt() << endl; -// // // } + if(DEBUG_MODE) { + + int temp5Array[5]; + + tempBoardArray[0] = 28; + tempBoardArray[1] = 45; + tempBoardArray[2] = 33; + tempBoardArray[3] = 4; + tempBoardArray[4] = 49; + + myBoard->setMyCards(tempBoardArray); + + tempPlayerAndBoardArray[2] = tempBoardArray[0]; + tempPlayerAndBoardArray[3] = tempBoardArray[1]; + tempPlayerAndBoardArray[4] = tempBoardArray[2]; + tempPlayerAndBoardArray[5] = tempBoardArray[3]; + tempPlayerAndBoardArray[6] = tempBoardArray[4]; + + tempPlayerArray[0] = 47; + tempPlayerArray[1] = 12; + tempPlayerAndBoardArray[0] = tempPlayerArray[0]; + tempPlayerAndBoardArray[1] = tempPlayerArray[1]; + + playerArray[0]->setMyCards(tempPlayerArray); + playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); + + playerArray[0]->setMyBestHandPosition(temp5Array); + + // for(i=0; i<5; i++) { + // cout << temp5Array[i] << " "; + // } + // cout << endl; + + tempPlayerArray[0] = 31; + tempPlayerArray[1] = 18; + tempPlayerAndBoardArray[0] = tempPlayerArray[0]; + tempPlayerAndBoardArray[1] = tempPlayerArray[1]; + + playerArray[1]->setMyCards(tempPlayerArray); + playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); + + playerArray[1]->setMyBestHandPosition(temp5Array); + + tempPlayerArray[0] = 24; + tempPlayerArray[1] = 48; + tempPlayerAndBoardArray[0] = tempPlayerArray[0]; + tempPlayerAndBoardArray[1] = tempPlayerArray[1]; + + playerArray[2]->setMyCards(tempPlayerArray); + playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); + + playerArray[2]->setMyBestHandPosition(temp5Array); + + tempPlayerArray[0] = 19; + tempPlayerArray[1] = 51; + tempPlayerAndBoardArray[0] = tempPlayerArray[0]; + tempPlayerAndBoardArray[1] = tempPlayerArray[1]; + + playerArray[3]->setMyCards(tempPlayerArray); + playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); + + playerArray[3]->setMyBestHandPosition(temp5Array); + + // for(i=0; i<4; i++) { + // cout << i << ": " << playerArray[i]->getMyCardsValueInt() << endl; + // } + dealerPosition = 0; + + } + // ---------------------------------------- // Dealer, SB, BB bestimmen diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index 408489b2..de2126af 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -31,18 +31,25 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq : PlayerInterface(), myConfig(c), actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), sBluff(0), sBluffStatus(0) { -// for statistic development -// if(myID==0) { -// myActiveStatus=0; -// myCash=20; -// } -// -// if(myID==1) { -// myCash=6130; -// } -// if(myID==2) { -// myCash=37; -// } + // !!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!! + if(DEBUG_MODE) { + + if(myID==0) { +// myActiveStatus=0; + myCash=570; + } + + if(myID==1) { + myCash=2730; + } + if(myID==2) { + myCash=5970; + } + if(myID==3) { + myCash=2730; + } + + } //////////////////////////// // myBestHandPosition mit -1 initialisieren @@ -332,6 +339,23 @@ void LocalPlayer::preflopEngine() { // cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl; + if(DEBUG_MODE) { + switch(myID) { + case 0: {} + break; + case 1: { myAction = PLAYER_ACTION_FOLD; } + break; + case 2: { myAction = PLAYER_ACTION_CALL; } + break; + case 3: { myAction = PLAYER_ACTION_FOLD; } + break; + default: {} + } + + + } + + evaluation(bet, raise); } @@ -1215,6 +1239,10 @@ void LocalPlayer::riverEngine() { } } } + + // lastPlayerAction für Karten umblättern reihenfolge setzrn + actualHand->getCurrentBeRo()->setLastActionPlayer(myID); + } // auf sBluffStatus testen --> raise statt call und bet statt check @@ -1292,6 +1320,7 @@ void LocalPlayer::evaluation(int bet, int raise) { highestSet = actualHand->getCurrentBeRo()->getHighestSet(); + // cout << "myAction(evaluation): " << myAction << endl; switch(myAction) { // none diff --git a/src/engine/network_engine/clientbero.cpp b/src/engine/network_engine/clientbero.cpp index 323a602a..1043a395 100644 --- a/src/engine/network_engine/clientbero.cpp +++ b/src/engine/network_engine/clientbero.cpp @@ -41,6 +41,18 @@ ClientBeRo::setHighestCardsValue(int theValue) highestCardsValue = theValue; } +void +ClientBeRo::setLastActionPlayer ( int theValue ) +{ + lastActionPlayer = theValue; +} + +int +ClientBeRo::getLastActionPlayer() const +{ + return lastActionPlayer; +} + void ClientBeRo::setPlayersTurn(int theValue) { diff --git a/src/engine/network_engine/clientbero.h b/src/engine/network_engine/clientbero.h index ad71b448..1e24711c 100644 --- a/src/engine/network_engine/clientbero.h +++ b/src/engine/network_engine/clientbero.h @@ -30,6 +30,9 @@ public: int getHighestCardsValue() const; void setHighestCardsValue(int theValue); + void setLastActionPlayer ( int theValue ); + int getLastActionPlayer() const; + void setPlayersTurn(int theValue); int getPlayersTurn() const; @@ -64,6 +67,8 @@ private: bool firstRound; int smallBlindPosition; int smallBlind; + + int lastActionPlayer; }; #endif diff --git a/src/game.cpp b/src/game.cpp index d16b1e53..03461934 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -106,20 +106,12 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, Game::~Game() { // cout << "Delete Game Object" << "\n"; - int i; delete actualBoard; actualBoard = 0; delete actualHand; actualHand = 0; -// boost::shared_ptr tempPlayer; -// for(i=0; isetSingleShot(TRUE); postRiverRunAnimation1Timer->setSingleShot(TRUE); postRiverRunAnimation2Timer->setSingleShot(TRUE); + postRiverRunAnimation2_flipHoleCards1Timer->setSingleShot(TRUE); + postRiverRunAnimation2_flipHoleCards2Timer->setSingleShot(TRUE); postRiverRunAnimation3Timer->setSingleShot(TRUE); postRiverRunAnimation5Timer->setSingleShot(TRUE); postRiverRunAnimation6Timer->setSingleShot(TRUE); @@ -555,6 +559,8 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) connect(postRiverAnimation1Timer, SIGNAL(timeout()), this, SLOT( postRiverAnimation1Action() )); connect(postRiverRunAnimation1Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation2() )); connect(postRiverRunAnimation2Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation3() )); + connect(postRiverRunAnimation2_flipHoleCards1Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation2_flipHoleCards1() )); + connect(postRiverRunAnimation2_flipHoleCards2Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation2_flipHoleCards2() )); connect(postRiverRunAnimation3Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation4() )); connect(potDistributeTimer, SIGNAL(timeout()), this, SLOT(postRiverRunAnimation5())); connect(postRiverRunAnimation5Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation6() )); @@ -1299,7 +1305,7 @@ void mainWindowImpl::dealHoleCards() { currentGame->getPlayerArray()[i]->getMyCards(tempCardsIntArray); for(j=0; j<2; j++) { if(currentGame->getPlayerArray()[i]->getMyActiveStatus()) { - if ((i == 0) || debugMode) { + if ((i == 0) || DEBUG_MODE) { tempCardsPixmapArray[j].load(":/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png"); holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j],FALSE); @@ -1838,20 +1844,7 @@ void mainWindowImpl::riverAnimation2Action() { mySession->getCurrentGame()->getC void mainWindowImpl::postRiverAnimation1() { postRiverAnimation1Timer->start(nextPlayerSpeed2); } void mainWindowImpl::postRiverAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); } -void mainWindowImpl::postRiverRunAnimation1() { - - //RoundsLabel mit "River" dunkel machen -// QPalette tempPalette = frame_handLabel->palette(); -// tempPalette.setColor(QPalette::Window, active); -// frame_handLabel->setPalette(tempPalette); - - //PotLabel aufhellen! -// // tempPalette = frame_Pot->palette(); -// tempPalette.setColor(QPalette::Window, highlight); -// frame_Pot->setPalette(tempPalette); - - postRiverRunAnimation1Timer->start(postRiverRunAnimationSpeed); -} +void mainWindowImpl::postRiverRunAnimation1() { postRiverRunAnimation1Timer->start(postRiverRunAnimationSpeed); } void mainWindowImpl::postRiverRunAnimation2() { @@ -1868,7 +1861,11 @@ void mainWindowImpl::postRiverRunAnimation2() { if(!flipHolecardsAllInAlreadyDone) { - //Config? mit oder ohne Eye-Candy? +//TODO - Turn cards like in the rules + +// postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2); + +// //Config? mit oder ohne Eye-Candy? if(myConfig->readConfigInt("ShowFlipCardsAnimation")) { // mit Eye-Candy @@ -1937,12 +1934,35 @@ void mainWindowImpl::postRiverRunAnimation2() { else { postRiverRunAnimation3(); } } +// TODO +void mainWindowImpl::postRiverRunAnimation2_flipHoleCards1() { + + HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); + + currentHand->getCurrentBeRo()->setPlayersTurn(currentHand->getCurrentBeRo()->getLastActionPlayer()); + + postRiverRunAnimation2_flipHoleCards2Timer->start(nextPlayerSpeed2); +} + + +void mainWindowImpl::postRiverRunAnimation2_flipHoleCards2() { + +// if() { +// postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2); +// } +// else { +// postRiverRunAnimation2Timer->start(postRiverRunAnimationSpeed); +// } +} + + void mainWindowImpl::postRiverRunAnimation3() { int i; HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); //Alle Winner erhellen und "Winner" schreiben for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) { // QPalette tempPalette = groupBoxArray[i]->palette(); diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index 0ef7ca00..9396ba69 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -230,6 +230,8 @@ public slots: void postRiverRunAnimation1(); void postRiverRunAnimation2(); + void postRiverRunAnimation2_flipHoleCards1(); + void postRiverRunAnimation2_flipHoleCards2(); void postRiverRunAnimation3(); void postRiverRunAnimation4(); void postRiverRunAnimation5(); @@ -274,6 +276,7 @@ public slots: void networkGameModification(); void quitPokerTH(); + @@ -339,6 +342,8 @@ private: QTimer *postRiverAnimation1Timer; QTimer *postRiverRunAnimation1Timer; QTimer *postRiverRunAnimation2Timer; + QTimer *postRiverRunAnimation2_flipHoleCards1Timer; + QTimer *postRiverRunAnimation2_flipHoleCards2Timer; QTimer *postRiverRunAnimation3Timer; QTimer *postRiverRunAnimation5Timer; QTimer *postRiverRunAnimation6Timer; @@ -396,7 +401,6 @@ private: bool myActionIsBet; bool myActionIsRaise; - bool debugMode; bool breakAfterActualHand; bool flipHolecardsAllInAlreadyDone;