diff --git a/src/engine/handinterface.h b/src/engine/handinterface.h index 8f90930f..6d60997c 100644 --- a/src/engine/handinterface.h +++ b/src/engine/handinterface.h @@ -54,6 +54,7 @@ public: virtual void setCurrentRound(GameState theValue) =0; virtual GameState getCurrentRound() const =0; + virtual GameState getRoundBeforePostRiver() const =0; virtual void setDealerPosition(int theValue) =0; virtual int getDealerPosition() const =0; @@ -67,9 +68,6 @@ public: virtual void setStartCash(int theValue) =0; virtual int getStartCash() const =0; - virtual void setBettingRoundsPlayed(int theValue) =0; - virtual int getBettingRoundsPlayed() const =0; - virtual void setPreviousPlayerID(int theValue) =0; virtual int getPreviousPlayerID() const =0; diff --git a/src/engine/local_engine/localbero.cpp b/src/engine/local_engine/localbero.cpp index 37ed23e2..63a22f7d 100644 --- a/src/engine/local_engine/localbero.cpp +++ b/src/engine/local_engine/localbero.cpp @@ -198,15 +198,6 @@ void LocalBeRo::run() } else { // aktuelle bero ist wirklich dran - // Anzahl der effektiv gespielten Runden (des human player) erhöhen - it_c = myHand->getActivePlayerIt(0); - if( it_c != myHand->getActivePlayerList()->end() ) { - // human player is active - if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD ) { - myHand->setBettingRoundsPlayed(myBeRoID); - } - } - // determine next running player PlayerListConstIterator currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId ); if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) { diff --git a/src/engine/local_engine/localboard.cpp b/src/engine/local_engine/localboard.cpp index 2c74c695..9ed55e8a 100755 --- a/src/engine/local_engine/localboard.cpp +++ b/src/engine/local_engine/localboard.cpp @@ -96,7 +96,6 @@ void LocalBoard::distributePot() int highestCardsValue; size_t winnerCount; size_t mod; -// int winnerPointer; bool winnerHit; // level loop @@ -161,8 +160,6 @@ void LocalBoard::distributePot() // --> distribution after smallBlind else { -// winnerPointer = currentHand->getDealerPosition(); - // find Seat with dealerPosition for(it=seatsList->begin(); it!=seatsList->end(); ++it) { if((*it)->getMyUniqueID() == dealerPosition) { @@ -179,25 +176,16 @@ void LocalBoard::distributePot() for(k=0; kend()) it = seatsList->begin(); for(l=2; lgetMyUniqueID() == potLevel[l]) winnerHit = true; } } -// it = currentHand->getSeatIt(winnerPointer); -// if(it == seatsList->end()) { -// throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND); -// } if(jsetMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1); // filling winners vector @@ -268,40 +256,17 @@ void LocalBoard::determinePlayerNeedToShowCards() else { - - // all winners have to show their cards - // playerNeedToShowCards = winners; - - // std::_List_const_iterator it_c; std::list > level; - // for(it_c=winners.begin(); it_c != winners.end(); ++it_c) { - // cout << (*it_c) << endl; - // } - // - // cout << "lastActionPlayer" << currentHand->getCurrentBeRo()->getLastActionPlayer() << endl; - // - // int lastActionPlayer = ; - // - // if(lastActionPlayer == -1) { - // lastActionPlayer = 0; - // } - // - // - // - - PlayerListConstIterator lastActionPlayerIt; PlayerListConstIterator it_c; - // 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) { lastActionPlayerIt = it_c; -// cout << (*it_c)->getMyUniqueID() << endl; break; } } @@ -318,27 +283,16 @@ void LocalBoard::determinePlayerNeedToShowCards() // the player who has done the last action has to show his cards first playerNeedToShowCards.push_back((*lastActionPlayerIt)->getMyUniqueID()); -// cout << (*lastActionPlayerIt)->getMyUniqueID() << " - " << (*lastActionPlayerIt)->getMyName() << endl; - -// int *level_tmp = new int[2]; std::pair level_tmp; // get position und cardsValue of the player who show his cards first level_tmp.first = (*lastActionPlayerIt)->getMyCardsValueInt(); level_tmp.second = (*lastActionPlayerIt)->getMyRoundStartCash()-(*lastActionPlayerIt)->getMyCash(); - // level_tmp = {(*lastActionPlayerIt)->getMyCardsValueInt(),(*lastActionPlayerIt)->getMyRoundStartCash()-(*lastActionPlayerIt)->getMyCash()}; - -// cout << level_tmp[0] << "," << level_tmp[1] << endl; - level.push_back(level_tmp); std::list >::iterator level_it; -// std::list >::iterator level_it_tmp; std::list >::iterator next_level_it; - // PlayerListConstIterator firstAfterLastActionPlayerIt = lastActionPlayerIt; - // firstAfterLastActionPlayerIt++; - it_c = lastActionPlayerIt; ++it_c; @@ -347,19 +301,13 @@ void LocalBoard::determinePlayerNeedToShowCards() if(it_c == activePlayerList->end()) it_c = activePlayerList->begin(); if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { - // for(it_c = firstAfterLastActionPlayerIt; it_c != lastActionPlayerIt; ++it_c) { - // if(it_c == lastActionPlayerIt) { - // break; - // } - // } for(level_it = level.begin(); level_it != level.end(); ++level_it) { if((*it_c)->getMyCardsValueInt() > (*level_it).first) { next_level_it = level_it; ++next_level_it; if(next_level_it == level.end()) { playerNeedToShowCards.push_back((*it_c)->getMyUniqueID()); -// level_tmp = new int[2]; level_tmp.first = (*it_c)->getMyCardsValueInt(); level_tmp.second = (*it_c)->getMyRoundStartCash()-(*it_c)->getMyCash(); level.push_back(level_tmp); @@ -369,11 +317,6 @@ void LocalBoard::determinePlayerNeedToShowCards() if((*it_c)->getMyCardsValueInt() == (*level_it).first) { next_level_it = level_it; ++next_level_it; -// -// for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) { -// cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl; -// } - if(next_level_it == level.end() || (*it_c)->getMyRoundStartCash()-(*it_c)->getMyCash() > (*next_level_it).second) { playerNeedToShowCards.push_back((*it_c)->getMyUniqueID()); @@ -385,20 +328,11 @@ void LocalBoard::determinePlayerNeedToShowCards() } else { if((*it_c)->getMyRoundStartCash()-(*it_c)->getMyCash() > (*level_it).second) { playerNeedToShowCards.push_back((*it_c)->getMyUniqueID()); -// level_tmp = new int(2); level_tmp.first = (*it_c)->getMyCardsValueInt(); level_tmp.second = (*it_c)->getMyRoundStartCash()-(*it_c)->getMyCash(); -// -// for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) { -// cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl; -// } level.insert(level_it,level_tmp); -// for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) { -// cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl; -// } - break; } } @@ -411,31 +345,8 @@ void LocalBoard::determinePlayerNeedToShowCards() } -// for(level_it = level.begin(); level_it != level.end(); ++level_it) { -// delete[] *level_it; -// } level.clear(); - // bool showCards; - - // search for more player who have to show their cards (perhaps not all situation are considered yet) - // for(it_c = ++lastActionPlayerIt; it_c!=activePlayerList->end(); ++it_c) { - // - // showCards = false; - // - //// if((*it_c)->getMyCardsValueInt() >= highestCardsValueInt) { - //// playerNeedToShowCards.push_back((*it_c)->getMyUniqueID()); - //// highestCardsValueInt = (*it_c)->getMyCardsValueInt(); - //// } - // } - // - // for(it_c = activePlayerList->begin(); it_c!=lastActionPlayerIt; ++it_c) { - //// if((*it_c)->getMyCardsValueInt() >= highestCardsValueInt) { - //// playerNeedToShowCards.push_back((*it_c)->getMyUniqueID()); - //// highestCardsValueInt = (*it_c)->getMyCardsValueInt(); - //// } - // } - } @@ -443,11 +354,4 @@ void LocalBoard::determinePlayerNeedToShowCards() playerNeedToShowCards.sort(); playerNeedToShowCards.unique(); -// std::_List_iterator playerNeedToShowCardsIt; -// -// for(playerNeedToShowCardsIt = playerNeedToShowCards.begin(); playerNeedToShowCardsIt!=playerNeedToShowCards.end(); playerNeedToShowCardsIt++) { -// cout << (*playerNeedToShowCardsIt) << '\t'; -// } -// cout << endl; - } diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 4e4f08fb..ce3915b0 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -30,8 +30,8 @@ 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), - cardsShown(false), bettingRoundsPlayed(0) + : 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), roundBeforePostRiver(GAME_STATE_PREFLOP), smallBlind(sB), startCash(sC), previousPlayerID(-1), lastActionPlayerID(0), allInCondition(false), + cardsShown(false) { int i, j, k; @@ -656,40 +656,34 @@ void LocalHand::switchRounds() myGui->refreshGameLabels((GameState)getCurrentRound()); + if(currentRound < GAME_STATE_POST_RIVER) { + roundBeforePostRiver = currentRound; + } + switch(currentRound) { - case 0: { - // start preflop + case GAME_STATE_PREFLOP: { myGui->preflopAnimation1(); } break; - case 1: { - // start flop + case GAME_STATE_FLOP: { myGui->flopAnimation1(); } break; - case 2: { - // start turn + case GAME_STATE_TURN: { myGui->turnAnimation1(); - } break; - case 3: { - // start river + case GAME_STATE_RIVER: { myGui->riverAnimation1(); - } break; - case 4: { - // start post river + case GAME_STATE_POST_RIVER: { myGui->postRiverAnimation1(); - } break; default: {} - - } } diff --git a/src/engine/local_engine/localhand.h b/src/engine/local_engine/localhand.h index 5c347251..0ad97691 100755 --- a/src/engine/local_engine/localhand.h +++ b/src/engine/local_engine/localhand.h @@ -94,6 +94,9 @@ public: GameState getCurrentRound() const { return currentRound; } + GameState getRoundBeforePostRiver() const { + return roundBeforePostRiver; + } void setDealerPosition(int theValue) { dealerPosition = theValue; @@ -123,13 +126,6 @@ public: return startCash; } - void setBettingRoundsPlayed(int theValue) { - bettingRoundsPlayed = theValue; - } - int getBettingRoundsPlayed() const { - return bettingRoundsPlayed; - } - void setPreviousPlayerID(int theValue) { previousPlayerID = theValue; } @@ -178,6 +174,7 @@ private: unsigned smallBlindPosition; unsigned bigBlindPosition; GameState currentRound; + GameState roundBeforePostRiver; int smallBlind; int startCash; @@ -186,9 +183,6 @@ private: bool allInCondition; bool cardsShown; - - // hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ... - int bettingRoundsPlayed; }; #endif diff --git a/src/engine/network_engine/clienthand.cpp b/src/engine/network_engine/clienthand.cpp index d81d9ee8..469ac8ae 100644 --- a/src/engine/network_engine/clienthand.cpp +++ b/src/engine/network_engine/clienthand.cpp @@ -22,9 +22,9 @@ 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), + : myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(GAME_STATE_PREFLOP), roundBeforePostRiver(GAME_STATE_PREFLOP), smallBlind(sB), startCash(sC), previousPlayerID(-1), allInCondition(0), - cardsShown(false), bettingRoundsPlayed(0) + cardsShown(false) { PlayerListIterator it; @@ -216,6 +216,13 @@ ClientHand::getCurrentRound() const return currentRound; } +GameState +ClientHand::getRoundBeforePostRiver() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return roundBeforePostRiver; +} + void ClientHand::setDealerPosition(int theValue) { @@ -272,20 +279,6 @@ ClientHand::getStartCash() const return startCash; } -void -ClientHand::setBettingRoundsPlayed(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - bettingRoundsPlayed = theValue; -} - -int -ClientHand::getBettingRoundsPlayed() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return bettingRoundsPlayed; -} - void ClientHand::setPreviousPlayerID(int theValue) { diff --git a/src/engine/network_engine/clienthand.h b/src/engine/network_engine/clienthand.h index e6634b9f..9f6c9d9a 100644 --- a/src/engine/network_engine/clienthand.h +++ b/src/engine/network_engine/clienthand.h @@ -65,6 +65,7 @@ public: void setCurrentRound ( GameState theValue ); GameState getCurrentRound() const; + GameState getRoundBeforePostRiver() const; void setDealerPosition ( int theValue ); int getDealerPosition() const; @@ -116,6 +117,7 @@ private: int startQuantityPlayers; unsigned dealerPosition; GameState currentRound; + GameState roundBeforePostRiver; int smallBlind; int startCash; @@ -124,9 +126,6 @@ private: bool allInCondition; bool cardsShown; - - // hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ... - int bettingRoundsPlayed; }; #endif