Rejoin now works, but yet only as spectator.

This commit is contained in:
lotodore
2011-10-03 09:53:50 +00:00
parent 7bda27d793
commit 828fc6bfac
2 changed files with 8 additions and 2 deletions
+3
View File
@@ -1495,6 +1495,7 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_gameStartMessage) { if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_gameStartMessage) {
// Start the network game as client. // Start the network game as client.
GameStartMessage_t *netGameStart = &tmpPacket->GetMsg()->choice.gameStartMessage; GameStartMessage_t *netGameStart = &tmpPacket->GetMsg()->choice.gameStartMessage;
unsigned tmpHandId = 0;
StartData startData; StartData startData;
startData.startDealerPlayerId = netGameStart->startDealerPlayerId; startData.startDealerPlayerId = netGameStart->startDealerPlayerId;
@@ -1525,6 +1526,7 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
// Set player numbers using the game start data slots. // Set player numbers using the game start data slots.
RejoinPlayerData_t **playerInfos = netStartModeRejoin->rejoinPlayerData.list.array; RejoinPlayerData_t **playerInfos = netStartModeRejoin->rejoinPlayerData.list.array;
unsigned numPlayers = netStartModeRejoin->rejoinPlayerData.list.count; unsigned numPlayers = netStartModeRejoin->rejoinPlayerData.list.count;
tmpHandId = netStartModeRejoin->handNum;
// Request player info for players if needed. // Request player info for players if needed.
if (numPlayers && playerInfos && *playerInfos) { if (numPlayers && playerInfos && *playerInfos) {
for (unsigned i = 0; i < numPlayers; i++) { for (unsigned i = 0; i < numPlayers; i++) {
@@ -1541,6 +1543,7 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
throw ClientException(__FILE__, __LINE__, ERR_NET_INTERNAL_GAME_ERROR, 0); throw ClientException(__FILE__, __LINE__, ERR_NET_INTERNAL_GAME_ERROR, 0);
} }
client->InitGame(); client->InitGame();
client->GetGame()->setCurrentHandID(tmpHandId);
client->GetCallback().SignalNetClientGameInfo(MSG_NET_GAME_CLIENT_START); client->GetCallback().SignalNetClientGameInfo(MSG_NET_GAME_CLIENT_START);
client->SetState(ClientStateWaitHand::Instance()); client->SetState(ClientStateWaitHand::Instance());
} }
+5 -2
View File
@@ -1133,9 +1133,8 @@ ServerGameStateHand::GetDealCardsDelaySec(ServerGame &server)
void void
ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server) ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
{ {
// Initialize hand.
Game &curGame = server->GetGame(); Game &curGame = server->GetGame();
curGame.initHand();
// Initialize rejoining players. // Initialize rejoining players.
{ {
PlayerIdList rejoinIdList(server->GetAndResetRejoinPlayers()); PlayerIdList rejoinIdList(server->GetAndResetRejoinPlayers());
@@ -1158,6 +1157,7 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
GameStartModeRejoin_t *netStartModeRejoin = &netGameStart->gameStartMode.choice.gameStartModeRejoin; GameStartModeRejoin_t *netStartModeRejoin = &netGameStart->gameStartMode.choice.gameStartModeRejoin;
// Send player data to client. // Send player data to client.
netStartModeRejoin->handNum = curGame.getCurrentHandID();
PlayerListIterator player_i = curGame.getSeatsList()->begin(); PlayerListIterator player_i = curGame.getSeatsList()->begin();
PlayerListIterator player_end = curGame.getSeatsList()->end(); PlayerListIterator player_end = curGame.getSeatsList()->end();
while (player_i != player_end) { while (player_i != player_end) {
@@ -1178,6 +1178,9 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
} }
} }
// Initialize hand.
curGame.initHand();
// HACK: Skip GUI notification run // HACK: Skip GUI notification run
curGame.getCurrentHand()->getFlop()->skipFirstRunGui(); curGame.getCurrentHand()->getFlop()->skipFirstRunGui();
curGame.getCurrentHand()->getTurn()->skipFirstRunGui(); curGame.getCurrentHand()->getTurn()->skipFirstRunGui();