From 756e92aeab01af89f449fa423316f1b332162b1c Mon Sep 17 00:00:00 2001 From: floty Date: Thu, 15 Jul 2010 22:37:46 +0000 Subject: [PATCH] implement frame for list of player who need to show their cards at the end of the hand --- src/engine/boardinterface.h | 4 ++ .../local_engine/localberopostriver.cpp | 3 ++ src/engine/local_engine/localboard.cpp | 39 +++++++++++++++++++ src/engine/local_engine/localboard.h | 5 +++ src/engine/local_engine/localhand.h | 6 +-- src/engine/network_engine/clientboard.cpp | 19 +++++++++ src/engine/network_engine/clientboard.h | 5 +++ 7 files changed, 78 insertions(+), 3 deletions(-) diff --git a/src/engine/boardinterface.h b/src/engine/boardinterface.h index ab1cc612..44b5d289 100644 --- a/src/engine/boardinterface.h +++ b/src/engine/boardinterface.h @@ -52,10 +52,14 @@ public: virtual void collectPot() =0; virtual void distributePot() =0; + virtual void determinePlayerNeedToShowCards() =0; virtual std::list getWinners() const =0; virtual void setWinners(const std::list &winners) =0; + virtual std::list getPlayerNeedToShowCards() const =0; + virtual void setPlayerNeedToShowCards(const std::list &playerNeedToShowCards) =0; + }; #endif diff --git a/src/engine/local_engine/localberopostriver.cpp b/src/engine/local_engine/localberopostriver.cpp index 6fbf5756..a98a4918 100644 --- a/src/engine/local_engine/localberopostriver.cpp +++ b/src/engine/local_engine/localberopostriver.cpp @@ -78,6 +78,9 @@ void LocalBeRoPostRiver::postRiverRun() { //Pot auf 0 setzen getMyHand()->getBoard()->setPot(0); + + // Spieler ermitteln, welche die Karten auf jeden Fall umdrehen müssen + getMyHand()->getBoard()->determinePlayerNeedToShowCards(); //starte die Animaionsreihe getMyHand()->getGuiInterface()->postRiverRunAnimation1(); diff --git a/src/engine/local_engine/localboard.cpp b/src/engine/local_engine/localboard.cpp index c0cc00f8..a87ffdc1 100755 --- a/src/engine/local_engine/localboard.cpp +++ b/src/engine/local_engine/localboard.cpp @@ -236,3 +236,42 @@ void LocalBoard::distributePot() { sum += (*it_c)->getMyCash(); } } + +void LocalBoard::determinePlayerNeedToShowCards() { + + // all winners have to show their cards + playerNeedToShowCards = winners; + +// // the player who has done the last action has to show his cards first +// playerNeedToShowCards.push_back(currentHand->getCurrentBeRo()->getLastActionPlayer()); +// +// // get position und cardsValue of the player who show his cards first +// PlayerListConstIterator lastActionPlayerIt = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getLastActionPlayer()); +// int highestCardsValueInt = (*lastActionPlayerIt)->getMyCardsValueInt(); +// +// // search for more player who have to show their cards (perhaps not all situation are considered yet) +// PlayerListConstIterator it_c; +// for(it_c = ++lastActionPlayerIt; it_c!=activePlayerList->end(); it_c++) { +// 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(); +// } +// } +// +// // sort and unique the list +// playerNeedToShowCards.sort(); +// playerNeedToShowCards.unique(); +// +// for(it_c = activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) { +// cout << (*it_c)->getMyUniqueID() << '\t'; +// } +// cout << endl; + +} diff --git a/src/engine/local_engine/localboard.h b/src/engine/local_engine/localboard.h index e1a35b46..750b4f17 100755 --- a/src/engine/local_engine/localboard.h +++ b/src/engine/local_engine/localboard.h @@ -50,10 +50,14 @@ public: void collectPot() ; void distributePot(); + void determinePlayerNeedToShowCards(); std::list getWinners() const { return winners; } void setWinners(const std::list &w) { winners = w; } + std::list getPlayerNeedToShowCards() const { return playerNeedToShowCards; } + void setPlayerNeedToShowCards(const std::list &p) { playerNeedToShowCards = p; } + private: PlayerList seatsList; @@ -63,6 +67,7 @@ private: HandInterface *currentHand; std::list winners; + std::list playerNeedToShowCards; int myCards[5]; int pot; diff --git a/src/engine/local_engine/localhand.h b/src/engine/local_engine/localhand.h index 2ec8df2f..0be1ecde 100755 --- a/src/engine/local_engine/localhand.h +++ b/src/engine/local_engine/localhand.h @@ -96,9 +96,9 @@ private: GuiInterface *myGui; BoardInterface *myBoard; - PlayerList seatsList; - PlayerList activePlayerList; - PlayerList runningPlayerList; + PlayerList seatsList; // all player + PlayerList activePlayerList; // all player who are not folded and not out + PlayerList runningPlayerList; // all player who are not folded, not all in and not out std::vector > myBeRo; diff --git a/src/engine/network_engine/clientboard.cpp b/src/engine/network_engine/clientboard.cpp index cb6a2f78..fa1fff77 100644 --- a/src/engine/network_engine/clientboard.cpp +++ b/src/engine/network_engine/clientboard.cpp @@ -118,6 +118,12 @@ ClientBoard::distributePot() } +void +ClientBoard::determinePlayerNeedToShowCards() +{ + +} + std::list ClientBoard::getWinners() const { @@ -132,3 +138,16 @@ ClientBoard::setWinners(const std::list &w) winners = w; } +std::list +ClientBoard::getPlayerNeedToShowCards() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return playerNeedToShowCards; +} + +void +ClientBoard::setPlayerNeedToShowCards(const std::list &p) +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + playerNeedToShowCards = p; +} diff --git a/src/engine/network_engine/clientboard.h b/src/engine/network_engine/clientboard.h index ded89180..be80e2c5 100644 --- a/src/engine/network_engine/clientboard.h +++ b/src/engine/network_engine/clientboard.h @@ -49,10 +49,14 @@ public: void collectPot(); void distributePot(); + void determinePlayerNeedToShowCards(); std::list getWinners() const; void setWinners(const std::list &winners); + std::list getPlayerNeedToShowCards() const; + void setPlayerNeedToShowCards(const std::list &playerNeedToShowCards); + private: mutable boost::recursive_mutex m_syncMutex; @@ -63,6 +67,7 @@ private: HandInterface *currentHand; std::list winners; + std::list playerNeedToShowCards; int myCards[5]; int pot;