Player action timeout - display is working, function still missing.
This commit is contained in:
@@ -55,7 +55,7 @@ Server Reply: Join Game ACK
|
|||||||
0 1 2 3
|
0 1 2 3
|
||||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Message Type = 2 | Message Length = 12 |
|
| Message Type = 2 | Message Length = 28 |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Your Session ID |
|
| Your Session ID |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
@@ -65,6 +65,8 @@ Server Reply: Join Game ACK
|
|||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Hands before raise | Proposed GUI Speed |
|
| Hands before raise | Proposed GUI Speed |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Player Action Timeout | Reserved |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Start Money |
|
| Start Money |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
@@ -74,6 +76,8 @@ Player ID:
|
|||||||
Unique Player ID
|
Unique Player ID
|
||||||
Proposed GUI Speed:
|
Proposed GUI Speed:
|
||||||
1-11
|
1-11
|
||||||
|
Player Action Timeout:
|
||||||
|
# seconds
|
||||||
|
|
||||||
|
|
||||||
Server Notification: Player Joined
|
Server Notification: Player Joined
|
||||||
|
|||||||
+2
-1
@@ -26,12 +26,13 @@
|
|||||||
struct GameData
|
struct GameData
|
||||||
{
|
{
|
||||||
GameData() : numberOfPlayers(0), startMoney(0), smallBlind(0),
|
GameData() : numberOfPlayers(0), startMoney(0), smallBlind(0),
|
||||||
handsBeforeRaise(1), guiSpeed(4) {}
|
handsBeforeRaise(1), guiSpeed(4), playerActionTimeoutSec(20) {}
|
||||||
int numberOfPlayers;
|
int numberOfPlayers;
|
||||||
int startMoney;
|
int startMoney;
|
||||||
int smallBlind;
|
int smallBlind;
|
||||||
int handsBeforeRaise;
|
int handsBeforeRaise;
|
||||||
int guiSpeed;
|
int guiSpeed;
|
||||||
|
int playerActionTimeoutSec;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StartData
|
struct StartData
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ void ServerGuiWrapper::flipHolecardsAllIn() {}
|
|||||||
void ServerGuiWrapper::nextRoundCleanGui() {}
|
void ServerGuiWrapper::nextRoundCleanGui() {}
|
||||||
|
|
||||||
void ServerGuiWrapper::meInAction() {}
|
void ServerGuiWrapper::meInAction() {}
|
||||||
|
void ServerGuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) {}
|
||||||
|
void ServerGuiWrapper::stopTimeoutAnimation(int playerId) {}
|
||||||
|
|
||||||
void ServerGuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) {}
|
void ServerGuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) {}
|
||||||
void ServerGuiWrapper::logNewGameHandMsg(int gameID, int handID) {}
|
void ServerGuiWrapper::logNewGameHandMsg(int gameID, int handID) {}
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public:
|
|||||||
void nextRoundCleanGui();
|
void nextRoundCleanGui();
|
||||||
|
|
||||||
void meInAction();
|
void meInAction();
|
||||||
|
void startTimeoutAnimation(int playerId, int timeoutSec);
|
||||||
|
void stopTimeoutAnimation(int playerId);
|
||||||
|
|
||||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||||
void logNewGameHandMsg(int gameID, int handID) ;
|
void logNewGameHandMsg(int gameID, int handID) ;
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ public:
|
|||||||
// virtual void userWidgetsBackgroudColor() const=0;
|
// virtual void userWidgetsBackgroudColor() const=0;
|
||||||
// virtual void timerBlockerFalse() const=0;
|
// virtual void timerBlockerFalse() const=0;
|
||||||
virtual void meInAction()=0;
|
virtual void meInAction()=0;
|
||||||
|
virtual void startTimeoutAnimation(int playerId, int timeoutSec) =0;
|
||||||
|
virtual void stopTimeoutAnimation(int playerId) =0;
|
||||||
|
|
||||||
//log.cpp
|
//log.cpp
|
||||||
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
|
|||||||
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
|
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
|
||||||
|
|
||||||
void GuiWrapper::meInAction() { myW->signalMeInAction(); }
|
void GuiWrapper::meInAction() { myW->signalMeInAction(); }
|
||||||
|
void GuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) { myW->signalStartTimeoutAnimation(playerId, timeoutSec); }
|
||||||
|
void GuiWrapper::stopTimeoutAnimation(int playerId) { myW->signalStopTimeoutAnimation(playerId); }
|
||||||
|
|
||||||
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
||||||
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ public:
|
|||||||
void nextRoundCleanGui();
|
void nextRoundCleanGui();
|
||||||
|
|
||||||
void meInAction();
|
void meInAction();
|
||||||
|
void startTimeoutAnimation(int playerId, int timeoutSec);
|
||||||
|
void stopTimeoutAnimation(int playerId);
|
||||||
|
|
||||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||||
void logNewGameHandMsg(int gameID, int handID) ;
|
void logNewGameHandMsg(int gameID, int handID) ;
|
||||||
|
|||||||
@@ -585,6 +585,8 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
connect(this, SIGNAL(signalRefreshGameLabels(int)), this, SLOT(refreshGameLabels(int)));
|
connect(this, SIGNAL(signalRefreshGameLabels(int)), this, SLOT(refreshGameLabels(int)));
|
||||||
|
|
||||||
connect(this, SIGNAL(signalMeInAction()), this, SLOT(meInAction()));
|
connect(this, SIGNAL(signalMeInAction()), this, SLOT(meInAction()));
|
||||||
|
connect(this, SIGNAL(signalStartTimeoutAnimation(int, int)), this, SLOT(startTimeoutAnimation(int, int)));
|
||||||
|
connect(this, SIGNAL(signalStopTimeoutAnimation(int)), this, SLOT(stopTimeoutAnimation(int)));
|
||||||
|
|
||||||
connect(this, SIGNAL(signalDealHoleCards()), this, SLOT(dealHoleCards()));
|
connect(this, SIGNAL(signalDealHoleCards()), this, SLOT(dealHoleCards()));
|
||||||
connect(this, SIGNAL(signalDealFlopCards0()), this, SLOT(dealFlopCards0()));
|
connect(this, SIGNAL(signalDealFlopCards0()), this, SLOT(dealFlopCards0()));
|
||||||
@@ -719,6 +721,7 @@ void mainWindowImpl::callCreateNetworkGameDialog() {
|
|||||||
//temporarely static until ai is enabled in network
|
//temporarely static until ai is enabled in network
|
||||||
// gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value();
|
// gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value();
|
||||||
gameData.guiSpeed = 4;
|
gameData.guiSpeed = 4;
|
||||||
|
gameData.playerActionTimeoutSec = myCreateNetworkGameDialog->spinBox_netTimeOutPlayerAction->value();
|
||||||
|
|
||||||
myStartNetworkGameDialog->setSession(&myServerGuiInterface->getSession());
|
myStartNetworkGameDialog->setSession(&myServerGuiInterface->getSession());
|
||||||
myStartNetworkGameDialog->treeWidget->clear();
|
myStartNetworkGameDialog->treeWidget->clear();
|
||||||
@@ -1500,6 +1503,16 @@ void mainWindowImpl::meInAction() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mainWindowImpl::startTimeoutAnimation(int playerId, int timeoutSec) {
|
||||||
|
assert(playerId >= 0 && playerId < mySession->getCurrentGame()->getStartQuantityPlayers());
|
||||||
|
setLabelArray[playerId]->startTimeOutAnimation(timeoutSec);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mainWindowImpl::stopTimeoutAnimation(int playerId) {
|
||||||
|
assert(playerId >= 0 && playerId < mySession->getCurrentGame()->getStartQuantityPlayers());
|
||||||
|
setLabelArray[playerId]->stopTimeOutAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
void mainWindowImpl::disableMyButtons() {
|
void mainWindowImpl::disableMyButtons() {
|
||||||
|
|
||||||
//clear userWidgets
|
//clear userWidgets
|
||||||
@@ -1758,15 +1771,6 @@ void mainWindowImpl::myAllIn(){
|
|||||||
myActionDone();
|
myActionDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::userActionTimeOutReached() {
|
|
||||||
|
|
||||||
//TODO
|
|
||||||
// automatic check, fold
|
|
||||||
cout << "timeoutaction" << endl;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mainWindowImpl::myActionDone() {
|
void mainWindowImpl::myActionDone() {
|
||||||
|
|
||||||
// If a network client is running, we need
|
// If a network client is running, we need
|
||||||
@@ -2514,8 +2518,6 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
|
|||||||
if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); }
|
if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); }
|
||||||
if (event->key() == Qt::Key_F10) { switchLeftToolBox(); }
|
if (event->key() == Qt::Key_F10) { switchLeftToolBox(); }
|
||||||
if (event->key() == Qt::Key_F11) { switchRightToolBox(); }
|
if (event->key() == Qt::Key_F11) { switchRightToolBox(); }
|
||||||
if (event->key() == Qt::Key_D) { setLabelArray[0]->startTimeOutAnimation(myConfig->readConfigInt("NetTimeOutPlayerAction")); } //f
|
|
||||||
if (event->key() == Qt::Key_E) { setLabelArray[0]->stopTimeOutAnimation(); } //f
|
|
||||||
// if (event->key() == Qt::Key_W) { qApp->quit(); } //s
|
// if (event->key() == Qt::Key_W) { qApp->quit(); } //s
|
||||||
if (event->key() == 16777249) {
|
if (event->key() == 16777249) {
|
||||||
pushButton_break->click();
|
pushButton_break->click();
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ signals:
|
|||||||
void signalRefreshGameLabels(int);
|
void signalRefreshGameLabels(int);
|
||||||
|
|
||||||
void signalMeInAction();
|
void signalMeInAction();
|
||||||
|
void signalStartTimeoutAnimation(int playerId, int timeoutSec);
|
||||||
|
void signalStopTimeoutAnimation(int playerId);
|
||||||
|
|
||||||
void signalDealHoleCards();
|
void signalDealHoleCards();
|
||||||
void signalDealFlopCards0();
|
void signalDealFlopCards0();
|
||||||
@@ -152,6 +154,9 @@ public slots:
|
|||||||
void callCreateNetworkGameDialog();
|
void callCreateNetworkGameDialog();
|
||||||
void callJoinNetworkGameDialog();
|
void callJoinNetworkGameDialog();
|
||||||
|
|
||||||
|
void startTimeoutAnimation(int playerId, int timoutSec);
|
||||||
|
void stopTimeoutAnimation(int playerId);
|
||||||
|
|
||||||
void myBetRaise();
|
void myBetRaise();
|
||||||
void myFoldAllin();
|
void myFoldAllin();
|
||||||
void myCallCheckSet();
|
void myCallCheckSet();
|
||||||
@@ -251,8 +256,6 @@ public slots:
|
|||||||
void localGameModification();
|
void localGameModification();
|
||||||
void networkGameModification();
|
void networkGameModification();
|
||||||
|
|
||||||
void userActionTimeOutReached();
|
|
||||||
|
|
||||||
void quitPokerTH();
|
void quitPokerTH();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ void MySetLabel::nextTimeOutAnimationFrame() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stopTimeOutAnimation();
|
stopTimeOutAnimation();
|
||||||
//callback
|
// no callback is called here.
|
||||||
myW->userActionTimeOutReached();
|
// the server initiates any action required.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -630,6 +630,9 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
if (tmpPlayer->getMySet() > GetHighestSet(*curGame))
|
if (tmpPlayer->getMySet() > GetHighestSet(*curGame))
|
||||||
SetHighestSet(*curGame, tmpPlayer->getMySet());
|
SetHighestSet(*curGame, tmpPlayer->getMySet());
|
||||||
|
|
||||||
|
// Stop the timeout for the player.
|
||||||
|
client.GetGui().stopTimeoutAnimation(tmpPlayer->getMyID());
|
||||||
|
|
||||||
// Unmark last player in GUI.
|
// Unmark last player in GUI.
|
||||||
client.GetGui().refreshGroupbox(tmpPlayer->getMyID(), 3);
|
client.GetGui().refreshGroupbox(tmpPlayer->getMyID(), 3);
|
||||||
|
|
||||||
@@ -668,6 +671,9 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
guiStatus = 1;
|
guiStatus = 1;
|
||||||
client.GetGui().refreshGroupbox(tmpPlayer->getMyID(), guiStatus);
|
client.GetGui().refreshGroupbox(tmpPlayer->getMyID(), guiStatus);
|
||||||
|
|
||||||
|
// Start displaying the timeout for the player.
|
||||||
|
client.GetGui().startTimeoutAnimation(tmpPlayer->getMyID(), client.GetGameData().playerActionTimeoutSec);
|
||||||
|
|
||||||
if (tmpPlayer->getMyID() == 0) // Is this the GUI player?
|
if (tmpPlayer->getMyID() == 0) // Is this the GUI player?
|
||||||
client.GetGui().meInAction();
|
client.GetGui().meInAction();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ struct GCC_PACKED NetPacketJoinGameAckData
|
|||||||
u_int16_t smallBlind;
|
u_int16_t smallBlind;
|
||||||
u_int16_t handsBeforeRaise;
|
u_int16_t handsBeforeRaise;
|
||||||
u_int16_t proposedGuiSpeed;
|
u_int16_t proposedGuiSpeed;
|
||||||
|
u_int16_t playerActionTimeout;
|
||||||
|
u_int16_t reserved;
|
||||||
u_int32_t startMoney;
|
u_int32_t startMoney;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -723,6 +725,7 @@ NetPacketJoinGameAck::SetData(const NetPacketJoinGameAck::Data &inData)
|
|||||||
tmpData->smallBlind = htons(inData.gameData.smallBlind);
|
tmpData->smallBlind = htons(inData.gameData.smallBlind);
|
||||||
tmpData->handsBeforeRaise = htons(inData.gameData.handsBeforeRaise);
|
tmpData->handsBeforeRaise = htons(inData.gameData.handsBeforeRaise);
|
||||||
tmpData->proposedGuiSpeed = htons(inData.gameData.guiSpeed);
|
tmpData->proposedGuiSpeed = htons(inData.gameData.guiSpeed);
|
||||||
|
tmpData->playerActionTimeout = htons(inData.gameData.playerActionTimeoutSec);
|
||||||
tmpData->startMoney = htonl(inData.gameData.startMoney);
|
tmpData->startMoney = htonl(inData.gameData.startMoney);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -739,6 +742,7 @@ NetPacketJoinGameAck::GetData(NetPacketJoinGameAck::Data &outData) const
|
|||||||
outData.gameData.smallBlind = ntohs(tmpData->smallBlind);
|
outData.gameData.smallBlind = ntohs(tmpData->smallBlind);
|
||||||
outData.gameData.handsBeforeRaise = ntohs(tmpData->handsBeforeRaise);
|
outData.gameData.handsBeforeRaise = ntohs(tmpData->handsBeforeRaise);
|
||||||
outData.gameData.guiSpeed = ntohs(tmpData->proposedGuiSpeed);
|
outData.gameData.guiSpeed = ntohs(tmpData->proposedGuiSpeed);
|
||||||
|
outData.gameData.playerActionTimeoutSec = ntohs(tmpData->playerActionTimeout);
|
||||||
outData.gameData.startMoney = ntohl(tmpData->startMoney);
|
outData.gameData.startMoney = ntohl(tmpData->startMoney);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user