The server is now sending the highest set, and the client is no longer calculating it on his own. This should fix some bugs when someone goes all in with the big/small blind.

This commit is contained in:
lotodore
2007-10-06 14:16:36 +00:00
parent 4c9216dcc2
commit 4e649450b2
6 changed files with 15 additions and 7 deletions
+3 -1
View File
@@ -534,7 +534,7 @@ Server Notification: Player's Action Done
0 1 2 3 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message Type = 84 | Message Length = 20 | | Message Type = 84 | Message Length = 24 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Player ID | | Player ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -544,6 +544,8 @@ Server Notification: Player's Action Done
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Player Money | | Player Money |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Highest Set |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Additional Game States: Additional Game States:
0xF0 - Preflop Small Blind (no action requested) 0xF0 - Preflop Small Blind (no action requested)
+1 -3
View File
@@ -813,12 +813,10 @@ 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()->getCurrentBeRo()->setHighestSet(actionDoneData.highestSet);
curGame->getCurrentHand()->getBoard()->collectSets(); curGame->getCurrentHand()->getBoard()->collectSets();
curGame->getCurrentHand()->switchRounds(); curGame->getCurrentHand()->switchRounds();
// Update highest set
if (tmpPlayer->getMySet() > curGame->getCurrentHand()->getCurrentBeRo()->getHighestSet())
curGame->getCurrentHand()->getCurrentBeRo()->setHighestSet(tmpPlayer->getMySet());
//log blinds sets after setting bigblind-button //log blinds sets after setting bigblind-button
if (isBigBlind) { if (isBigBlind) {
+3
View File
@@ -341,6 +341,7 @@ struct GCC_PACKED NetPacketPlayersActionDoneData
u_int16_t playerAction; u_int16_t playerAction;
u_int32_t totalPlayerBet; u_int32_t totalPlayerBet;
u_int32_t playerMoney; u_int32_t playerMoney;
u_int32_t highestSet;
}; };
struct GCC_PACKED NetPacketPlayersActionRejectedData struct GCC_PACKED NetPacketPlayersActionRejectedData
@@ -3067,6 +3068,7 @@ 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->highestSet = htonl(inData.highestSet);
// Check the packet - just in case. // Check the packet - just in case.
Check(GetRawData()); Check(GetRawData());
@@ -3082,6 +3084,7 @@ 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.highestSet = ntohl(tmpData->highestSet);
} }
const NetPacketPlayersActionDone * const NetPacketPlayersActionDone *
+3
View File
@@ -63,6 +63,7 @@ static void SendPlayerAction(ServerGameThread &server, boost::shared_ptr<PlayerI
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.highestSet = server.GetGame().getCurrentHand()->getCurrentBeRo()->getHighestSet();
static_cast<NetPacketPlayersActionDone *>(notifyActionDone.get())->SetData(actionDoneData); static_cast<NetPacketPlayersActionDone *>(notifyActionDone.get())->SetData(actionDoneData);
server.SendToAllPlayers(notifyActionDone, SessionData::Game); server.SendToAllPlayers(notifyActionDone, SessionData::Game);
} }
@@ -486,6 +487,7 @@ ServerGameStateStartHand::Process(ServerGameThread &server)
actionDoneData.playerAction = (PlayerAction)tmpPlayer->getMyAction(); actionDoneData.playerAction = (PlayerAction)tmpPlayer->getMyAction();
actionDoneData.totalPlayerBet = tmpPlayer->getMySet(); actionDoneData.totalPlayerBet = tmpPlayer->getMySet();
actionDoneData.playerMoney = tmpPlayer->getMyCash(); actionDoneData.playerMoney = tmpPlayer->getMyCash();
actionDoneData.highestSet = server.GetGame().getCurrentHand()->getCurrentBeRo()->getHighestSet();
static_cast<NetPacketPlayersActionDone *>(notifySmallBlind.get())->SetData(actionDoneData); static_cast<NetPacketPlayersActionDone *>(notifySmallBlind.get())->SetData(actionDoneData);
server.SendToAllPlayers(notifySmallBlind, SessionData::Game); server.SendToAllPlayers(notifySmallBlind, SessionData::Game);
break; break;
@@ -507,6 +509,7 @@ ServerGameStateStartHand::Process(ServerGameThread &server)
actionDoneData.playerAction = (PlayerAction)tmpPlayer->getMyAction(); actionDoneData.playerAction = (PlayerAction)tmpPlayer->getMyAction();
actionDoneData.totalPlayerBet = tmpPlayer->getMySet(); actionDoneData.totalPlayerBet = tmpPlayer->getMySet();
actionDoneData.playerMoney = tmpPlayer->getMyCash(); actionDoneData.playerMoney = tmpPlayer->getMyCash();
actionDoneData.highestSet = server.GetGame().getCurrentHand()->getCurrentBeRo()->getHighestSet();
static_cast<NetPacketPlayersActionDone *>(notifyBigBlind.get())->SetData(actionDoneData); static_cast<NetPacketPlayersActionDone *>(notifyBigBlind.get())->SetData(actionDoneData);
server.SendToAllPlayers(notifyBigBlind, SessionData::Game); server.SendToAllPlayers(notifyBigBlind, SessionData::Game);
break; break;
+1
View File
@@ -795,6 +795,7 @@ public:
PlayerAction playerAction; PlayerAction playerAction;
u_int32_t totalPlayerBet; u_int32_t totalPlayerBet;
u_int32_t playerMoney; u_int32_t playerMoney;
u_int32_t highestSet;
}; };
NetPacketPlayersActionDone(); NetPacketPlayersActionDone();
+4 -3
View File
@@ -68,6 +68,10 @@ public:
bool IsRunning() const; bool IsRunning() const;
// should be protected, but is needed in function.
const Game &GetGame() const;
Game &GetGame();
protected: protected:
typedef std::deque<SessionWrapper> SessionQueue; typedef std::deque<SessionWrapper> SessionQueue;
@@ -100,9 +104,6 @@ protected:
SenderThread &GetSender(); SenderThread &GetSender();
ReceiverHelper &GetReceiver(); ReceiverHelper &GetReceiver();
Game &GetGame();
const Game &GetGame() const;
const StartData &GetStartData() const; const StartData &GetStartData() const;
void SetStartData(const StartData &startData); void SetStartData(const StartData &startData);