cleanup game logging; delete old code and disused defines

This commit is contained in:
floty
2014-04-04 18:51:26 +02:00
parent 316f2f43c3
commit e4d358f97a
13 changed files with 394 additions and 741 deletions
-1
View File
@@ -215,7 +215,6 @@ void Game::startHand()
// log new hand // log new hand
myGui->logNewGameHandMsg(myGameID, currentHandID); myGui->logNewGameHandMsg(myGameID, currentHandID);
myGui->flushLogAtGame(myGameID);
currentHand->start(); currentHand->start();
} }
-1
View File
@@ -144,7 +144,6 @@ void LocalHand::start()
} else { } else {
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID"); LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID");
} }
myGui->flushLogAtHand();
// deal cards // deal cards
myGui->dealHoleCards(); myGui->dealHoleCards();
+1 -23
View File
@@ -119,15 +119,13 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), mySqliteLogFileName(""), myConfig(c)
Log::~Log() Log::~Log()
{ {
if(SQLITE_LOG) sqlite3_close(mySqliteLogDb); sqlite3_close(mySqliteLogDb);
} }
void void
Log::init() Log::init()
{ {
if(SQLITE_LOG) {
// logging activated // logging activated
if(myConfig->readConfigInt("LogOnOff")) { if(myConfig->readConfigInt("LogOnOff")) {
@@ -231,15 +229,12 @@ Log::init()
} }
} }
} }
}
void void
Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned dealerPosition, PlayerList seatsList) Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned dealerPosition, PlayerList seatsList)
{ {
uniqueGameID++; uniqueGameID++;
if(SQLITE_LOG) {
if(myConfig->readConfigInt("LogOnOff")) { if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled //if write logfiles is enabled
@@ -283,7 +278,6 @@ Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned deal
} }
} }
} }
}
void void
Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned smallBlindPosition, int bigBlind, unsigned bigBlindPosition, PlayerList seatsList) Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned smallBlindPosition, int bigBlind, unsigned bigBlindPosition, PlayerList seatsList)
@@ -296,8 +290,6 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
(*it_c)->setLogHoleCardsDone(false); (*it_c)->setLogHoleCardsDone(false);
} }
if(SQLITE_LOG) {
if(myConfig->readConfigInt("LogOnOff")) { if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled //if write logfiles is enabled
@@ -374,14 +366,11 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
} }
} }
} }
}
void void
Log::logPlayerAction(string playerName, PlayerActionLog action, int amount) Log::logPlayerAction(string playerName, PlayerActionLog action, int amount)
{ {
if(SQLITE_LOG) {
if(myConfig->readConfigInt("LogOnOff")) { if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled //if write logfiles is enabled
@@ -411,14 +400,11 @@ Log::logPlayerAction(string playerName, PlayerActionLog action, int amount)
} }
} }
} }
}
void void
Log::logPlayerAction(int seat, PlayerActionLog action, int amount) Log::logPlayerAction(int seat, PlayerActionLog action, int amount)
{ {
if(SQLITE_LOG) {
if(myConfig->readConfigInt("LogOnOff")) { if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled //if write logfiles is enabled
@@ -522,7 +508,6 @@ Log::logPlayerAction(int seat, PlayerActionLog action, int amount)
} }
} }
} }
}
PlayerActionLog PlayerActionLog
Log::transformPlayerActionLog(PlayerAction action) Log::transformPlayerActionLog(PlayerAction action)
@@ -552,7 +537,6 @@ Log::transformPlayerActionLog(PlayerAction action)
void void
Log::logBoardCards(int boardCards[5]) Log::logBoardCards(int boardCards[5])
{ {
if(SQLITE_LOG) {
if(myConfig->readConfigInt("LogOnOff")) { if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled //if write logfiles is enabled
@@ -591,7 +575,6 @@ Log::logBoardCards(int boardCards[5])
} }
} }
} }
}
void void
Log::logHoleCardsHandName(PlayerList activePlayerList) Log::logHoleCardsHandName(PlayerList activePlayerList)
@@ -612,8 +595,6 @@ void
Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog) Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog)
{ {
if(SQLITE_LOG) {
if(myConfig->readConfigInt("LogOnOff")) { if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled //if write logfiles is enabled
@@ -652,7 +633,6 @@ Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerI
} }
} }
} }
}
void void
Log::logHandWinner(PlayerList activePlayerList, int highestCardsValue, std::list<unsigned> winners) Log::logHandWinner(PlayerList activePlayerList, int highestCardsValue, std::list<unsigned> winners)
@@ -752,12 +732,10 @@ Log::exec_transaction()
//void //void
//Log::closeLogDbAtExit() //Log::closeLogDbAtExit()
//{ //{
// if(SQLITE_LOG) {
// // close sqlite-db // // close sqlite-db
// sqlite3_close(mySqliteLogDb); // sqlite3_close(mySqliteLogDb);
// mySqliteLogDb = NULL; // mySqliteLogDb = NULL;
//} //}
//}
void void
Log::debugMode_getStartSmallBlind(int* startSmallBlind, int* currentSmallBlind) Log::debugMode_getStartSmallBlind(int* startSmallBlind, int* currentSmallBlind)
-3
View File
@@ -37,9 +37,6 @@
#define MIN_GUI_SPEED 1 #define MIN_GUI_SPEED 1
#define MAX_GUI_SPEED 11 #define MAX_GUI_SPEED 11
#define SQLITE_LOG 1
#define HTML_LOG 0
#define POKERTH_VERSION_MAJOR 1 #define POKERTH_VERSION_MAJOR 1
#define POKERTH_VERSION_MINOR 11 #define POKERTH_VERSION_MINOR 11
#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR) #define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR)
-2
View File
@@ -105,8 +105,6 @@ void ServerGuiWrapper::logNewBlindsSetsMsg(int /*sbSet*/, int /*bbSet*/, std::st
void ServerGuiWrapper::logDealBoardCardsMsg(int /*roundID*/, int /*card1*/, int /*card2*/, int /*card3*/, int /*card4*/, int /*card5*/) {} 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::logFlipHoleCardsMsg(std::string /*playerName*/, int /*card1*/, int /*card2*/, int /*cardsValueInt*/, std::string /*showHas*/) {}
void ServerGuiWrapper::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {} void ServerGuiWrapper::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {}
void ServerGuiWrapper::flushLogAtGame(int /*gameID*/) {}
void ServerGuiWrapper::flushLogAtHand() {}
void ServerGuiWrapper::SignalNetClientServerListAdd(unsigned serverId) void ServerGuiWrapper::SignalNetClientServerListAdd(unsigned serverId)
{ {
-2
View File
@@ -118,8 +118,6 @@ public:
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ; 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 logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
void logPlayerWinGame(std::string playerName, int gameID); void logPlayerWinGame(std::string playerName, int gameID);
void flushLogAtGame(int gameID);
void flushLogAtHand();
void SignalNetClientConnect(int actionID); void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID); void SignalNetClientGameInfo(int actionID);
-2
View File
@@ -119,8 +119,6 @@ public:
virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 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 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 logPlayerWinGame(std::string playerName, int gameID) =0;
virtual void flushLogAtGame(int gameID) =0;
virtual void flushLogAtHand() =0;
}; };
+7 -306
View File
@@ -61,9 +61,6 @@ guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(
connect(this, SIGNAL(signalLogSpectatorLeftMsg(QString, int)), this, SLOT(logSpectatorLeftMsg(QString, int))); connect(this, SIGNAL(signalLogSpectatorLeftMsg(QString, int)), this, SLOT(logSpectatorLeftMsg(QString, int)));
connect(this, SIGNAL(signalLogSpectatorJoinedMsg(QString)), this, SLOT(logSpectatorJoinedMsg(QString))); connect(this, SIGNAL(signalLogSpectatorJoinedMsg(QString)), this, SLOT(logSpectatorJoinedMsg(QString)));
connect(this, SIGNAL(signalLogPlayerWinGame(QString, int)), this, SLOT(logPlayerWinGame(QString, int))); 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 = ""; logFileStreamString = "";
lastGameID = 0; lastGameID = 0;
@@ -79,40 +76,7 @@ guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(
myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())); myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
if(HTML_LOG) { // delete old log files - TODO: move to Log
QDateTime currentTime = QDateTime::currentDateTime();
if(SQLITE_LOG) {
myHtmlLogFile_old = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+"_old.html");
} else {
myHtmlLogFile_old = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".html");
}
//Logo-Pixmap extrahieren
QPixmap logoChipPixmapFile(":/gfx/logoChip3D.png");
logoChipPixmapFile.save(myLogDir->absolutePath()+"/logo.png");
// myW->textBrowser_Log->append(myHtmlLogFile_old->fileName());
// erstelle html-Datei
myHtmlLogFile_old->open( QIODevice::WriteOnly );
QTextStream stream_old( myHtmlLogFile_old );
stream_old << "<html>\n";
stream_old << "<head>\n";
stream_old << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\">";
stream_old << "</head>\n";
#ifdef GUI_800x480
stream_old << "<body style=\"font-size:14px\">\n";
#else
stream_old << "<body>\n";
#endif
stream_old << "<img src='logo.png'>\n";
stream_old << QString("<h3><b>Log-File for PokerTH %1 Session started on ").arg(POKERTH_BETA_RELEASE_STRING)+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>\n";
myHtmlLogFile_old->close();
}
// delete old log files
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration"); int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
QStringList filters("pokerth-log*"); QStringList filters("pokerth-log*");
@@ -191,62 +155,19 @@ void guiLog::logPlayerActionMsg(QString msg, int action, int setValue)
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+msg+"</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+msg+"</span>");
#endif #endif
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled
logFileStreamString += msg+"</br>\n";
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
}
} }
void guiLog::logNewGameHandMsg(int gameID, int handID) void guiLog::logNewGameHandMsg(int gameID, int handID)
{ {
PlayerListConstIterator it_c;
boost::shared_ptr<HandInterface> currentHand = myW->getSession()->getCurrentGame()->getCurrentHand();
PlayerList activePlayerList = currentHand->getActivePlayerList();
#ifdef GUI_800x480 #ifdef GUI_800x480
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>"); myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
#else #else
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
#endif #endif
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled
logFileStreamString += "<table><tr><td width=\"600\" align=\"center\"><hr noshade size=\"3\"><b>Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"</b></td><td></td></tr></table>";
logFileStreamString += "BLIND LEVEL: $"+QString::number(currentHand->getSmallBlind())+" / $"+QString::number(currentHand->getSmallBlind()*2)+"</br>";
//print cash only for active players
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
logFileStreamString += "Seat " + QString::number((*it_c)->getMyID()+1,10) + ": <b>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + "</b> ($" + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+")</br>";
}
}
}
} }
void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName) void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName)
{ {
// log blinds // log blinds
#ifdef GUI_800x480 #ifdef GUI_800x480
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>"); myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
@@ -255,45 +176,6 @@ void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString b
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>");
#endif #endif
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled
logFileStreamString += "BLINDS: ";
logFileStreamString += sbName+" ($"+QString::number(sbSet,10)+"), ";
logFileStreamString += bbName+" ($"+QString::number(bbSet,10)+")";
PlayerListConstIterator it_c;
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
PlayerList activePlayerList = currentGame->getActivePlayerList();
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
if(activePlayerList->size() > 2) {
if((*it_c)->getMyButton() == BUTTON_DEALER) {
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
break;
}
} else {
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
break;
}
}
}
logFileStreamString += "</br></br><b>PREFLOP</b>";
logFileStreamString += "</br>\n";
}
}
} }
void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main) void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main)
@@ -312,116 +194,43 @@ void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main)
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogWinnerSidePotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogWinnerSidePotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)</span>");
} }
#endif #endif
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled
logFileStreamString += "</br><i>"+playerName+" wins $"+QString::number(pot,10);
if(!main) {
logFileStreamString += " (side pot)";
}
logFileStreamString += "</i>\n";
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
}
} }
void guiLog::logPlayerSitsOut(QString playerName) void guiLog::logPlayerSitsOut(QString playerName)
{ {
#ifdef GUI_800x480 #ifdef GUI_800x480
myW->tabs.textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>"); myW->tabs.textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
#else #else
myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>"); myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
#endif #endif
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
logFileStreamString += "</br><i><span style=\"font-size:smaller;\">"+playerName+" sits out</span></i>\n";
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
}
} }
void guiLog::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) void guiLog::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5)
{ {
QString round;
switch (roundID) { switch (roundID) {
case 1: case 1:
round = "Flop";
#ifdef GUI_800x480 #ifdef GUI_800x480
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>"); myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Flop --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
#else #else
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Flop --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
#endif #endif
break; break;
case 2: case 2:
round = "Turn";
#ifdef GUI_800x480 #ifdef GUI_800x480
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>"); myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Turn --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
#else #else
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Turn --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
#endif #endif
break; break;
case 3: case 3:
round = "River";
#ifdef GUI_800x480 #ifdef GUI_800x480
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>"); myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- River --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
#else #else
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- River --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
#endif #endif
break; break;
default: default:
round = "ERROR";
}
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled
switch (roundID) {
case 1:
round = "Flop";
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+"]"+"</br>\n";
break; break;
case 2:
round = "Turn";
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+"]"+"</br>\n";
break;
case 3:
round = "River";
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+",<b>"+translateCardCode(card5).at(0)+"</b>"+translateCardCode(card5).at(1)+"]"+"</br>\n";
break;
default:
round = "ERROR";
}
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
} }
} }
@@ -447,40 +256,10 @@ void guiLog::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int c
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]</span>"); myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]</span>");
#endif #endif
} }
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled
if (cardsValueInt != -1) {
tempHandName.fromStdString(CardsValue::determineHandName(cardsValueInt,myW->getSession()->getCurrentGame()->getActivePlayerList()));
logFileStreamString += playerName+" "+showHas+" [ <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"] - "+tempHandName+"</br>\n";
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
} else {
logFileStreamString += playerName+" "+showHas+" [<b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"]"+"</br>\n";
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
}
}
} }
void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked) void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
{ {
QString action; QString action;
if(wasKicked) action = "was kicked from"; if(wasKicked) action = "was kicked from";
else action = "has left"; else action = "has left";
@@ -490,44 +269,15 @@ void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
#else #else
myW->textBrowser_Log->append( "<span style=\"color:#"+myStyle->getChatLogTextColor()+";\"><i>"+playerName+" "+action+" the game!</i></span>"); myW->textBrowser_Log->append( "<span style=\"color:#"+myStyle->getChatLogTextColor()+";\"><i>"+playerName+" "+action+" the game!</i></span>");
#endif #endif
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
logFileStreamString += "<i>"+playerName+" "+action+" the game!</i><br>\n";
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
}
} }
void guiLog::logNewGameAdminMsg(QString playerName) void guiLog::logNewGameAdminMsg(QString playerName)
{ {
#ifdef GUI_800x480 #ifdef GUI_800x480
myW->tabs.textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>"); myW->tabs.textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
#else #else
myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>"); myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
#endif #endif
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
logFileStreamString += "<i>"+playerName+" is game admin now!</i><br>\n";
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
}
} }
void guiLog::logPlayerJoinedMsg(QString playerName) void guiLog::logPlayerJoinedMsg(QString playerName)
@@ -551,27 +301,11 @@ void guiLog::logSpectatorJoinedMsg(QString playerName)
void guiLog::logPlayerWinGame(QString playerName, int gameID) void guiLog::logPlayerWinGame(QString playerName, int gameID)
{ {
#ifdef GUI_800x480 #ifdef GUI_800x480
myW->tabs.textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>"); myW->tabs.textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
#else #else
myW->textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>"); myW->textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
#endif #endif
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
logFileStreamString += "</br></br><i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b></br>\n";
if(myConfig->readConfigInt("LogInterval") == 0) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
}
} }
QStringList guiLog::translateCardCode(int cardCode) QStringList guiLog::translateCardCode(int cardCode)
@@ -693,39 +427,6 @@ void guiLog::writeLog(string log_string, int modus)
} }
void guiLog::flushLogAtHand()
{
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
if(myConfig->readConfigInt("LogInterval") < 2) {
// write for log after every action and after every hand
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
}
}
}
}
void guiLog::flushLogAtGame(int gameID)
{
if(HTML_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
// write for log after every game
if(gameID > lastGameID) {
writeLogFileStream(logFileStreamString);
logFileStreamString = "";
lastGameID = gameID;
}
}
}
}
void guiLog::exportLogPdbToHtml(QString fileStringPdb, QString exportFileString) void guiLog::exportLogPdbToHtml(QString fileStringPdb, QString exportFileString)
{ {
-4
View File
@@ -81,8 +81,6 @@ public slots:
void logSpectatorLeftMsg(QString playerName, int wasKicked); void logSpectatorLeftMsg(QString playerName, int wasKicked);
void logSpectatorJoinedMsg(QString playerName); void logSpectatorJoinedMsg(QString playerName);
void logPlayerWinGame(QString playerName, int gameID); void logPlayerWinGame(QString playerName, int gameID);
void flushLogAtGame(int gameID);
void flushLogAtHand();
void exportLogPdbToHtml(QString fileStringPdb, QString exportFileString); void exportLogPdbToHtml(QString fileStringPdb, QString exportFileString);
void exportLogPdbToTxt(QString fileStringPdb, QString exportFileString); void exportLogPdbToTxt(QString fileStringPdb, QString exportFileString);
void showLog(QString fileStringPdb, QTextBrowser *tb, int uniqueGameID = 0); void showLog(QString fileStringPdb, QTextBrowser *tb, int uniqueGameID = 0);
@@ -115,8 +113,6 @@ signals:
void signalLogSpectatorJoinedMsg(QString playerName); void signalLogSpectatorJoinedMsg(QString playerName);
void signalLogNewGameAdminMsg(QString playerName); void signalLogNewGameAdminMsg(QString playerName);
void signalLogPlayerWinGame(QString playerName, int gameID); void signalLogPlayerWinGame(QString playerName, int gameID);
void signalFlushLogAtGame(int gameID);
void signalFlushLogAtHand();
private: private:
-8
View File
@@ -287,14 +287,6 @@ void GuiWrapper::logPlayerWinGame(std::string playerName, int gameID)
{ {
myGuiLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID); myGuiLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID);
} }
void GuiWrapper::flushLogAtGame(int gameID)
{
myGuiLog->signalFlushLogAtGame(gameID);
}
void GuiWrapper::flushLogAtHand()
{
myGuiLog->signalFlushLogAtHand();
}
void GuiWrapper::SignalNetClientConnect(int actionID) void GuiWrapper::SignalNetClientConnect(int actionID)
-2
View File
@@ -124,8 +124,6 @@ public:
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1); 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 logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
void logPlayerWinGame(std::string playerName, int gameID); void logPlayerWinGame(std::string playerName, int gameID);
void flushLogAtGame(int gameID);
void flushLogAtHand();
void SignalNetClientConnect(int actionID); void SignalNetClientConnect(int actionID);
void SignalNetClientServerListAdd(unsigned serverId); void SignalNetClientServerListAdd(unsigned serverId);
-1
View File
@@ -1800,7 +1800,6 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMySet(), curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMySet(),
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(), curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(),
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName()); curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
client->GetGui().flushLogAtHand();
client->GetClientLog()->logNewHandMsg( client->GetClientLog()->logNewHandMsg(
curGame->getCurrentHandID(), curGame->getCurrentHandID(),
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1, curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1,