From 576942359567f21e2cece7e8301a394a216f28f8 Mon Sep 17 00:00:00 2001 From: floty Date: Mon, 9 Jan 2012 12:42:04 +0000 Subject: [PATCH] last bugfixes for sqlite-log; activating sqlite-log for release version 0.9.1 --- src/engine/log.cpp | 1 - src/game_defs.h | 4 +-- src/gui/qt/gametable/log/guilog.cpp | 25 ---------------- .../qt/settingsdialog/settingsdialogimpl.cpp | 17 +++++------ src/net/common/clientthread.cpp | 29 +++++++++---------- src/net/common/serverlobbythread.cpp | 2 +- 6 files changed, 25 insertions(+), 53 deletions(-) diff --git a/src/engine/log.cpp b/src/engine/log.cpp index d4c991ab..39ca27ae 100644 --- a/src/engine/log.cpp +++ b/src/engine/log.cpp @@ -319,7 +319,6 @@ Log::logPlayerAction(string playerName, PlayerActionLog action, int amount) if(nRow_Player == 1) { logPlayerAction(boost::lexical_cast(result_Player[1]), action, amount); } else { - cout << sql_select << endl; cout << "Implausible information about player " << playerName << " in log-db!" << endl; } } diff --git a/src/game_defs.h b/src/game_defs.h index da525c26..7f996729 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -25,8 +25,8 @@ #define MAX_GUI_SPEED 11 #define DEBUG_MODE 0 -#define SQLITE_LOG 0 -#define HTML_LOG 1 +#define SQLITE_LOG 1 +#define HTML_LOG 0 #define POKERTH_VERSION_MAJOR 0 #define POKERTH_VERSION_MINOR 90 diff --git a/src/gui/qt/gametable/log/guilog.cpp b/src/gui/qt/gametable/log/guilog.cpp index 528545f7..02090b2b 100644 --- a/src/gui/qt/gametable/log/guilog.cpp +++ b/src/gui/qt/gametable/log/guilog.cpp @@ -845,31 +845,6 @@ int guiLog::exportLog(QString fileStringPdb,int modus) player[i-1] = boost::lexical_cast(results.result_Player[nCol_Player*i]); } - - -// for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) { -// data_found = false; -// for(j=0; j(i); -// if(boost::lexical_cast(results.result_Game[j]) == cmpString) { -// // Seat found -// if(results.result_Game[j+nCol_Game*game_ctr]) { -// // the Seat is not empty -// player[i-1] = boost::lexical_cast(results.result_Game[j+nCol_Game*game_ctr]); -// } else { -// player[i-1] = ""; -// } -// data_found = true; -// } -// } -// if(!data_found) { -// cout << "Missing some seats!" << endl; -// cleanUp(results, mySqliteLogDb); -// return 1; -// } -// } - // read all hand id sql = "SELECT HandID FROM Hand WHERE UniqueGameID="; sql+= boost::lexical_cast(uniqueGameID); diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index e5ba8df0..6a668fd3 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -529,13 +529,12 @@ void settingsDialogImpl::isAccepted() checkSetPlayerNicks.insert(lineEdit_Opponent9Name->text().trimmed()); if(checkSetPlayerNicks.count() != 10) { - QMessageBox::warning(this, tr("Settings Error"), - tr("The opponent names are not unique.\n" - "Please choose different names for each Opponent!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } - else { + QMessageBox::warning(this, tr("Settings Error"), + tr("The opponent names are not unique.\n" + "Please choose different names for each Opponent!"), + QMessageBox::Ok); + settingsCorrect = FALSE; + } else { //save nicks and avatars myConfig->writeConfigString("MyName", lineEdit_HumanPlayerName->text().trimmed().toUtf8().constData()); myConfig->writeConfigString("MyAvatar", pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData()); @@ -1352,7 +1351,7 @@ void settingsDialogImpl::exportLogToHtml() if(selectedItem) { QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"), - QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())+"/"+selectedItem->text(0), + QDir::homePath()+"/"+selectedItem->text(0), tr("PokerTH HTML log (*.html)")); if(!fileName.isEmpty()) { @@ -1367,7 +1366,7 @@ void settingsDialogImpl::exportLogToTxt() if(selectedItem) { QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"), - QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())+"/"+selectedItem->text(0), + QDir::homePath()+"/"+selectedItem->text(0), tr("PokerTH plain text log (*.txt)")); if(!fileName.isEmpty()) { diff --git a/src/net/common/clientthread.cpp b/src/net/common/clientthread.cpp index abac99e2..6ba5d33c 100644 --- a/src/net/common/clientthread.cpp +++ b/src/net/common/clientthread.cpp @@ -752,10 +752,9 @@ ClientThread::SetNewGameAdmin(unsigned id) if (playerData.get()) { playerData->SetGameAdmin(true); GetCallback().SignalNetClientNewGameAdmin(id, playerData->GetName()); - m_clientLog->logPlayerAction( - playerData->GetName(), - LOG_ACTION_ADMIN - ); + if(m_game) { + m_clientLog->logPlayerAction(playerData->GetName(),LOG_ACTION_ADMIN); + } } } @@ -1092,8 +1091,12 @@ ClientThread::AddPlayerData(boost::shared_ptr playerData) m_playerDataList.push_back(playerData); if (playerData->GetUniqueId() == GetGuiPlayerId()) GetCallback().SignalNetClientSelfJoined(playerData->GetUniqueId(), playerData->GetName(), playerData->IsGameAdmin()); - else + else { GetCallback().SignalNetClientPlayerJoined(playerData->GetUniqueId(), playerData->GetName(), playerData->IsGameAdmin()); +// if(m_game) { +// m_clientLog->logPlayerAction(playerData->GetName(),LOG_ACTION_JOIN); +// } + } } } @@ -1123,16 +1126,12 @@ ClientThread::RemovePlayerData(unsigned playerId, int removeReason) } GetCallback().SignalNetClientPlayerLeft(tmpData->GetUniqueId(), tmpData->GetName(), removeReason); - if(removeReason == NTF_NET_REMOVED_KICKED) { - m_clientLog->logPlayerAction( - tmpData->GetName(), - LOG_ACTION_KICKED - ); - } else { - m_clientLog->logPlayerAction( - tmpData->GetName(), - LOG_ACTION_LEFT - ); + if(m_game) { + if(removeReason == NTF_NET_REMOVED_KICKED) { + m_clientLog->logPlayerAction(tmpData->GetName(),LOG_ACTION_KICKED); + } else { + m_clientLog->logPlayerAction(tmpData->GetName(),LOG_ACTION_LEFT); + } } } diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 242c5b15..83ee7f4c 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -891,7 +891,7 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr session, boost::s else if (packet->GetMsg()->present == PokerTHMessage_PR_avatarRequestMessage) HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->choice.avatarRequestMessage); else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage) - {} + {} else if (packet->GetMsg()->present == PokerTHMessage_PR_subscriptionRequestMessage) { SubscriptionRequestMessage_t *subscriptionRequest = &packet->GetMsg()->choice.subscriptionRequestMessage; if (subscriptionRequest->subscriptionAction == subscriptionAction_resubscribeGameList)