- some changes in sqlite logging

- replace beroID-int by GameState in hand
This commit is contained in:
floty
2011-10-22 23:57:02 +00:00
parent a958c4916e
commit ad4aace71d
11 changed files with 54 additions and 97 deletions
+12 -70
View File
@@ -359,71 +359,6 @@ void Log::logBoardCards(int bero, int boardCards[5])
}
}
void Log::logHoleCards(int bero, PlayerList activePlayerList)
{
if(SQLITE_LOG) {
if(myConfig->readConfigInt("LogOnOff") & !logHoleCardsDone) {
//if write logfiles is enabled
if( mySqliteLogDb != 0 ) {
// sqlite-db is open
PlayerListConstIterator it_c;
int myCards[2];
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
(*it_c)->getMyCards(myCards);
sql += "UPDATE Hand SET ";
sql += "Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
sql += ",Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Card_2=" + boost::lexical_cast<string>(myCards[1]);
sql += " WHERE ";
sql += "GameID=" + boost::lexical_cast<string>(curGameID) + " AND ";
sql += "HandID=" + boost::lexical_cast<string>(curHandID);
sql += ";";
if(myConfig->readConfigInt("LogInterval") == 0) {
exec_transaction(&sql);
}
logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_SHOW);
}
}
logHoleCardsDone = true;
}
}
}
}
//void Log::logHandName(int seat, int cardsValueInt, PlayerList activePlayerList)
//{
// if(SQLITE_LOG) {
// if(myConfig->readConfigInt("LogOnOff")) {
// //if write logfiles is enabled
// if( mySqliteLogDb != 0 ) {
// // sqlite-db is open
// sql += "UPDATE Hand SET ";
// sql += "Seat_" + boost::lexical_cast<string>(seat) + "_Hand_text=\"" + CardsValue::determineHandName(cardsValueInt,activePlayerList) + "\"";
// sql += ",Seat_" + boost::lexical_cast<string>(seat) + "_Hand_int=" + boost::lexical_cast<string>(cardsValueInt);
// sql += " WHERE ";
// sql += "GameID=" + boost::lexical_cast<string>(curGameID) + " AND ";
// sql += "HandID=" + boost::lexical_cast<string>(curHandID);
// sql += ";";
// if(myConfig->readConfigInt("LogInterval") == 0) {
// exec_transaction(&sql);
// }
// logPlayerAction(5,seat,LOG_ACTION_HAS);
// }
// }
// }
//}
void Log::logHoleCardsHandName(int bero, PlayerList activePlayerList)
{
if(SQLITE_LOG) {
@@ -431,8 +366,8 @@ void Log::logHoleCardsHandName(int bero, PlayerList activePlayerList)
if(myConfig->readConfigInt("LogOnOff")) {
//if write logfiles is enabled
if( mySqliteLogDb != 0 ) {
// sqlite-db is open
if( mySqliteLogDb != 0 && (bero==5 || !logHoleCardsDone)) {
// sqlite-db is open and we are in postriver or before postriver doesn't log hole cards til now
PlayerListConstIterator it_c;
int myCards[2];
@@ -441,10 +376,15 @@ void Log::logHoleCardsHandName(int bero, PlayerList activePlayerList)
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
(*it_c)->getMyCards(myCards);
sql += "UPDATE Hand SET ";
sql += "Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName((*it_c)->getMyCardsValueInt(),activePlayerList) + "\"";
sql += ",Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Hand_int=" + boost::lexical_cast<string>((*it_c)->getMyCardsValueInt());
if(bero==5) {
sql += "Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName((*it_c)->getMyCardsValueInt(),activePlayerList) + "\"";
sql += ",Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Hand_int=" + boost::lexical_cast<string>((*it_c)->getMyCardsValueInt());
}
if(bero==5 && !logHoleCardsDone) {
sql+= ",";
}
if(!logHoleCardsDone) {
sql += ",Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
sql += "Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
sql += ",Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Card_2=" + boost::lexical_cast<string>(myCards[1]);
}
sql += " WHERE ";
@@ -462,6 +402,8 @@ void Log::logHoleCardsHandName(int bero, PlayerList activePlayerList)
}
}
}
logHoleCardsDone = true;
}
}
}