diff --git a/docs/net_protocol.txt b/docs/net_protocol.txt index fb58aac2..e2bfa138 100644 --- a/docs/net_protocol.txt +++ b/docs/net_protocol.txt @@ -193,8 +193,6 @@ Server Notification: Player's Action Done +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Player Money | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Pot Size | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Current Hand Bets | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ diff --git a/src/engine/network_engine/clientboard.cpp b/src/engine/network_engine/clientboard.cpp index cc4990b1..88dc4eb6 100644 --- a/src/engine/network_engine/clientboard.cpp +++ b/src/engine/network_engine/clientboard.cpp @@ -53,6 +53,8 @@ ClientBoard::collectSets() void ClientBoard::collectPot() { + pot += sets; + sets = 0; } diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index b0620bfe..281884a9 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -613,7 +613,6 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrsetMyAction(actionDoneData.playerAction); tmpPlayer->setMySetAbsolute(actionDoneData.totalPlayerBet); tmpPlayer->setMyCash(actionDoneData.playerMoney); - curGame->getCurrentHand()->getBoard()->setPot(actionDoneData.potSize); curGame->getCurrentHand()->getBoard()->setSets(actionDoneData.curHandBets); // Update highest set @@ -670,8 +669,11 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr(cardsData.flopCards[num]); tmpCards[3] = tmpCards[4] = 0; curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); + curGame->getCurrentHand()->getBoard()->collectPot(); client.GetGui().refreshGameLabels(GAME_STATE_FLOP); + client.GetGui().refreshPot(); + client.GetGui().refreshSet(); client.GetGui().dealFlopCards(); } else if (packet->ToNetPacketDealTurnCard()) @@ -682,8 +684,11 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrgetCurrentHand()->getBoard()->getMyCards(tmpCards); tmpCards[3] = static_cast(cardsData.turnCard); curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); + curGame->getCurrentHand()->getBoard()->collectPot(); client.GetGui().refreshGameLabels(GAME_STATE_TURN); + client.GetGui().refreshPot(); + client.GetGui().refreshSet(); client.GetGui().dealTurnCard(); } else if (packet->ToNetPacketDealRiverCard()) @@ -694,8 +699,11 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrgetCurrentHand()->getBoard()->getMyCards(tmpCards); tmpCards[4] = static_cast(cardsData.riverCard); curGame->getCurrentHand()->getBoard()->setMyCards(tmpCards); + curGame->getCurrentHand()->getBoard()->collectPot(); client.GetGui().refreshGameLabels(GAME_STATE_RIVER); + client.GetGui().refreshPot(); + client.GetGui().refreshSet(); client.GetGui().dealRiverCard(); } else if (packet->ToNetPacketAllInShowCards()) diff --git a/src/net/common/netpacket.cpp b/src/net/common/netpacket.cpp index 80588d21..1b26b4dd 100644 --- a/src/net/common/netpacket.cpp +++ b/src/net/common/netpacket.cpp @@ -160,7 +160,6 @@ struct GCC_PACKED NetPacketPlayersActionDoneData u_int16_t reserved; u_int32_t totalPlayerBet; u_int32_t playerMoney; - u_int32_t potSize; u_int32_t curHandBets; }; @@ -1234,7 +1233,6 @@ NetPacketPlayersActionDone::SetData(const NetPacketPlayersActionDone::Data &inDa tmpData->playerAction = htons(inData.playerAction); tmpData->totalPlayerBet = htonl(inData.totalPlayerBet); tmpData->playerMoney = htonl(inData.playerMoney); - tmpData->potSize = htonl(inData.potSize); tmpData->curHandBets = htonl(inData.curHandBets); } @@ -1249,7 +1247,6 @@ NetPacketPlayersActionDone::GetData(NetPacketPlayersActionDone::Data &outData) c outData.playerAction = static_cast(ntohs(tmpData->playerAction)); outData.totalPlayerBet = ntohl(tmpData->totalPlayerBet); outData.playerMoney = ntohl(tmpData->playerMoney); - outData.potSize = ntohl(tmpData->potSize); outData.curHandBets = ntohl(tmpData->curHandBets); } diff --git a/src/net/common/serverrecvstate.cpp b/src/net/common/serverrecvstate.cpp index e7a34a68..e8aaf618 100644 --- a/src/net/common/serverrecvstate.cpp +++ b/src/net/common/serverrecvstate.cpp @@ -436,7 +436,6 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server) actionDoneData.playerAction = (PlayerAction)playerArray[i]->getMyAction(); actionDoneData.totalPlayerBet = playerArray[i]->getMySet(); actionDoneData.playerMoney = playerArray[i]->getMyCash(); - actionDoneData.potSize = curGame.getCurrentHand()->getBoard()->getPot(); actionDoneData.curHandBets = playerArray[i]->getMySet(); // first bet only static_cast(notifySmallBlind.get())->SetData(actionDoneData); server.SendToAllPlayers(notifySmallBlind); @@ -454,7 +453,6 @@ ServerRecvStateStartHand::Process(ServerRecvThread &server) actionDoneData.playerAction = (PlayerAction)playerArray[i]->getMyAction(); actionDoneData.totalPlayerBet = playerArray[i]->getMySet(); actionDoneData.playerMoney = playerArray[i]->getMyCash(); - actionDoneData.potSize = curGame.getCurrentHand()->getBoard()->getPot(); actionDoneData.curHandBets = curGame.getCurrentHand()->getBoard()->getSets(); static_cast(notifyBigBlind.get())->SetData(actionDoneData); server.SendToAllPlayers(notifyBigBlind); @@ -579,7 +577,7 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server) // Retrieve active players. If only one player is left, no cards are shown. std::list activePlayers = GetActivePlayers(curGame); - assert(!activePlayers.empty()); + // if (activePlayers.empty()) TODO throw exception if (activePlayers.size() == 1) { @@ -768,6 +766,8 @@ ServerRecvStateWaitPlayerAction::PerformPlayerAction(ServerRecvThread &server, P if (player->getMySet() > GetHighestSet(curGame)) SetHighestSet(curGame, player->getMySet()); + // Update total sets. + curGame.getCurrentHand()->getBoard()->collectSets(); } boost::shared_ptr notifyActionDone(new NetPacketPlayersActionDone); @@ -777,7 +777,6 @@ ServerRecvStateWaitPlayerAction::PerformPlayerAction(ServerRecvThread &server, P actionDoneData.playerAction = static_cast(player->getMyAction()); actionDoneData.totalPlayerBet = player->getMySet(); actionDoneData.playerMoney = player->getMyCash(); - actionDoneData.potSize = curGame.getCurrentHand()->getBoard()->getPot(); actionDoneData.curHandBets = curGame.getCurrentHand()->getBoard()->getSets(); static_cast(notifyActionDone.get())->SetData(actionDoneData); server.SendToAllPlayers(notifyActionDone); diff --git a/src/net/netpacket.h b/src/net/netpacket.h index b5ba8fc4..47d90178 100644 --- a/src/net/netpacket.h +++ b/src/net/netpacket.h @@ -316,7 +316,6 @@ public: PlayerAction playerAction; u_int32_t totalPlayerBet; u_int32_t playerMoney; - u_int32_t potSize; u_int32_t curHandBets; };