delete some bug for determining the list of player who have to show their cards. additionally the lastActionPlayer is now determined correctly (especially in every betting roud)

This commit is contained in:
floty
2010-07-22 21:17:22 +00:00
parent 53247a007a
commit 7f3e3f6dfd
11 changed files with 63 additions and 32 deletions
-3
View File
@@ -58,9 +58,6 @@ public:
virtual void setHighestCardsValue(int theValue) =0;
virtual int getHighestCardsValue() const =0;
virtual void setLastActionPlayer( unsigned theValue ) =0;
virtual unsigned getLastActionPlayer() const =0;
virtual void setMinimumRaise (int) =0;
virtual int getMinimumRaise() const =0;
+3
View File
@@ -75,6 +75,9 @@ public:
virtual void setLastPlayersTurn(int theValue) =0;
virtual int getLastPlayersTurn() const =0;
virtual void setLastActionPlayer( unsigned theValue ) =0;
virtual unsigned getLastActionPlayer() const =0;
virtual void setCardsShown(bool theValue) =0;
virtual bool getCardsShown() const =0;
+1 -1
View File
@@ -26,7 +26,7 @@
using namespace std;
LocalBeRo::LocalBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState gS)
: BeRoInterface(), myHand(hi), myBeRoID(gS), myID(id), 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), lastActionPlayer(-1)
: BeRoInterface(), myHand(hi), myBeRoID(gS), myID(id), 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();
-5
View File
@@ -97,9 +97,6 @@ protected:
void setSmallBlind(int theValue) { smallBlind = theValue; }
int getSmallBlind() const { return smallBlind; }
void setLastActionPlayer ( unsigned theValue ) { lastActionPlayer = theValue; }
unsigned getLastActionPlayer() const { return lastActionPlayer; }
@@ -137,8 +134,6 @@ private:
bool logBoardCardsDone;
int lastActionPlayer;
};
+19 -17
View File
@@ -240,6 +240,7 @@ void LocalBoard::distributePot() {
void LocalBoard::determinePlayerNeedToShowCards() {
playerNeedToShowCards.clear();
// all winners have to show their cards
@@ -268,14 +269,15 @@ void LocalBoard::determinePlayerNeedToShowCards() {
PlayerListConstIterator lastActionPlayerIt;
PlayerListConstIterator it_c;
// cout << "lAP-Ende: " << currentHand->getLastActionPlayer() << endl;
// search lastActionPlayer
for(it_c = activePlayerList->begin(); it_c != activePlayerList->end(); it_c++) {
// cout << (*it_c)->getMyUniqueID() << ',';
if((*it_c)->getMyUniqueID() == currentHand->getCurrentBeRo()->getLastActionPlayer() && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
if((*it_c)->getMyUniqueID() == currentHand->getLastActionPlayer() && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
lastActionPlayerIt = it_c;
// cout << (*it_c)->getMyUniqueID() << endl;
break;
}
}
// cout << endl;
if(it_c == activePlayerList->end()) {
for(it_c = activePlayerList->begin(); it_c != activePlayerList->end(); it_c++) {
@@ -310,7 +312,7 @@ void LocalBoard::determinePlayerNeedToShowCards() {
it_c = lastActionPlayerIt;
it_c++;
for(int i = 0; i < activePlayerList->size(); i++) {
for(unsigned i = 0; i < activePlayerList->size(); i++) {
if(it_c == activePlayerList->end()) it_c = activePlayerList->begin();
@@ -338,9 +340,9 @@ void LocalBoard::determinePlayerNeedToShowCards() {
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;
}
// 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)[1]) {
@@ -357,15 +359,15 @@ void LocalBoard::determinePlayerNeedToShowCards() {
level_tmp[0] = (*it_c)->getMyCardsValueInt();
level_tmp[1] = (*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;
}
// 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;
}
// 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;
}
@@ -407,9 +409,9 @@ void LocalBoard::determinePlayerNeedToShowCards() {
std::_List_iterator<unsigned> playerNeedToShowCardsIt;
for(playerNeedToShowCardsIt = playerNeedToShowCards.begin(); playerNeedToShowCardsIt!=playerNeedToShowCards.end(); playerNeedToShowCardsIt++) {
cout << (*playerNeedToShowCardsIt) << '\t';
}
cout << endl;
// for(playerNeedToShowCardsIt = playerNeedToShowCards.begin(); playerNeedToShowCardsIt!=playerNeedToShowCards.end(); playerNeedToShowCardsIt++) {
// cout << (*playerNeedToShowCardsIt) << '\t';
// }
// cout << endl;
}
+5 -3
View File
@@ -31,7 +31,7 @@
using namespace std;
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(-1), allInCondition(false),
: myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(-1), lastActionPlayer(0), allInCondition(false),
cardsShown(false), bettingRoundsPlayed(0)
{
@@ -431,7 +431,7 @@ void LocalHand::assignButtons() {
//big blind in heads up
(*it)->setMyButton(3);
// lastPlayerAction for showing cards
// getCurrentBeRo()->setLastActionPlayer((*it)->getMyUniqueID());
lastActionPlayer = (*it)->getMyUniqueID();
}
it++;
@@ -441,7 +441,7 @@ void LocalHand::assignButtons() {
//big blind normal
(*it)->setMyButton(3);
// lastPlayerAction for showing cards
// getCurrentBeRo()->setLastActionPlayer((*it)->getMyUniqueID());
lastActionPlayer = (*it)->getMyUniqueID();
} else {
//small blind in heads up
(*it)->setMyButton(2);
@@ -455,6 +455,8 @@ void LocalHand::assignButtons() {
throw LocalException(__FILE__, __LINE__, ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND);
}
// cout << "lAP-Button: " << lastActionPlayer << endl;
//do sets --> TODO switch?
for (it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); it_c++) {
+4
View File
@@ -82,6 +82,9 @@ public:
void setLastPlayersTurn(int theValue) { lastPlayersTurn = theValue; }
int getLastPlayersTurn() const { return lastPlayersTurn; }
void setLastActionPlayer ( unsigned theValue ) { lastActionPlayer = theValue; }
unsigned getLastActionPlayer() const { return lastActionPlayer; }
void setCardsShown(bool theValue) { cardsShown = theValue; }
bool getCardsShown() const { return cardsShown; }
@@ -110,6 +113,7 @@ private:
int startCash;
int lastPlayersTurn;
unsigned lastActionPlayer;
bool allInCondition;
bool cardsShown;
+9 -3
View File
@@ -3067,9 +3067,10 @@ void LocalPlayer::evaluation(int bet, int raise) {
myCash = myCash - bet;
mySet = bet;
highestSet = mySet;
}
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->getCurrentBeRo()->setLastActionPlayer(myUniqueID);
currentHand->setLastActionPlayer(myUniqueID);
}
break;
// raise
@@ -3097,6 +3098,9 @@ void LocalPlayer::evaluation(int bet, int raise) {
// -> full bet rule
if(highestSet + currentHand->getCurrentBeRo()->getMinimumRaise() > myCash + mySet) {
currentHand->getCurrentBeRo()->setFullBetRule(true);
} else {
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayer(myUniqueID);
}
mySet += myCash;
currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet);
@@ -3110,10 +3114,10 @@ void LocalPlayer::evaluation(int bet, int raise) {
myCash = myCash + mySet - highestSet - raise;
mySet = highestSet + raise;
highestSet = mySet;
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayer(myUniqueID);
}
}
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->getCurrentBeRo()->setLastActionPlayer(myUniqueID);
}
break;
// all in
@@ -3126,6 +3130,8 @@ void LocalPlayer::evaluation(int bet, int raise) {
currentHand->getCurrentBeRo()->setHighestSet(highestSet);
// cout << "lAP: " << currentHand->getLastActionPlayer() << endl;
}
+12
View File
@@ -296,6 +296,18 @@ ClientHand::getLastPlayersTurn() const
return lastPlayersTurn;
}
void
ClientHand::setLastActionPlayer (unsigned theValue)
{
lastActionPlayer = theValue;
}
unsigned
ClientHand::getLastActionPlayer() const
{
return lastActionPlayer;
}
void
ClientHand::setCardsShown(bool theValue)
{
+4
View File
@@ -83,6 +83,9 @@ class ClientHand : public HandInterface
void setLastPlayersTurn ( int theValue );
int getLastPlayersTurn() const;
void setLastActionPlayer ( unsigned theValue );
unsigned getLastActionPlayer() const;
void setCardsShown ( bool theValue );
bool getCardsShown() const;
@@ -110,6 +113,7 @@ class ClientHand : public HandInterface
int startCash;
int lastPlayersTurn;
unsigned lastActionPlayer;
bool allInCondition;
bool cardsShown;
+6
View File
@@ -1760,6 +1760,9 @@ void gameTableImpl::mySet(){
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(0);
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayer(currentHand->getSeatsList()->front()->getMyUniqueID());
//Spiel läuft weiter
myActionDone();
@@ -1786,6 +1789,9 @@ void gameTableImpl::myAllIn(){
currentHand->getCurrentBeRo()->setHighestSet(currentHand->getSeatsList()->front()->getMySet());
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayer(currentHand->getSeatsList()->front()->getMyUniqueID());
}
currentHand->getSeatsList()->front()->setMyTurn(0);