Client engine should now be completely thread safe. const int& -> int. Player CardsValue is now returned as copy, not the array itself.
This commit is contained in:
@@ -818,12 +818,14 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
||||
throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||
|
||||
int tmpCards[2];
|
||||
int bestHandPos[5];
|
||||
tmpCards[0] = static_cast<int>((*i).cards[0]);
|
||||
tmpCards[1] = static_cast<int>((*i).cards[1]);
|
||||
tmpPlayer->setMyCards(tmpCards);
|
||||
for (int num = 0; num < 5; num++)
|
||||
tmpPlayer->getMyBestHandPosition()[num] = (*i).bestHandPos[num];
|
||||
bestHandPos[num] = (*i).bestHandPos[num];
|
||||
tmpPlayer->setMyCardsValueInt((*i).valueOfCards);
|
||||
tmpPlayer->setMyBestHandPosition(bestHandPos);
|
||||
if (tmpPlayer->getMyCardsValueInt() > highestValueOfCards)
|
||||
highestValueOfCards = tmpPlayer->getMyCardsValueInt();
|
||||
tmpPlayer->setMyCash((*i).playerMoney);
|
||||
|
||||
@@ -618,12 +618,14 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
||||
tmpPlayerResult.playerId = (*i)->getMyUniqueID();
|
||||
|
||||
int tmpCards[2];
|
||||
int bestHandPos[5];
|
||||
(*i)->getMyCards(tmpCards);
|
||||
tmpPlayerResult.cards[0] = static_cast<u_int16_t>(tmpCards[0]);
|
||||
tmpPlayerResult.cards[1] = static_cast<u_int16_t>(tmpCards[1]);
|
||||
|
||||
(*i)->getMyBestHandPosition(bestHandPos);
|
||||
for (int num = 0; num < 5; num++)
|
||||
tmpPlayerResult.bestHandPos[num] = (*i)->getMyBestHandPosition()[num];
|
||||
tmpPlayerResult.bestHandPos[num] = bestHandPos[num];
|
||||
|
||||
tmpPlayerResult.valueOfCards = (*i)->getMyCardsValueInt();
|
||||
tmpPlayerResult.moneyWon = 0; // TODO
|
||||
|
||||
Reference in New Issue
Block a user