From 7da3ad5481b382d2e9c3432517053fbdcbea7310 Mon Sep 17 00:00:00 2001 From: doitux Date: Fri, 19 Oct 2007 20:43:53 +0000 Subject: [PATCH] starts human player input filed redesign - PART VII (firtst steps for network game) --- src/engine/local_engine/localhand.cpp | 2 +- src/engine/network_engine/clienthand.cpp | 2 +- src/gui/generic/serverguiwrapper.cpp | 1 + src/gui/generic/serverguiwrapper.h | 1 + src/gui/guiinterface.h | 1 + src/gui/qt/guiwrapper.cpp | 1 + src/gui/qt/guiwrapper.h | 1 + src/gui/qt/mainwindow/mainwindowimpl.cpp | 28 +++++++++++++++--------- src/gui/qt/mainwindow/mainwindowimpl.h | 1 + src/net/common/clientstate.cpp | 9 ++++---- 10 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 0da6228e..051e1fb6 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -30,7 +30,7 @@ using namespace std; LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC) -: myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(false), +: myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(-1), allInCondition(false), cardsShown(false), bettingRoundsPlayed(0) { diff --git a/src/engine/network_engine/clienthand.cpp b/src/engine/network_engine/clienthand.cpp index 6e2f9b5f..71bc3b61 100644 --- a/src/engine/network_engine/clienthand.cpp +++ b/src/engine/network_engine/clienthand.cpp @@ -23,7 +23,7 @@ using namespace std; ClientHand::ClientHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) : myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), - smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(0), + smallBlind(sB), startCash(sC), lastPlayersTurn(-1), allInCondition(0), cardsShown(false), bettingRoundsPlayed(0) { PlayerListIterator it; diff --git a/src/gui/generic/serverguiwrapper.cpp b/src/gui/generic/serverguiwrapper.cpp index 958d9fce..72c0d85e 100644 --- a/src/gui/generic/serverguiwrapper.cpp +++ b/src/gui/generic/serverguiwrapper.cpp @@ -95,6 +95,7 @@ void ServerGuiWrapper::nextRoundCleanGui() {} void ServerGuiWrapper::meInAction() {} void ServerGuiWrapper::disableMyButtons() {} +void ServerGuiWrapper::updateMyButtonsState() {} void ServerGuiWrapper::startTimeoutAnimation(int /*playerId*/, int /*timeoutSec*/) {} void ServerGuiWrapper::stopTimeoutAnimation(int /*playerId*/) {} diff --git a/src/gui/generic/serverguiwrapper.h b/src/gui/generic/serverguiwrapper.h index c408d49b..c9c32aac 100644 --- a/src/gui/generic/serverguiwrapper.h +++ b/src/gui/generic/serverguiwrapper.h @@ -78,6 +78,7 @@ public: void nextRoundCleanGui(); void meInAction(); + void updateMyButtonsState(); void disableMyButtons(); void startTimeoutAnimation(int playerId, int timeoutSec); void stopTimeoutAnimation(int playerId); diff --git a/src/gui/guiinterface.h b/src/gui/guiinterface.h index b6d68da5..ee6162ac 100644 --- a/src/gui/guiinterface.h +++ b/src/gui/guiinterface.h @@ -88,6 +88,7 @@ public: // virtual void userWidgetsBackgroudColor() const=0; // virtual void timerBlockerFalse() const=0; virtual void meInAction()=0; + virtual void updateMyButtonsState()=0; virtual void disableMyButtons()=0; virtual void startTimeoutAnimation(int playerId, int timeoutSec) =0; virtual void stopTimeoutAnimation(int playerId) =0; diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 3146809c..003f4ce4 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -95,6 +95,7 @@ void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); } void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); } void GuiWrapper::meInAction() { myW->signalMeInAction(); } +void GuiWrapper::updateMyButtonsState() { myW->updateMyButtonsState(); } void GuiWrapper::disableMyButtons() { myW->signalDisableMyButtons(); } void GuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) { myW->signalStartTimeoutAnimation(playerId, timeoutSec); } void GuiWrapper::stopTimeoutAnimation(int playerId) { myW->signalStopTimeoutAnimation(playerId); } diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index edd4e078..3be29668 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -86,6 +86,7 @@ public: void meInAction(); void disableMyButtons(); + void updateMyButtonsState(); void startTimeoutAnimation(int playerId, int timeoutSec); void stopTimeoutAnimation(int playerId); diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 82ee7aec..d9551763 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -2389,19 +2389,13 @@ void mainWindowImpl::nextPlayerAnimation() { if((*it_c)->getMyID() == currentHand->getLastPlayersTurn()) break; } - refreshAction(currentHand->getLastPlayersTurn(), (*it_c)->getMyAction()); + if(currentHand->getLastPlayersTurn() != -1) { + refreshAction(currentHand->getLastPlayersTurn(), (*it_c)->getMyAction()); + } refreshCash(); //refresh actions for human player - - if(currentHand->getLastPlayersTurn() == 0) { - myButtonsCheckable(FALSE); - clearMyButtons(); - } - else { - myButtonsCheckable(TRUE); - provideMyActions(); - } + updateMyButtonsState(); nextPlayerAnimationTimer->start(nextPlayerSpeed1); } @@ -3532,6 +3526,20 @@ void mainWindowImpl::mouseOverFlipCards(bool front) { } } +void mainWindowImpl::updateMyButtonsState() { + + HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); + + if(currentHand->getLastPlayersTurn() == 0) { + myButtonsCheckable(FALSE); + clearMyButtons(); + } + else { + myButtonsCheckable(TRUE); + provideMyActions(); + } +} + void mainWindowImpl::uncheckMyButtons() { pushButton_BetRaise->setChecked(FALSE); diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index ca997bbd..93bf410c 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -310,6 +310,7 @@ public slots: void mouseOverFlipCards(bool front); + void updateMyButtonsState(); void uncheckMyButtons(); void resetMyButtonsCheckStateMemory(); void clearMyButtons(); diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index d7cd4144..dca84cf4 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -935,7 +935,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrgetCurrentHand()->getCurrentBeRo()->setHighestSet(actionDoneData.highestSet); curGame->getCurrentHand()->getBoard()->collectSets(); curGame->getCurrentHand()->switchRounds(); - + curGame->getCurrentHand()->setLastPlayersTurn(tmpPlayer->getMyID()); //log blinds sets after setting bigblind-button if (isBigBlind) { @@ -957,6 +957,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrToNetPacketPlayersTurn()) { @@ -1011,7 +1012,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrToNetPacketDealTurnCard()) { @@ -1027,7 +1028,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrToNetPacketDealRiverCard()) { @@ -1043,7 +1044,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrToNetPacketAllInShowCards()) {