From 1a5a5600ce8255095032630f4e53645a5ec5b857 Mon Sep 17 00:00:00 2001 From: floty Date: Mon, 29 Oct 2007 22:26:50 +0000 Subject: [PATCH] lastMoneyWon --- src/engine/local_engine/localboard.cpp | 10 +++++++--- src/engine/local_engine/localplayer.cpp | 2 +- src/engine/local_engine/localplayer.h | 5 +++++ src/engine/network_engine/clientplayer.cpp | 12 ++++++++++++ src/engine/network_engine/clientplayer.h | 4 ++++ src/engine/playerinterface.h | 3 +++ 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/engine/local_engine/localboard.cpp b/src/engine/local_engine/localboard.cpp index 843d0845..c0cc00f8 100755 --- a/src/engine/local_engine/localboard.cpp +++ b/src/engine/local_engine/localboard.cpp @@ -76,12 +76,13 @@ void LocalBoard::distributePot() { // filling player sets vector vector playerSets; - for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) { - if((*it_c)->getMyActiveStatus()) { - playerSets.push_back( ( ((*it_c)->getMyRoundStartCash()) - ((*it_c)->getMyCash()) ) ); + for(it=seatsList->begin(); it!=seatsList->end(); it++) { + if((*it)->getMyActiveStatus()) { + playerSets.push_back( ( ((*it)->getMyRoundStartCash()) - ((*it)->getMyCash()) ) ); } else { playerSets.push_back(0); } + (*it)->setLastMoneyWon(0); } // sort player sets asc @@ -147,6 +148,7 @@ void LocalBoard::distributePot() { // filling winners vector winners.push_back((*it)->getMyUniqueID()); + (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount ); } } @@ -189,10 +191,12 @@ void LocalBoard::distributePot() { (*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1); // filling winners vector winners.push_back((*it)->getMyUniqueID()); + (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + ((potLevel[1])/winnerCount) + 1 ); } else { (*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount)); // filling winners vector winners.push_back((*it)->getMyUniqueID()); + (*it)->setLastMoneyWon( (*it)->getLastMoneyWon() + (potLevel[1])/winnerCount ); } } } diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index 5efac90e..b9a032ef 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -850,7 +850,7 @@ static const RoundData FlopValues[] = #define NUM_FLOP_VALUES (sizeof(FlopValues)/sizeof(RoundData)) LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) -: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), sBluff(0), sBluffStatus(0) +: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(0) { // !!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!! diff --git a/src/engine/local_engine/localplayer.h b/src/engine/local_engine/localplayer.h index 34d935e7..57c67477 100755 --- a/src/engine/local_engine/localplayer.h +++ b/src/engine/local_engine/localplayer.h @@ -117,6 +117,9 @@ public: void setMyRoundStartCash(int theValue) { myRoundStartCash = theValue;} int getMyRoundStartCash() const { return myRoundStartCash; } + void setLastMoneyWon ( int theValue ) { lastMoneyWon = theValue; } + int getLastMoneyWon() const { return lastMoneyWon; } + void setMyAverageSets(int theValue) { myAverageSets[0] = myAverageSets[1]; myAverageSets[1] = myAverageSets[2]; myAverageSets[2] = myAverageSets[3]; myAverageSets[3] = theValue; } int getMyAverageSets() const { return (myAverageSets[0]+myAverageSets[1]+myAverageSets[2]+myAverageSets[3])/4; } @@ -173,6 +176,7 @@ public: void setNetSessionData(boost::shared_ptr session); boost::shared_ptr getNetSessionData(); + @@ -210,6 +214,7 @@ private: bool myTurn; // 0 = no, 1 = yes bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped, int myRoundStartCash; + int lastMoneyWon; int myAverageSets[4]; bool myAggressive[7]; diff --git a/src/engine/network_engine/clientplayer.cpp b/src/engine/network_engine/clientplayer.cpp index ef1b81d1..14b1979c 100644 --- a/src/engine/network_engine/clientplayer.cpp +++ b/src/engine/network_engine/clientplayer.cpp @@ -306,6 +306,18 @@ ClientPlayer::getMyRoundStartCash() const return myRoundStartCash; } +void +ClientPlayer::setLastMoneyWon ( int theValue ) +{ + lastMoneyWon = theValue; +} + +int +ClientPlayer::getLastMoneyWon() const +{ + return lastMoneyWon; +} + void ClientPlayer::setMyAverageSets(int theValue) { diff --git a/src/engine/network_engine/clientplayer.h b/src/engine/network_engine/clientplayer.h index 6c2d4e29..be2866db 100644 --- a/src/engine/network_engine/clientplayer.h +++ b/src/engine/network_engine/clientplayer.h @@ -89,6 +89,9 @@ public: void setMyRoundStartCash(int theValue); int getMyRoundStartCash() const; + void setLastMoneyWon ( int theValue ); + int getLastMoneyWon() const; + void setMyAverageSets(int theValue); int getMyAverageSets() const; @@ -163,6 +166,7 @@ private: bool myTurn; // 0 = no, 1 = yes bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped, int myRoundStartCash; + int lastMoneyWon; int myAverageSets[4]; bool myAggressive[7]; diff --git a/src/engine/playerinterface.h b/src/engine/playerinterface.h index e4fb821e..89223629 100644 --- a/src/engine/playerinterface.h +++ b/src/engine/playerinterface.h @@ -89,6 +89,9 @@ public: virtual void setMyAverageSets(int theValue) =0; virtual int getMyAverageSets() const =0; + virtual void setLastMoneyWon ( int theValue ) =0; + virtual int getLastMoneyWon() const =0; + virtual void setMyAggressive(bool theValue) =0; virtual int getMyAggressive() const =0;