changing parameter in some log-functions; run astyle

This commit is contained in:
floty
2012-01-07 18:42:24 +00:00
parent 476ee936f0
commit 800199f6f0
12 changed files with 182 additions and 121 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ void LocalBeRo::run()
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID");
}
}
if(myHand->getLog()) myHand->getLog()->logBoardCards(myBeRoID, tempBoardCardsArray);
if(myHand->getLog()) myHand->getLog()->logBoardCards(tempBoardCardsArray);
logBoardCardsDone = true;
}
@@ -89,7 +89,7 @@ void LocalBeRoPostRiver::postRiverRun()
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++;
}
if(nonfoldPlayersCounter>1) {
if(getMyHand()->getLog()) getMyHand()->getLog()->logHoleCardsHandName(GAME_STATE_POST_RIVER,getMyHand()->getActivePlayerList());
if(getMyHand()->getLog()) getMyHand()->getLog()->logHoleCardsHandName(getMyHand()->getActivePlayerList());
}
if(getMyHand()->getLog()) {
getMyHand()->getLog()->logHandWinner(getMyHand()->getActivePlayerList(), highestCardsValue, getMyHand()->getBoard()->getWinners());
+7 -4
View File
@@ -527,7 +527,7 @@ void LocalHand::switchRounds()
// logging last player action
PlayerListConstIterator previousPlayerIt = getRunningPlayerIt(previousPlayerID);
if(previousPlayerIt != runningPlayerList->end()) {
if(myLog) myLog->logPlayerAction(currentRound,(*previousPlayerIt)->getMyID()+1,myLog->transformPlayerActionLog((*previousPlayerIt)->getMyAction()),(*previousPlayerIt)->getMySet());
if(myLog) myLog->logPlayerAction((*previousPlayerIt)->getMyName(),myLog->transformPlayerActionLog((*previousPlayerIt)->getMyAction()),(*previousPlayerIt)->getMySet());
}
PlayerListIterator it, it_1;
@@ -569,6 +569,7 @@ void LocalHand::switchRounds()
myGui->refreshPot();
myGui->refreshSet();
currentRound = GAME_STATE_POST_RIVER;
myLog->setCurrentRound(currentRound);
}
// check for all in condition
@@ -630,11 +631,13 @@ void LocalHand::switchRounds()
myGui->flipHolecardsAllIn();
// Logging HoleCards
if(currentRound<GAME_STATE_RIVER) {
if(myLog) myLog->logHoleCardsHandName(currentRound,activePlayerList);
if(myLog) myLog->logHoleCardsHandName(activePlayerList);
}
if (currentRound < GAME_STATE_POST_RIVER) // do not increment past 4
if (currentRound < GAME_STATE_POST_RIVER) { // do not increment past 4
currentRound = GameState(currentRound + 1);
myLog->setCurrentRound(currentRound);
}
//log board cards for allin
if(currentRound >= GAME_STATE_FLOP) {
@@ -642,7 +645,7 @@ void LocalHand::switchRounds()
myBoard->getMyCards(tempBoardCardsArray);
myGui->logDealBoardCardsMsg(currentRound, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
if(myLog) myLog->logBoardCards(currentRound, tempBoardCardsArray);
if(myLog) myLog->logBoardCards(tempBoardCardsArray);
}
}
+1
View File
@@ -90,6 +90,7 @@ public:
void setCurrentRound(GameState theValue) {
currentRound = theValue;
myLog->setCurrentRound(currentRound);
}
GameState getCurrentRound() const {
return currentRound;
+87 -42
View File
@@ -28,11 +28,8 @@
using namespace std;
Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), uniqueGameID(0), curHandID(0), sql("")
Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), uniqueGameID(0), currentHandID(0), currentRound(GAME_STATE_PREFLOP), sql("")
{
logVersion = 1;
}
Log::~Log()
@@ -94,7 +91,7 @@ Log::init()
sql += "\"" + boost::lexical_cast<string>(POKERTH_BETA_RELEASE_STRING) + "\",";
sql += "\"" + boost::lexical_cast<string>(curDate) + "\",";
sql += "\"" + boost::lexical_cast<string>(curTime) + "\",";
sql += boost::lexical_cast<string>(logVersion) + ");";
sql += boost::lexical_cast<string>(SQLITE_LOG_VERSION) + ");";
// create game table
sql += "CREATE TABLE Game (";
@@ -103,12 +100,16 @@ Log::init()
sql += ",Startmoney INTEGER NOT NULL";
sql += ",StartSb INTEGER NOT NULL";
sql += ",DealerPos INTEGER NOT NULL";
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + " TEXT";
}
sql += ",Winner_Seat INTEGER";
sql += ");";
// create player table
sql += "CREATE TABLE Player (";
sql += "UniqueGameID INTEGER NOT NULL";
sql += ",Seat INTEGER NOT NULL";
sql += ",Player TEXT NOT NULL";
sql += ",PRIMARY KEY(UniqueGameID,Seat));";
// create hand table
sql += "CREATE TABLE Hand (";
sql += "HandID INTEGER NOT NULL";
@@ -170,26 +171,31 @@ Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned deal
sql += ",Startmoney";
sql += ",StartSb";
sql += ",DealerPos";
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
sql += ",Seat_" + boost::lexical_cast<std::string>(i);
}
sql += ") VALUES (";
sql += boost::lexical_cast<string>(uniqueGameID);
sql += "," + boost::lexical_cast<string>(gameID);
sql += "," + boost::lexical_cast<string>(startCash);
sql += "," + boost::lexical_cast<string>(startSmallBlind);
sql += "," + boost::lexical_cast<string>(dealerPosition);
sql += ");";
i = 1;
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
if((*it_c)->getMyActiveStatus()) {
sql += "INSERT INTO Player (";
sql += "UniqueGameID";
sql += ",Seat";
sql += ",Player";
sql += ") VALUES (";
sql += boost::lexical_cast<string>(uniqueGameID);
sql += "," + boost::lexical_cast<string>(i);
sql += ",\"" + (*it_c)->getMyName() +"\"";
} else {
sql += ",NULL";
sql += ");";
}
i++;
}
sql += ");";
if(myConfig->readConfigInt("LogInterval") == 0) {
exec_transaction();
}
exec_transaction();
}
}
}
@@ -199,7 +205,8 @@ void
Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned smallBlindPosition, int bigBlind, unsigned bigBlindPosition, PlayerList seatsList)
{
curHandID = handID;
currentRound = GAME_STATE_PREFLOP;
currentHandID = handID;
PlayerListConstIterator it_c;
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
(*it_c)->setLogHoleCardsDone(false);
@@ -226,7 +233,7 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash";
}
sql += ") VALUES (";
sql += boost::lexical_cast<string>(curHandID);
sql += boost::lexical_cast<string>(currentHandID);
sql += "," + boost::lexical_cast<string>(uniqueGameID);
sql += "," + boost::lexical_cast<string>(dealerPosition);
sql += "," + boost::lexical_cast<string>(smallBlind);
@@ -257,22 +264,22 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
}
}
if(countActivePlayer==2) {
logPlayerAction(GAME_STATE_PREFLOP,smallBlindPosition,LOG_ACTION_DEALER);
logPlayerAction(smallBlindPosition,LOG_ACTION_DEALER);
} else {
if(dealerButtonOnTable) {
logPlayerAction(GAME_STATE_PREFLOP,dealerPosition,LOG_ACTION_DEALER);
logPlayerAction(dealerPosition,LOG_ACTION_DEALER);
}
}
// log blinds
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND && (*it_c)->getMySet()>0) {
logPlayerAction(GAME_STATE_PREFLOP,smallBlindPosition,LOG_ACTION_SMALL_BLIND,(*it_c)->getMySet());
logPlayerAction(smallBlindPosition,LOG_ACTION_SMALL_BLIND,(*it_c)->getMySet());
}
}
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
if((*it_c)->getMyButton() == BUTTON_BIG_BLIND && (*it_c)->getMySet()>0) {
logPlayerAction(GAME_STATE_PREFLOP,bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
logPlayerAction(bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
}
}
@@ -286,7 +293,45 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
}
void
Log::logPlayerAction(GameState bero, int seat, PlayerActionLog action, int amount)
Log::logPlayerAction(string playerName, PlayerActionLog action, int amount)
{
if(SQLITE_LOG) {
if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled
if( mySqliteLogDb != 0 ) {
// sqlite-db is open
char **result_Player=0;
int nRow_Player=0;
int nCol_Player=0;
char *errmsg = 0;
// read seat
string sql_select = "SELECT Seat FROM Player WHERE UniqueGameID=" + boost::lexical_cast<std::string>(uniqueGameID);
sql_select += " AND ";
sql_select += "Player=\"" + playerName +"\"";
if(sqlite3_get_table(mySqliteLogDb,sql_select.data(),&result_Player,&nRow_Player,&nCol_Player,&errmsg) != SQLITE_OK) {
cout << "Error in statement: " << sql_select.data() << "[" << errmsg << "]." << endl;
} else {
if(nRow_Player == 1) {
logPlayerAction(boost::lexical_cast<int>(result_Player[1]), action, amount);
} else {
cout << sql_select << endl;
cout << "Implausible information about player " << playerName << " in log-db!" << endl;
}
}
sqlite3_free_table(result_Player);
}
}
}
}
void
Log::logPlayerAction(int seat, PlayerActionLog action, int amount)
{
if(SQLITE_LOG) {
@@ -306,9 +351,9 @@ Log::logPlayerAction(GameState bero, int seat, PlayerActionLog action, int amoun
sql += ",Action";
sql += ",Amount";
sql += ") VALUES (";
sql += boost::lexical_cast<string>(curHandID);
sql += boost::lexical_cast<string>(currentHandID);
sql += "," + boost::lexical_cast<string>(uniqueGameID);
sql += "," + boost::lexical_cast<string>(bero);;
sql += "," + boost::lexical_cast<string>(currentRound);;
sql += "," + boost::lexical_cast<string>(seat);
switch(action) {
case LOG_ACTION_DEALER:
@@ -422,7 +467,7 @@ Log::transformPlayerActionLog(PlayerAction action)
}
void
Log::logBoardCards(GameState bero, int boardCards[5])
Log::logBoardCards(int boardCards[5])
{
if(SQLITE_LOG) {
@@ -432,7 +477,7 @@ Log::logBoardCards(GameState bero, int boardCards[5])
if( mySqliteLogDb != 0 ) {
// sqlite-db is open
switch(bero) {
switch(currentRound) {
case GAME_STATE_FLOP: {
sql += "UPDATE Hand SET ";
sql += "BoardCard_1=" + boost::lexical_cast<string>(boardCards[0]) + ",";
@@ -455,7 +500,7 @@ Log::logBoardCards(GameState bero, int boardCards[5])
}
sql += " WHERE ";
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
sql += "HandID=" + boost::lexical_cast<string>(curHandID);
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
sql += ";";
if(myConfig->readConfigInt("LogInterval") == 0) {
exec_transaction();
@@ -466,22 +511,22 @@ Log::logBoardCards(GameState bero, int boardCards[5])
}
void
Log::logHoleCardsHandName(GameState bero, PlayerList activePlayerList)
Log::logHoleCardsHandName(PlayerList activePlayerList)
{
PlayerListConstIterator it_c;
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && ( ((*it_c)->checkIfINeedToShowCards() && bero==GAME_STATE_POST_RIVER ) || ( bero!=GAME_STATE_POST_RIVER && !(*it_c)->getLogHoleCardsDone()) ) ) {
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && ( ((*it_c)->checkIfINeedToShowCards() && currentRound==GAME_STATE_POST_RIVER ) || ( currentRound!=GAME_STATE_POST_RIVER && !(*it_c)->getLogHoleCardsDone()) ) ) {
logHoleCardsHandName(bero, activePlayerList, *it_c);
logHoleCardsHandName(activePlayerList, *it_c);
}
}
}
void
Log::logHoleCardsHandName(GameState bero, PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog)
Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog)
{
if(SQLITE_LOG) {
@@ -494,11 +539,11 @@ Log::logHoleCardsHandName(GameState bero, PlayerList activePlayerList, boost::sh
int myCards[2];
player->getMyCards(myCards);
sql += "UPDATE Hand SET ";
if(bero==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0) {
if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0) {
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName(player->getMyCardsValueInt(),activePlayerList) + "\"";
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_int=" + boost::lexical_cast<string>(player->getMyCardsValueInt());
}
if(bero==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0 && !player->getLogHoleCardsDone()) {
if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0 && !player->getLogHoleCardsDone()) {
sql+= ",";
}
if(!player->getLogHoleCardsDone()) {
@@ -507,16 +552,16 @@ Log::logHoleCardsHandName(GameState bero, PlayerList activePlayerList, boost::sh
}
sql += " WHERE ";
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
sql += "HandID=" + boost::lexical_cast<string>(curHandID);
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
sql += ";";
if(myConfig->readConfigInt("LogInterval") == 0 || forceExecLog) {
exec_transaction();
}
if(!player->getLogHoleCardsDone()) {
logPlayerAction(bero,player->getMyID()+1,LOG_ACTION_SHOW);
logPlayerAction(player->getMyName(),LOG_ACTION_SHOW);
} else {
logPlayerAction(bero,player->getMyID()+1,LOG_ACTION_HAS);
logPlayerAction(player->getMyName(),LOG_ACTION_HAS);
}
player->setLogHoleCardsDone(true);
@@ -537,7 +582,7 @@ Log::logHandWinner(PlayerList activePlayerList, int highestCardsValue, std::list
// log winner
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == highestCardsValue) {
logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN,(*it_c)->getLastMoneyWon());
logPlayerAction((*it_c)->getMyName(),LOG_ACTION_WIN,(*it_c)->getLastMoneyWon());
}
}
@@ -547,7 +592,7 @@ Log::logHandWinner(PlayerList activePlayerList, int highestCardsValue, std::list
for(it_int = winners.begin(); it_int != winners.end(); ++it_int) {
if((*it_int) == (*it_c)->getMyUniqueID()) {
logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_SIDE_POT,(*it_c)->getLastMoneyWon());
logPlayerAction((*it_c)->getMyName(),LOG_ACTION_WIN_SIDE_POT,(*it_c)->getLastMoneyWon());
}
}
}
@@ -567,7 +612,7 @@ Log::logGameWinner(PlayerList activePlayerList)
if (playersPositiveCashCounter==1) {
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
if ((*it_c)->getMyCash() > 0) {
logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_GAME);
logPlayerAction((*it_c)->getMyName(),LOG_ACTION_WIN_GAME);
}
}
// for log after every game
@@ -584,7 +629,7 @@ Log::logPlayerSitsOut(PlayerList activePlayerList)
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
if((*it_c)->getMyCash() == 0) {
logPlayerAction(GAME_STATE_POST_RIVER, (*it_c)->getMyID()+1, LOG_ACTION_SIT_OUT);
logPlayerAction((*it_c)->getMyName(), LOG_ACTION_SIT_OUT);
}
}
+11 -5
View File
@@ -37,11 +37,12 @@ public:
void init();
void logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned dealerPosition, PlayerList seatsList);
void logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned smallBlindPosition, int bigBlind, unsigned bigBlindPosition, PlayerList seatsList);
void logPlayerAction(GameState bero, int seat, PlayerActionLog action, int amount = 0);
void logPlayerAction(std::string playerName, PlayerActionLog action, int amount = 0);
void logPlayerAction(int seat, PlayerActionLog action, int amount = 0);
PlayerActionLog transformPlayerActionLog(PlayerAction action);
void logBoardCards(GameState bero, int boardCards[5]);
void logHoleCardsHandName(GameState bero, PlayerList activePlayerList);
void logHoleCardsHandName(GameState bero, PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog = 0);
void logBoardCards(int boardCards[5]);
void logHoleCardsHandName(PlayerList activePlayerList);
void logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog = 0);
void logHandWinner(PlayerList activePlayerList, int highestCardsValue, std::list<unsigned> winners);
void logGameWinner(PlayerList activePlayerList);
void logPlayerSitsOut(PlayerList activePlayerList);
@@ -49,6 +50,10 @@ public:
void logAfterGame();
// void closeLogDbAtExit();
void setCurrentRound(GameState theValue) {
currentRound = theValue;
}
private:
@@ -58,7 +63,8 @@ private:
sqlite3 *mySqliteLogDb;
ConfigFile *myConfig;
int uniqueGameID;
int curHandID;
int currentHandID;
GameState currentRound;
std::string sql;
};
+58 -46
View File
@@ -687,6 +687,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
result_struct results;
results.result_Session = 0;
results.result_Game = 0;
results.result_Player = 0;
results.result_Hand = 0;
results.result_Hand_ID = 0;
results.result_Action = 0;
@@ -696,8 +697,8 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
string round_string = "";
string action_string = "";
bool data_found = false;
int nRow_Session=0, nRow_Game=0, nRow_Hand=0, nRow_Hand_ID=0, nRow_Action=0;
int nCol_Session=0, nCol_Game=0, nCol_Hand=0, nCol_Action=0;
int nRow_Session=0, nRow_Game=0, nRow_Player=0, nRow_Hand=0, nRow_Hand_ID=0, nRow_Action=0;
int nCol_Session=0, nCol_Game=0, nCol_Player=0, nCol_Hand=0, nCol_Action=0;
char *errmsg = 0;
int game_ctr = 0, hand_ctr = 0, round_ctr = 0, action_ctr = 0;
int i = 0, j = 0;
@@ -721,7 +722,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
cleanUp(results, mySqliteLogDb);
return 1;
}
if(nRow_Session<1 || nRow_Session>1) {
if(nRow_Session != 1) {
cout << "Number of Sessions implausible!" << endl;
cleanUp(results, mySqliteLogDb);
return 1;
@@ -775,8 +776,6 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
return 1;
}
// sqlite3_free_table(results.result_Session);
switch(modus) {
case 1:
log_string = "<h3><b>" + log_string + "</b></h3>\n";
@@ -834,28 +833,42 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
}
// read player
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
data_found = false;
for(j=0; j<nCol_Game; j++) {
cmpString = "Seat_";
cmpString+= boost::lexical_cast<std::string>(i);
if(boost::lexical_cast<std::string>(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<std::string>(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;
}
sql = "SELECT Player,Seat FROM Player WHERE UniqueGameID=";
sql += boost::lexical_cast<std::string>(uniqueGameID);
sql += " ORDER BY Seat;";
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Player,&nRow_Player,&nCol_Player,&errmsg) != SQLITE_OK) {
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
cleanUp(results, mySqliteLogDb);
return 1;
}
for(i=1; i<=nRow_Player; i++) {
player[i-1] = boost::lexical_cast<std::string>(results.result_Player[nCol_Player*i]);
}
// for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
// data_found = false;
// for(j=0; j<nCol_Game; j++) {
// cmpString = "Seat_";
// cmpString+= boost::lexical_cast<std::string>(i);
// if(boost::lexical_cast<std::string>(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<std::string>(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=";
@@ -1050,8 +1063,6 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
}
}
// sqlite3_free_table(results.result_Action);
} else {
log_string += "BLINDS: ";
@@ -1080,8 +1091,6 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
log_string += boost::lexical_cast<std::string>(results.result_Action[3]);
log_string += "), ";
// sqlite3_free_table(results.result_Action);
// read big blind
sql = "SELECT Player,Amount FROM Action WHERE UniqueGameID=";
sql += boost::lexical_cast<std::string>(uniqueGameID);
@@ -1106,8 +1115,6 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
log_string += boost::lexical_cast<std::string>(results.result_Action[3]);
log_string += ")";
// sqlite3_free_table(results.result_Action);
// read dealer
sql = "SELECT Player,Amount FROM Action WHERE UniqueGameID=";
sql += boost::lexical_cast<std::string>(uniqueGameID);
@@ -1145,8 +1152,6 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
log_string += " starts as dealer.";
}
// sqlite3_free_table(results.result_Action);
}
if(!neu && modus==1) log_string += "</br>";
@@ -1300,7 +1305,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
}
// wins
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has left the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "was kicked from the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "is game admin now" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has joined the game") {
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
switch(modus) {
case 1:
if(!neu) action_string = "</br><i>" + action_string + "</i>";
@@ -1314,6 +1319,21 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
}
}
// network actions
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has left the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "was kicked from the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "is game admin now" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has joined the game") {
switch(modus) {
case 1:
if(!neu) action_string = "<i>" + action_string + "!</i>";
else action_string = "<i>" + action_string + "</i>";
break;
case 3:
action_string = "<i>" + action_string + "</i>";
break;
default:
;
}
}
// sits out
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "sits out") {
switch(modus) {
@@ -1394,34 +1414,26 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
if(round_ctr == GAME_STATE_POST_RIVER) {
// find hand name
// data_found = false;
for(i=0; i<nCol_Hand; i++) {
cmpString = "Seat_";
cmpString += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr]);
cmpString += "_Hand_text";
if(boost::lexical_cast<std::string>(results.result_Hand[i]) == cmpString && results.result_Hand[i+nCol_Hand]) {
log_string += " - " + boost::lexical_cast<std::string>(results.result_Hand[i+nCol_Hand]);
// data_found = true;
}
}
// if(!data_found) {
// cout << "Missing hand name information in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
// sqlite3_close(mySqliteLogDb);
// return 1;
// }
}
}
if(!neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game") {
if(!neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game") {
log_string += ".";
}
if(neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game") log_string += ".";
if(neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game")
log_string += ".";
}
// sqlite3_free_table(results.result_Action);
}
if(modus == 1) log_string += "\n";
+1
View File
@@ -32,6 +32,7 @@
struct result_struct {
char **result_Session;
char **result_Game;
char **result_Player;
char **result_Hand;
char **result_Hand_ID;
char **result_Action;
+1 -1
View File
@@ -177,7 +177,7 @@ void MyAvatarLabel::refreshStars()
#ifdef __APPLE__
fontSize = "7";
#else
fontSize = "12";
fontSize = "12";
#endif
#endif
@@ -491,8 +491,7 @@ void settingsDialogImpl::prepareDialog()
if(calledIngame) {
pushButton_resetSettings->setDisabled(true);
label_resetNote->show();
}
else {
} else {
pushButton_resetSettings->setEnabled(true);
label_resetNote->hide();
}
@@ -1382,11 +1381,10 @@ void settingsDialogImpl::showLogFilePreview()
void settingsDialogImpl::resetSettings()
{
int ret = QMessageBox::warning(this, tr("PokerTH - Settings"),
tr("Attention: this will delete all your personal settings and close PokerTH!\n"
"Do you really want to reset factory settings?"),
QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes)
{
tr("Attention: this will delete all your personal settings and close PokerTH!\n"
"Do you really want to reset factory settings?"),
QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes) {
myConfig->deleteConfigFile();
exit(0);
}
+6 -8
View File
@@ -1710,7 +1710,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
tmpPlayer->setLastMoneyWon(r->moneyWon);
client->GetCallback().SignalNetClientPostRiverShowCards(r->playerId);
client->GetClientLog()->logHoleCardsHandName(GAME_STATE_POST_RIVER, client->GetGame()->getActivePlayerList(), tmpPlayer, true);
client->GetClientLog()->logHoleCardsHandName(client->GetGame()->getActivePlayerList(), tmpPlayer, true);
} else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_playerIdChangedMessage) {
boost::shared_ptr<Game> curGame = client->GetGame();
if (curGame) {
@@ -1788,8 +1788,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
netActionDone->playerAction,
netActionDone->totalPlayerBet - tmpPlayer->getMySet());
client->GetClientLog()->logPlayerAction(
curGame->getCurrentHand()->getCurrentBeRo()->getMyBeRoID(),
tmpPlayer->getMyID()+1,
tmpPlayer->getMyName(),
client->GetClientLog()->transformPlayerActionLog(PlayerAction(netActionDone->playerAction)),
netActionDone->totalPlayerBet - tmpPlayer->getMySet()
);
@@ -1886,7 +1885,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
curGame->getCurrentHand()->setPreviousPlayerID(-1);
client->GetGui().logDealBoardCardsMsg(GAME_STATE_FLOP, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
client->GetClientLog()->logBoardCards(GAME_STATE_FLOP,tmpCards);
client->GetClientLog()->logBoardCards(tmpCards);
client->GetGui().refreshGameLabels(GAME_STATE_FLOP);
client->GetGui().refreshPot();
client->GetGui().refreshSet();
@@ -1902,7 +1901,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
curGame->getCurrentHand()->setPreviousPlayerID(-1);
client->GetGui().logDealBoardCardsMsg(GAME_STATE_TURN, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
client->GetClientLog()->logBoardCards(GAME_STATE_TURN,tmpCards);
client->GetClientLog()->logBoardCards(tmpCards);
client->GetGui().refreshGameLabels(GAME_STATE_TURN);
client->GetGui().refreshPot();
client->GetGui().refreshSet();
@@ -1918,7 +1917,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
curGame->getCurrentHand()->setPreviousPlayerID(-1);
client->GetGui().logDealBoardCardsMsg(GAME_STATE_RIVER, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
client->GetClientLog()->logBoardCards(GAME_STATE_RIVER,tmpCards);
client->GetClientLog()->logBoardCards(tmpCards);
client->GetGui().refreshGameLabels(GAME_STATE_RIVER);
client->GetGui().refreshPot();
client->GetGui().refreshSet();
@@ -1947,7 +1946,6 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
client->GetGui().flipHolecardsAllIn();
if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) {
client->GetClientLog()->logHoleCardsHandName(
curGame->getCurrentHand()->getCurrentRound(),
curGame->getActivePlayerList()
);
}
@@ -2037,7 +2035,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
curGame->getCurrentHand()->getBoard()->setPlayerNeedToShowCards(showList);
// logging
client->GetClientLog()->logHoleCardsHandName(GAME_STATE_POST_RIVER,curGame->getActivePlayerList());
client->GetClientLog()->logHoleCardsHandName(curGame->getActivePlayerList());
client->GetClientLog()->logHandWinner(curGame->getActivePlayerList(), highestValueOfCards, winnerList);
client->GetGui().postRiverRunAnimation1();
+3 -6
View File
@@ -753,8 +753,7 @@ ClientThread::SetNewGameAdmin(unsigned id)
playerData->SetGameAdmin(true);
GetCallback().SignalNetClientNewGameAdmin(id, playerData->GetName());
m_clientLog->logPlayerAction(
m_game->getCurrentHand()->getCurrentRound(),
m_game->getPlayerByUniqueId(id)->getMyID()+1,
playerData->GetName(),
LOG_ACTION_ADMIN
);
}
@@ -1126,14 +1125,12 @@ ClientThread::RemovePlayerData(unsigned playerId, int removeReason)
if(removeReason == NTF_NET_REMOVED_KICKED) {
m_clientLog->logPlayerAction(
m_game->getCurrentHand()->getCurrentRound(),
m_game->getPlayerByUniqueId(tmpData->GetUniqueId())->getMyID()+1,
tmpData->GetName(),
LOG_ACTION_KICKED
);
} else {
m_clientLog->logPlayerAction(
m_game->getCurrentHand()->getCurrentRound(),
m_game->getPlayerByUniqueId(tmpData->GetUniqueId())->getMyID()+1,
tmpData->GetName(),
LOG_ACTION_LEFT
);
}