Fixed running more than the first hand in network games.

This commit is contained in:
lotodore
2007-05-27 13:24:52 +00:00
parent 5325897122
commit 1232017e3a
3 changed files with 80 additions and 78 deletions
@@ -48,19 +48,11 @@ ClientBoard::setHand(HandInterface* br)
void void
ClientBoard::collectSets() ClientBoard::collectSets()
{ {
sets = 0;
int i;
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) sets += playerArray[i]->getMySet();
} }
void void
ClientBoard::collectPot() ClientBoard::collectPot()
{ {
int i;
pot += sets;
sets = 0;
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++){ playerArray[i]->setMySetNull(); }
} }
+13 -3
View File
@@ -620,10 +620,8 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
int action = curGame->getPlayerArray()[i]->getMyAction(); int action = curGame->getPlayerArray()[i]->getMyAction();
if (action != 1 && action != 6) if (action != 1 && action != 6)
curGame->getPlayerArray()[i]->setMyAction(0); curGame->getPlayerArray()[i]->setMyAction(0);
curGame->getPlayerArray()[i]->setMySetNull();
} }
// Move sets to pot
curGame->getCurrentHand()->getBoard()->collectSets();
curGame->getCurrentHand()->getBoard()->collectPot();
client.GetGui().refreshPot(); client.GetGui().refreshPot();
client.GetGui().refreshSet(); client.GetGui().refreshSet();
@@ -691,6 +689,12 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
// TODO use moneyWon // TODO use moneyWon
client.GetGui().postRiverRunAnimation1(); client.GetGui().postRiverRunAnimation1();
// Reset player actions
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
{
curGame->getPlayerArray()[i]->setMyAction(0);
curGame->getPlayerArray()[i]->setMySetNull();
}
// Wait for next Hand. // Wait for next Hand.
client.SetState(ClientStateWaitHand::Instance()); client.SetState(ClientStateWaitHand::Instance());
retVal = MSG_NET_GAME_SERVER_HAND_END; retVal = MSG_NET_GAME_SERVER_HAND_END;
@@ -728,6 +732,12 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
client.GetGame()->getCurrentHand()->getRiver()->setHighestCardsValue(highestValueOfCards); client.GetGame()->getCurrentHand()->getRiver()->setHighestCardsValue(highestValueOfCards);
client.GetGui().postRiverRunAnimation1(); client.GetGui().postRiverRunAnimation1();
// Reset player sets
for (int i = 0; i < MAX_NUMBER_OF_PLAYERS; i++)
{
curGame->getPlayerArray()[i]->setMyAction(0);
curGame->getPlayerArray()[i]->setMySetNull();
}
// Wait for next Hand. // Wait for next Hand.
client.SetState(ClientStateWaitHand::Instance()); client.SetState(ClientStateWaitHand::Instance());
retVal = MSG_NET_GAME_SERVER_HAND_END; retVal = MSG_NET_GAME_SERVER_HAND_END;
+1 -1
View File
@@ -33,7 +33,7 @@
using namespace std; using namespace std;
#define SERVER_WAIT_TIMEOUT_MSEC 50 #define SERVER_WAIT_TIMEOUT_MSEC 50
#define SERVER_NEXT_HAND_DELAY_SEC 5 #define SERVER_NEXT_HAND_DELAY_SEC 10
ServerRecvState::~ServerRecvState() ServerRecvState::~ServerRecvState()