Resetting cards value on client side each hand. Added GUI synchronization function. Fixed update of pot when all but one fold. Reset sets on end of hand.

This commit is contained in:
lotodore
2007-06-10 12:46:29 +00:00
parent 6c9e6a6a28
commit b624714f5d
9 changed files with 58 additions and 11 deletions
+23 -6
View File
@@ -757,6 +757,15 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
}
else if (packet->ToNetPacketEndOfHandHideCards())
{
curGame->getCurrentHand()->getBoard()->collectPot();
// Reset player sets
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
curGame->getPlayerArray()[i]->setMySetNull();
client.GetGui().refreshPot();
client.GetGui().refreshSet();
// Synchronize with GUI.
client.GetGui().waitForGuiUpdateDone();
// End of Hand, but keep cards hidden.
NetPacketEndOfHandHideCards::Data endHandData;
packet->ToNetPacketEndOfHandHideCards()->GetData(endHandData);
@@ -768,17 +777,24 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
tmpPlayer->setMyCash(endHandData.playerMoney);
// TODO use moneyWon
curGame->getCurrentHand()->getBoard()->setPot(0);
client.GetGui().postRiverRunAnimation1();
// Reset player actions
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
curGame->getPlayerArray()[i]->setMySetNull();
// Wait for next Hand.
client.SetState(ClientStateWaitHand::Instance());
retVal = MSG_NET_GAME_SERVER_HAND_END;
}
else if (packet->ToNetPacketEndOfHandShowCards())
{
curGame->getCurrentHand()->getBoard()->collectPot();
// Reset player sets
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
curGame->getPlayerArray()[i]->setMySetNull();
client.GetGui().refreshPot();
client.GetGui().refreshSet();
// Synchronize with GUI.
client.GetGui().waitForGuiUpdateDone();
// End of Hand, show cards.
NetPacketEndOfHandShowCards::Data endHandData;
packet->ToNetPacketEndOfHandShowCards()->GetData(endHandData);
@@ -810,17 +826,18 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
}
curGame->getCurrentHand()->getRiver()->setHighestCardsValue(highestValueOfCards);
curGame->getCurrentHand()->getBoard()->setPot(0);
client.GetGui().postRiverRunAnimation1();
// Reset player sets
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
curGame->getPlayerArray()[i]->setMySetNull();
// Wait for next Hand.
client.SetState(ClientStateWaitHand::Instance());
retVal = MSG_NET_GAME_SERVER_HAND_END;
}
}
// Synchronize with GUI.
client.GetGui().waitForGuiUpdateDone();
return retVal;
}