cleanup game logging; delete old code and disused defines
This commit is contained in:
+5
-6
@@ -57,10 +57,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
dealerPosition = startData.startDealerPlayerId;
|
||||
|
||||
// debug mode
|
||||
if(myLog) {
|
||||
myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind);
|
||||
myLog->debugMode_getStartDealerPosition(&dealerPosition);
|
||||
}
|
||||
if(myLog) {
|
||||
myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind);
|
||||
myLog->debugMode_getStartDealerPosition(&dealerPosition);
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
@@ -110,7 +110,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
}
|
||||
|
||||
// debug mode
|
||||
if(myLog) myLog->debugMode_getPlayerStartCash(&myStartCash, i);
|
||||
if(myLog) myLog->debugMode_getPlayerStartCash(&myStartCash, i);
|
||||
|
||||
// create player objects
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, myStartCash, startQuantityPlayers > i, myStayOnTableStatus, 0);
|
||||
@@ -215,7 +215,6 @@ void Game::startHand()
|
||||
|
||||
// log new hand
|
||||
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
||||
myGui->flushLogAtGame(myGameID);
|
||||
|
||||
currentHand->start();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
for(i=0; i<5; i++) tempBoardArray[i] = cardsArray[i];
|
||||
|
||||
// debug mode
|
||||
if(myLog) myLog->debugMode_getBoardCards(tempBoardArray,myID);
|
||||
if(myLog) myLog->debugMode_getBoardCards(tempBoardArray,myID);
|
||||
|
||||
// prepare whole player hand
|
||||
for(i=0; i<5; i++) tempPlayerAndBoardArray[i+2] = tempBoardArray[i];
|
||||
@@ -92,7 +92,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
for(j=0; j<2; j++) tempPlayerArray[j] = cardsArray[2*k+j+5];
|
||||
|
||||
// debug mode
|
||||
if(myLog) myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k);
|
||||
if(myLog) myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k);
|
||||
|
||||
// complete whole player hand
|
||||
for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j];
|
||||
@@ -144,7 +144,6 @@ void LocalHand::start()
|
||||
} else {
|
||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID");
|
||||
}
|
||||
myGui->flushLogAtHand();
|
||||
|
||||
// deal cards
|
||||
myGui->dealHoleCards();
|
||||
|
||||
@@ -1264,7 +1264,7 @@ void LocalPlayer::preflopEngine()
|
||||
// cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl;
|
||||
|
||||
// debug mode
|
||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_PREFLOP, currentHand->getMyID(), myUniqueID, mySet);
|
||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_PREFLOP, currentHand->getMyID(), myUniqueID, mySet);
|
||||
|
||||
evaluation(bet, raise);
|
||||
}
|
||||
@@ -1526,7 +1526,7 @@ void LocalPlayer::flopEngine()
|
||||
}
|
||||
|
||||
// debug mode
|
||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_FLOP, currentHand->getMyID(), myUniqueID, mySet);
|
||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_FLOP, currentHand->getMyID(), myUniqueID, mySet);
|
||||
|
||||
evaluation(bet, raise);
|
||||
|
||||
@@ -1801,7 +1801,7 @@ void LocalPlayer::turnEngine()
|
||||
}
|
||||
|
||||
// debug mode
|
||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_TURN, currentHand->getMyID(), myUniqueID, mySet);
|
||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_TURN, currentHand->getMyID(), myUniqueID, mySet);
|
||||
|
||||
evaluation(bet, raise);
|
||||
|
||||
@@ -2062,7 +2062,7 @@ void LocalPlayer::riverEngine()
|
||||
}
|
||||
|
||||
// debug mode
|
||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_RIVER, currentHand->getMyID(), myUniqueID, mySet);
|
||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_RIVER, currentHand->getMyID(), myUniqueID, mySet);
|
||||
|
||||
evaluation(bet, raise);
|
||||
|
||||
|
||||
+375
-397
@@ -119,115 +119,112 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), mySqliteLogFileName(""), myConfig(c)
|
||||
|
||||
Log::~Log()
|
||||
{
|
||||
if(SQLITE_LOG) sqlite3_close(mySqliteLogDb);
|
||||
sqlite3_close(mySqliteLogDb);
|
||||
}
|
||||
|
||||
void
|
||||
Log::init()
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
// logging activated
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
|
||||
// logging activated
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
DIR *logDir;
|
||||
logDir = opendir((myConfig->readConfigString("LogDir")).c_str());
|
||||
bool dirExists = logDir != NULL;
|
||||
closedir(logDir);
|
||||
|
||||
DIR *logDir;
|
||||
logDir = opendir((myConfig->readConfigString("LogDir")).c_str());
|
||||
bool dirExists = logDir != NULL;
|
||||
closedir(logDir);
|
||||
// check if logging path exist
|
||||
if(myConfig->readConfigString("LogDir") != "" && dirExists) {
|
||||
|
||||
// check if logging path exist
|
||||
if(myConfig->readConfigString("LogDir") != "" && dirExists) {
|
||||
// detect current time
|
||||
char curDateTime[20];
|
||||
char curDate[11];
|
||||
char curTime[9];
|
||||
time_t now = time(NULL);
|
||||
tm *z = localtime(&now);
|
||||
strftime(curDateTime,20,"%Y-%m-%d_%H%M%S",z);
|
||||
strftime(curDate,11,"%Y-%m-%d",z);
|
||||
strftime(curTime,9,"%H:%M:%S",z);
|
||||
|
||||
// detect current time
|
||||
char curDateTime[20];
|
||||
char curDate[11];
|
||||
char curTime[9];
|
||||
time_t now = time(NULL);
|
||||
tm *z = localtime(&now);
|
||||
strftime(curDateTime,20,"%Y-%m-%d_%H%M%S",z);
|
||||
strftime(curDate,11,"%Y-%m-%d",z);
|
||||
strftime(curTime,9,"%H:%M:%S",z);
|
||||
mySqliteLogFileName.clear();
|
||||
mySqliteLogFileName /= myConfig->readConfigString("LogDir");
|
||||
mySqliteLogFileName /= string("pokerth-log-") + curDateTime + ".pdb";
|
||||
|
||||
mySqliteLogFileName.clear();
|
||||
mySqliteLogFileName /= myConfig->readConfigString("LogDir");
|
||||
mySqliteLogFileName /= string("pokerth-log-") + curDateTime + ".pdb";
|
||||
// open sqlite-db
|
||||
sqlite3_open(mySqliteLogFileName.directory_string().c_str(), &mySqliteLogDb);
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
|
||||
// open sqlite-db
|
||||
sqlite3_open(mySqliteLogFileName.directory_string().c_str(), &mySqliteLogDb);
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
int i;
|
||||
// create session table
|
||||
sql += "CREATE TABLE Session (";
|
||||
sql += "PokerTH_Version TEXT NOT NULL";
|
||||
sql += ",Date TEXT NOT NULL";
|
||||
sql += ",Time TEXT NOT NULL";
|
||||
sql += ",LogVersion INTEGER NOT NULL";
|
||||
sql += ", PRIMARY KEY(Date,Time));";
|
||||
|
||||
int i;
|
||||
// create session table
|
||||
sql += "CREATE TABLE Session (";
|
||||
sql += "PokerTH_Version TEXT NOT NULL";
|
||||
sql += ",Date TEXT NOT NULL";
|
||||
sql += ",Time TEXT NOT NULL";
|
||||
sql += ",LogVersion INTEGER NOT NULL";
|
||||
sql += ", PRIMARY KEY(Date,Time));";
|
||||
sql += "INSERT INTO Session (";
|
||||
sql += "PokerTH_Version";
|
||||
sql += ",Date";
|
||||
sql += ",Time";
|
||||
sql += ",LogVersion";
|
||||
sql += ") VALUES (";
|
||||
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>(SQLITE_LOG_VERSION) + ");";
|
||||
|
||||
sql += "INSERT INTO Session (";
|
||||
sql += "PokerTH_Version";
|
||||
sql += ",Date";
|
||||
sql += ",Time";
|
||||
sql += ",LogVersion";
|
||||
sql += ") VALUES (";
|
||||
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>(SQLITE_LOG_VERSION) + ");";
|
||||
// create game table
|
||||
sql += "CREATE TABLE Game (";
|
||||
sql += "UniqueGameID INTEGER PRIMARY KEY";
|
||||
sql += ",GameID INTEGER NOT NULL";
|
||||
sql += ",Startmoney INTEGER NOT NULL";
|
||||
sql += ",StartSb INTEGER NOT NULL";
|
||||
sql += ",DealerPos INTEGER NOT NULL";
|
||||
sql += ",Winner_Seat INTEGER";
|
||||
sql += ");";
|
||||
|
||||
// create game table
|
||||
sql += "CREATE TABLE Game (";
|
||||
sql += "UniqueGameID INTEGER PRIMARY KEY";
|
||||
sql += ",GameID INTEGER NOT NULL";
|
||||
sql += ",Startmoney INTEGER NOT NULL";
|
||||
sql += ",StartSb INTEGER NOT NULL";
|
||||
sql += ",DealerPos INTEGER NOT NULL";
|
||||
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 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";
|
||||
sql += ",UniqueGameID INTEGER NOT NULL";
|
||||
sql += ",Dealer_Seat INTEGER";
|
||||
sql += ",Sb_Amount INTEGER NOT NULL";
|
||||
sql += ",Sb_Seat INTEGER NOT NULL";
|
||||
sql += ",Bb_Amount INTEGER NOT NULL";
|
||||
sql += ",Bb_Seat INTEGER NOT NULL";
|
||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash INTEGER";
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Card_1 INTEGER";
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Card_2 INTEGER";
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Hand_text TEXT";
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Hand_int INTEGER";
|
||||
}
|
||||
for(i=1; i<=5; i++) {
|
||||
sql += ",BoardCard_" + boost::lexical_cast<std::string>(i) + " INTEGER";
|
||||
}
|
||||
sql += ",PRIMARY KEY(HandID,UniqueGameID));";
|
||||
|
||||
// create action table
|
||||
sql += "CREATE TABLE Action (";
|
||||
sql += "ActionID INTEGER PRIMARY KEY AUTOINCREMENT";
|
||||
sql += ",HandID INTEGER NOT NULL";
|
||||
sql += ",UniqueGameID INTEGER NOT NULL";
|
||||
sql += ",BeRo INTEGER NOT NULL";
|
||||
sql += ",Player INTEGER NOT NULL";
|
||||
sql += ",Action TEXT NOT NULL";
|
||||
sql += ",Amount INTEGER";
|
||||
sql += ");";
|
||||
|
||||
exec_transaction();
|
||||
// create hand table
|
||||
sql += "CREATE TABLE Hand (";
|
||||
sql += "HandID INTEGER NOT NULL";
|
||||
sql += ",UniqueGameID INTEGER NOT NULL";
|
||||
sql += ",Dealer_Seat INTEGER";
|
||||
sql += ",Sb_Amount INTEGER NOT NULL";
|
||||
sql += ",Sb_Seat INTEGER NOT NULL";
|
||||
sql += ",Bb_Amount INTEGER NOT NULL";
|
||||
sql += ",Bb_Seat INTEGER NOT NULL";
|
||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash INTEGER";
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Card_1 INTEGER";
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Card_2 INTEGER";
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Hand_text TEXT";
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Hand_int INTEGER";
|
||||
}
|
||||
for(i=1; i<=5; i++) {
|
||||
sql += ",BoardCard_" + boost::lexical_cast<std::string>(i) + " INTEGER";
|
||||
}
|
||||
sql += ",PRIMARY KEY(HandID,UniqueGameID));";
|
||||
|
||||
// create action table
|
||||
sql += "CREATE TABLE Action (";
|
||||
sql += "ActionID INTEGER PRIMARY KEY AUTOINCREMENT";
|
||||
sql += ",HandID INTEGER NOT NULL";
|
||||
sql += ",UniqueGameID INTEGER NOT NULL";
|
||||
sql += ",BeRo INTEGER NOT NULL";
|
||||
sql += ",Player INTEGER NOT NULL";
|
||||
sql += ",Action TEXT NOT NULL";
|
||||
sql += ",Amount INTEGER";
|
||||
sql += ");";
|
||||
|
||||
exec_transaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,49 +235,46 @@ Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned deal
|
||||
{
|
||||
uniqueGameID++;
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
int i;
|
||||
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
int i;
|
||||
sql += "INSERT INTO Game (";
|
||||
sql += "UniqueGameID";
|
||||
sql += ",GameID";
|
||||
sql += ",Startmoney";
|
||||
sql += ",StartSb";
|
||||
sql += ",DealerPos";
|
||||
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 += ");";
|
||||
|
||||
sql += "INSERT INTO Game (";
|
||||
sql += "UniqueGameID";
|
||||
sql += ",GameID";
|
||||
sql += ",Startmoney";
|
||||
sql += ",StartSb";
|
||||
sql += ",DealerPos";
|
||||
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() +"\"";
|
||||
sql += ");";
|
||||
}
|
||||
i++;
|
||||
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() +"\"";
|
||||
sql += ");";
|
||||
}
|
||||
|
||||
exec_transaction();
|
||||
i++;
|
||||
}
|
||||
|
||||
exec_transaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,82 +290,79 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
||||
(*it_c)->setLogHoleCardsDone(false);
|
||||
}
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
int i;
|
||||
|
||||
sql += "INSERT INTO Hand (";
|
||||
sql += "HandID";
|
||||
sql += ",UniqueGameID";
|
||||
sql += ",Dealer_Seat";
|
||||
sql += ",Sb_Amount";
|
||||
sql += ",Sb_Seat";
|
||||
sql += ",Bb_Amount";
|
||||
sql += ",Bb_Seat";
|
||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash";
|
||||
}
|
||||
sql += ") VALUES (";
|
||||
sql += boost::lexical_cast<string>(currentHandID);
|
||||
sql += "," + boost::lexical_cast<string>(uniqueGameID);
|
||||
sql += "," + boost::lexical_cast<string>(dealerPosition);
|
||||
sql += "," + boost::lexical_cast<string>(smallBlind);
|
||||
sql += "," + boost::lexical_cast<string>(smallBlindPosition);
|
||||
sql += "," + boost::lexical_cast<string>(bigBlind);
|
||||
sql += "," + boost::lexical_cast<string>(bigBlindPosition);
|
||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
sql += "," + boost::lexical_cast<string>((*it_c)->getMyRoundStartCash());
|
||||
} else {
|
||||
sql += ",NULL";
|
||||
}
|
||||
}
|
||||
sql += ");";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
exec_transaction();
|
||||
}
|
||||
|
||||
// !! TODO !! Hack, weil Button-Regel noch falsch und dealerPosition noch teilweise falsche ID enthält (HeadsUp: dealerPosition=bigBlindPosition <-- falsch)
|
||||
bool dealerButtonOnTable = false;
|
||||
int countActivePlayer = 0;
|
||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
countActivePlayer++;
|
||||
if((*it_c)->getMyButton()==BUTTON_DEALER && (*it_c)->getMyActiveStatus()) {
|
||||
dealerButtonOnTable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(countActivePlayer==2) {
|
||||
logPlayerAction(smallBlindPosition,LOG_ACTION_DEALER);
|
||||
} else {
|
||||
if(dealerButtonOnTable) {
|
||||
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(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(bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
|
||||
}
|
||||
}
|
||||
|
||||
// (*it_c)->getMySet() ist ein Hack, da es im Internetspiel vorkam, dass ein Spieler zweimal geloggt wurde mit Blind - einmal jedoch mit $0
|
||||
|
||||
// !! TODO !! Hack
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
int i;
|
||||
|
||||
sql += "INSERT INTO Hand (";
|
||||
sql += "HandID";
|
||||
sql += ",UniqueGameID";
|
||||
sql += ",Dealer_Seat";
|
||||
sql += ",Sb_Amount";
|
||||
sql += ",Sb_Seat";
|
||||
sql += ",Bb_Amount";
|
||||
sql += ",Bb_Seat";
|
||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash";
|
||||
}
|
||||
sql += ") VALUES (";
|
||||
sql += boost::lexical_cast<string>(currentHandID);
|
||||
sql += "," + boost::lexical_cast<string>(uniqueGameID);
|
||||
sql += "," + boost::lexical_cast<string>(dealerPosition);
|
||||
sql += "," + boost::lexical_cast<string>(smallBlind);
|
||||
sql += "," + boost::lexical_cast<string>(smallBlindPosition);
|
||||
sql += "," + boost::lexical_cast<string>(bigBlind);
|
||||
sql += "," + boost::lexical_cast<string>(bigBlindPosition);
|
||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
sql += "," + boost::lexical_cast<string>((*it_c)->getMyRoundStartCash());
|
||||
} else {
|
||||
sql += ",NULL";
|
||||
}
|
||||
}
|
||||
sql += ");";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
exec_transaction();
|
||||
}
|
||||
|
||||
// !! TODO !! Hack, weil Button-Regel noch falsch und dealerPosition noch teilweise falsche ID enthält (HeadsUp: dealerPosition=bigBlindPosition <-- falsch)
|
||||
bool dealerButtonOnTable = false;
|
||||
int countActivePlayer = 0;
|
||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
countActivePlayer++;
|
||||
if((*it_c)->getMyButton()==BUTTON_DEALER && (*it_c)->getMyActiveStatus()) {
|
||||
dealerButtonOnTable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(countActivePlayer==2) {
|
||||
logPlayerAction(smallBlindPosition,LOG_ACTION_DEALER);
|
||||
} else {
|
||||
if(dealerButtonOnTable) {
|
||||
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(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(bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
|
||||
}
|
||||
}
|
||||
|
||||
// (*it_c)->getMySet() ist ein Hack, da es im Internetspiel vorkam, dass ein Spieler zweimal geloggt wurde mit Blind - einmal jedoch mit $0
|
||||
|
||||
// !! TODO !! Hack
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,35 +371,32 @@ void
|
||||
Log::logPlayerAction(string playerName, PlayerActionLog action, int amount)
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
char **result_Player=0;
|
||||
int nRow_Player=0;
|
||||
int nCol_Player=0;
|
||||
char *errmsg = 0;
|
||||
|
||||
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.c_str(),&result_Player,&nRow_Player,&nCol_Player,&errmsg) != SQLITE_OK) {
|
||||
cout << "Error in statement: " << sql_select.c_str() << "[" << errmsg << "]." << endl;
|
||||
// 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.c_str(),&result_Player,&nRow_Player,&nCol_Player,&errmsg) != SQLITE_OK) {
|
||||
cout << "Error in statement: " << sql_select.c_str() << "[" << errmsg << "]." << endl;
|
||||
} else {
|
||||
if(nRow_Player == 1) {
|
||||
logPlayerAction(boost::lexical_cast<int>(result_Player[1]), action, amount);
|
||||
} else {
|
||||
if(nRow_Player == 1) {
|
||||
logPlayerAction(boost::lexical_cast<int>(result_Player[1]), action, amount);
|
||||
} else {
|
||||
cout << "Implausible information about player " << playerName << " in log-db!" << endl;
|
||||
}
|
||||
cout << "Implausible information about player " << playerName << " in log-db!" << endl;
|
||||
}
|
||||
|
||||
sqlite3_free_table(result_Player);
|
||||
}
|
||||
|
||||
sqlite3_free_table(result_Player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,107 +405,104 @@ void
|
||||
Log::logPlayerAction(int seat, PlayerActionLog action, int amount)
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
|
||||
if(action!=LOG_ACTION_NONE) {
|
||||
sql += "INSERT INTO Action (";
|
||||
sql += "HandID";
|
||||
sql += ",UniqueGameID";
|
||||
sql += ",BeRo";
|
||||
sql += ",Player";
|
||||
sql += ",Action";
|
||||
sql += ",Amount";
|
||||
sql += ") VALUES (";
|
||||
sql += boost::lexical_cast<string>(currentHandID);
|
||||
sql += "," + boost::lexical_cast<string>(uniqueGameID);
|
||||
sql += "," + boost::lexical_cast<string>(currentRound);;
|
||||
sql += "," + boost::lexical_cast<string>(seat);
|
||||
switch(action) {
|
||||
case LOG_ACTION_DEALER:
|
||||
sql += ",'starts as dealer'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_SMALL_BLIND:
|
||||
sql += ",'posts small blind'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_BIG_BLIND:
|
||||
sql += ",'posts big blind'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_FOLD:
|
||||
sql += ",'folds'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_CHECK:
|
||||
sql += ",'checks'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_CALL:
|
||||
sql += ",'calls'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_BET:
|
||||
sql += ",'bets'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_ALL_IN:
|
||||
sql += ",'is all in with'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_SHOW:
|
||||
sql += ",'shows'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_HAS:
|
||||
sql += ",'has'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_WIN:
|
||||
sql += ",'wins'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_WIN_SIDE_POT:
|
||||
sql += ",'wins (side pot)'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_SIT_OUT:
|
||||
sql += ",'sits out'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_WIN_GAME:
|
||||
sql += ",'wins game'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_LEFT:
|
||||
sql += ",'has left the game'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_KICKED:
|
||||
sql += ",'was kicked from the game'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_ADMIN:
|
||||
sql += ",'is game admin now'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_JOIN:
|
||||
sql += ",'has joined the game'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
sql += ");";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
exec_transaction();
|
||||
}
|
||||
if(action!=LOG_ACTION_NONE) {
|
||||
sql += "INSERT INTO Action (";
|
||||
sql += "HandID";
|
||||
sql += ",UniqueGameID";
|
||||
sql += ",BeRo";
|
||||
sql += ",Player";
|
||||
sql += ",Action";
|
||||
sql += ",Amount";
|
||||
sql += ") VALUES (";
|
||||
sql += boost::lexical_cast<string>(currentHandID);
|
||||
sql += "," + boost::lexical_cast<string>(uniqueGameID);
|
||||
sql += "," + boost::lexical_cast<string>(currentRound);;
|
||||
sql += "," + boost::lexical_cast<string>(seat);
|
||||
switch(action) {
|
||||
case LOG_ACTION_DEALER:
|
||||
sql += ",'starts as dealer'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_SMALL_BLIND:
|
||||
sql += ",'posts small blind'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_BIG_BLIND:
|
||||
sql += ",'posts big blind'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_FOLD:
|
||||
sql += ",'folds'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_CHECK:
|
||||
sql += ",'checks'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_CALL:
|
||||
sql += ",'calls'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_BET:
|
||||
sql += ",'bets'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_ALL_IN:
|
||||
sql += ",'is all in with'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_SHOW:
|
||||
sql += ",'shows'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_HAS:
|
||||
sql += ",'has'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_WIN:
|
||||
sql += ",'wins'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_WIN_SIDE_POT:
|
||||
sql += ",'wins (side pot)'";
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
break;
|
||||
case LOG_ACTION_SIT_OUT:
|
||||
sql += ",'sits out'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_WIN_GAME:
|
||||
sql += ",'wins game'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_LEFT:
|
||||
sql += ",'has left the game'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_KICKED:
|
||||
sql += ",'was kicked from the game'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_ADMIN:
|
||||
sql += ",'is game admin now'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
case LOG_ACTION_JOIN:
|
||||
sql += ",'has joined the game'";
|
||||
sql += ",NULL";
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
sql += ");";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
exec_transaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -552,42 +537,40 @@ Log::transformPlayerActionLog(PlayerAction action)
|
||||
void
|
||||
Log::logBoardCards(int boardCards[5])
|
||||
{
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
|
||||
switch(currentRound) {
|
||||
case GAME_STATE_FLOP: {
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "BoardCard_1=" + boost::lexical_cast<string>(boardCards[0]) + ",";
|
||||
sql += "BoardCard_2=" + boost::lexical_cast<string>(boardCards[1]) + ",";
|
||||
sql += "BoardCard_3=" + boost::lexical_cast<string>(boardCards[2]);
|
||||
}
|
||||
break;
|
||||
case GAME_STATE_TURN: {
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "BoardCard_4=" + boost::lexical_cast<string>(boardCards[3]);
|
||||
}
|
||||
break;
|
||||
case GAME_STATE_RIVER: {
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "BoardCard_5=" + boost::lexical_cast<string>(boardCards[4]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
sql += " WHERE ";
|
||||
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
|
||||
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
|
||||
sql += ";";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
exec_transaction();
|
||||
}
|
||||
switch(currentRound) {
|
||||
case GAME_STATE_FLOP: {
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "BoardCard_1=" + boost::lexical_cast<string>(boardCards[0]) + ",";
|
||||
sql += "BoardCard_2=" + boost::lexical_cast<string>(boardCards[1]) + ",";
|
||||
sql += "BoardCard_3=" + boost::lexical_cast<string>(boardCards[2]);
|
||||
}
|
||||
break;
|
||||
case GAME_STATE_TURN: {
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "BoardCard_4=" + boost::lexical_cast<string>(boardCards[3]);
|
||||
}
|
||||
break;
|
||||
case GAME_STATE_RIVER: {
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "BoardCard_5=" + boost::lexical_cast<string>(boardCards[4]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
sql += " WHERE ";
|
||||
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
|
||||
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
|
||||
sql += ";";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
exec_transaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -612,44 +595,41 @@ void
|
||||
Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog)
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if( mySqliteLogDb != 0) {
|
||||
|
||||
int myCards[2];
|
||||
player->getMyCards(myCards);
|
||||
sql += "UPDATE Hand SET ";
|
||||
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(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0 && !player->getLogHoleCardsDone()) {
|
||||
sql+= ",";
|
||||
}
|
||||
if(!player->getLogHoleCardsDone()) {
|
||||
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
|
||||
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_2=" + boost::lexical_cast<string>(myCards[1]);
|
||||
}
|
||||
sql += " WHERE ";
|
||||
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
|
||||
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
|
||||
sql += ";";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0 || forceExecLog) {
|
||||
exec_transaction();
|
||||
}
|
||||
|
||||
if(!player->getLogHoleCardsDone()) {
|
||||
logPlayerAction(player->getMyName(),LOG_ACTION_SHOW);
|
||||
} else {
|
||||
logPlayerAction(player->getMyName(),LOG_ACTION_HAS);
|
||||
}
|
||||
|
||||
player->setLogHoleCardsDone(true);
|
||||
if( mySqliteLogDb != 0) {
|
||||
|
||||
int myCards[2];
|
||||
player->getMyCards(myCards);
|
||||
sql += "UPDATE Hand SET ";
|
||||
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(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0 && !player->getLogHoleCardsDone()) {
|
||||
sql+= ",";
|
||||
}
|
||||
if(!player->getLogHoleCardsDone()) {
|
||||
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
|
||||
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_2=" + boost::lexical_cast<string>(myCards[1]);
|
||||
}
|
||||
sql += " WHERE ";
|
||||
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
|
||||
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
|
||||
sql += ";";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0 || forceExecLog) {
|
||||
exec_transaction();
|
||||
}
|
||||
|
||||
if(!player->getLogHoleCardsDone()) {
|
||||
logPlayerAction(player->getMyName(),LOG_ACTION_SHOW);
|
||||
} else {
|
||||
logPlayerAction(player->getMyName(),LOG_ACTION_HAS);
|
||||
}
|
||||
|
||||
player->setLogHoleCardsDone(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -752,11 +732,9 @@ Log::exec_transaction()
|
||||
//void
|
||||
//Log::closeLogDbAtExit()
|
||||
//{
|
||||
// if(SQLITE_LOG) {
|
||||
// // close sqlite-db
|
||||
// sqlite3_close(mySqliteLogDb);
|
||||
// mySqliteLogDb = NULL;
|
||||
// }
|
||||
// // close sqlite-db
|
||||
// sqlite3_close(mySqliteLogDb);
|
||||
// mySqliteLogDb = NULL;
|
||||
//}
|
||||
|
||||
void
|
||||
|
||||
@@ -37,9 +37,6 @@
|
||||
#define MIN_GUI_SPEED 1
|
||||
#define MAX_GUI_SPEED 11
|
||||
|
||||
#define SQLITE_LOG 1
|
||||
#define HTML_LOG 0
|
||||
|
||||
#define POKERTH_VERSION_MAJOR 1
|
||||
#define POKERTH_VERSION_MINOR 11
|
||||
#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR)
|
||||
|
||||
@@ -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::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::SignalNetClientServerListAdd(unsigned serverId)
|
||||
{
|
||||
|
||||
@@ -118,8 +118,6 @@ public:
|
||||
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);
|
||||
|
||||
@@ -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 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;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -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(signalLogSpectatorJoinedMsg(QString)), this, SLOT(logSpectatorJoinedMsg(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 = "";
|
||||
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()));
|
||||
|
||||
if(HTML_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
|
||||
// delete old log files - TODO: move to Log
|
||||
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
||||
|
||||
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>");
|
||||
#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)
|
||||
{
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
boost::shared_ptr<HandInterface> currentHand = myW->getSession()->getCurrentGame()->getCurrentHand();
|
||||
|
||||
PlayerList activePlayerList = currentHand->getActivePlayerList();
|
||||
|
||||
#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>");
|
||||
#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>");
|
||||
#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)
|
||||
{
|
||||
|
||||
// log blinds
|
||||
#ifdef GUI_800x480
|
||||
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()+";\">"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>");
|
||||
#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)
|
||||
@@ -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>");
|
||||
}
|
||||
#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)
|
||||
{
|
||||
|
||||
#ifdef GUI_800x480
|
||||
myW->tabs.textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
||||
#else
|
||||
myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
||||
#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)
|
||||
{
|
||||
|
||||
QString round;
|
||||
|
||||
switch (roundID) {
|
||||
|
||||
case 1:
|
||||
round = "Flop";
|
||||
#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
|
||||
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
|
||||
break;
|
||||
case 2:
|
||||
round = "Turn";
|
||||
#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
|
||||
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
|
||||
break;
|
||||
case 3:
|
||||
round = "River";
|
||||
#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
|
||||
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
|
||||
break;
|
||||
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;
|
||||
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 = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>");
|
||||
#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)
|
||||
{
|
||||
|
||||
QString action;
|
||||
if(wasKicked) action = "was kicked from";
|
||||
else action = "has left";
|
||||
@@ -490,44 +269,15 @@ void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
|
||||
#else
|
||||
myW->textBrowser_Log->append( "<span style=\"color:#"+myStyle->getChatLogTextColor()+";\"><i>"+playerName+" "+action+" the game!</i></span>");
|
||||
#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)
|
||||
{
|
||||
|
||||
#ifdef GUI_800x480
|
||||
myW->tabs.textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
||||
#else
|
||||
myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
||||
#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)
|
||||
@@ -551,27 +301,11 @@ void guiLog::logSpectatorJoinedMsg(QString playerName)
|
||||
|
||||
void guiLog::logPlayerWinGame(QString playerName, int gameID)
|
||||
{
|
||||
|
||||
#ifdef GUI_800x480
|
||||
myW->tabs.textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
||||
#else
|
||||
myW->textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
||||
#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)
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
|
||||
@@ -81,8 +81,6 @@ public slots:
|
||||
void logSpectatorLeftMsg(QString playerName, int wasKicked);
|
||||
void logSpectatorJoinedMsg(QString playerName);
|
||||
void logPlayerWinGame(QString playerName, int gameID);
|
||||
void flushLogAtGame(int gameID);
|
||||
void flushLogAtHand();
|
||||
void exportLogPdbToHtml(QString fileStringPdb, QString exportFileString);
|
||||
void exportLogPdbToTxt(QString fileStringPdb, QString exportFileString);
|
||||
void showLog(QString fileStringPdb, QTextBrowser *tb, int uniqueGameID = 0);
|
||||
@@ -115,8 +113,6 @@ signals:
|
||||
void signalLogSpectatorJoinedMsg(QString playerName);
|
||||
void signalLogNewGameAdminMsg(QString playerName);
|
||||
void signalLogPlayerWinGame(QString playerName, int gameID);
|
||||
void signalFlushLogAtGame(int gameID);
|
||||
void signalFlushLogAtHand();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -287,14 +287,6 @@ void GuiWrapper::logPlayerWinGame(std::string playerName, int 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)
|
||||
|
||||
@@ -124,8 +124,6 @@ public:
|
||||
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 SignalNetClientServerListAdd(unsigned serverId);
|
||||
|
||||
@@ -1800,7 +1800,6 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMySet(),
|
||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(),
|
||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
|
||||
client->GetGui().flushLogAtHand();
|
||||
client->GetClientLog()->logNewHandMsg(
|
||||
curGame->getCurrentHandID(),
|
||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1,
|
||||
|
||||
Reference in New Issue
Block a user