diff --git a/src/engine/network_engine/clientplayer.h b/src/engine/network_engine/clientplayer.h index 2f45ced9..78d977f5 100644 --- a/src/engine/network_engine/clientplayer.h +++ b/src/engine/network_engine/clientplayer.h @@ -56,7 +56,7 @@ public: void setMyCash(int theValue) { myCash = theValue; } int getMyCash() const { return myCash; } - void setMySet(int theValue) { myLastRelativeSet = theValue; mySet += theValue; myCash -= theValue; } + void setMySet(int theValue) { myLastRelativeSet = theValue; } void setMySetAbsolute(int theValue) { mySet = theValue; } void setMySetNull() { mySet = 0; myLastRelativeSet = 0; } int getMySet() const { return mySet;} @@ -77,8 +77,22 @@ public: void setMyTurn(bool theValue){ myTurn = theValue;} bool getMyTurn() const{ return myTurn;} - void setMyCardsFlip(bool theValue, int state){ myCardsFlip = theValue;} - bool getMyCardsFlip() const{ return myCardsFlip;} + void setMyCardsFlip(bool theValue, int state){ + myCardsFlip = theValue; + // log flipping cards + if(myCardsFlip) { + switch(state) { + case 1: actualHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt); + break; + case 2: actualHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]); + break; + case 3: actualHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has"); + break; + default: ; + } + } + } + bool getMyCardsFlip() const{ return myCardsFlip;} void setMyCardsValueInt(int theValue) { myCardsValueInt = theValue;} int getMyCardsValueInt() const { return myCardsValueInt; } @@ -112,8 +126,11 @@ public: void setSBluffStatus ( bool theValue ) { sBluffStatus = theValue; } bool getSBluffStatus() const { return sBluffStatus; } - void setMyWinnerState ( bool theValue, int pot ) { myWinnerState = theValue; } - bool getMyWinnerState() const { return myWinnerState;} + void setMyWinnerState ( bool theValue, int pot ) { + myWinnerState = theValue; + if(theValue) actualHand->getGuiInterface()->logPlayerWinsMsg(myID, pot); + } + bool getMyWinnerState() const { return myWinnerState;} void action(); diff --git a/src/gui/generic/serverguiwrapper.cpp b/src/gui/generic/serverguiwrapper.cpp index 2323f191..0611bc2e 100644 --- a/src/gui/generic/serverguiwrapper.cpp +++ b/src/gui/generic/serverguiwrapper.cpp @@ -95,7 +95,6 @@ void ServerGuiWrapper::logNewGameHandMsg(int gameID, int handID) {} void ServerGuiWrapper::logPlayerWinsMsg(int playerID, int pot) {} void ServerGuiWrapper::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) {} void ServerGuiWrapper::logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt, std::string showHas) {} -void ServerGuiWrapper::logPlayerLeftMsg(int playerID) {} void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); } void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); } diff --git a/src/gui/generic/serverguiwrapper.h b/src/gui/generic/serverguiwrapper.h index 2219f6d9..2713a6ec 100644 --- a/src/gui/generic/serverguiwrapper.h +++ b/src/gui/generic/serverguiwrapper.h @@ -79,7 +79,6 @@ public: void logPlayerWinsMsg(int playerID, int pot); void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ; void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ; - void logPlayerLeftMsg(int playerID); void SignalNetClientConnect(int actionID); void SignalNetClientGameInfo(int actionID); diff --git a/src/gui/guiinterface.h b/src/gui/guiinterface.h index 83d13c55..f8cd6ac6 100644 --- a/src/gui/guiinterface.h +++ b/src/gui/guiinterface.h @@ -90,7 +90,6 @@ public: virtual void logPlayerWinsMsg(int playerID, int pot) = 0; virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 0; virtual void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0; - virtual void logPlayerLeftMsg(int playerID) =0; }; #endif diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 72c98294..f73dbe47 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -92,8 +92,7 @@ void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); } void GuiWrapper::logPlayerWinsMsg(int playerID, int pot) { myLog->signalLogPlayerWinsMsg(playerID, pot); } void GuiWrapper::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) { myLog->signalLogDealBoardCardsMsg(roundID, card1, card2, card3, card4, card5); } -void GuiWrapper::logFlipHoleCardsMsg(string playerName, int card1, int card2, int cardsValueInt, string showHas) { myLog->signalLogFlipHoleCardsMsg(playerName, card1, card2, cardsValueInt, showHas); } -void GuiWrapper::logPlayerLeftMsg(int playerID) { myLog->signalLogPlayerLeftMsg(playerID); } +void GuiWrapper::logFlipHoleCardsMsg(string playerName, int card1, int card2, int cardsValueInt, string showHas) { myLog->signalLogFlipHoleCardsMsg(QString::fromUtf8(playerName.c_str()), card1, card2, cardsValueInt, QString::fromUtf8(showHas.c_str())); } void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); } void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); } @@ -106,6 +105,11 @@ void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string & void GuiWrapper::SignalNetServerSuccess(int actionID) { } void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { myW->signalNetServerError(errorID, osErrorID); } void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { myW->signalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); } -void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { myW->signalNetServerPlayerLeft(QString::fromUtf8(playerName.c_str())); } +void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) +{ + QString tmpName(QString::fromUtf8(playerName.c_str())); + myW->signalNetServerPlayerLeft(tmpName); + myLog->signalLogPlayerLeftMsg(tmpName); +} diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index bc86979b..3b833ef9 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -87,7 +87,6 @@ public: void logPlayerWinsMsg(int playerID, int pot); void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1); void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows"); - void logPlayerLeftMsg(int playerID); void SignalNetClientConnect(int actionID); void SignalNetClientGameInfo(int actionID); diff --git a/src/gui/qt/mainwindow/log/log.cpp b/src/gui/qt/mainwindow/log/log.cpp index 70ceaf04..a05fea17 100644 --- a/src/gui/qt/mainwindow/log/log.cpp +++ b/src/gui/qt/mainwindow/log/log.cpp @@ -35,8 +35,8 @@ Log::Log(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), m connect(this, SIGNAL(signalLogNewGameHandMsg(int, int)), this, SLOT(logNewGameHandMsg(int, int))); connect(this, SIGNAL(signalLogPlayerWinsMsg(int, int)), this, SLOT(logPlayerWinsMsg(int, int))); connect(this, SIGNAL(signalLogDealBoardCardsMsg(int, int, int, int, int, int)), this, SLOT(logDealBoardCardsMsg(int, int, int, int, int, int))); - connect(this, SIGNAL(signalLogFlipHoleCardsMsg(std::string, int, int, int, std::string)), this, SLOT(logFlipHoleCardsMsg(std::string, int, int, int, std::string))); - connect(this, SIGNAL(signalLogPlayerLeftMsg(int)), this, SLOT(logPlayerLeftMsg(int))); + connect(this, SIGNAL(signalLogFlipHoleCardsMsg(QString, int, int, int, QString)), this, SLOT(logFlipHoleCardsMsg(QString, int, int, int, QString))); + connect(this, SIGNAL(signalLogPlayerLeftMsg(QString)), this, SLOT(logPlayerLeftMsg(QString))); logFileStreamString = ""; @@ -305,7 +305,7 @@ void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int } } -void Log::logFlipHoleCardsMsg(string playerName, int card1, int card2, int cardsValueInt, string showHas) { +void Log::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int cardsValueInt, QString showHas) { if (cardsValueInt != -1) { @@ -412,12 +412,12 @@ void Log::logFlipHoleCardsMsg(string playerName, int card1, int card2, int cards default: {} } - myW->textBrowser_Log->append(QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" \""+tempHandName+"\""); + myW->textBrowser_Log->append(playerName+" "+showHas+" \""+tempHandName+"\""); if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled - logFileStreamString += QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" [ "+translateCardCode(card1).at(0)+""+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+""+translateCardCode(card2).at(1)+"] - "+tempHandName+"
\n"; + logFileStreamString += playerName+" "+showHas+" [ "+translateCardCode(card1).at(0)+""+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+""+translateCardCode(card2).at(1)+"] - "+tempHandName+"
\n"; if(myConfig->readConfigInt("LogInterval") == 0) { writeLogFileStream(logFileStreamString); @@ -427,12 +427,12 @@ void Log::logFlipHoleCardsMsg(string playerName, int card1, int card2, int cards } } else { - myW->textBrowser_Log->append(QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]"); + myW->textBrowser_Log->append(playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]"); if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled - logFileStreamString += QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" ["+translateCardCode(card1).at(0)+""+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+""+translateCardCode(card2).at(1)+"]"+"
\n"; + logFileStreamString += playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+""+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+""+translateCardCode(card2).at(1)+"]"+"
\n"; if(myConfig->readConfigInt("LogInterval") == 0) { writeLogFileStream(logFileStreamString); logFileStreamString = ""; @@ -442,15 +442,15 @@ void Log::logFlipHoleCardsMsg(string playerName, int card1, int card2, int cards } -void Log::logPlayerLeftMsg(int playerID) { +void Log::logPlayerLeftMsg(QString playerName) { HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand(); - myW->textBrowser_Log->append( ""+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" has left the game!"); + myW->textBrowser_Log->append( ""+playerName+" has left the game!"); if(myConfig->readConfigInt("LogOnOff")) { - logFileStreamString += ""+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" has left the game!
\n"; + logFileStreamString += ""+playerName+" has left the game!
\n"; if(myConfig->readConfigInt("LogInterval") == 0) { writeLogFileStream(logFileStreamString); diff --git a/src/gui/qt/mainwindow/log/log.h b/src/gui/qt/mainwindow/log/log.h index afc32859..a5662c34 100644 --- a/src/gui/qt/mainwindow/log/log.h +++ b/src/gui/qt/mainwindow/log/log.h @@ -45,8 +45,8 @@ public slots: void logNewGameHandMsg(int gameID, int handID); void logPlayerWinsMsg(int playerID, int pot); void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1); - void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows"); - void logPlayerLeftMsg(int playerID); + void logFlipHoleCardsMsg(QString playerName, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows"); + void logPlayerLeftMsg(QString playerName); public: @@ -60,8 +60,8 @@ signals: void signalLogNewGameHandMsg(int gameID, int handID); void signalLogPlayerWinsMsg(int playerID, int pot); void signalLogDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1); - void signalLogFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows"); - void signalLogPlayerLeftMsg(int playerID); + void signalLogFlipHoleCardsMsg(QString playerName, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows"); + void signalLogPlayerLeftMsg(QString playerName); private: diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 91a1457a..d4696ee1 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -2510,7 +2510,6 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { 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_S) { mySession->getGui()->logPlayerLeftMsg(2); } //s // if (event->key() == Qt::Key_W) { qApp->quit(); } //s if (event->key() == 16777249) { pushButton_break->click(); diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index 281884a9..826083f5 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -609,6 +609,17 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrsetMyButton(BUTTON_SMALL_BLIND); else if (actionDoneData.gameState == GAME_STATE_PREFLOP_BIG_BLIND) tmpPlayer->setMyButton(BUTTON_BIG_BLIND); + else // no blind -> log + { + if (actionDoneData.playerAction) + { + assert(actionDoneData.totalPlayerBet >= (unsigned)tmpPlayer->getMySet()); + client.GetGui().logPlayerActionMsg( + tmpPlayer->getMyName(), + actionDoneData.playerAction, + actionDoneData.totalPlayerBet - tmpPlayer->getMySet()); + } + } tmpPlayer->setMyAction(actionDoneData.playerAction); tmpPlayer->setMySetAbsolute(actionDoneData.totalPlayerBet); @@ -671,6 +682,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrgetCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->collectPot(); + client.GetGui().logDealBoardCardsMsg(GAME_STATE_FLOP, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]); client.GetGui().refreshGameLabels(GAME_STATE_FLOP); client.GetGui().refreshPot(); client.GetGui().refreshSet(); @@ -686,6 +698,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrgetCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->collectPot(); + client.GetGui().logDealBoardCardsMsg(GAME_STATE_TURN, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]); client.GetGui().refreshGameLabels(GAME_STATE_TURN); client.GetGui().refreshPot(); client.GetGui().refreshSet(); @@ -701,6 +714,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrgetCurrentHand()->getBoard()->setMyCards(tmpCards); curGame->getCurrentHand()->getBoard()->collectPot(); + client.GetGui().logDealBoardCardsMsg(GAME_STATE_RIVER, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]); client.GetGui().refreshGameLabels(GAME_STATE_RIVER); client.GetGui().refreshPot(); client.GetGui().refreshSet();