Fixing game list update. Joining players still broken.
This commit is contained in:
@@ -819,29 +819,26 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
|
|||||||
NonZeroId_t **playerIds = netListNew->playerIds.list.array;
|
NonZeroId_t **playerIds = netListNew->playerIds.list.array;
|
||||||
unsigned numPlayers = netListNew->playerIds.list.count;
|
unsigned numPlayers = netListNew->playerIds.list.count;
|
||||||
// Request player info for players if needed.
|
// Request player info for players if needed.
|
||||||
if (numPlayers && playerIds && *playerIds)
|
GameInfo tmpInfo;
|
||||||
|
for (unsigned i = 0; i < numPlayers; i++)
|
||||||
{
|
{
|
||||||
GameInfo tmpInfo;
|
PlayerInfo info;
|
||||||
for (unsigned i = 0; i < numPlayers; i++)
|
unsigned playerId = *playerIds[i];
|
||||||
|
if (!client->GetCachedPlayerInfo(playerId, info))
|
||||||
{
|
{
|
||||||
PlayerInfo info;
|
// Request player info.
|
||||||
unsigned playerId = *playerIds[i];
|
client->RequestPlayerInfo(playerId);
|
||||||
if (!client->GetCachedPlayerInfo(playerId, info))
|
|
||||||
{
|
|
||||||
// Request player info.
|
|
||||||
client->RequestPlayerInfo(playerId);
|
|
||||||
}
|
|
||||||
tmpInfo.players.push_back(playerId);
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
tmpInfo.adminPlayerId = netListNew->adminPlayerId;
|
tmpInfo.players.push_back(playerId);
|
||||||
tmpInfo.isPasswordProtected = netListNew->isPrivate ? true : false;
|
++i;
|
||||||
tmpInfo.mode = GAME_MODE_CREATED;
|
|
||||||
tmpInfo.name = STL_STRING_FROM_OCTET_STRING(netListNew->gameInfo.gameName);
|
|
||||||
NetPacket::GetGameData(&netListNew->gameInfo, tmpInfo.data);
|
|
||||||
|
|
||||||
client->AddGameInfo(gameId, tmpInfo);
|
|
||||||
}
|
}
|
||||||
|
tmpInfo.adminPlayerId = netListNew->adminPlayerId;
|
||||||
|
tmpInfo.isPasswordProtected = netListNew->isPrivate ? true : false;
|
||||||
|
tmpInfo.mode = GAME_MODE_CREATED;
|
||||||
|
tmpInfo.name = STL_STRING_FROM_OCTET_STRING(netListNew->gameInfo.gameName);
|
||||||
|
NetPacket::GetGameData(&netListNew->gameInfo, tmpInfo.data);
|
||||||
|
|
||||||
|
client->AddGameInfo(gameId, tmpInfo);
|
||||||
}
|
}
|
||||||
else if (netGameList->gameListNotification.present == gameListNotification_PR_gameListUpdate)
|
else if (netGameList->gameListNotification.present == gameListNotification_PR_gameListUpdate)
|
||||||
{
|
{
|
||||||
@@ -1593,22 +1590,19 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
PlayerAllIn_t **allInPlayers = netAllInShow->playersAllIn.list.array;
|
PlayerAllIn_t **allInPlayers = netAllInShow->playersAllIn.list.array;
|
||||||
unsigned numPlayers = netAllInShow->playersAllIn.list.count;
|
unsigned numPlayers = netAllInShow->playersAllIn.list.count;
|
||||||
// Request player info for players if needed.
|
// Request player info for players if needed.
|
||||||
if (numPlayers && allInPlayers && *allInPlayers)
|
for (unsigned i = 0; i < numPlayers; i++)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < numPlayers; i++)
|
PlayerAllIn_t *p = allInPlayers[i];
|
||||||
{
|
|
||||||
PlayerAllIn_t *p = allInPlayers[i];
|
|
||||||
|
|
||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(p->playerId);
|
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(p->playerId);
|
||||||
if (!tmpPlayer)
|
if (!tmpPlayer)
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||||
|
|
||||||
int tmpCards[2];
|
int tmpCards[2];
|
||||||
tmpCards[0] = static_cast<int>(p->allInCard1);
|
tmpCards[0] = static_cast<int>(p->allInCard1);
|
||||||
tmpCards[1] = static_cast<int>(p->allInCard2);
|
tmpCards[1] = static_cast<int>(p->allInCard2);
|
||||||
tmpPlayer->setMyCards(tmpCards);
|
tmpPlayer->setMyCards(tmpCards);
|
||||||
++i;
|
++i;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
client->GetGui().flipHolecardsAllIn();
|
client->GetGui().flipHolecardsAllIn();
|
||||||
}
|
}
|
||||||
@@ -1664,32 +1658,29 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
PlayerResult_t **playerResults = showCards->playerResults.list.array;
|
PlayerResult_t **playerResults = showCards->playerResults.list.array;
|
||||||
unsigned numResults = showCards->playerResults.list.count;
|
unsigned numResults = showCards->playerResults.list.count;
|
||||||
// Request player info for players if needed.
|
// Request player info for players if needed.
|
||||||
if (numResults && playerResults && *playerResults)
|
for (unsigned i = 0; i < numResults; i++)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < numResults; i++)
|
PlayerResult_t *r = playerResults[i];
|
||||||
{
|
|
||||||
PlayerResult_t *r = playerResults[i];
|
|
||||||
|
|
||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(r->playerId);
|
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(r->playerId);
|
||||||
if (!tmpPlayer)
|
if (!tmpPlayer)
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||||
|
|
||||||
int tmpCards[2];
|
int tmpCards[2];
|
||||||
int bestHandPos[5];
|
int bestHandPos[5];
|
||||||
tmpCards[0] = static_cast<int>(r->resultCard1);
|
tmpCards[0] = static_cast<int>(r->resultCard1);
|
||||||
tmpCards[1] = static_cast<int>(r->resultCard2);
|
tmpCards[1] = static_cast<int>(r->resultCard2);
|
||||||
tmpPlayer->setMyCards(tmpCards);
|
tmpPlayer->setMyCards(tmpCards);
|
||||||
for (int num = 0; num < 5; num++)
|
for (int num = 0; num < 5; num++)
|
||||||
bestHandPos[num] = *r->bestHandPosition.list.array[num];
|
bestHandPos[num] = *r->bestHandPosition.list.array[num];
|
||||||
tmpPlayer->setMyCardsValueInt(r->cardsValue);
|
tmpPlayer->setMyCardsValueInt(r->cardsValue);
|
||||||
tmpPlayer->setMyBestHandPosition(bestHandPos);
|
tmpPlayer->setMyBestHandPosition(bestHandPos);
|
||||||
if (tmpPlayer->getMyCardsValueInt() > highestValueOfCards)
|
if (tmpPlayer->getMyCardsValueInt() > highestValueOfCards)
|
||||||
highestValueOfCards = tmpPlayer->getMyCardsValueInt();
|
highestValueOfCards = tmpPlayer->getMyCardsValueInt();
|
||||||
tmpPlayer->setMyCash(r->playerMoney);
|
tmpPlayer->setMyCash(r->playerMoney);
|
||||||
tmpPlayer->setLastMoneyWon(r->moneyWon);
|
tmpPlayer->setLastMoneyWon(r->moneyWon);
|
||||||
if (r->moneyWon)
|
if (r->moneyWon)
|
||||||
winnerList.push_back(r->playerId);
|
winnerList.push_back(r->playerId);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
curGame->getCurrentHand()->getCurrentBeRo()->setHighestCardsValue(highestValueOfCards);
|
curGame->getCurrentHand()->getCurrentBeRo()->setHighestCardsValue(highestValueOfCards);
|
||||||
|
|||||||
Reference in New Issue
Block a user