From b8d369a126d0da4f257b88e099c0d5753efa9961 Mon Sep 17 00:00:00 2001 From: doitux Date: Wed, 3 Oct 2007 19:27:37 +0000 Subject: [PATCH] adds LogNewBlindsSetsMsg to seperate blindsSets logging --- src/game.cpp | 11 +++++- src/gui/generic/serverguiwrapper.cpp | 2 ++ 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/log/log.cpp | 52 +++++++++++++++++++++++++--- src/gui/qt/mainwindow/log/log.h | 2 ++ 8 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index c1ba448d..bb543454 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -239,8 +239,17 @@ void Game::startHand() //GUI bereinigen myGui->nextRoundCleanGui(); + //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"; } + actualHand->start(); } diff --git a/src/gui/generic/serverguiwrapper.cpp b/src/gui/generic/serverguiwrapper.cpp index 57861ae0..cc779f46 100644 --- a/src/gui/generic/serverguiwrapper.cpp +++ b/src/gui/generic/serverguiwrapper.cpp @@ -101,6 +101,8 @@ 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::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*/) {} diff --git a/src/gui/generic/serverguiwrapper.h b/src/gui/generic/serverguiwrapper.h index cfab385b..2e07c377 100644 --- a/src/gui/generic/serverguiwrapper.h +++ b/src/gui/generic/serverguiwrapper.h @@ -85,6 +85,7 @@ 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 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); diff --git a/src/gui/guiinterface.h b/src/gui/guiinterface.h index c75e4bd2..3a761f26 100644 --- a/src/gui/guiinterface.h +++ b/src/gui/guiinterface.h @@ -96,6 +96,7 @@ 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 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; diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index e519cfae..457d6542 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -103,6 +103,7 @@ 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::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())); } diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index ce83b0d7..fd73a7c3 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -91,6 +91,7 @@ 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 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"); diff --git a/src/gui/qt/mainwindow/log/log.cpp b/src/gui/qt/mainwindow/log/log.cpp index 47b2868c..0865a114 100644 --- a/src/gui/qt/mainwindow/log/log.cpp +++ b/src/gui/qt/mainwindow/log/log.cpp @@ -35,6 +35,7 @@ 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(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))); @@ -237,7 +238,7 @@ void Log::logNewGameHandMsg(int gameID, int handID) { } } } - // log blinds +/* // log blinds logFileStreamString += "
BLINDS: "; // for(i=0; igetCurrentBeRo()->getSmallBlindPositionId() << endl; + cout << "BB: " << currentHand->getCurrentBeRo()->getBigBlindPositionId() << endl; // smallBlind it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getSmallBlindPositionId()); @@ -298,8 +300,52 @@ void Log::logNewGameHandMsg(int gameID, int handID) { + 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::logNewBlindsSetsMsg(int gameID, int sbSet, int bbSet, QString sbName, QString bbName) { + + // log blinds + logFileStreamString += "
BLINDS: "; +/* + cout << "SB: " << sbName << endl; + cout << "BB: " << bbName << endl; */ + +// smallBlind +// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getSmallBlindPositionId()); +// if(it_c != currentHand->getActivePlayerList()->end()) { +// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$), "; +// }*/ + + logFileStreamString += sbName+" ("+QString::number(sbSet,10)+"$), "; + + // bigBlind +// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getBigBlindPositionId()); +// if(it_c != currentHand->getActivePlayerList()->end()) { +// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$)"; +// } + logFileStreamString += bbName+" ("+QString::number(bbSet,10)+"$)"; + logFileStreamString += "

PREFLOP"; logFileStreamString += "
\n"; + if(myConfig->readConfigInt("LogInterval") < 2) { // write for log after every action and after every hand @@ -314,8 +360,6 @@ void Log::logNewGameHandMsg(int gameID, int handID) { lastGameID = gameID; } } - - } } void Log::logPlayerWinsMsg(QString playerName, int pot) { diff --git a/src/gui/qt/mainwindow/log/log.h b/src/gui/qt/mainwindow/log/log.h index d1c29808..5c57bc20 100644 --- a/src/gui/qt/mainwindow/log/log.h +++ b/src/gui/qt/mainwindow/log/log.h @@ -42,6 +42,7 @@ 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 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"); @@ -59,6 +60,7 @@ 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 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");