Automatic action when for player timeout. First try, not finished yet.
This commit is contained in:
@@ -89,6 +89,7 @@ void ServerGuiWrapper::flipHolecardsAllIn() {}
|
||||
void ServerGuiWrapper::nextRoundCleanGui() {}
|
||||
|
||||
void ServerGuiWrapper::meInAction() {}
|
||||
void ServerGuiWrapper::disableMyButtons() {}
|
||||
void ServerGuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) {}
|
||||
void ServerGuiWrapper::stopTimeoutAnimation(int playerId) {}
|
||||
|
||||
|
||||
@@ -73,8 +73,9 @@ public:
|
||||
void nextRoundCleanGui();
|
||||
|
||||
void meInAction();
|
||||
void startTimeoutAnimation(int playerId, int timeoutSec);
|
||||
void stopTimeoutAnimation(int playerId);
|
||||
void disableMyButtons();
|
||||
void startTimeoutAnimation(int playerId, int timeoutSec);
|
||||
void stopTimeoutAnimation(int playerId);
|
||||
|
||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||
void logNewGameHandMsg(int gameID, int handID) ;
|
||||
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
// virtual void userWidgetsBackgroudColor() const=0;
|
||||
// virtual void timerBlockerFalse() const=0;
|
||||
virtual void meInAction()=0;
|
||||
virtual void disableMyButtons()=0;
|
||||
virtual void startTimeoutAnimation(int playerId, int timeoutSec) =0;
|
||||
virtual void stopTimeoutAnimation(int playerId) =0;
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
|
||||
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
|
||||
|
||||
void GuiWrapper::meInAction() { myW->signalMeInAction(); }
|
||||
void GuiWrapper::disableMyButtons() { myW->signalDisableMyButtons(); }
|
||||
void GuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) { myW->signalStartTimeoutAnimation(playerId, timeoutSec); }
|
||||
void GuiWrapper::stopTimeoutAnimation(int playerId) { myW->signalStopTimeoutAnimation(playerId); }
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
void nextRoundCleanGui();
|
||||
|
||||
void meInAction();
|
||||
void disableMyButtons();
|
||||
void startTimeoutAnimation(int playerId, int timeoutSec);
|
||||
void stopTimeoutAnimation(int playerId);
|
||||
|
||||
|
||||
@@ -585,6 +585,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
connect(this, SIGNAL(signalRefreshGameLabels(int)), this, SLOT(refreshGameLabels(int)));
|
||||
|
||||
connect(this, SIGNAL(signalMeInAction()), this, SLOT(meInAction()));
|
||||
connect(this, SIGNAL(signalDisableMyButtons()), this, SLOT(disableMyButtons()));
|
||||
connect(this, SIGNAL(signalStartTimeoutAnimation(int, int)), this, SLOT(startTimeoutAnimation(int, int)));
|
||||
connect(this, SIGNAL(signalStopTimeoutAnimation(int)), this, SLOT(stopTimeoutAnimation(int)));
|
||||
|
||||
@@ -1551,7 +1552,6 @@ void mainWindowImpl::myFold(){
|
||||
|
||||
holeCardsArray[0][0]->startFadeOut(10);
|
||||
holeCardsArray[0][1]->startFadeOut(10);
|
||||
disableMyButtons();
|
||||
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
currentHand->setLastPlayersTurn(0);
|
||||
@@ -1568,8 +1568,6 @@ void mainWindowImpl::myCheck() {
|
||||
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
||||
currentHand->getPlayerArray()[0]->setMyAction(2);
|
||||
|
||||
disableMyButtons();
|
||||
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
currentHand->setLastPlayersTurn(0);
|
||||
|
||||
@@ -1611,8 +1609,6 @@ void mainWindowImpl::myCall(){
|
||||
currentHand->getBoard()->collectSets();
|
||||
refreshPot();
|
||||
|
||||
disableMyButtons();
|
||||
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
currentHand->setLastPlayersTurn(0);
|
||||
|
||||
@@ -1723,8 +1719,6 @@ void mainWindowImpl::mySet(){
|
||||
currentHand->getBoard()->collectSets();
|
||||
refreshPot();
|
||||
|
||||
disableMyButtons();
|
||||
|
||||
statusBar()->clearMessage();
|
||||
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
@@ -1760,8 +1754,6 @@ void mainWindowImpl::myAllIn(){
|
||||
currentHand->getBoard()->collectSets();
|
||||
refreshPot();
|
||||
|
||||
disableMyButtons();
|
||||
|
||||
statusBar()->clearMessage();
|
||||
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
@@ -1777,6 +1769,9 @@ void mainWindowImpl::myActionDone() {
|
||||
// to transfer the action to the server.
|
||||
mySession->sendClientPlayerAction();
|
||||
|
||||
// TODO: Should not call in networking game.
|
||||
disableMyButtons();
|
||||
|
||||
nextPlayerAnimation();
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ signals:
|
||||
void signalRefreshGameLabels(int);
|
||||
|
||||
void signalMeInAction();
|
||||
void signalDisableMyButtons();
|
||||
void signalStartTimeoutAnimation(int playerId, int timeoutSec);
|
||||
void signalStopTimeoutAnimation(int playerId);
|
||||
|
||||
@@ -145,6 +146,8 @@ public slots:
|
||||
//Spieler-Funktionen
|
||||
void meInAction();
|
||||
void disableMyButtons();
|
||||
void startTimeoutAnimation(int playerId, int timoutSec);
|
||||
void stopTimeoutAnimation(int playerId);
|
||||
|
||||
void setGameSpeed(const int theValue) { guiGameSpeed = theValue; setSpeeds(); } // Achtung Faktor 10!!!
|
||||
|
||||
@@ -154,9 +157,6 @@ public slots:
|
||||
void callCreateNetworkGameDialog();
|
||||
void callJoinNetworkGameDialog();
|
||||
|
||||
void startTimeoutAnimation(int playerId, int timoutSec);
|
||||
void stopTimeoutAnimation(int playerId);
|
||||
|
||||
void myBetRaise();
|
||||
void myFoldAllin();
|
||||
void myCallCheckSet();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user