From 7f13da91e551c013e294f683dbb7746ac4c18794 Mon Sep 17 00:00:00 2001 From: floty Date: Wed, 26 Oct 2011 22:29:47 +0000 Subject: [PATCH] applying astyle --- src/engine/boardinterface.h | 2 +- src/engine/enginefactory.h | 2 +- src/engine/handinterface.h | 12 +- src/engine/local_engine/localbero.cpp | 6 +- src/engine/local_engine/localbero.h | 2 +- src/engine/local_engine/localberoflop.h | 2 +- .../local_engine/localberopostriver.cpp | 42 +-- src/engine/local_engine/localberopostriver.h | 2 +- src/engine/local_engine/localberopreflop.h | 2 +- src/engine/local_engine/localberoriver.h | 2 +- src/engine/local_engine/localberoturn.h | 2 +- src/engine/local_engine/localboard.cpp | 2 +- src/engine/local_engine/localboard.h | 6 +- .../local_engine/localenginefactory.cpp | 10 +- src/engine/local_engine/localenginefactory.h | 2 +- src/engine/local_engine/localhand.cpp | 56 ++-- src/engine/local_engine/localhand.h | 24 +- src/engine/local_engine/localplayer.cpp | 314 +++++++++--------- src/engine/local_engine/localplayer.h | 6 +- src/engine/log.cpp | 205 ++++++------ src/engine/log.h | 12 +- src/engine/network_engine/clientbero.h | 2 +- src/engine/network_engine/clientboard.cpp | 4 +- src/engine/network_engine/clientboard.h | 4 +- .../network_engine/clientenginefactory.cpp | 10 +- .../network_engine/clientenginefactory.h | 2 +- src/engine/network_engine/clienthand.cpp | 14 +- src/engine/network_engine/clienthand.h | 18 +- src/engine/network_engine/clientplayer.cpp | 2 +- src/engine/network_engine/clientplayer.h | 6 +- src/engine/playerinterface.h | 4 +- src/game_defs.h | 32 +- src/gui/qt/chattools/chattools.cpp | 6 +- src/gui/qt/gametable/gametableimpl.cpp | 51 ++- src/net/common/clientstate.cpp | 12 +- src/net/common/servergamestate.cpp | 6 +- src/net/common/serverlobbythread.cpp | 2 +- src/session.cpp | 2 +- 38 files changed, 443 insertions(+), 447 deletions(-) diff --git a/src/engine/boardinterface.h b/src/engine/boardinterface.h index 5d06b4b9..55724b54 100644 --- a/src/engine/boardinterface.h +++ b/src/engine/boardinterface.h @@ -41,7 +41,7 @@ public: virtual void setSets(int theValue) =0; virtual void setAllInCondition(bool theValue) =0; - virtual void setLastActionPlayerID(unsigned theValue) =0; + virtual void setLastActionPlayerID(unsigned theValue) =0; // virtual void collectSets() =0; virtual void collectPot() =0; diff --git a/src/engine/enginefactory.h b/src/engine/enginefactory.h index 9a15c99c..d7fcf87a 100644 --- a/src/engine/enginefactory.h +++ b/src/engine/enginefactory.h @@ -34,7 +34,7 @@ public: virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0; virtual boost::shared_ptr createBoard(unsigned dp) =0; virtual boost::shared_ptr createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) =0; - virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB) =0; + virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB) =0; }; #endif diff --git a/src/engine/handinterface.h b/src/engine/handinterface.h index fc616013..8f90930f 100644 --- a/src/engine/handinterface.h +++ b/src/engine/handinterface.h @@ -52,8 +52,8 @@ public: virtual void setStartQuantityPlayers(int theValue) =0; virtual int getStartQuantityPlayers() const =0; - virtual void setCurrentRound(GameState theValue) =0; - virtual GameState getCurrentRound() const =0; + virtual void setCurrentRound(GameState theValue) =0; + virtual GameState getCurrentRound() const =0; virtual void setDealerPosition(int theValue) =0; virtual int getDealerPosition() const =0; @@ -70,11 +70,11 @@ public: virtual void setBettingRoundsPlayed(int theValue) =0; virtual int getBettingRoundsPlayed() const =0; - virtual void setPreviousPlayerID(int theValue) =0; - virtual int getPreviousPlayerID() const =0; + virtual void setPreviousPlayerID(int theValue) =0; + virtual int getPreviousPlayerID() const =0; - virtual void setLastActionPlayerID( unsigned theValue ) =0; - virtual unsigned getLastActionPlayerID() const =0; + virtual void setLastActionPlayerID( unsigned theValue ) =0; + virtual unsigned getLastActionPlayerID() const =0; virtual void setCardsShown(bool theValue) =0; virtual bool getCardsShown() const =0; diff --git a/src/engine/local_engine/localbero.cpp b/src/engine/local_engine/localbero.cpp index 5d37c7bb..aa24c12c 100644 --- a/src/engine/local_engine/localbero.cpp +++ b/src/engine/local_engine/localbero.cpp @@ -25,7 +25,7 @@ using namespace std; LocalBeRo::LocalBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS) - : BeRoInterface(), myHand(hi), myBeRoID(gS), dealerPosition(dP), smallBlindPosition(0), dealerPositionId(dP), smallBlindPositionId(0), bigBlindPositionId(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), fullBetRule(false), firstRun(true), firstRunGui(true), firstRound(true), firstHeadsUpRound(true), currentPlayersTurnId(0), firstRoundLastPlayersTurnId(0), logBoardCardsDone(false) + : BeRoInterface(), myHand(hi), myBeRoID(gS), dealerPosition(dP), smallBlindPosition(0), dealerPositionId(dP), smallBlindPositionId(0), bigBlindPositionId(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), fullBetRule(false), firstRun(true), firstRunGui(true), firstRound(true), firstHeadsUpRound(true), currentPlayersTurnId(0), firstRoundLastPlayersTurnId(0), logBoardCardsDone(false) { currentPlayersTurnIt = myHand->getRunningPlayerList()->begin(); lastPlayersTurnIt = myHand->getRunningPlayerList()->begin(); @@ -84,7 +84,7 @@ void LocalBeRo::run() if(firstRunGui) { firstRunGui = false; - myHand->setPreviousPlayerID(-1); + myHand->setPreviousPlayerID(-1); myHand->getGuiInterface()->dealBeRoCards(myBeRoID); } else { @@ -176,7 +176,7 @@ void LocalBeRo::run() // aktuelle bero nicht dran, weil alle Sets gleich sind //also gehe in naechste bero - myHand->setCurrentRound(GameState(myBeRoID+1)); + myHand->setCurrentRound(GameState(myBeRoID+1)); //Action loeschen und ActionButtons refresh for(it_c=myHand->getRunningPlayerList()->begin(); it_c!=myHand->getRunningPlayerList()->end(); ++it_c) { diff --git a/src/engine/local_engine/localbero.h b/src/engine/local_engine/localbero.h index 2a8c0225..3d0f69bd 100644 --- a/src/engine/local_engine/localbero.h +++ b/src/engine/local_engine/localbero.h @@ -28,7 +28,7 @@ class LocalBeRo : public BeRoInterface { public: - LocalBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS); + LocalBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS); ~LocalBeRo(); GameState getMyBeRoID() const { diff --git a/src/engine/local_engine/localberoflop.h b/src/engine/local_engine/localberoflop.h index cb2f7c10..74762d09 100644 --- a/src/engine/local_engine/localberoflop.h +++ b/src/engine/local_engine/localberoflop.h @@ -28,7 +28,7 @@ class LocalBeRoFlop : public LocalBeRo { public: - LocalBeRoFlop(HandInterface*, unsigned, int); + LocalBeRoFlop(HandInterface*, unsigned, int); ~LocalBeRoFlop(); }; diff --git a/src/engine/local_engine/localberopostriver.cpp b/src/engine/local_engine/localberopostriver.cpp index 33b7a5a9..8eda25c4 100644 --- a/src/engine/local_engine/localberopostriver.cpp +++ b/src/engine/local_engine/localberopostriver.cpp @@ -83,28 +83,28 @@ void LocalBeRoPostRiver::postRiverRun() //Pot auf 0 setzen getMyHand()->getBoard()->setPot(0); - // logging hole Cards / Hands - int nonfoldPlayersCounter = 0; - for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { - if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++; - } - if(nonfoldPlayersCounter>1) { - getMyHand()->getLog()->logHoleCardsHandName(5,getMyHand()->getActivePlayerList()); - } + // logging hole Cards / Hands + int nonfoldPlayersCounter = 0; + for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { + if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++; + } + if(nonfoldPlayersCounter>1) { + getMyHand()->getLog()->logHoleCardsHandName(5,getMyHand()->getActivePlayerList()); + } - // logging winner if game is over - // wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen - int playersPositiveCashCounter = 0; - for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { - if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++; - } - if (playersPositiveCashCounter==1) { - for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { - if ((*it_c)->getMyCash() > 0) { - getMyHand()->getLog()->logPlayerAction(5,(*it_c)->getMyID()+1,LOG_ACTION_WIN_GAME); - } - } - } + // logging winner if game is over + // wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen + int playersPositiveCashCounter = 0; + for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { + if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++; + } + if (playersPositiveCashCounter==1) { + for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { + if ((*it_c)->getMyCash() > 0) { + getMyHand()->getLog()->logPlayerAction(5,(*it_c)->getMyID()+1,LOG_ACTION_WIN_GAME); + } + } + } //starte die Animaionsreihe getMyHand()->getGuiInterface()->postRiverRunAnimation1(); diff --git a/src/engine/local_engine/localberopostriver.h b/src/engine/local_engine/localberopostriver.h index 964dfd87..606d2639 100644 --- a/src/engine/local_engine/localberopostriver.h +++ b/src/engine/local_engine/localberopostriver.h @@ -28,7 +28,7 @@ class HandInterface; class LocalBeRoPostRiver : public LocalBeRo { public: - LocalBeRoPostRiver(HandInterface*, int, int); + LocalBeRoPostRiver(HandInterface*, int, int); ~LocalBeRoPostRiver(); void setHighestCardsValue(int theValue) { diff --git a/src/engine/local_engine/localberopreflop.h b/src/engine/local_engine/localberopreflop.h index 1e5b23f9..644d4216 100644 --- a/src/engine/local_engine/localberopreflop.h +++ b/src/engine/local_engine/localberopreflop.h @@ -28,7 +28,7 @@ class LocalBeRoPreflop : public LocalBeRo { public: - LocalBeRoPreflop(HandInterface*, unsigned, int); + LocalBeRoPreflop(HandInterface*, unsigned, int); ~LocalBeRoPreflop(); void run(); diff --git a/src/engine/local_engine/localberoriver.h b/src/engine/local_engine/localberoriver.h index 459f71bd..c7f1a3df 100644 --- a/src/engine/local_engine/localberoriver.h +++ b/src/engine/local_engine/localberoriver.h @@ -28,7 +28,7 @@ class HandInterface; class LocalBeRoRiver : public LocalBeRo { public: - LocalBeRoRiver(HandInterface*, unsigned, int); + LocalBeRoRiver(HandInterface*, unsigned, int); ~LocalBeRoRiver(); }; diff --git a/src/engine/local_engine/localberoturn.h b/src/engine/local_engine/localberoturn.h index 684bcbec..25361588 100644 --- a/src/engine/local_engine/localberoturn.h +++ b/src/engine/local_engine/localberoturn.h @@ -27,7 +27,7 @@ class HandInterface; class LocalBeRoTurn : public LocalBeRo { public: - LocalBeRoTurn(HandInterface*, unsigned, int); + LocalBeRoTurn(HandInterface*, unsigned, int); ~LocalBeRoTurn(); }; diff --git a/src/engine/local_engine/localboard.cpp b/src/engine/local_engine/localboard.cpp index ca590f95..139cee2f 100755 --- a/src/engine/local_engine/localboard.cpp +++ b/src/engine/local_engine/localboard.cpp @@ -299,7 +299,7 @@ void LocalBoard::determinePlayerNeedToShowCards() // cout << "lAP-Ende: " << currentHand->getLastActionPlayer() << endl; // search lastActionPlayer for(it_c = activePlayerList->begin(); it_c != activePlayerList->end(); ++it_c) { - if((*it_c)->getMyUniqueID() == lastActionPlayerID && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { + if((*it_c)->getMyUniqueID() == lastActionPlayerID && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { lastActionPlayerIt = it_c; // cout << (*it_c)->getMyUniqueID() << endl; break; diff --git a/src/engine/local_engine/localboard.h b/src/engine/local_engine/localboard.h index 9af7e101..591e0b9d 100755 --- a/src/engine/local_engine/localboard.h +++ b/src/engine/local_engine/localboard.h @@ -49,8 +49,8 @@ public: void setAllInCondition(bool theValue) { allInCondition = theValue; } - void setLastActionPlayerID(unsigned theValue) { - lastActionPlayerID = theValue; + void setLastActionPlayerID(unsigned theValue) { + lastActionPlayerID = theValue; } int getPot() const { @@ -100,7 +100,7 @@ private: int sets; unsigned dealerPosition; bool allInCondition; - unsigned lastActionPlayerID; + unsigned lastActionPlayerID; }; diff --git a/src/engine/local_engine/localenginefactory.cpp b/src/engine/local_engine/localenginefactory.cpp index 68350e60..b0394d69 100644 --- a/src/engine/local_engine/localenginefactory.cpp +++ b/src/engine/local_engine/localenginefactory.cpp @@ -64,15 +64,15 @@ LocalEngineFactory::createBeRo(HandInterface *hi, unsigned dP, int sB) { std::vector > myBeRo; - myBeRo.push_back(boost::shared_ptr(new LocalBeRoPreflop(hi, dP, sB))); + myBeRo.push_back(boost::shared_ptr(new LocalBeRoPreflop(hi, dP, sB))); - myBeRo.push_back(boost::shared_ptr(new LocalBeRoFlop(hi, dP, sB))); + myBeRo.push_back(boost::shared_ptr(new LocalBeRoFlop(hi, dP, sB))); - myBeRo.push_back(boost::shared_ptr(new LocalBeRoTurn(hi, dP, sB))); + myBeRo.push_back(boost::shared_ptr(new LocalBeRoTurn(hi, dP, sB))); - myBeRo.push_back(boost::shared_ptr(new LocalBeRoRiver(hi, dP, sB))); + myBeRo.push_back(boost::shared_ptr(new LocalBeRoRiver(hi, dP, sB))); - myBeRo.push_back(boost::shared_ptr(new LocalBeRoPostRiver(hi, dP, sB))); + myBeRo.push_back(boost::shared_ptr(new LocalBeRoPostRiver(hi, dP, sB))); return myBeRo; diff --git a/src/engine/local_engine/localenginefactory.h b/src/engine/local_engine/localenginefactory.h index f1f6a1de..2346e739 100644 --- a/src/engine/local_engine/localenginefactory.h +++ b/src/engine/local_engine/localenginefactory.h @@ -39,7 +39,7 @@ public: virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); virtual boost::shared_ptr createBoard(unsigned dp); virtual boost::shared_ptr createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); - virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB); + virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB); private: ConfigFile *myConfig; diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index fceba75f..7e12ced7 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -30,7 +30,7 @@ using namespace std; LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC) - : myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), smallBlindPosition(dP), bigBlindPosition(dP), currentRound(GAME_STATE_PREFLOP), smallBlind(sB), startCash(sC), previousPlayerID(-1), lastActionPlayerID(0), allInCondition(false), + : myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), smallBlindPosition(dP), bigBlindPosition(dP), currentRound(GAME_STATE_PREFLOP), smallBlind(sB), startCash(sC), previousPlayerID(-1), lastActionPlayerID(0), allInCondition(false), cardsShown(false), bettingRoundsPlayed(0) { @@ -46,7 +46,7 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost: // generate cards and assign to board and player const int NumCards = 52; int cardsArray[NumCards] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, @@ -367,7 +367,7 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost: setBlinds(); - myBeRo = myFactory->createBeRo(this, dealerPosition, smallBlind); + myBeRo = myFactory->createBeRo(this, dealerPosition, smallBlind); } @@ -448,8 +448,8 @@ void LocalHand::assignButtons() } // first player after dealer have to show his cards first (in showdown) - lastActionPlayerID = (*it)->getMyUniqueID(); - myBoard->setLastActionPlayerID(lastActionPlayerID); + lastActionPlayerID = (*it)->getMyUniqueID(); + myBoard->setLastActionPlayerID(lastActionPlayerID); ++it; if(it == activePlayerList->end()) it = activePlayerList->begin(); @@ -528,29 +528,29 @@ void LocalHand::setBlinds() void LocalHand::switchRounds() { - // logging last player action -// currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId ); -// if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) { -// throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND); -// } +// // logging last player action +// PlayerListConstIterator previousPlayerIt = getRunningPlayerIt(previousPlayerID); +// if(previousPlayerIt == runningPlayerList->end()) { +// throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND); +// } -// switch((*currentPlayersTurnIt)->getMyAction()) { +// switch((*previousPlayerIt)->getMyAction()) { // case PLAYER_ACTION_FOLD: { -// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,LOG_ACTION_FOLD); +// myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_FOLD); // } break; // case PLAYER_ACTION_CHECK: { -// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,LOG_ACTION_CHECK); +// myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_CHECK); // } break; // case PLAYER_ACTION_CALL: { -// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,LOG_ACTION_CALL); +// myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_CALL); // } break; // case PLAYER_ACTION_BET: // case PLAYER_ACTION_RAISE: { -// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,LOG_ACTION_BET,(*currentPlayersTurnIt)->getMySet()); +// myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_BET,(*previousPlayerIt)->getMySet()); // } break; // case PLAYER_ACTION_ALLIN: { -// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,LOG_ACTION_ALL_IN,(*currentPlayersTurnIt)->getMySet()); +// myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_ALL_IN,(*previousPlayerIt)->getMySet()); // } break; // default: { // } @@ -595,7 +595,7 @@ void LocalHand::switchRounds() myBoard->collectPot(); myGui->refreshPot(); myGui->refreshSet(); - currentRound = GAME_STATE_POST_RIVER; + currentRound = GAME_STATE_POST_RIVER; } // check for all in condition @@ -655,16 +655,16 @@ void LocalHand::switchRounds() myGui->refreshPot(); myGui->refreshSet(); myGui->flipHolecardsAllIn(); - // Logging HoleCards - if(currentRoundlogHoleCardsHandName(currentRound+1,activePlayerList); - } + // Logging HoleCards + if(currentRoundlogHoleCardsHandName(currentRound+1,activePlayerList); + } - if (currentRound < GAME_STATE_POST_RIVER) // do not increment past 4 - currentRound = GameState(currentRound + 1); + if (currentRound < GAME_STATE_POST_RIVER) // do not increment past 4 + currentRound = GameState(currentRound + 1); //log board cards for allin - if(currentRound >= GAME_STATE_FLOP) { + if(currentRound >= GAME_STATE_FLOP) { int tempBoardCardsArray[5]; myBoard->getMyCards(tempBoardCardsArray); @@ -675,10 +675,10 @@ void LocalHand::switchRounds() } //unhighlight current players groupbox - it_c = getActivePlayerIt(previousPlayerID); + it_c = getActivePlayerIt(previousPlayerID); if( it_c != activePlayerList->end() ) { // lastPlayersTurn is active - myGui->refreshGroupbox(previousPlayerID,1); + myGui->refreshGroupbox(previousPlayerID,1); } myGui->refreshGameLabels((GameState)getCurrentRound()); @@ -769,6 +769,6 @@ PlayerListIterator LocalHand::getRunningPlayerIt(unsigned uniqueId) const void LocalHand::setLastActionPlayerID(unsigned theValue) { - lastActionPlayerID = theValue; - myBoard->setLastActionPlayerID(theValue); + lastActionPlayerID = theValue; + myBoard->setLastActionPlayerID(theValue); } diff --git a/src/engine/local_engine/localhand.h b/src/engine/local_engine/localhand.h index 0b21e99d..5c347251 100755 --- a/src/engine/local_engine/localhand.h +++ b/src/engine/local_engine/localhand.h @@ -88,10 +88,10 @@ public: return startQuantityPlayers; } - void setCurrentRound(GameState theValue) { + void setCurrentRound(GameState theValue) { currentRound = theValue; } - GameState getCurrentRound() const { + GameState getCurrentRound() const { return currentRound; } @@ -130,16 +130,16 @@ public: return bettingRoundsPlayed; } - void setPreviousPlayerID(int theValue) { - previousPlayerID = theValue; + void setPreviousPlayerID(int theValue) { + previousPlayerID = theValue; } - int getPreviousPlayerID() const { - return previousPlayerID; + int getPreviousPlayerID() const { + return previousPlayerID; } - void setLastActionPlayerID ( unsigned theValue ); - unsigned getLastActionPlayerID() const { - return lastActionPlayerID; + void setLastActionPlayerID ( unsigned theValue ); + unsigned getLastActionPlayerID() const { + return lastActionPlayerID; } void setCardsShown(bool theValue) { @@ -177,12 +177,12 @@ private: unsigned dealerPosition; unsigned smallBlindPosition; unsigned bigBlindPosition; - GameState currentRound; + GameState currentRound; int smallBlind; int startCash; - int previousPlayerID; - unsigned lastActionPlayerID; + int previousPlayerID; + unsigned lastActionPlayerID; bool allInCondition; bool cardsShown; diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index f25918a6..a4bfeac6 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -847,7 +847,7 @@ static const RoundData FlopValues[] = { LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) : PlayerInterface(), myConfig(c), currentHand(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(PLAYER_ACTION_NONE), + myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(1), myTurn(0), myCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(0), myWinnerState(false), m_actionTimeoutCounter(0), m_isConnected(false) { @@ -1066,7 +1066,7 @@ void LocalPlayer::action() // cout << "jetzt" << endl; //set that i was the last active player. need this for unhighlighting groupbox - currentHand->setPreviousPlayerID(myID); + currentHand->setPreviousPlayerID(myID); currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet); currentHand->getGuiInterface()->nextPlayerAnimation(); @@ -1222,16 +1222,16 @@ void LocalPlayer::preflopEngine() // all in if(myOdds >= myNiveau[2] + 8) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // nur call else { // all in bei knappem call if(myCash-currentHand->getCurrentBeRo()->getHighestSet() <= (myCash*1)/5) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } else { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } @@ -1247,51 +1247,51 @@ void LocalPlayer::preflopEngine() if(myCash/(2*currentHand->getSmallBlind()) <= 6 || raise >= (myCash*4)/5) { raise = myCash; } - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // auf cBluff testen --> call (bzw check) statt raise if(cBluff > 90) { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; // bigBlind --> check - if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; + if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; } if(cBluff > 80 && myOdds >= myNiveau[2] + 4) { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; // bigBlind --> check - if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; + if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; } if(cBluff > 70 && myOdds >= myNiveau[2] + 8) { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; // bigBlind --> check - if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; + if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; } if(cBluff > 60 && myOdds >= myNiveau[2] + 12) { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; // bigBlind --> check - if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; + if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; } } else { // call if(myOdds >= myNiveau[0] || (mySet >= currentHand->getCurrentBeRo()->getHighestSet()/2 && myOdds >= myNiveau[0]-8)) { // bigBlind --> check - if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; + if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; else { // all in bei knappem call if(myCash-currentHand->getCurrentBeRo()->getHighestSet() <= (myCash*1)/5) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } else { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } } // fold else { // bigBlind -> check - if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; - else myAction = PLAYER_ACTION_FOLD; + if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; + else myAction = PLAYER_ACTION_FOLD; } } @@ -1308,11 +1308,11 @@ void LocalPlayer::preflopEngine() // all in bei knappem call if(myCash-currentHand->getCurrentBeRo()->getHighestSet() <= (myCash*1)/6) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } else { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; // bigBlind --> check - if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; + if(myButton == 3 && mySet == currentHand->getCurrentBeRo()->getHighestSet()) myAction = PLAYER_ACTION_CHECK; } } // Standard-Raise-Routine @@ -1327,12 +1327,12 @@ void LocalPlayer::preflopEngine() if(myCash/(2*currentHand->getSmallBlind()) <= 6 || raise >= (myCash*4)/5) { raise = myCash; } - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // extrem hoher set der gegner -> bluff beenden if((currentHand->getCurrentBeRo()->getHighestSet() >= 12*currentHand->getSmallBlind() && myOdds < myNiveau[0]) || (currentHand->getCurrentBeRo()->getHighestSet() >= 20*currentHand->getSmallBlind() && myOdds < myNiveau[2])) { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } @@ -1590,16 +1590,16 @@ void LocalPlayer::flopEngine() // all in if(myOdds >= myNiveau[2] + 15) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // nur call else { // all in bei knappem call if(myCash-currentHand->getCurrentBeRo()->getHighestSet() <= (myCash*1)/5) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } else { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } @@ -1615,14 +1615,14 @@ void LocalPlayer::flopEngine() if(myCash/(2*currentHand->getSmallBlind()) <= 6 || raise >= (myCash*4.0)/5.0) { raise = myCash; } - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // auf cBluff testen --> call statt raise - if(cBluff > 90) myAction = PLAYER_ACTION_CALL; - if(cBluff > 80 && myOdds >= myNiveau[2] + 4) myAction = PLAYER_ACTION_CALL; - if(cBluff > 70 && myOdds >= myNiveau[2] + 8) myAction = PLAYER_ACTION_CALL; - if(cBluff > 60 && myOdds >= myNiveau[2] + 12) myAction = PLAYER_ACTION_CALL; + if(cBluff > 90) myAction = PLAYER_ACTION_CALL; + if(cBluff > 80 && myOdds >= myNiveau[2] + 4) myAction = PLAYER_ACTION_CALL; + if(cBluff > 70 && myOdds >= myNiveau[2] + 8) myAction = PLAYER_ACTION_CALL; + if(cBluff > 60 && myOdds >= myNiveau[2] + 12) myAction = PLAYER_ACTION_CALL; } else { // call -> über niveau0, schon einiges gesetzt im flop, schon einiges insgesamt gesetzt @@ -1630,12 +1630,12 @@ void LocalPlayer::flopEngine() // all in bei knappem call if(currentHand->getCurrentBeRo()->getHighestSet() > (myCash*3.0)/4.0) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; - } else myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_RAISE; + } else myAction = PLAYER_ACTION_CALL; } // fold else { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } } } else { @@ -1654,17 +1654,17 @@ void LocalPlayer::flopEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; // auf cBluff testen --> check statt bet - if(cBluff > 80) myAction = PLAYER_ACTION_CHECK; - if(cBluff > 70 && myOdds >= myNiveau[1] + 4) myAction = PLAYER_ACTION_CHECK; - if(cBluff > 60 && myOdds >= myNiveau[1] + 8) myAction = PLAYER_ACTION_CHECK; - if(cBluff > 50 && myOdds >= myNiveau[1] + 12) myAction = PLAYER_ACTION_CHECK; + if(cBluff > 80) myAction = PLAYER_ACTION_CHECK; + if(cBluff > 70 && myOdds >= myNiveau[1] + 4) myAction = PLAYER_ACTION_CHECK; + if(cBluff > 60 && myOdds >= myNiveau[1] + 8) myAction = PLAYER_ACTION_CHECK; + if(cBluff > 50 && myOdds >= myNiveau[1] + 12) myAction = PLAYER_ACTION_CHECK; } // check else { - myAction = PLAYER_ACTION_CHECK; + myAction = PLAYER_ACTION_CHECK; // Position if(myButton == 1) { // Position-Bluff generieren @@ -1683,7 +1683,7 @@ void LocalPlayer::flopEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } } } @@ -1701,7 +1701,7 @@ void LocalPlayer::flopEngine() // Gegner setzen -> call if(currentHand->getCurrentBeRo()->getHighestSet() >= 4*currentHand->getSmallBlind()) { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } // Standard-Raise-Routine else { @@ -1716,12 +1716,12 @@ void LocalPlayer::flopEngine() if(myCash/(2*currentHand->getSmallBlind()) <= 6 || raise >= (myCash*4)/5) { raise = myCash; } - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // extrem hoher set der gegner -> bluff beenden if(currentHand->getCurrentBeRo()->getHighestSet() >= 10*currentHand->getSmallBlind()) { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } } } else { @@ -1743,7 +1743,7 @@ void LocalPlayer::flopEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } } @@ -1974,11 +1974,11 @@ void LocalPlayer::flopEngine() // case 4: { // Tools::getRandNumber(0,100,1,&cBluff,0); // if(cBluff < 35) { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // else { // if(myCash/(2*currentHand->getSmallBlind()) <= 8) { - // myAction = PLAYER_ACTION_ALLIN; + // myAction = PLAYER_ACTION_ALLIN; // } else { // if(cBluff < 60) { // bet = (7-myDude4)*2*currentHand->getSmallBlind(); @@ -1986,7 +1986,7 @@ void LocalPlayer::flopEngine() // bet = (((100-cBluff)/20)+2)*currentHand->getSmallBlind(); // } // if(bet < 2*currentHand->getSmallBlind()) bet = 2*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // } // } @@ -1996,11 +1996,11 @@ void LocalPlayer::flopEngine() // case 2: { // Tools::getRandNumber(0,100,1,&cBluff,0); // if(cBluff < 35) { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // else { // if(myCash/(2*currentHand->getSmallBlind()) <= 8) { - // myAction = PLAYER_ACTION_ALLIN; + // myAction = PLAYER_ACTION_ALLIN; // } else { // if(cBluff < 60) { // bet = (5-myDude4)*2*currentHand->getSmallBlind(); @@ -2008,7 +2008,7 @@ void LocalPlayer::flopEngine() // bet = (((100-cBluff)/20)+2)*currentHand->getSmallBlind(); // } // if(bet < 2*currentHand->getSmallBlind()) bet = 2*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // } // } @@ -2016,11 +2016,11 @@ void LocalPlayer::flopEngine() // case 1: { // Tools::getRandNumber(0,100,1,&cBluff,0); // if(cBluff < 40) { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // else { // if(myCash/(2*currentHand->getSmallBlind()) <= 6) { - // myAction = PLAYER_ACTION_ALLIN; + // myAction = PLAYER_ACTION_ALLIN; // } else { // if(cBluff < 60) { // bet = (3-myDude4)*2*currentHand->getSmallBlind(); @@ -2028,7 +2028,7 @@ void LocalPlayer::flopEngine() // bet = (((100-cBluff)/20)+2)*currentHand->getSmallBlind(); // } // if(bet < 2*currentHand->getSmallBlind()) bet = 2*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // } // } @@ -2038,10 +2038,10 @@ void LocalPlayer::flopEngine() // if(info[1] >= 10 && sBluff <= 40) { // bet = (sBluff/10)*2*currentHand->getSmallBlind(); // if(bet < 2*currentHand->getSmallBlind()) bet = 2*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // else { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // } // } @@ -2052,15 +2052,15 @@ void LocalPlayer::flopEngine() // case 2: { // Tools::getRandNumber(0,100,1,&cBluff,0); // if(cBluff > 80) { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // else { // if(myCash/(2*currentHand->getSmallBlind()) <= 6) { - // myAction = PLAYER_ACTION_ALLIN; + // myAction = PLAYER_ACTION_ALLIN; // } else { // bet = (cBluff/20)*2*currentHand->getSmallBlind(); // if(bet < 2*currentHand->getSmallBlind()) bet = 2*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // } // } @@ -2068,15 +2068,15 @@ void LocalPlayer::flopEngine() // default: { // Tools::getRandNumber(0,100,1,&cBluff,0); // if(cBluff > 90) { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // else { // if(myCash/(2*currentHand->getSmallBlind()) <= 5) { - // myAction = PLAYER_ACTION_ALLIN; + // myAction = PLAYER_ACTION_ALLIN; // } else { // bet = (cBluff/30)*2*currentHand->getSmallBlind(); // if(bet < 2*currentHand->getSmallBlind()) bet = 2*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // } // } @@ -2092,7 +2092,7 @@ void LocalPlayer::flopEngine() // if(currentHand->getActivePlayerList().size() == 2) { // bet = (1-myDude4)*2*currentHand->getSmallBlind(); // if(bet < 2*currentHand->getSmallBlind()) bet = 2*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // // } // else { @@ -2100,40 +2100,40 @@ void LocalPlayer::flopEngine() // case 3: { // if(sBluff <= 10) { // bet = (sBluff/5 + 2)*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // else { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // } // break; // case 2: { // if(sBluff <= 15) { // bet = (sBluff/5 + 2)*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // else { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // } // break; // case 1: { // if(sBluff <= 50) { // bet = (sBluff/15 + 2)*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // else { - // myAction = PLAYER_ACTION_CHECK; + // myAction = PLAYER_ACTION_CHECK; // } // } // break; // default: { // if(myCash/(2*currentHand->getSmallBlind()) <= 5) { - // myAction = PLAYER_ACTION_ALLIN; + // myAction = PLAYER_ACTION_ALLIN; // } else { // bet = (sBluff/15)*2*currentHand->getSmallBlind(); // if(bet < 2*currentHand->getSmallBlind()) bet = 2*currentHand->getSmallBlind(); - // myAction = PLAYER_ACTION_BET; + // myAction = PLAYER_ACTION_BET; // } // } // break; @@ -2292,16 +2292,16 @@ void LocalPlayer::turnEngine() // all in if(myOdds >= myNiveau[2] + 15) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // nur call else { // all in bei knappem call if(myCash-currentHand->getCurrentBeRo()->getHighestSet() <= (myCash*1)/5) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } else { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } @@ -2317,25 +2317,25 @@ void LocalPlayer::turnEngine() if(myCash/(2*currentHand->getSmallBlind()) <= 6 || raise >= (myCash*4.0)/5.0) { raise = myCash; } - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // auf cBluff testen --> call statt raise - if(cBluff > 90) myAction = PLAYER_ACTION_CALL; - if(cBluff > 80 && myOdds >= myNiveau[2] + 5) myAction = PLAYER_ACTION_CALL; - if(cBluff > 70 && myOdds >= myNiveau[2] + 10) myAction = PLAYER_ACTION_CALL; - if(cBluff > 60 && myOdds >= myNiveau[2] + 15) myAction = PLAYER_ACTION_CALL; + if(cBluff > 90) myAction = PLAYER_ACTION_CALL; + if(cBluff > 80 && myOdds >= myNiveau[2] + 5) myAction = PLAYER_ACTION_CALL; + if(cBluff > 70 && myOdds >= myNiveau[2] + 10) myAction = PLAYER_ACTION_CALL; + if(cBluff > 60 && myOdds >= myNiveau[2] + 15) myAction = PLAYER_ACTION_CALL; } else { // call -> über niveau0, schon einiges gesetzt im flop, schon einiges insgesamt gesetzt if(myOdds >= myNiveau[0] || (mySet >= currentHand->getCurrentBeRo()->getHighestSet()/2 && myOdds >= myNiveau[0]-5) || (myRoundStartCash-myCash > individualHighestSet && myNiveau[0]-3)) { // all in bei knappem call if(currentHand->getCurrentBeRo()->getHighestSet() > (myCash*3.0)/4.0) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; - } else myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_RAISE; + } else myAction = PLAYER_ACTION_CALL; } // fold else { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } } } @@ -2355,17 +2355,17 @@ void LocalPlayer::turnEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; // auf cBluff testen --> call statt raise - if(cBluff > 90) myAction = PLAYER_ACTION_CHECK; - if(cBluff > 80 && myOdds >= myNiveau[2] + 5) myAction = PLAYER_ACTION_CHECK; - if(cBluff > 70 && myOdds >= myNiveau[2] + 10) myAction = PLAYER_ACTION_CHECK; - if(cBluff > 60 && myOdds >= myNiveau[2] + 15) myAction = PLAYER_ACTION_CHECK; + if(cBluff > 90) myAction = PLAYER_ACTION_CHECK; + if(cBluff > 80 && myOdds >= myNiveau[2] + 5) myAction = PLAYER_ACTION_CHECK; + if(cBluff > 70 && myOdds >= myNiveau[2] + 10) myAction = PLAYER_ACTION_CHECK; + if(cBluff > 60 && myOdds >= myNiveau[2] + 15) myAction = PLAYER_ACTION_CHECK; } // check else { - myAction = PLAYER_ACTION_CHECK; + myAction = PLAYER_ACTION_CHECK; // Position if(myButton == 1) { // Position-Bluff generieren @@ -2384,7 +2384,7 @@ void LocalPlayer::turnEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } } } @@ -2401,7 +2401,7 @@ void LocalPlayer::turnEngine() // Gegner setzen -> call if(currentHand->getCurrentBeRo()->getHighestSet() >= 4*currentHand->getSmallBlind()) { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } // Standard-Raise-Routine else { @@ -2416,12 +2416,12 @@ void LocalPlayer::turnEngine() if(myCash/(2*currentHand->getSmallBlind()) <= 6 || raise >= (myCash*4)/5) { raise = myCash; } - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // extrem hoher set der gegner -> bluff beenden if(currentHand->getCurrentBeRo()->getHighestSet() >= 10*currentHand->getSmallBlind()) { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } } } else { @@ -2443,7 +2443,7 @@ void LocalPlayer::turnEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } } @@ -2813,16 +2813,16 @@ void LocalPlayer::riverEngine() // all in if(myOdds >= myNiveau[2] + 15) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // nur call else { // all in bei knappem call if(myCash-currentHand->getCurrentBeRo()->getHighestSet() <= (myCash*1)/5) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } else { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } } @@ -2838,7 +2838,7 @@ void LocalPlayer::riverEngine() if(myCash/(2*currentHand->getSmallBlind()) <= 8) { raise = myCash; } - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } } else { // call -> über niveau0, schon einiges gesetzt im flop, schon einiges insgesamt gesetzt @@ -2846,12 +2846,12 @@ void LocalPlayer::riverEngine() // all in bei knappem call if(myCash-currentHand->getCurrentBeRo()->getHighestSet() <= (myCash*1)/4) { raise = myCash; - myAction = PLAYER_ACTION_RAISE; - } else myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_RAISE; + } else myAction = PLAYER_ACTION_CALL; } // fold else { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } } } else { @@ -2869,11 +2869,11 @@ void LocalPlayer::riverEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } // check else { - myAction = PLAYER_ACTION_CHECK; + myAction = PLAYER_ACTION_CHECK; // Position if(myButton == 1) { // Position-Bluff generieren @@ -2892,7 +2892,7 @@ void LocalPlayer::riverEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } } } @@ -2913,7 +2913,7 @@ void LocalPlayer::riverEngine() // Gegner setzen -> call if(currentHand->getCurrentBeRo()->getHighestSet() >= 4*currentHand->getSmallBlind()) { - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } // Standard-Raise-Routine else { @@ -2928,12 +2928,12 @@ void LocalPlayer::riverEngine() if(myCash/(2*currentHand->getSmallBlind()) <= 6 || raise >= (myCash*4)/5) { raise = myCash; } - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } // extrem hoher set der gegner -> bluff beenden if(currentHand->getCurrentBeRo()->getHighestSet() >= 10*currentHand->getSmallBlind()) { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } } } else { @@ -2955,7 +2955,7 @@ void LocalPlayer::riverEngine() if(bet > (myCash*4.0)/5.0) { bet = myCash; } - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } } @@ -3237,7 +3237,7 @@ void LocalPlayer::evaluation(int bet, int raise) if(highestSet >= myCash + mySet) { mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet); // cout << "evaluation(call) - mySet: " << mySet << endl; } @@ -3260,7 +3260,7 @@ void LocalPlayer::evaluation(int bet, int raise) currentHand->getCurrentBeRo()->setMinimumRaise(myCash); mySet = myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; highestSet = mySet; // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet); } @@ -3274,7 +3274,7 @@ void LocalPlayer::evaluation(int bet, int raise) } // lastPlayerAction für Karten umblättern reihenfolge setzrn - currentHand->setLastActionPlayerID(myUniqueID); + currentHand->setLastActionPlayerID(myUniqueID); } break; // raise @@ -3284,14 +3284,14 @@ void LocalPlayer::evaluation(int bet, int raise) if(highestSet >= myCash + mySet) { mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet); } // sonst else { myCash = myCash - highestSet + mySet; mySet = highestSet; - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CALL,mySet); } } else { @@ -3306,27 +3306,27 @@ void LocalPlayer::evaluation(int bet, int raise) // only call all-in mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } else { // raise, but not enough --> full bet rule currentHand->getCurrentBeRo()->setFullBetRule(true); // lastPlayerAction für Karten umblättern reihenfolge setzrn - currentHand->setLastActionPlayerID(myUniqueID); + currentHand->setLastActionPlayerID(myUniqueID); mySet += myCash; currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet); myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; highestSet = mySet; } } else { // lastPlayerAction für Karten umblättern reihenfolge setzrn - currentHand->setLastActionPlayerID(myUniqueID); + currentHand->setLastActionPlayerID(myUniqueID); mySet += myCash; currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet); myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; highestSet = mySet; } // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet); @@ -3338,7 +3338,7 @@ void LocalPlayer::evaluation(int bet, int raise) mySet = highestSet + raise; highestSet = mySet; // lastPlayerAction für Karten umblättern reihenfolge setzrn - currentHand->setLastActionPlayerID(myUniqueID); + currentHand->setLastActionPlayerID(myUniqueID); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_BET,mySet); } } @@ -4470,7 +4470,7 @@ void LocalPlayer::preflopEngine3() // FOLD --> wenn Potential negativ oder HighestSet zu hoch if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * currentHand->getSmallBlind() && potential<4)) && CardsValue::holeCardsClass(myCards[0], myCards[1]) < 9 && bluff > 15) { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } else { // RAISE --> wenn hohes Potential if((potential >= 4 && 6 * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || bluff <= 6) { @@ -4489,14 +4489,14 @@ void LocalPlayer::preflopEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } else { // doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!! @@ -4507,14 +4507,14 @@ void LocalPlayer::preflopEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } else raise = (potential - 4 ) * 2 * currentHand->getCurrentBeRo()->getHighestSet(); @@ -4535,14 +4535,14 @@ void LocalPlayer::preflopEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } else { // doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!! @@ -4553,14 +4553,14 @@ void LocalPlayer::preflopEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } else raise = (potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet(); } @@ -4573,7 +4573,7 @@ void LocalPlayer::preflopEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); } @@ -4583,7 +4583,7 @@ void LocalPlayer::preflopEngine3() myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; currentHand->getCurrentBeRo()->setHighestSet(mySet); - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } } } @@ -4591,7 +4591,7 @@ void LocalPlayer::preflopEngine3() else { // CHECK --> wenn alle Sets glieich bei BigBlind und nich zu hohem Potential if(mySet == currentHand->getCurrentBeRo()->getHighestSet()) { - myAction = PLAYER_ACTION_CHECK; + myAction = PLAYER_ACTION_CHECK; } // CALL --> bei normalen Potential else { @@ -4600,14 +4600,14 @@ void LocalPlayer::preflopEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } } @@ -4697,14 +4697,14 @@ void LocalPlayer::flopEngine3() // FOLD --> wenn potential negativ oder HighestSet zu hoch if(( potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 18) { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } else { // CHECK und BET --> wenn noch keiner was gesetzt hat if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { // CHECK --> wenn Potential klein oder check-bluff sonst bet oder bet-bluff if((potential<3 || bluff >= 80) && bluff > 15) { // check - myAction = PLAYER_ACTION_CHECK; + myAction = PLAYER_ACTION_CHECK; } // BET --> wenn Potential hoch else { @@ -4719,13 +4719,13 @@ void LocalPlayer::flopEngine3() if(mySet >= myCash) { mySet = myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash -= mySet; - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } currentHand->getCurrentBeRo()->setHighestSet(mySet); } @@ -4748,7 +4748,7 @@ void LocalPlayer::flopEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); } @@ -4758,7 +4758,7 @@ void LocalPlayer::flopEngine3() myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; currentHand->getCurrentBeRo()->setHighestSet(mySet); - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } } // CALL --> bei normalen Potential @@ -4769,14 +4769,14 @@ void LocalPlayer::flopEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } } @@ -4864,14 +4864,14 @@ void LocalPlayer::turnEngine3() // FOLD // --> wenn potential negativ oder HighestSet zu hoch if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 15) { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } else { // CHECK und BET --> wenn noch keiner was gesetzt hat if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { // CHECK --> wenn Potential klein if((potential<2 || bluff >= 80) && bluff > 10) { // check - myAction = PLAYER_ACTION_CHECK; + myAction = PLAYER_ACTION_CHECK; } // BET --> wenn Potential hoch else { @@ -4887,13 +4887,13 @@ void LocalPlayer::turnEngine3() if(mySet >= myCash) { mySet = myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash -= mySet; - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } currentHand->getCurrentBeRo()->setHighestSet(mySet); } @@ -4916,7 +4916,7 @@ void LocalPlayer::turnEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); } @@ -4926,7 +4926,7 @@ void LocalPlayer::turnEngine3() myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; currentHand->getCurrentBeRo()->setHighestSet(mySet); - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } } // CALL --> bei normalen Potential @@ -4936,14 +4936,14 @@ void LocalPlayer::turnEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } } @@ -5026,14 +5026,14 @@ void LocalPlayer::riverEngine3() // FOLD // --> wenn potential negativ oder HighestSet zu hoch if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 15) { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_FOLD; } else { // CHECK und BET --> wenn noch keiner was gesetzt hat if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { // CHECK --> wenn Potential klein if((potential<2 || bluff >= 92) && bluff > 15) { // check - myAction = PLAYER_ACTION_CHECK; + myAction = PLAYER_ACTION_CHECK; } // BET --> wenn Potential hoch else { @@ -5049,13 +5049,13 @@ void LocalPlayer::riverEngine3() if(mySet >= myCash) { mySet = myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash -= mySet; - myAction = PLAYER_ACTION_BET; + myAction = PLAYER_ACTION_BET; } currentHand->getCurrentBeRo()->setHighestSet(mySet); } @@ -5078,7 +5078,7 @@ void LocalPlayer::riverEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); } @@ -5088,7 +5088,7 @@ void LocalPlayer::riverEngine3() myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; currentHand->getCurrentBeRo()->setHighestSet(mySet); - myAction = PLAYER_ACTION_RAISE; + myAction = PLAYER_ACTION_RAISE; } } // CALL --> bei normalen Potential @@ -5098,14 +5098,14 @@ void LocalPlayer::riverEngine3() mySet += myCash; myCash = 0; - myAction = PLAYER_ACTION_ALLIN; + myAction = PLAYER_ACTION_ALLIN; } // sonst else { myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; } } } diff --git a/src/engine/local_engine/localplayer.h b/src/engine/local_engine/localplayer.h index f8a3c0cf..d9191ae4 100755 --- a/src/engine/local_engine/localplayer.h +++ b/src/engine/local_engine/localplayer.h @@ -113,12 +113,12 @@ public: return myLastRelativeSet; } - void setMyAction(PlayerAction theValue, bool blind = 0) { + void setMyAction(PlayerAction theValue, bool blind = 0) { myAction = theValue; // logging for human player if(myAction && !blind) currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet); } - PlayerAction getMyAction() const { + PlayerAction getMyAction() const { return myAction; } @@ -317,7 +317,7 @@ private: int myCash; int mySet; int myLastRelativeSet; - PlayerAction myAction; + PlayerAction myAction; int myButton; // 0 = none, 1 = dealer, 2 =small, 3 = big bool myActiveStatus; // 0 = inactive, 1 = active bool myStayOnTableStatus; // 0 = left, 1 = stay diff --git a/src/engine/log.cpp b/src/engine/log.cpp index 5073ada5..fe8da41f 100644 --- a/src/engine/log.cpp +++ b/src/engine/log.cpp @@ -34,15 +34,15 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID if(SQLITE_LOG) { // logging activated - if(myConfig->readConfigInt("LogOnOff")) { + if(myConfig->readConfigInt("LogOnOff")) { DIR *logDir; - logDir = opendir((myConfig->readConfigString("LogDir")).c_str()); + logDir = opendir((myConfig->readConfigString("LogDir")).c_str()); bool dirExists = logDir != NULL; closedir(logDir); // check if logging path exist - if(myConfig->readConfigString("LogDir") != "" && dirExists) { + if(myConfig->readConfigString("LogDir") != "" && dirExists) { // detect current time char curDateTime[20]; @@ -54,7 +54,7 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID strftime(curDate,11,"%Y-%m-%d",z); strftime(curTime,9,"%H:%M:%S",z); - string mySqliteLogFileName = boost::lexical_cast((myConfig->readConfigString("LogDir")).c_str()); + string mySqliteLogFileName = boost::lexical_cast((myConfig->readConfigString("LogDir")).c_str()); mySqliteLogFileName += "pokerth-log-" + boost::lexical_cast(curDateTime) + ".pdb"; // open sqlite-db @@ -63,23 +63,23 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID int i; // create session table - sql += "CREATE TABLE Session ("; + sql += "CREATE TABLE Session ("; sql += "PokerTH_Version TEXT NOT NULL"; sql += ",Date TEXT NOT NULL"; sql += ",Time TEXT NOT NULL"; - sql += ", PRIMARY KEY(Date,Time));"; + sql += ", PRIMARY KEY(Date,Time));"; - sql += "INSERT INTO Session ("; + sql += "INSERT INTO Session ("; sql += "PokerTH_Version"; sql += ",Date"; sql += ",Time"; sql += ") VALUES ("; sql += "\"" + boost::lexical_cast(POKERTH_BETA_RELEASE_STRING) + "\","; sql += "\"" + boost::lexical_cast(curDate) + "\","; - sql += "\"" + boost::lexical_cast(curTime) + "\");"; + sql += "\"" + boost::lexical_cast(curTime) + "\");"; // create game table - sql += "CREATE TABLE Game ("; + sql += "CREATE TABLE Game ("; sql += "GameID INTEGER NOT NULL PRIMARY KEY"; sql += ",Startmoney INTEGER NOT NULL"; sql += ",StartSb INTEGER NOT NULL"; @@ -88,10 +88,10 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID sql += ",Seat_" + boost::lexical_cast(i) + " TEXT"; } sql += ",Winner_Seat INTEGER"; - sql += ");"; + sql += ");"; // create hand table - sql += "CREATE TABLE Hand ("; + sql += "CREATE TABLE Hand ("; sql += "HandID INTEGER NOT NULL"; sql += ",GameID INTEGER NOT NULL"; sql += ",Dealer_Seat INTEGER"; @@ -109,10 +109,10 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID for(i=1; i<=5; i++) { sql += ",BoardCard_" + boost::lexical_cast(i) + " INTEGER"; } - sql += ",PRIMARY KEY(HandID,GameID));"; + sql += ",PRIMARY KEY(HandID,GameID));"; // create action table - sql += "CREATE TABLE Action ("; + sql += "CREATE TABLE Action ("; sql += "ActionID INTEGER PRIMARY KEY AUTOINCREMENT"; sql += ",HandID INTEGER NOT NULL"; sql += ",GameID INTEGER NOT NULL"; @@ -120,9 +120,9 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID sql += ",Player INTEGER NOT NULL"; sql += ",Action TEXT NOT NULL"; sql += ",Amount INTEGER"; - sql += ");"; + sql += ");"; - exec_transaction(&sql); + exec_transaction(&sql); } } } @@ -143,7 +143,7 @@ void Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned if(SQLITE_LOG) { - if(myConfig->readConfigInt("LogOnOff")) { + if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled PlayerListConstIterator it_c; @@ -152,7 +152,7 @@ void Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned // sqlite-db is open int i; - sql += "INSERT INTO Game ("; + sql += "INSERT INTO Game ("; sql += "GameID"; sql += ",Startmoney"; sql += ",StartSb"; @@ -172,8 +172,8 @@ void Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned sql += ",NULL"; } } - sql += ");"; - exec_transaction(&sql); + sql += ");"; + exec_transaction(&sql); } } } @@ -183,11 +183,11 @@ void Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, uns { curHandID = handID; - logHoleCardsDone = false; + logHoleCardsDone = false; if(SQLITE_LOG) { - if(myConfig->readConfigInt("LogOnOff")) { + if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled PlayerListConstIterator it_c; @@ -196,7 +196,7 @@ void Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, uns // sqlite-db is open int i; - sql += "INSERT INTO Hand ("; + sql += "INSERT INTO Hand ("; sql += "HandID"; sql += ",GameID"; sql += ",Dealer_Seat"; @@ -222,31 +222,30 @@ void Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, uns sql += ",NULL"; } } - sql += ");"; - if(myConfig->readConfigInt("LogInterval") == 0) { - exec_transaction(&sql); - } + sql += ");"; + if(myConfig->readConfigInt("LogInterval") == 0) { + exec_transaction(&sql); + } - // !! TODO !! Hack, weil Button-Regel noch falsch und dealerPosition noch teilweise falsche ID enthält (HeadsUp: dealerPosition=bigBlindPosition <-- falsch) - bool dealerButtonOnTable = false; - int countActivePlayer = 0; - for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) { - if((*it_c)->getMyActiveStatus()) { - countActivePlayer++; - if((*it_c)->getMyButton()==BUTTON_DEALER && (*it_c)->getMyActiveStatus()) { - dealerButtonOnTable = true; - } - } - } - if(countActivePlayer==2) { - logPlayerAction(0,smallBlindPosition,LOG_ACTION_DEALER); - } - else { - if(dealerButtonOnTable) { - logPlayerAction(0,dealerPosition,LOG_ACTION_DEALER); - } - } - // !! TODO !! Hack + // !! TODO !! Hack, weil Button-Regel noch falsch und dealerPosition noch teilweise falsche ID enthält (HeadsUp: dealerPosition=bigBlindPosition <-- falsch) + bool dealerButtonOnTable = false; + int countActivePlayer = 0; + for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) { + if((*it_c)->getMyActiveStatus()) { + countActivePlayer++; + if((*it_c)->getMyButton()==BUTTON_DEALER && (*it_c)->getMyActiveStatus()) { + dealerButtonOnTable = true; + } + } + } + if(countActivePlayer==2) { + logPlayerAction(0,smallBlindPosition,LOG_ACTION_DEALER); + } else { + if(dealerButtonOnTable) { + logPlayerAction(0,dealerPosition,LOG_ACTION_DEALER); + } + } + // !! TODO !! Hack } } } @@ -257,13 +256,13 @@ void Log::logPlayerAction(int bero, int seat, PlayerActionLog action, int amount if(SQLITE_LOG) { - if(myConfig->readConfigInt("LogOnOff")) { + if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled if( mySqliteLogDb != 0 ) { // sqlite-db is open - sql += "INSERT INTO Action ("; + sql += "INSERT INTO Action ("; sql += "HandID"; sql += ",GameID"; sql += ",BeRo"; @@ -326,10 +325,10 @@ void Log::logPlayerAction(int bero, int seat, PlayerActionLog action, int amount } else { sql += ",NULL"; } - sql += ");"; - if(myConfig->readConfigInt("LogInterval") == 0) { - exec_transaction(&sql); - } + sql += ");"; + if(myConfig->readConfigInt("LogInterval") == 0) { + exec_transaction(&sql); + } } } } @@ -339,7 +338,7 @@ void Log::logBoardCards(int bero, int boardCards[5]) { if(SQLITE_LOG) { - if(myConfig->readConfigInt("LogOnOff")) { + if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled if( mySqliteLogDb != 0 ) { @@ -347,19 +346,19 @@ void Log::logBoardCards(int bero, int boardCards[5]) switch(bero) { case 2: { - sql += "UPDATE Hand SET "; + sql += "UPDATE Hand SET "; sql += "BoardCard_1=" + boost::lexical_cast(boardCards[0]) + ","; sql += "BoardCard_2=" + boost::lexical_cast(boardCards[1]) + ","; sql += "BoardCard_3=" + boost::lexical_cast(boardCards[2]); } break; case 3: { - sql += "UPDATE Hand SET "; + sql += "UPDATE Hand SET "; sql += "BoardCard_4=" + boost::lexical_cast(boardCards[3]); } break; case 4: { - sql += "UPDATE Hand SET "; + sql += "UPDATE Hand SET "; sql += "BoardCard_5=" + boost::lexical_cast(boardCards[4]); } break; @@ -369,10 +368,10 @@ void Log::logBoardCards(int bero, int boardCards[5]) sql += " WHERE "; sql += "GameID=" + boost::lexical_cast(curGameID) + " AND "; sql += "HandID=" + boost::lexical_cast(curHandID); - sql += ";"; - if(myConfig->readConfigInt("LogInterval") == 0) { - exec_transaction(&sql); - } + sql += ";"; + if(myConfig->readConfigInt("LogInterval") == 0) { + exec_transaction(&sql); + } } } } @@ -382,47 +381,47 @@ void Log::logHoleCardsHandName(int bero, PlayerList activePlayerList) { if(SQLITE_LOG) { - if(myConfig->readConfigInt("LogOnOff")) { + if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled - if( mySqliteLogDb != 0 && (bero==5 || !logHoleCardsDone)) { - // sqlite-db is open and we are in postriver or before postriver doesn't log hole cards til now + if( mySqliteLogDb != 0 && (bero==5 || !logHoleCardsDone)) { + // sqlite-db is open and we are in postriver or before postriver doesn't log hole cards til now - PlayerListConstIterator it_c; - int myCards[2]; + PlayerListConstIterator it_c; + int myCards[2]; - for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { - if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { - (*it_c)->getMyCards(myCards); - sql += "UPDATE Hand SET "; - if(bero==5) { - sql += "Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName((*it_c)->getMyCardsValueInt(),activePlayerList) + "\""; - sql += ",Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Hand_int=" + boost::lexical_cast((*it_c)->getMyCardsValueInt()); - } - if(bero==5 && !logHoleCardsDone) { - sql+= ","; - } - if(!logHoleCardsDone) { - sql += "Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Card_1=" + boost::lexical_cast(myCards[0]); - sql += ",Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Card_2=" + boost::lexical_cast(myCards[1]); - } - sql += " WHERE "; - sql += "GameID=" + boost::lexical_cast(curGameID) + " AND "; - sql += "HandID=" + boost::lexical_cast(curHandID); - sql += ";"; - if(myConfig->readConfigInt("LogInterval") == 0) { - exec_transaction(&sql); - } + for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { + if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { + (*it_c)->getMyCards(myCards); + sql += "UPDATE Hand SET "; + if(bero==5) { + sql += "Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName((*it_c)->getMyCardsValueInt(),activePlayerList) + "\""; + sql += ",Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Hand_int=" + boost::lexical_cast((*it_c)->getMyCardsValueInt()); + } + if(bero==5 && !logHoleCardsDone) { + sql+= ","; + } + if(!logHoleCardsDone) { + sql += "Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Card_1=" + boost::lexical_cast(myCards[0]); + sql += ",Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Card_2=" + boost::lexical_cast(myCards[1]); + } + sql += " WHERE "; + sql += "GameID=" + boost::lexical_cast(curGameID) + " AND "; + sql += "HandID=" + boost::lexical_cast(curHandID); + sql += ";"; + if(myConfig->readConfigInt("LogInterval") == 0) { + exec_transaction(&sql); + } - if(!logHoleCardsDone) { - logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_SHOW); - } else { - logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_HAS); - } - } - } + if(!logHoleCardsDone) { + logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_SHOW); + } else { + logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_HAS); + } + } + } - logHoleCardsDone = true; + logHoleCardsDone = true; } } } @@ -430,16 +429,16 @@ void Log::logHoleCardsHandName(int bero, PlayerList activePlayerList) void Log::exec_transaction(string *sql) { - char *errmsg = NULL; + char *errmsg = NULL; - string sql_transaction = "BEGIN;" + *sql + "COMMIT;"; - *sql = ""; + string sql_transaction = "BEGIN;" + *sql + "COMMIT;"; + *sql = ""; - if(sqlite3_exec(mySqliteLogDb, sql_transaction.data(), 0, 0, &errmsg) != SQLITE_OK) { - cout << "Error in statement: " << sql_transaction.data() << "[" << errmsg << "]." << endl; - sqlite3_free(errmsg); - errmsg = NULL; - } + if(sqlite3_exec(mySqliteLogDb, sql_transaction.data(), 0, 0, &errmsg) != SQLITE_OK) { + cout << "Error in statement: " << sql_transaction.data() << "[" << errmsg << "]." << endl; + sqlite3_free(errmsg); + errmsg = NULL; + } } //void diff --git a/src/engine/log.h b/src/engine/log.h index 60891ea2..a1e01a6f 100644 --- a/src/engine/log.h +++ b/src/engine/log.h @@ -30,7 +30,7 @@ class Log { public: - Log(ConfigFile *c); + Log(ConfigFile *c); ~Log(); @@ -38,18 +38,18 @@ public: void logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned smallBlindPosition, int bigBlind, unsigned bigBlindPosition, PlayerList seatsList); void logPlayerAction(int bero, int seat, PlayerActionLog action, int amount = 0); void logBoardCards(int bero, int boardCards[5]); - void logHoleCardsHandName(int bero, PlayerList activePlayerList); - void exec_transaction(std::string *sql); + void logHoleCardsHandName(int bero, PlayerList activePlayerList); + void exec_transaction(std::string *sql); // void closeLogDbAtExit(); private: sqlite3 *mySqliteLogDb; - ConfigFile *myConfig; + ConfigFile *myConfig; int curGameID; int curHandID; - std::string sql; - bool logHoleCardsDone; + std::string sql; + bool logHoleCardsDone; }; #endif // LOG_H diff --git a/src/engine/network_engine/clientbero.h b/src/engine/network_engine/clientbero.h index 4ddec12f..62b052c4 100644 --- a/src/engine/network_engine/clientbero.h +++ b/src/engine/network_engine/clientbero.h @@ -30,7 +30,7 @@ class HandInterface; class ClientBeRo : public BeRoInterface { public: - ClientBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS); + ClientBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS); ~ClientBeRo(); GameState getMyBeRoID() const; diff --git a/src/engine/network_engine/clientboard.cpp b/src/engine/network_engine/clientboard.cpp index f66c1e69..95df92ad 100644 --- a/src/engine/network_engine/clientboard.cpp +++ b/src/engine/network_engine/clientboard.cpp @@ -24,7 +24,7 @@ using namespace std; ClientBoard::ClientBoard(unsigned dp) - : pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayerID(0) + : pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayerID(0) { myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0; } @@ -98,7 +98,7 @@ void ClientBoard::setLastActionPlayerID(unsigned theValue) { boost::recursive_mutex::scoped_lock lock(m_syncMutex); - lastActionPlayerID = theValue; + lastActionPlayerID = theValue; } void diff --git a/src/engine/network_engine/clientboard.h b/src/engine/network_engine/clientboard.h index 497c6d25..82619abe 100644 --- a/src/engine/network_engine/clientboard.h +++ b/src/engine/network_engine/clientboard.h @@ -45,7 +45,7 @@ public: void setSets(int theValue); void setAllInCondition(bool theValue); - void setLastActionPlayerID(unsigned theValue); + void setLastActionPlayerID(unsigned theValue); void collectSets(); void collectPot(); @@ -74,7 +74,7 @@ private: int sets; unsigned dealerPosition; bool allInCondition; - unsigned lastActionPlayerID; + unsigned lastActionPlayerID; }; #endif diff --git a/src/engine/network_engine/clientenginefactory.cpp b/src/engine/network_engine/clientenginefactory.cpp index 5a260cb1..05ea3ae4 100644 --- a/src/engine/network_engine/clientenginefactory.cpp +++ b/src/engine/network_engine/clientenginefactory.cpp @@ -58,11 +58,11 @@ ClientEngineFactory::createBeRo(HandInterface *hi, unsigned dP, int sB) { std::vector > myBeRo; - myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_PREFLOP))); - myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_FLOP))); - myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_TURN))); - myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_RIVER))); - myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_POST_RIVER))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_PREFLOP))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_FLOP))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_TURN))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_RIVER))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, dP, sB, GAME_STATE_POST_RIVER))); return myBeRo; diff --git a/src/engine/network_engine/clientenginefactory.h b/src/engine/network_engine/clientenginefactory.h index b1766902..e2ccf417 100644 --- a/src/engine/network_engine/clientenginefactory.h +++ b/src/engine/network_engine/clientenginefactory.h @@ -41,7 +41,7 @@ public: virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); virtual boost::shared_ptr createBoard(unsigned dp); virtual boost::shared_ptr createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); - virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB); + virtual std::vector > createBeRo(HandInterface *hi, unsigned dP, int sB); }; #endif diff --git a/src/engine/network_engine/clienthand.cpp b/src/engine/network_engine/clienthand.cpp index d076807e..d81d9ee8 100644 --- a/src/engine/network_engine/clienthand.cpp +++ b/src/engine/network_engine/clienthand.cpp @@ -22,8 +22,8 @@ using namespace std; ClientHand::ClientHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) - : myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(GAME_STATE_PREFLOP), - smallBlind(sB), startCash(sC), previousPlayerID(-1), allInCondition(0), + : myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(GAME_STATE_PREFLOP), + smallBlind(sB), startCash(sC), previousPlayerID(-1), allInCondition(0), cardsShown(false), bettingRoundsPlayed(0) { PlayerListIterator it; @@ -51,7 +51,7 @@ ClientHand::ClientHand(boost::shared_ptr f, GuiInterface *g, boos // the rest of the buttons are assigned later as received from the server. // Preflop, Flop, Turn und River erstellen - myBeRo = myFactory->createBeRo(this, dealerPosition, smallBlind); + myBeRo = myFactory->createBeRo(this, dealerPosition, smallBlind); } @@ -290,28 +290,28 @@ void ClientHand::setPreviousPlayerID(int theValue) { boost::recursive_mutex::scoped_lock lock(m_syncMutex); - previousPlayerID = theValue; + previousPlayerID = theValue; } int ClientHand::getPreviousPlayerID() const { boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return previousPlayerID; + return previousPlayerID; } void ClientHand::setLastActionPlayerID (unsigned theValue) { boost::recursive_mutex::scoped_lock lock(m_syncMutex); - lastActionPlayerID = theValue; + lastActionPlayerID = theValue; } unsigned ClientHand::getLastActionPlayerID() const { boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return lastActionPlayerID; + return lastActionPlayerID; } void diff --git a/src/engine/network_engine/clienthand.h b/src/engine/network_engine/clienthand.h index ace6945b..e6634b9f 100644 --- a/src/engine/network_engine/clienthand.h +++ b/src/engine/network_engine/clienthand.h @@ -63,8 +63,8 @@ public: void setStartQuantityPlayers ( int theValue ); int getStartQuantityPlayers() const; - void setCurrentRound ( GameState theValue ); - GameState getCurrentRound() const; + void setCurrentRound ( GameState theValue ); + GameState getCurrentRound() const; void setDealerPosition ( int theValue ); int getDealerPosition() const; @@ -81,11 +81,11 @@ public: void setBettingRoundsPlayed ( int theValue ); int getBettingRoundsPlayed() const; - void setPreviousPlayerID ( int theValue ); - int getPreviousPlayerID() const; + void setPreviousPlayerID ( int theValue ); + int getPreviousPlayerID() const; - void setLastActionPlayerID ( unsigned theValue ); - unsigned getLastActionPlayerID() const; + void setLastActionPlayerID ( unsigned theValue ); + unsigned getLastActionPlayerID() const; void setCardsShown ( bool theValue ); bool getCardsShown() const; @@ -115,12 +115,12 @@ private: int myID; int startQuantityPlayers; unsigned dealerPosition; - GameState currentRound; + GameState currentRound; int smallBlind; int startCash; - int previousPlayerID; - unsigned lastActionPlayerID; + int previousPlayerID; + unsigned lastActionPlayerID; bool allInCondition; bool cardsShown; diff --git a/src/engine/network_engine/clientplayer.cpp b/src/engine/network_engine/clientplayer.cpp index 4030c889..809936ca 100644 --- a/src/engine/network_engine/clientplayer.cpp +++ b/src/engine/network_engine/clientplayer.cpp @@ -25,7 +25,7 @@ using namespace std; ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) : PlayerInterface(), myConfig(c), currentHand(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(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(true), myTurn(false), myCardsFlip(false), myRoundStartCash(0), + myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(true), myTurn(false), myCardsFlip(false), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(false), myWinnerState(false), m_isConnected(false) { myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0; diff --git a/src/engine/network_engine/clientplayer.h b/src/engine/network_engine/clientplayer.h index 9d935c9a..cd8812d7 100644 --- a/src/engine/network_engine/clientplayer.h +++ b/src/engine/network_engine/clientplayer.h @@ -64,8 +64,8 @@ public: int getMySet() const; int getMyLastRelativeSet() const; - void setMyAction(PlayerAction theValue, bool blind); - PlayerAction getMyAction() const; + void setMyAction(PlayerAction theValue, bool blind); + PlayerAction getMyAction() const; void setMyButton(int theValue); int getMyButton() const; @@ -172,7 +172,7 @@ private: int myCash; int mySet; int myLastRelativeSet; - PlayerAction myAction; + PlayerAction myAction; int myButton; // 0 = none, 1 = dealer, 2 =small, 3 = big bool myActiveStatus; // 0 = inactive, 1 = active bool myStayOnTableStatus; // 0 = left, 1 = stay diff --git a/src/engine/playerinterface.h b/src/engine/playerinterface.h index e27cf034..81e7313c 100644 --- a/src/engine/playerinterface.h +++ b/src/engine/playerinterface.h @@ -62,8 +62,8 @@ public: virtual int getMySet() const =0; virtual int getMyLastRelativeSet() const =0; - virtual void setMyAction(PlayerAction theValue, bool blind=0) =0; - virtual PlayerAction getMyAction() const =0; + virtual void setMyAction(PlayerAction theValue, bool blind=0) =0; + virtual PlayerAction getMyAction() const =0; virtual void setMyButton(int theValue) =0; virtual int getMyButton() const =0; diff --git a/src/game_defs.h b/src/game_defs.h index 7730fbda..98b988b0 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -69,7 +69,7 @@ enum PlayerAction { PLAYER_ACTION_CALL, PLAYER_ACTION_BET, PLAYER_ACTION_RAISE, - PLAYER_ACTION_ALLIN + PLAYER_ACTION_ALLIN }; enum PlayerActionCode { @@ -80,21 +80,21 @@ enum PlayerActionCode { }; enum PlayerActionLog { - LOG_ACTION_NONE = 0, - LOG_ACTION_DEALER, // starts as dealer - LOG_ACTION_SMALL_BLIND, // posts small blind - LOG_ACTION_BIG_BLIND, // posts big blind - LOG_ACTION_FOLD, // folds - LOG_ACTION_CHECK, // checks - LOG_ACTION_CALL, // calls - LOG_ACTION_BET, // bets - LOG_ACTION_ALL_IN, // is all in with - LOG_ACTION_SHOW, // shows - LOG_ACTION_HAS, // has - LOG_ACTION_WIN, // wins - LOG_ACTION_WIN_SIDE_POT,// wins (side pot) - LOG_ACTION_SIT_OUT, // sits out - LOG_ACTION_WIN_GAME // wins game + LOG_ACTION_NONE = 0, + LOG_ACTION_DEALER, // starts as dealer + LOG_ACTION_SMALL_BLIND, // posts small blind + LOG_ACTION_BIG_BLIND, // posts big blind + LOG_ACTION_FOLD, // folds + LOG_ACTION_CHECK, // checks + LOG_ACTION_CALL, // calls + LOG_ACTION_BET, // bets + LOG_ACTION_ALL_IN, // is all in with + LOG_ACTION_SHOW, // shows + LOG_ACTION_HAS, // has + LOG_ACTION_WIN, // wins + LOG_ACTION_WIN_SIDE_POT,// wins (side pot) + LOG_ACTION_SIT_OUT, // sits out + LOG_ACTION_WIN_GAME // wins game }; enum DenyKickPlayerReason { diff --git a/src/gui/qt/chattools/chattools.cpp b/src/gui/qt/chattools/chattools.cpp index e906d9c4..7fdbe0f7 100644 --- a/src/gui/qt/chattools/chattools.cpp +++ b/src/gui/qt/chattools/chattools.cpp @@ -248,13 +248,11 @@ void ChatTools::nickAutoCompletition() if(lastChatString == "") { myLineEdit->setText(lastMatchStringList.at(nickAutoCompletitionCounter)+": "); - } - else { + } else { //check if lastChatString is pm-code if((lastChatString == "/msg" || lastChatString == "/msg ") && lastMatchStringList.at(nickAutoCompletitionCounter).contains(" ")) { myLineEdit->setText(lastChatString+" \""+lastMatchStringList.at(nickAutoCompletitionCounter)+"\" "); - } - else { + } else { myLineEdit->setText(lastChatString+" "+lastMatchStringList.at(nickAutoCompletitionCounter)+" "); } } diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 457569a2..05095b53 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -1823,12 +1823,12 @@ void gameTableImpl::myFold() boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); boost::shared_ptr humanPlayer = currentHand->getSeatsList()->front(); - humanPlayer->setMyAction(PLAYER_ACTION_FOLD); + humanPlayer->setMyAction(PLAYER_ACTION_FOLD); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,1,LOG_ACTION_FOLD); humanPlayer->setMyTurn(0); //set that i was the last active player. need this for unhighlighting groupbox - currentHand->setPreviousPlayerID(0); + currentHand->setPreviousPlayerID(0); // statusBar()->clearMessage(); @@ -1844,10 +1844,10 @@ void gameTableImpl::myCheck() boost::shared_ptr humanPlayer = currentHand->getSeatsList()->front(); humanPlayer->setMyTurn(0); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,1,LOG_ACTION_CHECK); - humanPlayer->setMyAction(PLAYER_ACTION_CHECK); + humanPlayer->setMyAction(PLAYER_ACTION_CHECK); //set that i was the last active player. need this for unhighlighting groupbox - currentHand->setPreviousPlayerID(0); + currentHand->setPreviousPlayerID(0); // statusBar()->clearMessage(); @@ -1911,11 +1911,11 @@ void gameTableImpl::myCall() humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMyCash(0); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,1,LOG_ACTION_ALL_IN,humanPlayer->getMySet()); - humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); + humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); } else { humanPlayer->setMySet(tempHighestSet - humanPlayer->getMySet()); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,1,LOG_ACTION_CALL,humanPlayer->getMySet()); - humanPlayer->setMyAction(PLAYER_ACTION_CALL); + humanPlayer->setMyAction(PLAYER_ACTION_CALL); } humanPlayer->setMyTurn(0); @@ -1923,7 +1923,7 @@ void gameTableImpl::myCall() refreshPot(); //set that i was the last active player. need this for unhighlighting groupbox - currentHand->setPreviousPlayerID(0); + currentHand->setPreviousPlayerID(0); // statusBar()->clearMessage(); @@ -1948,7 +1948,7 @@ void gameTableImpl::mySet() humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMyCash(0); - humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); + humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,1,LOG_ACTION_ALL_IN,humanPlayer->getMySet()); // full bet rule @@ -1960,7 +1960,7 @@ void gameTableImpl::mySet() if(myActionIsRaise) { //do not if allIn if(humanPlayer->getMyAction() != 6) { - humanPlayer->setMyAction(PLAYER_ACTION_RAISE); + humanPlayer->setMyAction(PLAYER_ACTION_RAISE); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,1,LOG_ACTION_BET,humanPlayer->getMySet()); } myActionIsRaise = 0; @@ -1971,7 +1971,7 @@ void gameTableImpl::mySet() if(myActionIsBet) { //do not if allIn if(humanPlayer->getMyAction() != 6) { - humanPlayer->setMyAction(PLAYER_ACTION_BET); + humanPlayer->setMyAction(PLAYER_ACTION_BET); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,1,LOG_ACTION_BET,humanPlayer->getMySet()); } myActionIsBet = 0; @@ -1989,10 +1989,10 @@ void gameTableImpl::mySet() // statusBar()->clearMessage(); //set that i was the last active player. need this for unhighlighting groupbox - currentHand->setPreviousPlayerID(0); + currentHand->setPreviousPlayerID(0); // lastPlayerAction für Karten umblättern reihenfolge setzrn - currentHand->setLastActionPlayerID(humanPlayer->getMyUniqueID()); + currentHand->setLastActionPlayerID(humanPlayer->getMyUniqueID()); //Spiel läuft weiter myActionDone(); @@ -2009,7 +2009,7 @@ void gameTableImpl::myAllIn() humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMyCash(0); - humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); + humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); // currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,1,LOG_ACTION_ALL_IN,humanPlayer->getMySet()); // full bet rule @@ -2023,7 +2023,7 @@ void gameTableImpl::myAllIn() currentHand->getCurrentBeRo()->setHighestSet(humanPlayer->getMySet()); // lastPlayerAction für Karten umblättern reihenfolge setzrn - currentHand->setLastActionPlayerID(humanPlayer->getMyUniqueID()); + currentHand->setLastActionPlayerID(humanPlayer->getMyUniqueID()); } @@ -2033,7 +2033,7 @@ void gameTableImpl::myAllIn() refreshPot(); //set that i was the last active player. need this for unhighlighting groupbox - currentHand->setPreviousPlayerID(0); + currentHand->setPreviousPlayerID(0); //Spiel läuft weiter myActionDone(); @@ -2174,11 +2174,11 @@ void gameTableImpl::nextPlayerAnimation() PlayerListConstIterator it_c; PlayerList seatsList = currentHand->getSeatsList(); for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) { - if((*it_c)->getMyID() == currentHand->getPreviousPlayerID()) break; + if((*it_c)->getMyID() == currentHand->getPreviousPlayerID()) break; } - if(currentHand->getPreviousPlayerID() != -1) { - refreshAction(currentHand->getPreviousPlayerID(), (*it_c)->getMyAction()); + if(currentHand->getPreviousPlayerID() != -1) { + refreshAction(currentHand->getPreviousPlayerID(), (*it_c)->getMyAction()); } refreshCash(); @@ -2512,7 +2512,7 @@ void gameTableImpl::postRiverRunAnimation3() for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { if((*it_c)->getMyCash() == 0) { currentHand->getGuiInterface()->logPlayerSitsOut((*it_c)->getMyName()); - currentHand->getLog()->logPlayerAction(5, (*it_c)->getMyID()+1, LOG_ACTION_SIT_OUT); + currentHand->getLog()->logPlayerAction(5, (*it_c)->getMyID()+1, LOG_ACTION_SIT_OUT); } } @@ -2651,12 +2651,11 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn) } } //set Player value (logging) - if(currentHand->getCurrentRound() < GAME_STATE_RIVER || allIn) { + if(currentHand->getCurrentRound() < GAME_STATE_RIVER || allIn) { (*it_c)->setMyCardsFlip(1,2); //for bero before postriver or allin just log the hole cards - } - else { - (*it_c)->setMyCardsFlip(1,1); //for postriver log the value - } + } else { + (*it_c)->setMyCardsFlip(1,1); //for postriver log the value + } } } } @@ -2666,7 +2665,7 @@ void gameTableImpl::flipHolecardsAllIn() boost::shared_ptr currentGame = myStartWindow->getSession()->getCurrentGame(); - if(!flipHolecardsAllInAlreadyDone && currentGame->getCurrentHand()->getCurrentRound() < GAME_STATE_RIVER) { + if(!flipHolecardsAllInAlreadyDone && currentGame->getCurrentHand()->getCurrentRound() < GAME_STATE_RIVER) { //Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen int nonfoldPlayersCounter = 0; PlayerListConstIterator it_c; @@ -3229,7 +3228,7 @@ void gameTableImpl::updateMyButtonsState(int mode) boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); - if(currentHand->getPreviousPlayerID() == 0) { + if(currentHand->getPreviousPlayerID() == 0) { myButtonsCheckable(FALSE); clearMyButtons(); } else { diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index 6d137135..89b490f0 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -1756,10 +1756,10 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr client, netActionDone->totalPlayerBet - tmpPlayer->getMySet()); } // Update last players turn only after the blinds. - curGame->getCurrentHand()->setPreviousPlayerID(tmpPlayer->getMyID()); + curGame->getCurrentHand()->setPreviousPlayerID(tmpPlayer->getMyID()); } - tmpPlayer->setMyAction(PlayerAction(netActionDone->playerAction)); + tmpPlayer->setMyAction(PlayerAction(netActionDone->playerAction)); tmpPlayer->setMySetAbsolute(netActionDone->totalPlayerBet); tmpPlayer->setMyCash(netActionDone->playerMoney); curGame->getCurrentHand()->getCurrentBeRo()->setHighestSet(netActionDone->highestSet); @@ -1835,7 +1835,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr client, tmpCards[3] = tmpCards[4] = 0; curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->collectPot(); - curGame->getCurrentHand()->setPreviousPlayerID(-1); + curGame->getCurrentHand()->setPreviousPlayerID(-1); client->GetGui().logDealBoardCardsMsg(GAME_STATE_FLOP, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]); client->GetGui().refreshGameLabels(GAME_STATE_FLOP); @@ -1850,7 +1850,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr client, tmpCards[3] = static_cast(netDealTurn->turnCard); curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->collectPot(); - curGame->getCurrentHand()->setPreviousPlayerID(-1); + curGame->getCurrentHand()->setPreviousPlayerID(-1); client->GetGui().logDealBoardCardsMsg(GAME_STATE_TURN, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]); client->GetGui().refreshGameLabels(GAME_STATE_TURN); @@ -1865,7 +1865,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr client, tmpCards[4] = static_cast(netDealRiver->riverCard); curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->collectPot(); - curGame->getCurrentHand()->setPreviousPlayerID(-1); + curGame->getCurrentHand()->setPreviousPlayerID(-1); client->GetGui().logDealBoardCardsMsg(GAME_STATE_RIVER, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]); client->GetGui().refreshGameLabels(GAME_STATE_RIVER); @@ -1995,7 +1995,7 @@ ClientStateRunHand::ResetPlayerActions(Game &curGame) while (i != end) { int action = (*i)->getMyAction(); if (action != 1 && action != 6) - (*i)->setMyAction(PLAYER_ACTION_NONE); + (*i)->setMyAction(PLAYER_ACTION_NONE); (*i)->setMySetNull(); ++i; } diff --git a/src/net/common/servergamestate.cpp b/src/net/common/servergamestate.cpp index 28611a82..cf098448 100644 --- a/src/net/common/servergamestate.cpp +++ b/src/net/common/servergamestate.cpp @@ -154,12 +154,12 @@ static void PerformPlayerAction(ServerGame &server, boost::shared_ptrgetCurrentBeRo()->setMinimumRaise(bet); - curGame.getCurrentHand()->setLastActionPlayerID(player->getMyUniqueID()); + curGame.getCurrentHand()->setLastActionPlayerID(player->getMyUniqueID()); } break; case PLAYER_ACTION_RAISE: { curGame.getCurrentHand()->getCurrentBeRo()->setMinimumRaise(player->getMySet() - curGame.getCurrentHand()->getCurrentBeRo()->getHighestSet()); - curGame.getCurrentHand()->setLastActionPlayerID(player->getMyUniqueID()); + curGame.getCurrentHand()->setLastActionPlayerID(player->getMyUniqueID()); } break; case PLAYER_ACTION_ALLIN: { @@ -167,7 +167,7 @@ static void PerformPlayerAction(ServerGame &server, boost::shared_ptrgetCurrentBeRo()->setMinimumRaise(player->getMySet() - curGame.getCurrentHand()->getCurrentBeRo()->getHighestSet()); } if(player->getMySet() - curGame.getCurrentHand()->getCurrentBeRo()->getHighestSet() > 0) { - curGame.getCurrentHand()->setLastActionPlayerID(player->getMyUniqueID()); + curGame.getCurrentHand()->setLastActionPlayerID(player->getMyUniqueID()); } } break; diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 6f14ad68..fe32ef50 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -905,7 +905,7 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr session, boost::s else if (packet->GetMsg()->present == PokerTHMessage_PR_avatarRequestMessage) HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->choice.avatarRequestMessage); else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage) - {} + {} else if (packet->GetMsg()->present == PokerTHMessage_PR_subscriptionRequestMessage) { SubscriptionRequestMessage_t *subscriptionRequest = &packet->GetMsg()->choice.subscriptionRequestMessage; if (subscriptionRequest->subscriptionAction == subscriptionAction_resubscribeGameList) diff --git a/src/session.cpp b/src/session.cpp index dacd9b92..f6a90cdc 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -43,7 +43,7 @@ Session::Session(GuiInterface *g, ConfigFile *c) : currentGameNum(0), myGui(g), myConfig(c), myLog(0), myGameType(GAME_TYPE_NONE) { myQtToolsInterface = CreateQtToolsWrapper(); - myLog = new Log(myConfig); + myLog = new Log(myConfig); }