Pot and total sets are now displayed correctly.

This commit is contained in:
lotodore
2007-06-07 15:09:51 +00:00
parent 05a86be4fe
commit 48c7a27145
6 changed files with 14 additions and 11 deletions
-2
View File
@@ -193,8 +193,6 @@ Server Notification: Player's Action Done
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Player Money | | Player Money |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pot Size |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Current Hand Bets | | Current Hand Bets |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -53,6 +53,8 @@ ClientBoard::collectSets()
void void
ClientBoard::collectPot() ClientBoard::collectPot()
{ {
pot += sets;
sets = 0;
} }
+9 -1
View File
@@ -613,7 +613,6 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
tmpPlayer->setMyAction(actionDoneData.playerAction); tmpPlayer->setMyAction(actionDoneData.playerAction);
tmpPlayer->setMySetAbsolute(actionDoneData.totalPlayerBet); tmpPlayer->setMySetAbsolute(actionDoneData.totalPlayerBet);
tmpPlayer->setMyCash(actionDoneData.playerMoney); tmpPlayer->setMyCash(actionDoneData.playerMoney);
curGame->getCurrentHand()->getBoard()->setPot(actionDoneData.potSize);
curGame->getCurrentHand()->getBoard()->setSets(actionDoneData.curHandBets); curGame->getCurrentHand()->getBoard()->setSets(actionDoneData.curHandBets);
// Update highest set // Update highest set
@@ -670,8 +669,11 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
tmpCards[num] = static_cast<int>(cardsData.flopCards[num]); tmpCards[num] = static_cast<int>(cardsData.flopCards[num]);
tmpCards[3] = tmpCards[4] = 0; tmpCards[3] = tmpCards[4] = 0;
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
curGame->getCurrentHand()->getBoard()->collectPot();
client.GetGui().refreshGameLabels(GAME_STATE_FLOP); client.GetGui().refreshGameLabels(GAME_STATE_FLOP);
client.GetGui().refreshPot();
client.GetGui().refreshSet();
client.GetGui().dealFlopCards(); client.GetGui().dealFlopCards();
} }
else if (packet->ToNetPacketDealTurnCard()) else if (packet->ToNetPacketDealTurnCard())
@@ -682,8 +684,11 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
curGame->getCurrentHand()->getBoard()->getMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->getMyCards(tmpCards);
tmpCards[3] = static_cast<int>(cardsData.turnCard); tmpCards[3] = static_cast<int>(cardsData.turnCard);
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
curGame->getCurrentHand()->getBoard()->collectPot();
client.GetGui().refreshGameLabels(GAME_STATE_TURN); client.GetGui().refreshGameLabels(GAME_STATE_TURN);
client.GetGui().refreshPot();
client.GetGui().refreshSet();
client.GetGui().dealTurnCard(); client.GetGui().dealTurnCard();
} }
else if (packet->ToNetPacketDealRiverCard()) else if (packet->ToNetPacketDealRiverCard())
@@ -694,8 +699,11 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
curGame->getCurrentHand()->getBoard()->getMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->getMyCards(tmpCards);
tmpCards[4] = static_cast<int>(cardsData.riverCard); tmpCards[4] = static_cast<int>(cardsData.riverCard);
curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards);
curGame->getCurrentHand()->getBoard()->collectPot();
client.GetGui().refreshGameLabels(GAME_STATE_RIVER); client.GetGui().refreshGameLabels(GAME_STATE_RIVER);
client.GetGui().refreshPot();
client.GetGui().refreshSet();
client.GetGui().dealRiverCard(); client.GetGui().dealRiverCard();
} }
else if (packet->ToNetPacketAllInShowCards()) else if (packet->ToNetPacketAllInShowCards())
-3
View File
@@ -160,7 +160,6 @@ struct GCC_PACKED NetPacketPlayersActionDoneData
u_int16_t reserved; u_int16_t reserved;
u_int32_t totalPlayerBet; u_int32_t totalPlayerBet;
u_int32_t playerMoney; u_int32_t playerMoney;
u_int32_t potSize;
u_int32_t curHandBets; u_int32_t curHandBets;
}; };
@@ -1234,7 +1233,6 @@ NetPacketPlayersActionDone::SetData(const NetPacketPlayersActionDone::Data &inDa
tmpData->playerAction = htons(inData.playerAction); tmpData->playerAction = htons(inData.playerAction);
tmpData->totalPlayerBet = htonl(inData.totalPlayerBet); tmpData->totalPlayerBet = htonl(inData.totalPlayerBet);
tmpData->playerMoney = htonl(inData.playerMoney); tmpData->playerMoney = htonl(inData.playerMoney);
tmpData->potSize = htonl(inData.potSize);
tmpData->curHandBets = htonl(inData.curHandBets); tmpData->curHandBets = htonl(inData.curHandBets);
} }
@@ -1249,7 +1247,6 @@ NetPacketPlayersActionDone::GetData(NetPacketPlayersActionDone::Data &outData) c
outData.playerAction = static_cast<PlayerAction>(ntohs(tmpData->playerAction)); outData.playerAction = static_cast<PlayerAction>(ntohs(tmpData->playerAction));
outData.totalPlayerBet = ntohl(tmpData->totalPlayerBet); outData.totalPlayerBet = ntohl(tmpData->totalPlayerBet);
outData.playerMoney = ntohl(tmpData->playerMoney); outData.playerMoney = ntohl(tmpData->playerMoney);
outData.potSize = ntohl(tmpData->potSize);
outData.curHandBets = ntohl(tmpData->curHandBets); outData.curHandBets = ntohl(tmpData->curHandBets);
} }
+3 -4
View File
@@ -436,7 +436,6 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server)
actionDoneData.playerAction = (PlayerAction)playerArray[i]->getMyAction(); actionDoneData.playerAction = (PlayerAction)playerArray[i]->getMyAction();
actionDoneData.totalPlayerBet = playerArray[i]->getMySet(); actionDoneData.totalPlayerBet = playerArray[i]->getMySet();
actionDoneData.playerMoney = playerArray[i]->getMyCash(); actionDoneData.playerMoney = playerArray[i]->getMyCash();
actionDoneData.potSize = curGame.getCurrentHand()->getBoard()->getPot();
actionDoneData.curHandBets = playerArray[i]->getMySet(); // first bet only actionDoneData.curHandBets = playerArray[i]->getMySet(); // first bet only
static_cast<NetPacketPlayersActionDone *>(notifySmallBlind.get())->SetData(actionDoneData); static_cast<NetPacketPlayersActionDone *>(notifySmallBlind.get())->SetData(actionDoneData);
server.SendToAllPlayers(notifySmallBlind); server.SendToAllPlayers(notifySmallBlind);
@@ -454,7 +453,6 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server)
actionDoneData.playerAction = (PlayerAction)playerArray[i]->getMyAction(); actionDoneData.playerAction = (PlayerAction)playerArray[i]->getMyAction();
actionDoneData.totalPlayerBet = playerArray[i]->getMySet(); actionDoneData.totalPlayerBet = playerArray[i]->getMySet();
actionDoneData.playerMoney = playerArray[i]->getMyCash(); actionDoneData.playerMoney = playerArray[i]->getMyCash();
actionDoneData.potSize = curGame.getCurrentHand()->getBoard()->getPot();
actionDoneData.curHandBets = curGame.getCurrentHand()->getBoard()->getSets(); actionDoneData.curHandBets = curGame.getCurrentHand()->getBoard()->getSets();
static_cast<NetPacketPlayersActionDone *>(notifyBigBlind.get())->SetData(actionDoneData); static_cast<NetPacketPlayersActionDone *>(notifyBigBlind.get())->SetData(actionDoneData);
server.SendToAllPlayers(notifyBigBlind); server.SendToAllPlayers(notifyBigBlind);
@@ -579,7 +577,7 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
// Retrieve 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.
std::list<PlayerInterface *> activePlayers = GetActivePlayers(curGame); std::list<PlayerInterface *> activePlayers = GetActivePlayers(curGame);
assert(!activePlayers.empty()); // if (activePlayers.empty()) TODO throw exception
if (activePlayers.size() == 1) if (activePlayers.size() == 1)
{ {
@@ -768,6 +766,8 @@ ServerRecvStateWaitPlayerAction::PerformPlayerAction(ServerRecvThread &server, P
if (player->getMySet() > GetHighestSet(curGame)) if (player->getMySet() > GetHighestSet(curGame))
SetHighestSet(curGame, player->getMySet()); SetHighestSet(curGame, player->getMySet());
// Update total sets.
curGame.getCurrentHand()->getBoard()->collectSets();
} }
boost::shared_ptr<NetPacket> notifyActionDone(new NetPacketPlayersActionDone); boost::shared_ptr<NetPacket> notifyActionDone(new NetPacketPlayersActionDone);
@@ -777,7 +777,6 @@ ServerRecvStateWaitPlayerAction::PerformPlayerAction(ServerRecvThread &server, P
actionDoneData.playerAction = static_cast<PlayerAction>(player->getMyAction()); actionDoneData.playerAction = static_cast<PlayerAction>(player->getMyAction());
actionDoneData.totalPlayerBet = player->getMySet(); actionDoneData.totalPlayerBet = player->getMySet();
actionDoneData.playerMoney = player->getMyCash(); actionDoneData.playerMoney = player->getMyCash();
actionDoneData.potSize = curGame.getCurrentHand()->getBoard()->getPot();
actionDoneData.curHandBets = curGame.getCurrentHand()->getBoard()->getSets(); actionDoneData.curHandBets = curGame.getCurrentHand()->getBoard()->getSets();
static_cast<NetPacketPlayersActionDone *>(notifyActionDone.get())->SetData(actionDoneData); static_cast<NetPacketPlayersActionDone *>(notifyActionDone.get())->SetData(actionDoneData);
server.SendToAllPlayers(notifyActionDone); server.SendToAllPlayers(notifyActionDone);
-1
View File
@@ -316,7 +316,6 @@ public:
PlayerAction playerAction; PlayerAction playerAction;
u_int32_t totalPlayerBet; u_int32_t totalPlayerBet;
u_int32_t playerMoney; u_int32_t playerMoney;
u_int32_t potSize;
u_int32_t curHandBets; u_int32_t curHandBets;
}; };