diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index a3e8e7dd..fedf82c0 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -338,7 +338,15 @@ LocalHand::~LocalHand() void LocalHand::start() { - ///////////////////// + //Log blinds sets for new Hand + PlayerListConstIterator it_sB, it_bB; + it_sB = getActivePlayerIt(getCurrentBeRo()->getSmallBlindPositionId()); + it_bB = getActivePlayerIt(getCurrentBeRo()->getBigBlindPositionId()); + if(it_sB != getActivePlayerList()->end() && it_bB != getActivePlayerList()->end()) { + myGui->logNewBlindsSetsMsg((*it_sB)->getMySet(), (*it_bB)->getMySet(), (*it_sB)->getMyName().c_str(), (*it_bB)->getMyName().c_str()); + } + else { cout << "Log Error: cannot find sBID or bBID" << "\n"; } + myGui->flushLogAtHand(); // Karten austeilen myGui->dealHoleCards(); diff --git a/src/game.cpp b/src/game.cpp index bb543454..1429fefc 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -241,15 +241,8 @@ void Game::startHand() //Log new Hand myGui->logNewGameHandMsg(myGameID, actualHandID); - //Log blinds sets for new Hand - PlayerListConstIterator it_sB, it_bB; - it_sB = actualHand->getActivePlayerIt(actualHand->getCurrentBeRo()->getSmallBlindPositionId()); - it_bB = actualHand->getActivePlayerIt(actualHand->getCurrentBeRo()->getBigBlindPositionId()); - if(it_sB != actualHand->getActivePlayerList()->end() && it_bB != actualHand->getActivePlayerList()->end()) { - myGui->logNewBlindsSetsMsg(myGameID, (*it_sB)->getMySet(), (*it_bB)->getMySet(), (*it_sB)->getMyName().c_str(), (*it_bB)->getMyName().c_str()); - } - else { cout << "Log Error: cannot find sBID or bBID" << "\n"; } - + myGui->flushLogAtGame(myGameID); + actualHand->start(); } diff --git a/src/gui/generic/serverguiwrapper.cpp b/src/gui/generic/serverguiwrapper.cpp index cc779f46..1ae6df7f 100644 --- a/src/gui/generic/serverguiwrapper.cpp +++ b/src/gui/generic/serverguiwrapper.cpp @@ -101,11 +101,13 @@ void ServerGuiWrapper::stopTimeoutAnimation(int /*playerId*/) {} void ServerGuiWrapper::logPlayerActionMsg(string /*playerName*/, int /*action*/, int /*setValue*/) {} void ServerGuiWrapper::logNewGameHandMsg(int /*gameID*/, int /*handID*/) {} void ServerGuiWrapper::logPlayerWinsMsg(std::string /*playerName*/, int /*pot*/) {} -void ServerGuiWrapper::logNewBlindsSetsMsg(int /*gameID*/, int /*sbSet*/, int /*bbSet*/, std::string /*sbName*/, std::string /*bbName*/) {} +void ServerGuiWrapper::logNewBlindsSetsMsg(int /*sbSet*/, int /*bbSet*/, std::string /*sbName*/, std::string /*bbName*/) {} 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::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {} +void ServerGuiWrapper::flushLogAtGame(int /*gameID*/) {} +void ServerGuiWrapper::flushLogAtHand() {} 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 2e07c377..c2c32c8a 100644 --- a/src/gui/generic/serverguiwrapper.h +++ b/src/gui/generic/serverguiwrapper.h @@ -85,10 +85,12 @@ public: void logPlayerActionMsg(std::string playerName, int action, int setValue) ; void logNewGameHandMsg(int gameID, int handID) ; void logPlayerWinsMsg(std::string playerName, int pot); - void logNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, std::string sbName, std::string bbName); + void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName); 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 logPlayerWinGame(std::string playerName, int gameID); + void flushLogAtGame(int gameID); + void flushLogAtHand(); void SignalNetClientConnect(int actionID); void SignalNetClientGameInfo(int actionID); diff --git a/src/gui/guiinterface.h b/src/gui/guiinterface.h index 3a761f26..2245b9f9 100644 --- a/src/gui/guiinterface.h +++ b/src/gui/guiinterface.h @@ -96,10 +96,12 @@ public: virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0; virtual void logNewGameHandMsg(int gameID, int HandID) =0; virtual void logPlayerWinsMsg(std::string playerName, int pot) = 0; - virtual void logNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, std::string sbName, std::string bbName) =0; + virtual void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName) =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 logPlayerWinGame(std::string playerName, int gameID) =0; + virtual void flushLogAtGame(int gameID) =0; + virtual void flushLogAtHand() =0; }; diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 457d6542..d4a6c467 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -103,11 +103,14 @@ void GuiWrapper::stopTimeoutAnimation(int playerId) { myW->signalStopTimeoutAnim 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::logNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, std::string sbName, std::string bbName) { myLog->signalLogNewBlindsSetsMsg(gameID, sbSet, bbSet, QString::fromUtf8(sbName.c_str()), QString::fromUtf8(bbName.c_str())); } +void GuiWrapper::logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName) { myLog->signalLogNewBlindsSetsMsg(sbSet, bbSet, QString::fromUtf8(sbName.c_str()), QString::fromUtf8(bbName.c_str())); } void GuiWrapper::logPlayerWinsMsg(std::string playerName, int pot) { myLog->signalLogPlayerWinsMsg(QString::fromUtf8(playerName.c_str()), 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(QString::fromUtf8(playerName.c_str()), card1, card2, cardsValueInt, QString::fromUtf8(showHas.c_str())); } void GuiWrapper::logPlayerWinGame(std::string playerName, int gameID) { myLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID); } +void GuiWrapper::flushLogAtGame(int gameID) { myLog->signalFlushLogAtGame(gameID); } +void GuiWrapper::flushLogAtHand() { myLog->signalFlushLogAtHand(); } + void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); } void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); } diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index fd73a7c3..d14eef9b 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -91,11 +91,13 @@ public: void logPlayerActionMsg(std::string playerName, int action, int setValue) ; void logNewGameHandMsg(int gameID, int handID) ; - void logNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, std::string sbName, std::string bbName); + void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName); void logPlayerWinsMsg(std::string playerName, 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 logPlayerWinGame(std::string playerName, int gameID); + void flushLogAtGame(int gameID); + void flushLogAtHand(); 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 0865a114..0d3455f2 100644 --- a/src/gui/qt/mainwindow/log/log.cpp +++ b/src/gui/qt/mainwindow/log/log.cpp @@ -35,12 +35,14 @@ Log::Log(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), m connect(this, SIGNAL(signalLogPlayerActionMsg(QString, int, int)), this, SLOT(logPlayerActionMsg(QString, int, int))); connect(this, SIGNAL(signalLogNewGameHandMsg(int, int)), this, SLOT(logNewGameHandMsg(int, int))); - connect(this, SIGNAL(signalLogNewBlindsSetsMsg(int, int, int, QString, QString)), this, SLOT(logNewBlindsSetsMsg(int, int, int, QString, QString))); + connect(this, SIGNAL(signalLogNewBlindsSetsMsg(int, int, QString, QString)), this, SLOT(logNewBlindsSetsMsg(int, int, QString, QString))); connect(this, SIGNAL(signalLogPlayerWinsMsg(QString, int)), this, SLOT(logPlayerWinsMsg(QString, int))); connect(this, SIGNAL(signalLogDealBoardCardsMsg(int, int, int, int, int, int)), this, SLOT(logDealBoardCardsMsg(int, int, int, int, int, 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))); connect(this, SIGNAL(signalLogPlayerWinGame(QString, int)), this, SLOT(logPlayerWinGame(QString, int))); + connect(this, SIGNAL(signalFlushLogAtGame(int)), this, SLOT(flushLogAtGame(int))); + connect(this, SIGNAL(signalFlushLogAtHand()), this, SLOT(flushLogAtHand())); logFileStreamString = ""; @@ -320,7 +322,7 @@ void Log::logNewGameHandMsg(int gameID, int handID) { } } -void Log::logNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, QString sbName, QString bbName) { +void Log::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName) { // log blinds logFileStreamString += "
BLINDS: "; @@ -345,21 +347,6 @@ void Log::logNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, QString sbName, logFileStreamString += "

PREFLOP"; logFileStreamString += "
\n"; - - - if(myConfig->readConfigInt("LogInterval") < 2) { -// write for log after every action and after every hand - writeLogFileStream(logFileStreamString); - logFileStreamString = ""; - } - else { -// write for log after every game - if(gameID > lastGameID) { - writeLogFileStream(logFileStreamString); - logFileStreamString = ""; - lastGameID = gameID; - } - } } void Log::logPlayerWinsMsg(QString playerName, int pot) { @@ -1797,3 +1784,20 @@ void Log::writeLogFileStream(QString streamString) { else { cout << "could not find log-file to write log-messages!" << endl; } } +void Log::flushLogAtHand() { + + if(myConfig->readConfigInt("LogInterval") < 2) { +// write for log after every action and after every hand + writeLogFileStream(logFileStreamString); + logFileStreamString = ""; + } +} + +void Log::flushLogAtGame(int gameID) { +// write for log after every game + if(gameID > lastGameID) { + writeLogFileStream(logFileStreamString); + logFileStreamString = ""; + lastGameID = gameID; + } +} diff --git a/src/gui/qt/mainwindow/log/log.h b/src/gui/qt/mainwindow/log/log.h index 5c57bc20..a0616d66 100644 --- a/src/gui/qt/mainwindow/log/log.h +++ b/src/gui/qt/mainwindow/log/log.h @@ -42,12 +42,14 @@ public: public slots: void logPlayerActionMsg(QString playerName, int action, int setValue); void logNewGameHandMsg(int gameID, int handID); - void logNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, QString sbName, QString bbName); + void logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName); void logPlayerWinsMsg(QString playerName, int pot); void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1); void logFlipHoleCardsMsg(QString playerName, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows"); void logPlayerLeftMsg(QString playerName); void logPlayerWinGame(QString playerName, int gameID); + void flushLogAtGame(int gameID); + void flushLogAtHand(); public: @@ -60,12 +62,14 @@ public: signals: void signalLogPlayerActionMsg(QString playerName, int action, int setValue); void signalLogNewGameHandMsg(int gameID, int handID); - void signalLogNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, QString sbName, QString bbName); + void signalLogNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName); void signalLogPlayerWinsMsg(QString playerName, int pot); void signalLogDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1); void signalLogFlipHoleCardsMsg(QString playerName, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows"); void signalLogPlayerLeftMsg(QString playerName); void signalLogPlayerWinGame(QString playerName, int gameID); + void signalFlushLogAtGame(int gameID); + void signalFlushLogAtHand(); private: diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index fa3184d7..9b6bc5a7 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -767,6 +767,8 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr tmpPlayer = curGame->getPlayerByUniqueId(actionDoneData.playerId); if (!tmpPlayer) throw ClientException(ERR_NET_UNKNOWN_PLAYER_ID, 0); + + bool isBigBlind = false; if (actionDoneData.gameState == GAME_STATE_PREFLOP_SMALL_BLIND) { @@ -777,6 +779,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrgetCurrentHand()->getCurrentBeRo()->setBigBlindPositionId(tmpPlayer->getMyUniqueID()); tmpPlayer->setMyButton(BUTTON_BIG_BLIND); + isBigBlind = true; } else // no blind -> log { @@ -800,6 +803,12 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptrgetMySet() > curGame->getCurrentHand()->getCurrentBeRo()->getHighestSet()) curGame->getCurrentHand()->getCurrentBeRo()->setHighestSet(tmpPlayer->getMySet()); + //log blinds sets after setting bigblind-button + if (isBigBlind) { + client.GetGui().logNewBlindsSetsMsg(curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMySet(), curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMySet(), curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(), curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName()); + client.GetGui().flushLogAtHand(); + } + // Stop the timeout for the player. client.GetGui().stopTimeoutAnimation(tmpPlayer->getMyID());