some changes in hole cards logging
This commit is contained in:
@@ -84,12 +84,12 @@ void LocalBeRoPostRiver::postRiverRun()
|
||||
getMyHand()->getBoard()->setPot(0);
|
||||
|
||||
// Logging hole Cards / Hands
|
||||
int myCards[2];
|
||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
(*it_c)->getMyCards(myCards);
|
||||
getMyHand()->getLog()->logHoleCardsHandName((*it_c)->getMyID()+1,myCards,(*it_c)->getMyCardsValueInt(),getMyHand()->getActivePlayerList());
|
||||
}
|
||||
int nonfoldPlayersCounter = 0;
|
||||
for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++;
|
||||
}
|
||||
if(nonfoldPlayersCounter>1) {
|
||||
getMyHand()->getLog()->logHoleCardsHandName(5,getMyHand()->getActivePlayerList());
|
||||
}
|
||||
|
||||
//starte die Animaionsreihe
|
||||
|
||||
@@ -627,13 +627,7 @@ void LocalHand::switchRounds()
|
||||
myGui->refreshSet();
|
||||
myGui->flipHolecardsAllIn();
|
||||
// Logging HoleCards
|
||||
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);
|
||||
myLog->logHoleCards(currentRound+1,(*it_c)->getMyID()+1,myCards);
|
||||
}
|
||||
}
|
||||
myLog->logHoleCards(currentRound+1,activePlayerList);
|
||||
|
||||
if (currentRound < 4) // do not increment past 4
|
||||
currentRound++;
|
||||
|
||||
+77
-61
@@ -28,7 +28,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
Log::Log(ConfigFile *c) : myConfig(c), curGameID(0), curHandID(0), sql(""), logHoleCardsDone(false)
|
||||
Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID(0), sql(""), logHoleCardsDone(false)
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
@@ -183,6 +183,7 @@ void Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, uns
|
||||
{
|
||||
|
||||
curHandID = handID;
|
||||
logHoleCardsDone = false;
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
@@ -358,37 +359,72 @@ void Log::logBoardCards(int bero, int boardCards[5])
|
||||
}
|
||||
}
|
||||
|
||||
void Log::logHoleCards(int bero, int seat, int cards[2])
|
||||
void Log::logHoleCards(int bero, PlayerList activePlayerList)
|
||||
{
|
||||
|
||||
logHoleCardsDone = false;
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
if(myConfig->readConfigInt("LogOnOff") & !logHoleCardsDone) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "Seat_" + boost::lexical_cast<string>(seat) + "_Card_1=" + boost::lexical_cast<string>(cards[0]);
|
||||
sql += ",Seat_" + boost::lexical_cast<string>(seat) + "_Card_2=" + boost::lexical_cast<string>(cards[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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
logPlayerAction(bero,seat,LOG_ACTION_SHOW);
|
||||
logHoleCardsDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Log::logHandName(int seat, int cardsValueInt, PlayerList activePlayerList)
|
||||
//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) {
|
||||
|
||||
@@ -398,53 +434,33 @@ void Log::logHandName(int seat, int cardsValueInt, PlayerList activePlayerList)
|
||||
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);
|
||||
}
|
||||
PlayerListConstIterator it_c;
|
||||
int myCards[2];
|
||||
|
||||
logPlayerAction(5,seat,LOG_ACTION_HAS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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) + "_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(!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_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);
|
||||
}
|
||||
|
||||
void Log::logHoleCardsHandName(int seat, int cards[2], 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);
|
||||
if(!logHoleCardsDone) {
|
||||
sql += ",Seat_" + boost::lexical_cast<string>(seat) + "_Card_1=" + boost::lexical_cast<string>(cards[0]);
|
||||
sql += ",Seat_" + boost::lexical_cast<string>(seat) + "_Card_2=" + boost::lexical_cast<string>(cards[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(5,seat,LOG_ACTION_SHOW);
|
||||
if(!logHoleCardsDone) {
|
||||
logPlayerAction(5,seat,LOG_ACTION_SHOW);
|
||||
} else {
|
||||
logPlayerAction(5,seat,LOG_ACTION_HAS);
|
||||
if(!logHoleCardsDone) {
|
||||
logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_SHOW);
|
||||
} else {
|
||||
logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_HAS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -38,9 +38,9 @@ public:
|
||||
void logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned smallBlindPosition, int bigBlind, unsigned bigBlindPosition, PlayerList seatsList);
|
||||
void logPlayerAction(int bero, int seat, PlayerActionLog action, int amount = 0);
|
||||
void logBoardCards(int bero, int boardCards[5]);
|
||||
void logHoleCards(int bero, int seat, int cards[2]);
|
||||
void logHandName(int seat, int cardsValueInt, PlayerList activePlayerList);
|
||||
void logHoleCardsHandName(int seat, int cards[2], int cardsValueInt, PlayerList activePlayerList);
|
||||
void logHoleCards(int bero, PlayerList activePlayerList);
|
||||
// void logHandName(int seat, int cardsValueInt, PlayerList activePlayerList);
|
||||
void logHoleCardsHandName(int bero, PlayerList activePlayerList);
|
||||
void exec_transaction(std::string *sql);
|
||||
// void closeLogDbAtExit();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user