establishing new parameter roundBeforePostRiver; deleting needless parameter bettingRoundsPlayed
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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; k<MAX_NUMBER_OF_PLAYERS && !winnerHit; k++) {
|
||||
|
||||
// winnerPointer = (winnerPointer+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
|
||||
// winnerHit = false;
|
||||
|
||||
++it;
|
||||
if(it == seatsList->end())
|
||||
it = seatsList->begin();
|
||||
|
||||
for(l=2; l<potLevel.size(); l++) {
|
||||
// if(winnerPointer == potLevel[l]) winnerHit = true;
|
||||
if((*it)->getMyUniqueID() == potLevel[l]) winnerHit = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// it = currentHand->getSeatIt(winnerPointer);
|
||||
// if(it == seatsList->end()) {
|
||||
// throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
// }
|
||||
if(j<mod) {
|
||||
(*it)->setMyCash( (*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<unsigned> it_c;
|
||||
|
||||
std::list<std::pair<int,int> > 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<int,int> 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<std::pair<int,int> >::iterator level_it;
|
||||
// std::list<std::pair<int,int> >::iterator level_it_tmp;
|
||||
std::list<std::pair<int,int> >::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<unsigned> playerNeedToShowCardsIt;
|
||||
//
|
||||
// for(playerNeedToShowCardsIt = playerNeedToShowCards.begin(); playerNeedToShowCardsIt!=playerNeedToShowCards.end(); playerNeedToShowCardsIt++) {
|
||||
// cout << (*playerNeedToShowCardsIt) << '\t';
|
||||
// }
|
||||
// cout << endl;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
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), 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:
|
||||
{}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
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),
|
||||
: 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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user