First try of showing cards when everybody is all in.
This commit is contained in:
+13
-10
@@ -43,39 +43,42 @@ public:
|
|||||||
virtual RiverInterface* getRiver() const =0;
|
virtual RiverInterface* getRiver() const =0;
|
||||||
virtual GuiInterface* getGuiInterface() const =0;
|
virtual GuiInterface* getGuiInterface() const =0;
|
||||||
|
|
||||||
virtual void setMyID(const int& theValue) =0;
|
virtual void setMyID(int theValue) =0;
|
||||||
virtual int getMyID() const =0;
|
virtual int getMyID() const =0;
|
||||||
|
|
||||||
virtual void setActualQuantityPlayers(const int& theValue) =0;
|
virtual void setActualQuantityPlayers(int theValue) =0;
|
||||||
virtual int getActualQuantityPlayers() const =0;
|
virtual int getActualQuantityPlayers() const =0;
|
||||||
|
|
||||||
virtual void setStartQuantityPlayers(const int& theValue) =0;
|
virtual void setStartQuantityPlayers(int theValue) =0;
|
||||||
virtual int getStartQuantityPlayers() const =0;
|
virtual int getStartQuantityPlayers() const =0;
|
||||||
|
|
||||||
virtual void setActualRound(const int& theValue) =0;
|
virtual void setActualRound(int theValue) =0;
|
||||||
virtual int getActualRound() const =0;
|
virtual int getActualRound() const =0;
|
||||||
|
|
||||||
virtual void setDealerPosition(const int& theValue) =0;
|
virtual void setDealerPosition(int theValue) =0;
|
||||||
virtual int getDealerPosition() const =0;
|
virtual int getDealerPosition() const =0;
|
||||||
|
|
||||||
virtual void setSmallBlind(const int& theValue) =0;
|
virtual void setSmallBlind(int theValue) =0;
|
||||||
virtual int getSmallBlind() const =0;
|
virtual int getSmallBlind() const =0;
|
||||||
|
|
||||||
virtual void setAllInCondition(bool theValue) =0;
|
virtual void setAllInCondition(bool theValue) =0;
|
||||||
virtual bool getAllInCondition() const =0;
|
virtual bool getAllInCondition() const =0;
|
||||||
|
|
||||||
virtual void setStartCash(const int& theValue) =0;
|
virtual void setStartCash(int theValue) =0;
|
||||||
virtual int getStartCash() const =0;
|
virtual int getStartCash() const =0;
|
||||||
|
|
||||||
virtual void setActivePlayersCounter(const int& theValue) =0;
|
virtual void setActivePlayersCounter(int theValue) =0;
|
||||||
virtual int getActivePlayersCounter() const =0;
|
virtual int getActivePlayersCounter() const =0;
|
||||||
|
|
||||||
virtual void setBettingRoundsPlayed(const int& theValue) =0;
|
virtual void setBettingRoundsPlayed(int theValue) =0;
|
||||||
virtual int getBettingRoundsPlayed() const =0;
|
virtual int getBettingRoundsPlayed() const =0;
|
||||||
|
|
||||||
virtual void setLastPlayersTurn(const int& theValue) =0;
|
virtual void setLastPlayersTurn(int theValue) =0;
|
||||||
virtual int getLastPlayersTurn() const =0;
|
virtual int getLastPlayersTurn() const =0;
|
||||||
|
|
||||||
|
virtual void setCardsShown(bool theValue) =0;
|
||||||
|
virtual bool getCardsShown() const =0;
|
||||||
|
|
||||||
virtual void switchRounds() =0;
|
virtual void switchRounds() =0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
|||||||
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0),
|
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0),
|
||||||
myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0),
|
myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0),
|
||||||
smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
|
smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
|
||||||
bettingRoundsPlayed(0)
|
cardsShown(false), bettingRoundsPlayed(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|||||||
@@ -46,39 +46,41 @@ public:
|
|||||||
RiverInterface* getRiver() const { return myRiver; }
|
RiverInterface* getRiver() const { return myRiver; }
|
||||||
GuiInterface* getGuiInterface() const { return myGui; }
|
GuiInterface* getGuiInterface() const { return myGui; }
|
||||||
|
|
||||||
void setMyID(const int& theValue) { myID = theValue; }
|
void setMyID(int theValue) { myID = theValue; }
|
||||||
int getMyID() const { return myID; }
|
int getMyID() const { return myID; }
|
||||||
|
|
||||||
void setActualQuantityPlayers(const int& theValue) { actualQuantityPlayers = theValue; }
|
void setActualQuantityPlayers(int theValue) { actualQuantityPlayers = theValue; }
|
||||||
int getActualQuantityPlayers() const { return actualQuantityPlayers; }
|
int getActualQuantityPlayers() const { return actualQuantityPlayers; }
|
||||||
|
|
||||||
void setStartQuantityPlayers(const int& theValue) { startQuantityPlayers = theValue; }
|
void setStartQuantityPlayers(int theValue) { startQuantityPlayers = theValue; }
|
||||||
int getStartQuantityPlayers() const { return startQuantityPlayers; }
|
int getStartQuantityPlayers() const { return startQuantityPlayers; }
|
||||||
|
|
||||||
void setActualRound(const int& theValue) { actualRound = theValue; }
|
void setActualRound(int theValue) { actualRound = theValue; }
|
||||||
int getActualRound() const { return actualRound; }
|
int getActualRound() const { return actualRound; }
|
||||||
|
|
||||||
void setDealerPosition(const int& theValue) { dealerPosition = theValue; }
|
void setDealerPosition(int theValue) { dealerPosition = theValue; }
|
||||||
int getDealerPosition() const { return dealerPosition; }
|
int getDealerPosition() const { return dealerPosition; }
|
||||||
|
|
||||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
void setSmallBlind(int theValue) { smallBlind = theValue; }
|
||||||
int getSmallBlind() const { return smallBlind; }
|
int getSmallBlind() const { return smallBlind; }
|
||||||
|
|
||||||
void setAllInCondition(bool theValue) { allInCondition = theValue; }
|
void setAllInCondition(bool theValue) { allInCondition = theValue; }
|
||||||
bool getAllInCondition() const { return allInCondition; }
|
bool getAllInCondition() const { return allInCondition; }
|
||||||
|
|
||||||
void setStartCash(const int& theValue) { startCash = theValue; }
|
void setStartCash(int theValue) { startCash = theValue; }
|
||||||
int getStartCash() const { return startCash; }
|
int getStartCash() const { return startCash; }
|
||||||
|
|
||||||
void setActivePlayersCounter(const int& theValue) { activePlayersCounter = theValue; }
|
void setActivePlayersCounter(int theValue) { activePlayersCounter = theValue; }
|
||||||
int getActivePlayersCounter() const { return activePlayersCounter; }
|
int getActivePlayersCounter() const { return activePlayersCounter; }
|
||||||
|
|
||||||
void setBettingRoundsPlayed(const int& theValue) { bettingRoundsPlayed = theValue; }
|
void setBettingRoundsPlayed(int theValue) { bettingRoundsPlayed = theValue; }
|
||||||
int getBettingRoundsPlayed() const { return bettingRoundsPlayed; }
|
int getBettingRoundsPlayed() const { return bettingRoundsPlayed; }
|
||||||
|
|
||||||
void setLastPlayersTurn(const int& theValue) { lastPlayersTurn = theValue; }
|
void setLastPlayersTurn(int theValue) { lastPlayersTurn = theValue; }
|
||||||
int getLastPlayersTurn() const { return lastPlayersTurn; }
|
int getLastPlayersTurn() const { return lastPlayersTurn; }
|
||||||
|
|
||||||
|
void setCardsShown(bool theValue) { cardsShown = theValue; }
|
||||||
|
bool getCardsShown() const { return cardsShown; }
|
||||||
|
|
||||||
void assignButtons();
|
void assignButtons();
|
||||||
|
|
||||||
@@ -108,6 +110,7 @@ private:
|
|||||||
int lastPlayersTurn;
|
int lastPlayersTurn;
|
||||||
|
|
||||||
bool allInCondition;
|
bool allInCondition;
|
||||||
|
bool cardsShown;
|
||||||
|
|
||||||
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
|
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
|
||||||
int bettingRoundsPlayed;
|
int bettingRoundsPlayed;
|
||||||
|
|||||||
@@ -22,10 +22,10 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
||||||
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0),
|
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0),
|
||||||
myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0),
|
myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0),
|
||||||
smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
|
smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
|
||||||
bettingRoundsPlayed(0)
|
cardsShown(false), bettingRoundsPlayed(0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
lastPlayersTurn = 0;
|
lastPlayersTurn = 0;
|
||||||
@@ -37,7 +37,7 @@ ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, Boar
|
|||||||
if(playerArray[i]->getMyActiveStatus() != 0) {
|
if(playerArray[i]->getMyActiveStatus() != 0) {
|
||||||
playerArray[i]->setHand(this);
|
playerArray[i]->setHand(this);
|
||||||
}
|
}
|
||||||
// myFlipCards auf 0 setzen
|
// myFlipCards auf 0 setzen
|
||||||
playerArray[i]->setMyCardsFlip(0, 0);
|
playerArray[i]->setMyCardsFlip(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,10 +77,10 @@ void
|
|||||||
ClientHand::switchRounds()
|
ClientHand::switchRounds()
|
||||||
{
|
{
|
||||||
// update active players counter.
|
// update active players counter.
|
||||||
activePlayersCounter = 0;
|
activePlayersCounter = 0;
|
||||||
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++) {
|
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
if (playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyActiveStatus() == 1) activePlayersCounter++;
|
if (playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyActiveStatus() == 1) activePlayersCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,39 +46,42 @@ public:
|
|||||||
RiverInterface* getRiver() const { return myRiver; }
|
RiverInterface* getRiver() const { return myRiver; }
|
||||||
GuiInterface* getGuiInterface() const { return myGui; }
|
GuiInterface* getGuiInterface() const { return myGui; }
|
||||||
|
|
||||||
void setMyID(const int& theValue) { myID = theValue; }
|
void setMyID(int theValue) { myID = theValue; }
|
||||||
int getMyID() const { return myID; }
|
int getMyID() const { return myID; }
|
||||||
|
|
||||||
void setActualQuantityPlayers(const int& theValue) { actualQuantityPlayers = theValue; }
|
void setActualQuantityPlayers(int theValue) { actualQuantityPlayers = theValue; }
|
||||||
int getActualQuantityPlayers() const { return actualQuantityPlayers; }
|
int getActualQuantityPlayers() const { return actualQuantityPlayers; }
|
||||||
|
|
||||||
void setStartQuantityPlayers(const int& theValue) { startQuantityPlayers = theValue; }
|
void setStartQuantityPlayers(int theValue) { startQuantityPlayers = theValue; }
|
||||||
int getStartQuantityPlayers() const { return startQuantityPlayers; }
|
int getStartQuantityPlayers() const { return startQuantityPlayers; }
|
||||||
|
|
||||||
void setActualRound(const int& theValue) { actualRound = theValue; }
|
void setActualRound(int theValue) { actualRound = theValue; }
|
||||||
int getActualRound() const { return actualRound; }
|
int getActualRound() const { return actualRound; }
|
||||||
|
|
||||||
void setDealerPosition(const int& theValue) { dealerPosition = theValue; }
|
void setDealerPosition(int theValue) { dealerPosition = theValue; }
|
||||||
int getDealerPosition() const { return dealerPosition; }
|
int getDealerPosition() const { return dealerPosition; }
|
||||||
|
|
||||||
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
|
void setSmallBlind(int theValue) { smallBlind = theValue; }
|
||||||
int getSmallBlind() const { return smallBlind; }
|
int getSmallBlind() const { return smallBlind; }
|
||||||
|
|
||||||
void setAllInCondition(bool theValue) { allInCondition = theValue; }
|
void setAllInCondition(bool theValue) { allInCondition = theValue; }
|
||||||
bool getAllInCondition() const { return allInCondition; }
|
bool getAllInCondition() const { return allInCondition; }
|
||||||
|
|
||||||
void setStartCash(const int& theValue) { startCash = theValue; }
|
void setStartCash(int theValue) { startCash = theValue; }
|
||||||
int getStartCash() const { return startCash; }
|
int getStartCash() const { return startCash; }
|
||||||
|
|
||||||
void setActivePlayersCounter(const int& theValue) { activePlayersCounter = theValue; }
|
void setActivePlayersCounter(int theValue) { activePlayersCounter = theValue; }
|
||||||
int getActivePlayersCounter() const { return activePlayersCounter; }
|
int getActivePlayersCounter() const { return activePlayersCounter; }
|
||||||
|
|
||||||
void setBettingRoundsPlayed(const int& theValue) { bettingRoundsPlayed = theValue; }
|
void setBettingRoundsPlayed(int theValue) { bettingRoundsPlayed = theValue; }
|
||||||
int getBettingRoundsPlayed() const { return bettingRoundsPlayed; }
|
int getBettingRoundsPlayed() const { return bettingRoundsPlayed; }
|
||||||
|
|
||||||
void setLastPlayersTurn(const int& theValue) { lastPlayersTurn = theValue; }
|
void setLastPlayersTurn(int theValue) { lastPlayersTurn = theValue; }
|
||||||
int getLastPlayersTurn() const { return lastPlayersTurn; }
|
int getLastPlayersTurn() const { return lastPlayersTurn; }
|
||||||
|
|
||||||
|
void setCardsShown(bool theValue) { cardsShown = theValue; }
|
||||||
|
bool getCardsShown() const { return cardsShown; }
|
||||||
|
|
||||||
void switchRounds();
|
void switchRounds();
|
||||||
|
|
||||||
|
|
||||||
@@ -105,6 +108,7 @@ private:
|
|||||||
int lastPlayersTurn;
|
int lastPlayersTurn;
|
||||||
|
|
||||||
bool allInCondition;
|
bool allInCondition;
|
||||||
|
bool cardsShown;
|
||||||
|
|
||||||
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
|
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
|
||||||
int bettingRoundsPlayed;
|
int bettingRoundsPlayed;
|
||||||
|
|||||||
@@ -700,6 +700,30 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
|
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
|
||||||
client.GetGui().dealRiverCard();
|
client.GetGui().dealRiverCard();
|
||||||
}
|
}
|
||||||
|
else if (packet->ToNetPacketAllInShowCards())
|
||||||
|
{
|
||||||
|
NetPacketAllInShowCards::Data allInData;
|
||||||
|
packet->ToNetPacketAllInShowCards()->GetData(allInData);
|
||||||
|
|
||||||
|
NetPacketAllInShowCards::PlayerCardsList::const_iterator i
|
||||||
|
= allInData.playerCards.begin();
|
||||||
|
NetPacketAllInShowCards::PlayerCardsList::const_iterator end
|
||||||
|
= allInData.playerCards.end();
|
||||||
|
|
||||||
|
while (i != end)
|
||||||
|
{
|
||||||
|
PlayerInterface *tmpPlayer = curGame->getPlayerByUniqueId((*i).playerId);
|
||||||
|
if (!tmpPlayer)
|
||||||
|
throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||||
|
|
||||||
|
int tmpCards[2];
|
||||||
|
tmpCards[0] = static_cast<int>((*i).cards[0]);
|
||||||
|
tmpCards[1] = static_cast<int>((*i).cards[1]);
|
||||||
|
tmpPlayer->setMyCards(tmpCards);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
client.GetGui().flipHolecardsAllIn();
|
||||||
|
}
|
||||||
else if (packet->ToNetPacketEndOfHandHideCards())
|
else if (packet->ToNetPacketEndOfHandHideCards())
|
||||||
{
|
{
|
||||||
// End of Hand, but keep cards hidden.
|
// End of Hand, but keep cards hidden.
|
||||||
|
|||||||
@@ -454,6 +454,42 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
if (newRound != curRound)
|
if (newRound != curRound)
|
||||||
{
|
{
|
||||||
assert(newRound > curRound);
|
assert(newRound > curRound);
|
||||||
|
|
||||||
|
if (curGame.getCurrentHand()->getAllInCondition()
|
||||||
|
&& !curGame.getCurrentHand()->getCardsShown())
|
||||||
|
{
|
||||||
|
// Retrieve active players. If only one player is left, no cards are shown.
|
||||||
|
std::list<PlayerInterface *> activePlayers = GetActivePlayers(curGame);
|
||||||
|
assert(!activePlayers.empty());
|
||||||
|
if (activePlayers.size() > 1)
|
||||||
|
{
|
||||||
|
// Send cards of all active players to all players (all in).
|
||||||
|
boost::shared_ptr<NetPacket> allIn(new NetPacketAllInShowCards);
|
||||||
|
NetPacketAllInShowCards::Data allInData;
|
||||||
|
|
||||||
|
std::list<PlayerInterface *>::iterator i = activePlayers.begin();
|
||||||
|
std::list<PlayerInterface *>::iterator end = activePlayers.end();
|
||||||
|
|
||||||
|
while (i != end)
|
||||||
|
{
|
||||||
|
NetPacketAllInShowCards::PlayerCards tmpPlayerCards;
|
||||||
|
tmpPlayerCards.playerId = (*i)->getMyUniqueID();
|
||||||
|
|
||||||
|
int tmpCards[2];
|
||||||
|
(*i)->getMyCards(tmpCards);
|
||||||
|
tmpPlayerCards.cards[0] = static_cast<u_int16_t>(tmpCards[0]);
|
||||||
|
tmpPlayerCards.cards[1] = static_cast<u_int16_t>(tmpCards[1]);
|
||||||
|
|
||||||
|
allInData.playerCards.push_back(tmpPlayerCards);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
static_cast<NetPacketAllInShowCards *>(allIn.get())->SetData(allInData);
|
||||||
|
server.SendToAllPlayers(allIn);
|
||||||
|
|
||||||
|
curGame.getCurrentHand()->setCardsShown(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SendNewRoundCards(server, curGame, newRound);
|
SendNewRoundCards(server, curGame, newRound);
|
||||||
|
|
||||||
boost::microsec_timer delayTimer;
|
boost::microsec_timer delayTimer;
|
||||||
@@ -466,47 +502,35 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
{
|
{
|
||||||
if (newRound != GAME_STATE_POST_RIVER) // continue hand
|
if (newRound != GAME_STATE_POST_RIVER) // continue hand
|
||||||
{
|
{
|
||||||
if (!curGame.getCurrentHand()->getAllInCondition())
|
assert (!curGame.getCurrentHand()->getAllInCondition()); // this would be an error.
|
||||||
{
|
|
||||||
// Retrieve current player.
|
|
||||||
PlayerInterface *curPlayer = GetCurrentPlayer(curGame);
|
|
||||||
assert(curPlayer); // TODO throw exception
|
|
||||||
assert(curPlayer->getMyActiveStatus()); // TODO throw exception
|
|
||||||
|
|
||||||
boost::shared_ptr<NetPacket> notification(new NetPacketPlayersTurn);
|
// Retrieve current player.
|
||||||
NetPacketPlayersTurn::Data playersTurnData;
|
PlayerInterface *curPlayer = GetCurrentPlayer(curGame);
|
||||||
playersTurnData.gameState = (GameState)curGame.getCurrentHand()->getActualRound();
|
assert(curPlayer); // TODO throw exception
|
||||||
playersTurnData.playerId = curPlayer->getMyUniqueID();
|
assert(curPlayer->getMyActiveStatus()); // TODO throw exception
|
||||||
static_cast<NetPacketPlayersTurn *>(notification.get())->SetData(playersTurnData);
|
|
||||||
|
|
||||||
server.SendToAllPlayers(notification);
|
boost::shared_ptr<NetPacket> notification(new NetPacketPlayersTurn);
|
||||||
|
NetPacketPlayersTurn::Data playersTurnData;
|
||||||
|
playersTurnData.gameState = (GameState)curGame.getCurrentHand()->getActualRound();
|
||||||
|
playersTurnData.playerId = curPlayer->getMyUniqueID();
|
||||||
|
static_cast<NetPacketPlayersTurn *>(notification.get())->SetData(playersTurnData);
|
||||||
|
|
||||||
server.SetState(ServerRecvStateWaitPlayerAction::Instance());
|
server.SendToAllPlayers(notification);
|
||||||
|
|
||||||
retVal = MSG_NET_GAME_SERVER_ROUND;
|
server.SetState(ServerRecvStateWaitPlayerAction::Instance());
|
||||||
}
|
|
||||||
|
retVal = MSG_NET_GAME_SERVER_ROUND;
|
||||||
}
|
}
|
||||||
else // hand is over
|
else // hand is over
|
||||||
{
|
{
|
||||||
// Let the engine find out the winner(s).
|
// Let the engine find out the winner(s).
|
||||||
curGame.getCurrentHand()->getRiver()->postRiverRun();
|
curGame.getCurrentHand()->getRiver()->postRiverRun();
|
||||||
|
|
||||||
// Count active players. If only one player is left, no cards are shown.
|
// Retrieve active players. If only one player is left, no cards are shown.
|
||||||
int activePlayersCounter = 0;
|
std::list<PlayerInterface *> activePlayers = GetActivePlayers(curGame);
|
||||||
std::list<PlayerInterface *> activePlayers;
|
|
||||||
for (int i = 0; i < curGame.getStartQuantityPlayers() ; i++)
|
|
||||||
{
|
|
||||||
if (curGame.getPlayerArray()[i]->getMyActiveStatus()
|
|
||||||
&& curGame.getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD)
|
|
||||||
{
|
|
||||||
activePlayersCounter++;
|
|
||||||
activePlayers.push_back(curGame.getPlayerArray()[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert(activePlayersCounter);
|
|
||||||
assert(!activePlayers.empty());
|
assert(!activePlayers.empty());
|
||||||
|
|
||||||
if (activePlayersCounter == 1)
|
if (activePlayers.size() == 1)
|
||||||
{
|
{
|
||||||
// End of Hand, but keep cards hidden.
|
// End of Hand, but keep cards hidden.
|
||||||
PlayerInterface *player = activePlayers.front();
|
PlayerInterface *player = activePlayers.front();
|
||||||
@@ -646,6 +670,21 @@ ServerRecvStateStartRound::SendNewRoundCards(ServerRecvThread &server, Game &cur
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::list<PlayerInterface *>
|
||||||
|
ServerRecvStateStartRound::GetActivePlayers(Game &curGame)
|
||||||
|
{
|
||||||
|
std::list<PlayerInterface *> activePlayers;
|
||||||
|
for (int i = 0; i < curGame.getStartQuantityPlayers() ; i++)
|
||||||
|
{
|
||||||
|
if (curGame.getPlayerArray()[i]->getMyActiveStatus()
|
||||||
|
&& curGame.getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD)
|
||||||
|
{
|
||||||
|
activePlayers.push_back(curGame.getPlayerArray()[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return activePlayers;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ServerRecvStateWaitPlayerAction &
|
ServerRecvStateWaitPlayerAction &
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ protected:
|
|||||||
|
|
||||||
static void GameRun(Game &curGame);
|
static void GameRun(Game &curGame);
|
||||||
static void SendNewRoundCards(ServerRecvThread &server, Game &curGame, int state);
|
static void SendNewRoundCards(ServerRecvThread &server, Game &curGame, int state);
|
||||||
|
static std::list<PlayerInterface *> GetActivePlayers(Game &curGame);
|
||||||
};
|
};
|
||||||
|
|
||||||
// State: Wait for a player action.
|
// State: Wait for a player action.
|
||||||
|
|||||||
Reference in New Issue
Block a user