- rename lastPlayersTurn -> previousPlayerID and lastActionPlayer -> lastActionPlayerID

This commit is contained in:
floty
2011-10-26 19:34:57 +00:00
parent c867a789d3
commit f1dc2e90a5
15 changed files with 119 additions and 116 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ public:
virtual void setSets(int theValue) =0;
virtual void setAllInCondition(bool theValue) =0;
virtual void setLastActionPlayer(unsigned theValue) =0;
virtual void setLastActionPlayerID(unsigned theValue) =0;
//
virtual void collectSets() =0;
virtual void collectPot() =0;
+4 -4
View File
@@ -70,11 +70,11 @@ public:
virtual void setBettingRoundsPlayed(int theValue) =0;
virtual int getBettingRoundsPlayed() const =0;
virtual void setLastPlayersTurn(int theValue) =0;
virtual int getLastPlayersTurn() const =0;
virtual void setPreviousPlayerID(int theValue) =0;
virtual int getPreviousPlayerID() const =0;
virtual void setLastActionPlayer( unsigned theValue ) =0;
virtual unsigned getLastActionPlayer() const =0;
virtual void setLastActionPlayerID( unsigned theValue ) =0;
virtual unsigned getLastActionPlayerID() const =0;
virtual void setCardsShown(bool theValue) =0;
virtual bool getCardsShown() const =0;
+1 -27
View File
@@ -84,7 +84,7 @@ void LocalBeRo::run()
if(firstRunGui) {
firstRunGui = false;
myHand->setLastPlayersTurn(-1);
myHand->setPreviousPlayerID(-1);
myHand->getGuiInterface()->dealBeRoCards(myBeRoID);
} else {
@@ -243,32 +243,6 @@ void LocalBeRo::run()
myHand->getGuiInterface()->beRoAnimation2(myBeRoID);
}
// logging action
PlayerActionLog myActionLog = LOG_ACTION_NONE;
switch((*currentPlayersTurnIt)->getMyAction()) {
case PLAYER_ACTION_FOLD: {
myActionLog = LOG_ACTION_FOLD;
} break;
case PLAYER_ACTION_CHECK: {
myActionLog = LOG_ACTION_CHECK;
} break;
case PLAYER_ACTION_CALL: {
myActionLog = LOG_ACTION_CALL;
} break;
case PLAYER_ACTION_BET:
case PLAYER_ACTION_RAISE: {
myActionLog = LOG_ACTION_BET;
} break;
case PLAYER_ACTION_ALLIN: {
myActionLog = LOG_ACTION_ALL_IN;
} break;
default: {
}
}
if(myActionLog) {
// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,myActionLog);
}
}
}
}
+2 -2
View File
@@ -24,7 +24,7 @@
#include "localexception.h"
#include "engine_msg.h"
LocalBoard::LocalBoard(unsigned dp) : BoardInterface(), pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayer(0)
LocalBoard::LocalBoard(unsigned dp) : BoardInterface(), pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayerID(0)
{
myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
}
@@ -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() == lastActionPlayer && (*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;
+3 -3
View File
@@ -49,8 +49,8 @@ public:
void setAllInCondition(bool theValue) {
allInCondition = theValue;
}
void setLastActionPlayer(unsigned theValue) {
lastActionPlayer = theValue;
void setLastActionPlayerID(unsigned theValue) {
lastActionPlayerID = theValue;
}
int getPot() const {
@@ -100,7 +100,7 @@ private:
int sets;
unsigned dealerPosition;
bool allInCondition;
unsigned lastActionPlayer;
unsigned lastActionPlayerID;
};
+37 -8
View File
@@ -30,7 +30,7 @@
using namespace std;
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> 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), lastPlayersTurn(-1), lastActionPlayer(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)
{
@@ -448,8 +448,8 @@ void LocalHand::assignButtons()
}
// first player after dealer have to show his cards first (in showdown)
lastActionPlayer = (*it)->getMyUniqueID();
myBoard->setLastActionPlayer(lastActionPlayer);
lastActionPlayerID = (*it)->getMyUniqueID();
myBoard->setLastActionPlayerID(lastActionPlayerID);
++it;
if(it == activePlayerList->end()) it = activePlayerList->begin();
@@ -528,6 +528,35 @@ 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);
// }
// switch((*currentPlayersTurnIt)->getMyAction()) {
// case PLAYER_ACTION_FOLD: {
// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,LOG_ACTION_FOLD);
// } break;
// case PLAYER_ACTION_CHECK: {
// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,LOG_ACTION_CHECK);
// } break;
// case PLAYER_ACTION_CALL: {
// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->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());
// } break;
// case PLAYER_ACTION_ALLIN: {
// myHand->getLog()->logPlayerAction(myBeRoID+1,(*currentPlayersTurnIt)->getMyID()+1,LOG_ACTION_ALL_IN,(*currentPlayersTurnIt)->getMySet());
// } break;
// default: {
// }
// }
PlayerListIterator it, it_1;
PlayerListConstIterator it_c;
@@ -646,10 +675,10 @@ void LocalHand::switchRounds()
}
//unhighlight current players groupbox
it_c = getActivePlayerIt(lastPlayersTurn);
it_c = getActivePlayerIt(previousPlayerID);
if( it_c != activePlayerList->end() ) {
// lastPlayersTurn is active
myGui->refreshGroupbox(lastPlayersTurn,1);
myGui->refreshGroupbox(previousPlayerID,1);
}
myGui->refreshGameLabels((GameState)getCurrentRound());
@@ -738,8 +767,8 @@ PlayerListIterator LocalHand::getRunningPlayerIt(unsigned uniqueId) const
}
void LocalHand::setLastActionPlayer(unsigned theValue)
void LocalHand::setLastActionPlayerID(unsigned theValue)
{
lastActionPlayer = theValue;
myBoard->setLastActionPlayer(theValue);
lastActionPlayerID = theValue;
myBoard->setLastActionPlayerID(theValue);
}
+9 -9
View File
@@ -130,16 +130,16 @@ public:
return bettingRoundsPlayed;
}
void setLastPlayersTurn(int theValue) {
lastPlayersTurn = theValue;
void setPreviousPlayerID(int theValue) {
previousPlayerID = theValue;
}
int getLastPlayersTurn() const {
return lastPlayersTurn;
int getPreviousPlayerID() const {
return previousPlayerID;
}
void setLastActionPlayer ( unsigned theValue );
unsigned getLastActionPlayer() const {
return lastActionPlayer;
void setLastActionPlayerID ( unsigned theValue );
unsigned getLastActionPlayerID() const {
return lastActionPlayerID;
}
void setCardsShown(bool theValue) {
@@ -181,8 +181,8 @@ private:
int smallBlind;
int startCash;
int lastPlayersTurn;
unsigned lastActionPlayer;
int previousPlayerID;
unsigned lastActionPlayerID;
bool allInCondition;
bool cardsShown;
+16 -16
View File
@@ -1066,7 +1066,7 @@ void LocalPlayer::action()
// cout << "jetzt" << endl;
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(myID);
currentHand->setPreviousPlayerID(myID);
currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet);
currentHand->getGuiInterface()->nextPlayerAnimation();
@@ -3222,12 +3222,12 @@ void LocalPlayer::evaluation(int bet, int raise)
break;
// fold
case 1: {
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_FOLD);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_FOLD);
}
break;
// check
case 2: {
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CHECK);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CHECK);
}
break;
// call
@@ -3238,14 +3238,14 @@ void LocalPlayer::evaluation(int bet, int raise)
mySet += myCash;
myCash = 0;
myAction = PLAYER_ACTION_ALLIN;
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
// cout << "evaluation(call) - mySet: " << mySet << endl;
}
// sonst
else {
myCash = myCash - highestSet + mySet;
mySet = highestSet;
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CALL,mySet);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CALL,mySet);
}
}
break;
@@ -3262,7 +3262,7 @@ void LocalPlayer::evaluation(int bet, int raise)
myCash = 0;
myAction = PLAYER_ACTION_ALLIN;
highestSet = mySet;
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
}
// sonst
else {
@@ -3270,11 +3270,11 @@ void LocalPlayer::evaluation(int bet, int raise)
myCash = myCash - bet;
mySet = bet;
highestSet = mySet;
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_BET,mySet);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_BET,mySet);
}
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayer(myUniqueID);
currentHand->setLastActionPlayerID(myUniqueID);
}
break;
// raise
@@ -3285,14 +3285,14 @@ void LocalPlayer::evaluation(int bet, int raise)
mySet += myCash;
myCash = 0;
myAction = PLAYER_ACTION_ALLIN;
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
// 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;
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CALL,mySet);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CALL,mySet);
}
} else {
if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) {
@@ -3311,7 +3311,7 @@ void LocalPlayer::evaluation(int bet, int raise)
// raise, but not enough --> full bet rule
currentHand->getCurrentBeRo()->setFullBetRule(true);
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayer(myUniqueID);
currentHand->setLastActionPlayerID(myUniqueID);
mySet += myCash;
currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet);
@@ -3321,7 +3321,7 @@ void LocalPlayer::evaluation(int bet, int raise)
}
} else {
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayer(myUniqueID);
currentHand->setLastActionPlayerID(myUniqueID);
mySet += myCash;
currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet);
@@ -3329,7 +3329,7 @@ void LocalPlayer::evaluation(int bet, int raise)
myAction = PLAYER_ACTION_ALLIN;
highestSet = mySet;
}
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
}
// sonst
else {
@@ -3338,15 +3338,15 @@ void LocalPlayer::evaluation(int bet, int raise)
mySet = highestSet + raise;
highestSet = mySet;
// lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayer(myUniqueID);
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_BET,mySet);
currentHand->setLastActionPlayerID(myUniqueID);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_BET,mySet);
}
}
}
break;
// all in
case 6: {
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
}
break;
default:
+3 -3
View File
@@ -24,7 +24,7 @@
using namespace std;
ClientBoard::ClientBoard(unsigned dp)
: pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayer(0)
: pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayerID(0)
{
myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
}
@@ -95,10 +95,10 @@ ClientBoard::setAllInCondition(bool theValue)
}
void
ClientBoard::setLastActionPlayer(unsigned theValue)
ClientBoard::setLastActionPlayerID(unsigned theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
lastActionPlayer = theValue;
lastActionPlayerID = theValue;
}
void
+2 -2
View File
@@ -45,7 +45,7 @@ public:
void setSets(int theValue);
void setAllInCondition(bool theValue);
void setLastActionPlayer(unsigned theValue);
void setLastActionPlayerID(unsigned theValue);
void collectSets();
void collectPot();
@@ -74,7 +74,7 @@ private:
int sets;
unsigned dealerPosition;
bool allInCondition;
unsigned lastActionPlayer;
unsigned lastActionPlayerID;
};
#endif
+9 -9
View File
@@ -23,7 +23,7 @@ using namespace std;
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> 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), lastPlayersTurn(-1), allInCondition(0),
smallBlind(sB), startCash(sC), previousPlayerID(-1), allInCondition(0),
cardsShown(false), bettingRoundsPlayed(0)
{
PlayerListIterator it;
@@ -287,31 +287,31 @@ ClientHand::getBettingRoundsPlayed() const
}
void
ClientHand::setLastPlayersTurn(int theValue)
ClientHand::setPreviousPlayerID(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
lastPlayersTurn = theValue;
previousPlayerID = theValue;
}
int
ClientHand::getLastPlayersTurn() const
ClientHand::getPreviousPlayerID() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return lastPlayersTurn;
return previousPlayerID;
}
void
ClientHand::setLastActionPlayer (unsigned theValue)
ClientHand::setLastActionPlayerID (unsigned theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
lastActionPlayer = theValue;
lastActionPlayerID = theValue;
}
unsigned
ClientHand::getLastActionPlayer() const
ClientHand::getLastActionPlayerID() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return lastActionPlayer;
return lastActionPlayerID;
}
void
+6 -6
View File
@@ -81,11 +81,11 @@ public:
void setBettingRoundsPlayed ( int theValue );
int getBettingRoundsPlayed() const;
void setLastPlayersTurn ( int theValue );
int getLastPlayersTurn() const;
void setPreviousPlayerID ( int theValue );
int getPreviousPlayerID() const;
void setLastActionPlayer ( unsigned theValue );
unsigned getLastActionPlayer() const;
void setLastActionPlayerID ( unsigned theValue );
unsigned getLastActionPlayerID() const;
void setCardsShown ( bool theValue );
bool getCardsShown() const;
@@ -119,8 +119,8 @@ private:
int smallBlind;
int startCash;
int lastPlayersTurn;
unsigned lastActionPlayer;
int previousPlayerID;
unsigned lastActionPlayerID;
bool allInCondition;
bool cardsShown;