Should be working to play up to river.
This commit is contained in:
@@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
void setMySet(int theValue) { myLastRelativeSet = theValue; mySet += theValue; myCash -= theValue; }
|
void setMySet(int theValue) { myLastRelativeSet = theValue; mySet += theValue; myCash -= theValue; }
|
||||||
void setMySetAbsolute(int theValue) { mySet = theValue; }
|
void setMySetAbsolute(int theValue) { mySet = theValue; }
|
||||||
void setMySetNull() { mySet = 0; }
|
void setMySetNull() { mySet = 0; myLastRelativeSet = 0; }
|
||||||
int getMySet() const { return mySet;}
|
int getMySet() const { return mySet;}
|
||||||
int getMyLastRelativeSet() const { return myLastRelativeSet; }
|
int getMyLastRelativeSet() const { return myLastRelativeSet; }
|
||||||
|
|
||||||
|
|||||||
@@ -48,11 +48,19 @@ ClientBoard::setHand(HandInterface* br)
|
|||||||
void
|
void
|
||||||
ClientBoard::collectSets()
|
ClientBoard::collectSets()
|
||||||
{
|
{
|
||||||
|
sets = 0;
|
||||||
|
int i;
|
||||||
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) sets += playerArray[i]->getMySet();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientBoard::collectPot()
|
ClientBoard::collectPot()
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
pot += sets;
|
||||||
|
sets = 0;
|
||||||
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++){ playerArray[i]->setMySetNull(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
void setMySet(int theValue) { myLastRelativeSet = theValue; mySet += theValue; myCash -= theValue; }
|
void setMySet(int theValue) { myLastRelativeSet = theValue; mySet += theValue; myCash -= theValue; }
|
||||||
void setMySetAbsolute(int theValue) { mySet = theValue; }
|
void setMySetAbsolute(int theValue) { mySet = theValue; }
|
||||||
void setMySetNull() { mySet = 0; }
|
void setMySetNull() { mySet = 0; myLastRelativeSet = 0; }
|
||||||
int getMySet() const { return mySet;}
|
int getMySet() const { return mySet;}
|
||||||
int getMyLastRelativeSet() const { return myLastRelativeSet; }
|
int getMyLastRelativeSet() const { return myLastRelativeSet; }
|
||||||
|
|
||||||
|
|||||||
@@ -597,8 +597,8 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
client.GetGui().refreshGroupbox(tmpPlayer->getMyID(), 3);
|
client.GetGui().refreshGroupbox(tmpPlayer->getMyID(), 3);
|
||||||
|
|
||||||
// Refresh GUI
|
// Refresh GUI
|
||||||
client.GetGui().refreshSet();
|
|
||||||
client.GetGui().refreshPot();
|
client.GetGui().refreshPot();
|
||||||
|
client.GetGui().refreshSet();
|
||||||
client.GetGui().refreshAction();
|
client.GetGui().refreshAction();
|
||||||
client.GetGui().refreshCash();
|
client.GetGui().refreshCash();
|
||||||
}
|
}
|
||||||
@@ -610,7 +610,26 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
assert(tmpPlayer); // TODO: throw exception
|
assert(tmpPlayer); // TODO: throw exception
|
||||||
|
|
||||||
// Set round.
|
// Set round.
|
||||||
|
if (curGame->getCurrentHand()->getActualRound() != turnData.gameState)
|
||||||
|
{
|
||||||
|
// Reset player actions
|
||||||
|
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
|
||||||
|
{
|
||||||
|
int action = curGame->getPlayerArray()[i]->getMyAction();
|
||||||
|
if (action != 1 && action != 6)
|
||||||
|
curGame->getPlayerArray()[i]->setMyAction(0);
|
||||||
|
}
|
||||||
|
// Move sets to pot
|
||||||
|
curGame->getCurrentHand()->getBoard()->collectSets();
|
||||||
|
curGame->getCurrentHand()->getBoard()->collectPot();
|
||||||
|
|
||||||
|
client.GetGui().refreshPot();
|
||||||
|
client.GetGui().refreshSet();
|
||||||
|
client.GetGui().refreshAction();
|
||||||
|
client.GetGui().refreshCash();
|
||||||
|
|
||||||
curGame->getCurrentHand()->setActualRound(turnData.gameState);
|
curGame->getCurrentHand()->setActualRound(turnData.gameState);
|
||||||
|
}
|
||||||
|
|
||||||
// Next player's turn.
|
// Next player's turn.
|
||||||
SetPlayersTurn(*curGame, tmpPlayer->getMyID());
|
SetPlayersTurn(*curGame, tmpPlayer->getMyID());
|
||||||
|
|||||||
@@ -318,6 +318,7 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server)
|
|||||||
// Initialize hand.
|
// Initialize hand.
|
||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
curGame.initHand();
|
curGame.initHand();
|
||||||
|
|
||||||
PlayerInterface **playerArray = curGame.getPlayerArray();
|
PlayerInterface **playerArray = curGame.getPlayerArray();
|
||||||
|
|
||||||
// Send cards to all players.
|
// Send cards to all players.
|
||||||
@@ -417,7 +418,11 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
|
|
||||||
// If round changes, deal cards if needed.
|
// If round changes, deal cards if needed.
|
||||||
if (newRound != curRound)
|
if (newRound != curRound)
|
||||||
|
{
|
||||||
|
// HACK: Skip GUI notification run
|
||||||
|
GameRun(curGame, newRound);
|
||||||
SendNewRoundCards(server, curGame);
|
SendNewRoundCards(server, curGame);
|
||||||
|
}
|
||||||
} while (newRound != curRound);
|
} while (newRound != curRound);
|
||||||
|
|
||||||
// Retrieve current player.
|
// Retrieve current player.
|
||||||
@@ -505,9 +510,9 @@ ServerRecvStateStartRound::SendNewRoundCards(ServerRecvThread &server, Game &cur
|
|||||||
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
||||||
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealFlopCards);
|
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealFlopCards);
|
||||||
NetPacketDealFlopCards::Data notifyCardsData;
|
NetPacketDealFlopCards::Data notifyCardsData;
|
||||||
notifyCardsData.flopCards[0] = static_cast<unsigned>(cards[0]);
|
notifyCardsData.flopCards[0] = static_cast<u_int16_t>(cards[0]);
|
||||||
notifyCardsData.flopCards[1] = static_cast<unsigned>(cards[1]);
|
notifyCardsData.flopCards[1] = static_cast<u_int16_t>(cards[1]);
|
||||||
notifyCardsData.flopCards[2] = static_cast<unsigned>(cards[2]);
|
notifyCardsData.flopCards[2] = static_cast<u_int16_t>(cards[2]);
|
||||||
static_cast<NetPacketDealFlopCards *>(notifyCards.get())->SetData(notifyCardsData);
|
static_cast<NetPacketDealFlopCards *>(notifyCards.get())->SetData(notifyCardsData);
|
||||||
server.SendToAllPlayers(notifyCards);
|
server.SendToAllPlayers(notifyCards);
|
||||||
} break;
|
} break;
|
||||||
@@ -517,7 +522,7 @@ ServerRecvStateStartRound::SendNewRoundCards(ServerRecvThread &server, Game &cur
|
|||||||
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
||||||
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealTurnCard);
|
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealTurnCard);
|
||||||
NetPacketDealTurnCard::Data notifyCardsData;
|
NetPacketDealTurnCard::Data notifyCardsData;
|
||||||
notifyCardsData.turnCard = static_cast<unsigned>(cards[3]);
|
notifyCardsData.turnCard = static_cast<u_int16_t>(cards[3]);
|
||||||
static_cast<NetPacketDealTurnCard *>(notifyCards.get())->SetData(notifyCardsData);
|
static_cast<NetPacketDealTurnCard *>(notifyCards.get())->SetData(notifyCardsData);
|
||||||
server.SendToAllPlayers(notifyCards);
|
server.SendToAllPlayers(notifyCards);
|
||||||
} break;
|
} break;
|
||||||
@@ -527,7 +532,7 @@ ServerRecvStateStartRound::SendNewRoundCards(ServerRecvThread &server, Game &cur
|
|||||||
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
curGame.getCurrentHand()->getBoard()->getMyCards(cards);
|
||||||
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealRiverCard);
|
boost::shared_ptr<NetPacket> notifyCards(new NetPacketDealRiverCard);
|
||||||
NetPacketDealRiverCard::Data notifyCardsData;
|
NetPacketDealRiverCard::Data notifyCardsData;
|
||||||
notifyCardsData.riverCard = static_cast<unsigned>(cards[4]);
|
notifyCardsData.riverCard = static_cast<u_int16_t>(cards[4]);
|
||||||
static_cast<NetPacketDealRiverCard *>(notifyCards.get())->SetData(notifyCardsData);
|
static_cast<NetPacketDealRiverCard *>(notifyCards.get())->SetData(notifyCardsData);
|
||||||
server.SendToAllPlayers(notifyCards);
|
server.SendToAllPlayers(notifyCards);
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
Reference in New Issue
Block a user