optimizing local sqlite-logging; implementing first steps network client sqlite-logging
This commit is contained in:
@@ -152,7 +152,7 @@ void LocalBeRo::run()
|
||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID");
|
||||
}
|
||||
}
|
||||
myHand->getLog()->logBoardCards(myBeRoID+1, tempBoardCardsArray);
|
||||
myHand->getLog()->logBoardCards(myBeRoID, tempBoardCardsArray);
|
||||
logBoardCardsDone = true;
|
||||
|
||||
}
|
||||
|
||||
@@ -89,13 +89,13 @@ void LocalBeRoPostRiver::postRiverRun()
|
||||
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++;
|
||||
}
|
||||
if(nonfoldPlayersCounter>1) {
|
||||
getMyHand()->getLog()->logHoleCardsHandName(5,getMyHand()->getActivePlayerList());
|
||||
getMyHand()->getLog()->logHoleCardsHandName(GAME_STATE_POST_RIVER,getMyHand()->getActivePlayerList());
|
||||
}
|
||||
|
||||
// logging winner of the hand
|
||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == highestCardsValue) {
|
||||
getMyHand()->getLog()->logPlayerAction(5,(*it_c)->getMyID()+1,LOG_ACTION_WIN,(*it_c)->getLastMoneyWon());
|
||||
getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN,(*it_c)->getLastMoneyWon());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ void LocalBeRoPostRiver::postRiverRun()
|
||||
|
||||
for(it_int = winners.begin(); it_int != winners.end(); ++it_int) {
|
||||
if((*it_int) == (*it_c)->getMyUniqueID()) {
|
||||
getMyHand()->getLog()->logPlayerAction(5,(*it_c)->getMyID()+1,LOG_ACTION_WIN_SIDE_POT,(*it_c)->getLastMoneyWon());
|
||||
getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_SIDE_POT,(*it_c)->getLastMoneyWon());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ void LocalBeRoPostRiver::postRiverRun()
|
||||
// log player sits out
|
||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if((*it_c)->getMyCash() == 0) {
|
||||
getMyHand()->getLog()->logPlayerAction(5, (*it_c)->getMyID()+1, LOG_ACTION_SIT_OUT);
|
||||
getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER, (*it_c)->getMyID()+1, LOG_ACTION_SIT_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void LocalBeRoPostRiver::postRiverRun()
|
||||
if (playersPositiveCashCounter==1) {
|
||||
for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if ((*it_c)->getMyCash() > 0) {
|
||||
getMyHand()->getLog()->logPlayerAction(5,(*it_c)->getMyID()+1,LOG_ACTION_WIN_GAME);
|
||||
getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_GAME);
|
||||
}
|
||||
}
|
||||
// for log after every game
|
||||
|
||||
@@ -363,10 +363,10 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
|
||||
assignButtons();
|
||||
|
||||
myLog->logNewHandMsg(myID, dealerPosition+1, smallBlind, smallBlindPosition+1, 2*smallBlind, bigBlindPosition+1, seatsList);
|
||||
|
||||
setBlinds();
|
||||
|
||||
myLog->logNewHandMsg(myID, dealerPosition+1, smallBlind, smallBlindPosition+1, 2*smallBlind, bigBlindPosition+1, seatsList);
|
||||
|
||||
myBeRo = myFactory->createBeRo(this, dealerPosition, smallBlind);
|
||||
}
|
||||
|
||||
@@ -489,13 +489,11 @@ void LocalHand::setBlinds()
|
||||
// All in ?
|
||||
if((*it_c)->getMyCash() <= smallBlind) {
|
||||
|
||||
myLog->logPlayerAction(0,smallBlindPosition+1,LOG_ACTION_SMALL_BLIND,(*it_c)->getMyCash());
|
||||
(*it_c)->setMySet((*it_c)->getMyCash());
|
||||
// 1 to do not log this
|
||||
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
||||
|
||||
} else {
|
||||
myLog->logPlayerAction(0,smallBlindPosition+1,LOG_ACTION_SMALL_BLIND,smallBlind);
|
||||
(*it_c)->setMySet(smallBlind);
|
||||
}
|
||||
}
|
||||
@@ -511,13 +509,11 @@ void LocalHand::setBlinds()
|
||||
// all in ?
|
||||
if((*it_c)->getMyCash() <= 2*smallBlind) {
|
||||
|
||||
myLog->logPlayerAction(0,bigBlindPosition+1,LOG_ACTION_BIG_BLIND,(*it_c)->getMyCash());
|
||||
(*it_c)->setMySet((*it_c)->getMyCash());
|
||||
// 1 to do not log this
|
||||
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
||||
|
||||
} else {
|
||||
myLog->logPlayerAction(0,bigBlindPosition+1,LOG_ACTION_BIG_BLIND,2*smallBlind);
|
||||
(*it_c)->setMySet(2*smallBlind);
|
||||
}
|
||||
}
|
||||
@@ -531,31 +527,7 @@ void LocalHand::switchRounds()
|
||||
// logging last player action
|
||||
PlayerListConstIterator previousPlayerIt = getRunningPlayerIt(previousPlayerID);
|
||||
if(previousPlayerIt != runningPlayerList->end()) {
|
||||
switch((*previousPlayerIt)->getMyAction()) {
|
||||
case PLAYER_ACTION_FOLD: {
|
||||
myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_FOLD);
|
||||
}
|
||||
break;
|
||||
case PLAYER_ACTION_CHECK: {
|
||||
myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_CHECK);
|
||||
}
|
||||
break;
|
||||
case PLAYER_ACTION_CALL: {
|
||||
myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_CALL,(*previousPlayerIt)->getMySet());
|
||||
}
|
||||
break;
|
||||
case PLAYER_ACTION_BET:
|
||||
case PLAYER_ACTION_RAISE: {
|
||||
myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_BET,(*previousPlayerIt)->getMySet());
|
||||
}
|
||||
break;
|
||||
case PLAYER_ACTION_ALLIN: {
|
||||
myLog->logPlayerAction(currentRound+1,(*previousPlayerIt)->getMyID()+1,LOG_ACTION_ALL_IN,(*previousPlayerIt)->getMySet());
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
}
|
||||
}
|
||||
myLog->logPlayerAction(currentRound,(*previousPlayerIt)->getMyID()+1,myLog->transformPlayerActionLog((*previousPlayerIt)->getMyAction()),(*previousPlayerIt)->getMySet());
|
||||
}
|
||||
|
||||
PlayerListIterator it, it_1;
|
||||
@@ -658,7 +630,7 @@ void LocalHand::switchRounds()
|
||||
myGui->flipHolecardsAllIn();
|
||||
// Logging HoleCards
|
||||
if(currentRound<GAME_STATE_RIVER) {
|
||||
myLog->logHoleCardsHandName(currentRound+1,activePlayerList);
|
||||
myLog->logHoleCardsHandName(currentRound,activePlayerList);
|
||||
}
|
||||
|
||||
if (currentRound < GAME_STATE_POST_RIVER) // do not increment past 4
|
||||
@@ -670,7 +642,7 @@ void LocalHand::switchRounds()
|
||||
|
||||
myBoard->getMyCards(tempBoardCardsArray);
|
||||
myGui->logDealBoardCardsMsg(currentRound, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
||||
myLog->logBoardCards(currentRound+1, tempBoardCardsArray);
|
||||
myLog->logBoardCards(currentRound, tempBoardCardsArray);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3222,12 +3222,12 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
break;
|
||||
// fold
|
||||
case 1: {
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_FOLD);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_FOLD);
|
||||
}
|
||||
break;
|
||||
// check
|
||||
case 2: {
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CHECK);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_CHECK);
|
||||
}
|
||||
break;
|
||||
// call
|
||||
@@ -3238,14 +3238,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
mySet += myCash;
|
||||
myCash = 0;
|
||||
myAction = PLAYER_ACTION_ALLIN;
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
// cout << "evaluation(call) - mySet: " << mySet << endl;
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
myCash = myCash - highestSet + mySet;
|
||||
mySet = highestSet;
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CALL,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_CALL,mySet);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3262,7 +3262,7 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
myCash = 0;
|
||||
myAction = PLAYER_ACTION_ALLIN;
|
||||
highestSet = mySet;
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
@@ -3270,7 +3270,7 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
myCash = myCash - bet;
|
||||
mySet = bet;
|
||||
highestSet = mySet;
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_BET,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_BET,mySet);
|
||||
|
||||
}
|
||||
// lastPlayerAction für Karten umblättern reihenfolge setzrn
|
||||
@@ -3285,14 +3285,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
mySet += myCash;
|
||||
myCash = 0;
|
||||
myAction = PLAYER_ACTION_ALLIN;
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
myCash = myCash - highestSet + mySet;
|
||||
mySet = highestSet;
|
||||
myAction = PLAYER_ACTION_CALL;
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CALL,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_CALL,mySet);
|
||||
}
|
||||
} else {
|
||||
if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) {
|
||||
@@ -3329,7 +3329,7 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
myAction = PLAYER_ACTION_ALLIN;
|
||||
highestSet = mySet;
|
||||
}
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
@@ -3339,14 +3339,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
highestSet = mySet;
|
||||
// lastPlayerAction für Karten umblättern reihenfolge setzrn
|
||||
currentHand->setLastActionPlayerID(myUniqueID);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_BET,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_BET,mySet);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// all in
|
||||
case 6: {
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -171,4 +171,3 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
+124
-87
@@ -221,7 +221,7 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
||||
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)->getMyCash());
|
||||
sql += "," + boost::lexical_cast<string>((*it_c)->getMyRoundStartCash());
|
||||
} else {
|
||||
sql += ",NULL";
|
||||
}
|
||||
@@ -243,20 +243,30 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
||||
}
|
||||
}
|
||||
if(countActivePlayer==2) {
|
||||
logPlayerAction(0,smallBlindPosition,LOG_ACTION_DEALER);
|
||||
logPlayerAction(GAME_STATE_PREFLOP,smallBlindPosition,LOG_ACTION_DEALER);
|
||||
} else {
|
||||
if(dealerButtonOnTable) {
|
||||
logPlayerAction(0,dealerPosition,LOG_ACTION_DEALER);
|
||||
logPlayerAction(GAME_STATE_PREFLOP,dealerPosition,LOG_ACTION_DEALER);
|
||||
}
|
||||
}
|
||||
// !! TODO !! Hack
|
||||
|
||||
// log blinds
|
||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
||||
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
||||
logPlayerAction(GAME_STATE_PREFLOP,smallBlindPosition,LOG_ACTION_SMALL_BLIND,(*it_c)->getMySet());
|
||||
}
|
||||
if((*it_c)->getMyButton() == BUTTON_BIG_BLIND) {
|
||||
logPlayerAction(GAME_STATE_PREFLOP,bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::logPlayerAction(int bero, int seat, PlayerActionLog action, int amount)
|
||||
Log::logPlayerAction(GameState bero, int seat, PlayerActionLog action, int amount)
|
||||
{
|
||||
|
||||
if(SQLITE_LOG) {
|
||||
@@ -267,80 +277,116 @@ Log::logPlayerAction(int bero, int seat, PlayerActionLog action, int amount)
|
||||
if( mySqliteLogDb != 0 ) {
|
||||
// sqlite-db is open
|
||||
|
||||
sql += "INSERT INTO Action (";
|
||||
sql += "HandID";
|
||||
sql += ",GameID";
|
||||
sql += ",BeRo";
|
||||
sql += ",Player";
|
||||
sql += ",Action";
|
||||
sql += ",Amount";
|
||||
sql += ") VALUES (";
|
||||
sql += boost::lexical_cast<string>(curHandID);
|
||||
sql += "," + boost::lexical_cast<string>(curGameID);
|
||||
sql += "," + boost::lexical_cast<string>(bero);;
|
||||
sql += "," + boost::lexical_cast<string>(seat);
|
||||
switch(action) {
|
||||
case LOG_ACTION_DEALER:
|
||||
sql += ",'starts as dealer'";
|
||||
break;
|
||||
case LOG_ACTION_SMALL_BLIND:
|
||||
sql += ",'posts small blind'";
|
||||
break;
|
||||
case LOG_ACTION_BIG_BLIND:
|
||||
sql += ",'posts big blind'";
|
||||
break;
|
||||
case LOG_ACTION_FOLD:
|
||||
sql += ",'folds'";
|
||||
break;
|
||||
case LOG_ACTION_CHECK:
|
||||
sql += ",'checks'";
|
||||
break;
|
||||
case LOG_ACTION_CALL:
|
||||
sql += ",'calls'";
|
||||
break;
|
||||
case LOG_ACTION_BET:
|
||||
sql += ",'bets'";
|
||||
break;
|
||||
case LOG_ACTION_ALL_IN:
|
||||
sql += ",'is all in with'";
|
||||
break;
|
||||
case LOG_ACTION_SHOW:
|
||||
sql += ",'shows'";
|
||||
break;
|
||||
case LOG_ACTION_HAS:
|
||||
sql += ",'has'";
|
||||
break;
|
||||
case LOG_ACTION_WIN:
|
||||
sql += ",'wins'";
|
||||
break;
|
||||
case LOG_ACTION_WIN_SIDE_POT:
|
||||
sql += ",'wins (side pot)'";
|
||||
break;
|
||||
case LOG_ACTION_SIT_OUT:
|
||||
sql += ",'sits out'";
|
||||
break;
|
||||
case LOG_ACTION_WIN_GAME:
|
||||
sql += ",'wins game'";
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if(amount>0) {
|
||||
sql += "," + boost::lexical_cast<string>(amount);
|
||||
} else {
|
||||
sql += ",NULL";
|
||||
}
|
||||
sql += ");";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
exec_transaction();
|
||||
if(action!=LOG_ACTION_NONE) {
|
||||
sql += "INSERT INTO Action (";
|
||||
sql += "HandID";
|
||||
sql += ",GameID";
|
||||
sql += ",BeRo";
|
||||
sql += ",Player";
|
||||
sql += ",Action";
|
||||
sql += ",Amount";
|
||||
sql += ") VALUES (";
|
||||
sql += boost::lexical_cast<string>(curHandID);
|
||||
sql += "," + boost::lexical_cast<string>(curGameID);
|
||||
sql += "," + boost::lexical_cast<string>(bero);;
|
||||
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;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
sql += ");";
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
exec_transaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlayerActionLog
|
||||
Log::transformPlayerActionLog(PlayerAction action)
|
||||
{
|
||||
switch(action) {
|
||||
case PLAYER_ACTION_FOLD:
|
||||
return LOG_ACTION_FOLD;
|
||||
break;
|
||||
case PLAYER_ACTION_CHECK:
|
||||
return LOG_ACTION_CHECK;
|
||||
break;
|
||||
case PLAYER_ACTION_CALL:
|
||||
return LOG_ACTION_CALL;
|
||||
break;
|
||||
case PLAYER_ACTION_BET:
|
||||
case PLAYER_ACTION_RAISE:
|
||||
return LOG_ACTION_BET;
|
||||
break;
|
||||
case PLAYER_ACTION_ALLIN:
|
||||
return LOG_ACTION_ALL_IN;
|
||||
break;
|
||||
default:
|
||||
return LOG_ACTION_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::logBoardCards(int bero, int boardCards[5])
|
||||
Log::logBoardCards(GameState bero, int boardCards[5])
|
||||
{
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
@@ -351,19 +397,19 @@ Log::logBoardCards(int bero, int boardCards[5])
|
||||
// sqlite-db is open
|
||||
|
||||
switch(bero) {
|
||||
case 2: {
|
||||
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 3: {
|
||||
case GAME_STATE_TURN: {
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "BoardCard_4=" + boost::lexical_cast<string>(boardCards[3]);
|
||||
}
|
||||
break;
|
||||
case 4: {
|
||||
case GAME_STATE_RIVER: {
|
||||
sql += "UPDATE Hand SET ";
|
||||
sql += "BoardCard_5=" + boost::lexical_cast<string>(boardCards[4]);
|
||||
}
|
||||
@@ -384,14 +430,14 @@ Log::logBoardCards(int bero, int boardCards[5])
|
||||
}
|
||||
|
||||
void
|
||||
Log::logHoleCardsHandName(int bero, PlayerList activePlayerList)
|
||||
Log::logHoleCardsHandName(GameState bero, PlayerList activePlayerList)
|
||||
{
|
||||
if(SQLITE_LOG) {
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
if( mySqliteLogDb != 0 && (bero==5 || !logHoleCardsDone)) {
|
||||
if( mySqliteLogDb != 0 && (bero==GAME_STATE_POST_RIVER || !logHoleCardsDone)) {
|
||||
// sqlite-db is open and we are in postriver or before postriver doesn't log hole cards til now
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
@@ -401,11 +447,11 @@ Log::logHoleCardsHandName(int bero, PlayerList activePlayerList)
|
||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
(*it_c)->getMyCards(myCards);
|
||||
sql += "UPDATE Hand SET ";
|
||||
if(bero==5) {
|
||||
if(bero==GAME_STATE_POST_RIVER) {
|
||||
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) {
|
||||
if(bero==GAME_STATE_POST_RIVER && !logHoleCardsDone) {
|
||||
sql+= ",";
|
||||
}
|
||||
if(!logHoleCardsDone) {
|
||||
@@ -473,13 +519,4 @@ Log::exec_transaction()
|
||||
// sqlite3_close(mySqliteLogDb);
|
||||
// mySqliteLogDb = NULL;
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
// Bero-Code
|
||||
// 0 Pre-Preflop
|
||||
// 1 Preflop
|
||||
// 2 Flop
|
||||
// 3 Turn
|
||||
// 4 River
|
||||
// 5 Post-River
|
||||
|
||||
+4
-3
@@ -36,9 +36,10 @@ public:
|
||||
|
||||
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(int bero, int seat, PlayerActionLog action, int amount = 0);
|
||||
void logBoardCards(int bero, int boardCards[5]);
|
||||
void logHoleCardsHandName(int bero, PlayerList activePlayerList);
|
||||
void logPlayerAction(GameState bero, 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 logAfterHand();
|
||||
void logAfterGame();
|
||||
void exec_transaction();
|
||||
|
||||
Reference in New Issue
Block a user