Automatic action when for player timeout. First try, not finished yet.

This commit is contained in:
lotodore
2007-06-08 22:14:05 +00:00
parent 1d838fcc07
commit db4aea3f78
9 changed files with 25 additions and 14 deletions
+2
View File
@@ -638,6 +638,8 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
client.GetGui().refreshGroupbox(tmpPlayer->getMyID(), 3);
// Refresh GUI
if (tmpPlayer->getMyID() == 0)
client.GetGui().disableMyButtons();
client.GetGui().refreshPot();
client.GetGui().refreshSet();
client.GetGui().refreshAction();
+9
View File
@@ -39,6 +39,7 @@ using namespace std;
#define SERVER_DEAL_RIVER_CARD_DELAY_SEC 2
#define SERVER_DEAL_ADD_ALL_IN_DELAY_SEC 1
#define SERVER_SHOW_CARDS_DELAY_SEC 2
#define SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC 2
// Helper functions
// TODO: these are hacks.
@@ -728,6 +729,14 @@ ServerRecvStateWaitPlayerAction::Process(ServerRecvThread &server)
server.SetState(ServerRecvStateStartRound::Instance());
retVal = MSG_NET_GAME_SERVER_ACTION;
}
else if (GetTimer().elapsed().seconds() >= server.GetGameData().playerActionTimeoutSec + SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC)
{
// Player did not act fast enough. Act for him.
PerformPlayerAction(server, tmpPlayer, PLAYER_ACTION_FOLD, 0);
server.SetState(ServerRecvStateStartRound::Instance());
retVal = MSG_NET_GAME_SERVER_ACTION;
}
else
retVal = ServerRecvStateReceiving::Process(server);