Preparing network protocol for rejoin.

This commit is contained in:
lotodore
2011-07-16 14:52:45 +00:00
parent 711091bcd9
commit e109c0037d
303 changed files with 8477 additions and 7528 deletions
+7 -3
View File
@@ -1485,13 +1485,17 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
GameStartMessage_t *netGameStart = &tmpPacket->GetMsg()->choice.gameStartMessage;
StartData startData;
startData.numberOfPlayers = netGameStart->playerSeats.list.count;
startData.startDealerPlayerId = netGameStart->startDealerPlayerId;
if (netGameStart->gameStartMode.present != gameStartMode_PR_gameStartModeInitial)
throw ClientException(__FILE__, __LINE__, ERR_NET_INTERNAL_GAME_ERROR, 0);
GameStartModeInitial_t *netStartModeInitial = &netGameStart->gameStartMode.choice.gameStartModeInitial;
startData.numberOfPlayers = netStartModeInitial->playerSeats.list.count;
client->SetStartData(startData);
// Set player numbers using the game start data slots.
NonZeroId_t **playerIds = netGameStart->playerSeats.list.array;
unsigned numPlayers = netGameStart->playerSeats.list.count;
NonZeroId_t **playerIds = netStartModeInitial->playerSeats.list.array;
unsigned numPlayers = netStartModeInitial->playerSeats.list.count;
// Request player info for players if needed.
if (numPlayers && playerIds && *playerIds) {
for (unsigned i = 0; i < numPlayers; i++) {
+3 -1
View File
@@ -721,6 +721,8 @@ ServerGameStateStartGame::DoStart(boost::shared_ptr<ServerGame> server)
GameStartMessage_t *netGameStart = &packet->GetMsg()->choice.gameStartMessage;
netGameStart->gameId = server->GetId();
netGameStart->startDealerPlayerId = server->GetStartData().startDealerPlayerId;
netGameStart->gameStartMode.present = gameStartMode_PR_gameStartModeInitial;
GameStartModeInitial_t *netStartModeInitial = &netGameStart->gameStartMode.choice.gameStartModeInitial;
// Send player order to clients.
// Assume player list is sorted by number.
@@ -729,7 +731,7 @@ ServerGameStateStartGame::DoStart(boost::shared_ptr<ServerGame> server)
while (player_i != player_end) {
NonZeroId_t *playerSlot = (NonZeroId_t *)calloc(1, sizeof(NonZeroId_t));
*playerSlot = (*player_i)->GetUniqueId();
ASN_SEQUENCE_ADD(&netGameStart->playerSeats.list, playerSlot);
ASN_SEQUENCE_ADD(&netStartModeInitial->playerSeats.list, playerSlot);
++player_i;
}