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");
|
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myHand->getLog()->logBoardCards(myBeRoID+1, tempBoardCardsArray);
|
myHand->getLog()->logBoardCards(myBeRoID, tempBoardCardsArray);
|
||||||
logBoardCardsDone = true;
|
logBoardCardsDone = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,13 +89,13 @@ void LocalBeRoPostRiver::postRiverRun()
|
|||||||
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++;
|
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++;
|
||||||
}
|
}
|
||||||
if(nonfoldPlayersCounter>1) {
|
if(nonfoldPlayersCounter>1) {
|
||||||
getMyHand()->getLog()->logHoleCardsHandName(5,getMyHand()->getActivePlayerList());
|
getMyHand()->getLog()->logHoleCardsHandName(GAME_STATE_POST_RIVER,getMyHand()->getActivePlayerList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// logging winner of the hand
|
// logging winner of the hand
|
||||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == highestCardsValue) {
|
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) {
|
for(it_int = winners.begin(); it_int != winners.end(); ++it_int) {
|
||||||
if((*it_int) == (*it_c)->getMyUniqueID()) {
|
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
|
// log player sits out
|
||||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||||
if((*it_c)->getMyCash() == 0) {
|
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) {
|
if (playersPositiveCashCounter==1) {
|
||||||
for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||||
if ((*it_c)->getMyCash() > 0) {
|
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
|
// for log after every game
|
||||||
|
|||||||
@@ -363,10 +363,10 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
|||||||
|
|
||||||
assignButtons();
|
assignButtons();
|
||||||
|
|
||||||
myLog->logNewHandMsg(myID, dealerPosition+1, smallBlind, smallBlindPosition+1, 2*smallBlind, bigBlindPosition+1, seatsList);
|
|
||||||
|
|
||||||
setBlinds();
|
setBlinds();
|
||||||
|
|
||||||
|
myLog->logNewHandMsg(myID, dealerPosition+1, smallBlind, smallBlindPosition+1, 2*smallBlind, bigBlindPosition+1, seatsList);
|
||||||
|
|
||||||
myBeRo = myFactory->createBeRo(this, dealerPosition, smallBlind);
|
myBeRo = myFactory->createBeRo(this, dealerPosition, smallBlind);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,13 +489,11 @@ void LocalHand::setBlinds()
|
|||||||
// All in ?
|
// All in ?
|
||||||
if((*it_c)->getMyCash() <= smallBlind) {
|
if((*it_c)->getMyCash() <= smallBlind) {
|
||||||
|
|
||||||
myLog->logPlayerAction(0,smallBlindPosition+1,LOG_ACTION_SMALL_BLIND,(*it_c)->getMyCash());
|
|
||||||
(*it_c)->setMySet((*it_c)->getMyCash());
|
(*it_c)->setMySet((*it_c)->getMyCash());
|
||||||
// 1 to do not log this
|
// 1 to do not log this
|
||||||
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
myLog->logPlayerAction(0,smallBlindPosition+1,LOG_ACTION_SMALL_BLIND,smallBlind);
|
|
||||||
(*it_c)->setMySet(smallBlind);
|
(*it_c)->setMySet(smallBlind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -511,13 +509,11 @@ void LocalHand::setBlinds()
|
|||||||
// all in ?
|
// all in ?
|
||||||
if((*it_c)->getMyCash() <= 2*smallBlind) {
|
if((*it_c)->getMyCash() <= 2*smallBlind) {
|
||||||
|
|
||||||
myLog->logPlayerAction(0,bigBlindPosition+1,LOG_ACTION_BIG_BLIND,(*it_c)->getMyCash());
|
|
||||||
(*it_c)->setMySet((*it_c)->getMyCash());
|
(*it_c)->setMySet((*it_c)->getMyCash());
|
||||||
// 1 to do not log this
|
// 1 to do not log this
|
||||||
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
myLog->logPlayerAction(0,bigBlindPosition+1,LOG_ACTION_BIG_BLIND,2*smallBlind);
|
|
||||||
(*it_c)->setMySet(2*smallBlind);
|
(*it_c)->setMySet(2*smallBlind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -531,31 +527,7 @@ void LocalHand::switchRounds()
|
|||||||
// logging last player action
|
// logging last player action
|
||||||
PlayerListConstIterator previousPlayerIt = getRunningPlayerIt(previousPlayerID);
|
PlayerListConstIterator previousPlayerIt = getRunningPlayerIt(previousPlayerID);
|
||||||
if(previousPlayerIt != runningPlayerList->end()) {
|
if(previousPlayerIt != runningPlayerList->end()) {
|
||||||
switch((*previousPlayerIt)->getMyAction()) {
|
myLog->logPlayerAction(currentRound,(*previousPlayerIt)->getMyID()+1,myLog->transformPlayerActionLog((*previousPlayerIt)->getMyAction()),(*previousPlayerIt)->getMySet());
|
||||||
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: {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerListIterator it, it_1;
|
PlayerListIterator it, it_1;
|
||||||
@@ -658,7 +630,7 @@ void LocalHand::switchRounds()
|
|||||||
myGui->flipHolecardsAllIn();
|
myGui->flipHolecardsAllIn();
|
||||||
// Logging HoleCards
|
// Logging HoleCards
|
||||||
if(currentRound<GAME_STATE_RIVER) {
|
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
|
if (currentRound < GAME_STATE_POST_RIVER) // do not increment past 4
|
||||||
@@ -670,7 +642,7 @@ void LocalHand::switchRounds()
|
|||||||
|
|
||||||
myBoard->getMyCards(tempBoardCardsArray);
|
myBoard->getMyCards(tempBoardCardsArray);
|
||||||
myGui->logDealBoardCardsMsg(currentRound, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
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;
|
break;
|
||||||
// fold
|
// fold
|
||||||
case 1: {
|
case 1: {
|
||||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_FOLD);
|
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_FOLD);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// check
|
// check
|
||||||
case 2: {
|
case 2: {
|
||||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CHECK);
|
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_CHECK);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// call
|
// call
|
||||||
@@ -3238,14 +3238,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
|||||||
mySet += myCash;
|
mySet += myCash;
|
||||||
myCash = 0;
|
myCash = 0;
|
||||||
myAction = PLAYER_ACTION_ALLIN;
|
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;
|
// cout << "evaluation(call) - mySet: " << mySet << endl;
|
||||||
}
|
}
|
||||||
// sonst
|
// sonst
|
||||||
else {
|
else {
|
||||||
myCash = myCash - highestSet + mySet;
|
myCash = myCash - highestSet + mySet;
|
||||||
mySet = highestSet;
|
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;
|
break;
|
||||||
@@ -3262,7 +3262,7 @@ void LocalPlayer::evaluation(int bet, int raise)
|
|||||||
myCash = 0;
|
myCash = 0;
|
||||||
myAction = PLAYER_ACTION_ALLIN;
|
myAction = PLAYER_ACTION_ALLIN;
|
||||||
highestSet = mySet;
|
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
|
// sonst
|
||||||
else {
|
else {
|
||||||
@@ -3270,7 +3270,7 @@ void LocalPlayer::evaluation(int bet, int raise)
|
|||||||
myCash = myCash - bet;
|
myCash = myCash - bet;
|
||||||
mySet = bet;
|
mySet = bet;
|
||||||
highestSet = mySet;
|
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
|
// lastPlayerAction für Karten umblättern reihenfolge setzrn
|
||||||
@@ -3285,14 +3285,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
|||||||
mySet += myCash;
|
mySet += myCash;
|
||||||
myCash = 0;
|
myCash = 0;
|
||||||
myAction = PLAYER_ACTION_ALLIN;
|
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
|
// sonst
|
||||||
else {
|
else {
|
||||||
myCash = myCash - highestSet + mySet;
|
myCash = myCash - highestSet + mySet;
|
||||||
mySet = highestSet;
|
mySet = highestSet;
|
||||||
myAction = PLAYER_ACTION_CALL;
|
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 {
|
} else {
|
||||||
if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) {
|
if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) {
|
||||||
@@ -3329,7 +3329,7 @@ void LocalPlayer::evaluation(int bet, int raise)
|
|||||||
myAction = PLAYER_ACTION_ALLIN;
|
myAction = PLAYER_ACTION_ALLIN;
|
||||||
highestSet = mySet;
|
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
|
// sonst
|
||||||
else {
|
else {
|
||||||
@@ -3339,14 +3339,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
|||||||
highestSet = mySet;
|
highestSet = mySet;
|
||||||
// lastPlayerAction für Karten umblättern reihenfolge setzrn
|
// lastPlayerAction für Karten umblättern reihenfolge setzrn
|
||||||
currentHand->setLastActionPlayerID(myUniqueID);
|
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;
|
break;
|
||||||
// all in
|
// all in
|
||||||
case 6: {
|
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;
|
break;
|
||||||
default:
|
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);
|
sql += "," + boost::lexical_cast<string>(bigBlindPosition);
|
||||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
sql += "," + boost::lexical_cast<string>((*it_c)->getMyCash());
|
sql += "," + boost::lexical_cast<string>((*it_c)->getMyRoundStartCash());
|
||||||
} else {
|
} else {
|
||||||
sql += ",NULL";
|
sql += ",NULL";
|
||||||
}
|
}
|
||||||
@@ -243,20 +243,30 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(countActivePlayer==2) {
|
if(countActivePlayer==2) {
|
||||||
logPlayerAction(0,smallBlindPosition,LOG_ACTION_DEALER);
|
logPlayerAction(GAME_STATE_PREFLOP,smallBlindPosition,LOG_ACTION_DEALER);
|
||||||
} else {
|
} else {
|
||||||
if(dealerButtonOnTable) {
|
if(dealerButtonOnTable) {
|
||||||
logPlayerAction(0,dealerPosition,LOG_ACTION_DEALER);
|
logPlayerAction(GAME_STATE_PREFLOP,dealerPosition,LOG_ACTION_DEALER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// !! TODO !! Hack
|
// !! 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
|
void
|
||||||
Log::logPlayerAction(int bero, int seat, PlayerActionLog action, int amount)
|
Log::logPlayerAction(GameState bero, int seat, PlayerActionLog action, int amount)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(SQLITE_LOG) {
|
||||||
@@ -267,80 +277,116 @@ Log::logPlayerAction(int bero, int seat, PlayerActionLog action, int amount)
|
|||||||
if( mySqliteLogDb != 0 ) {
|
if( mySqliteLogDb != 0 ) {
|
||||||
// sqlite-db is open
|
// sqlite-db is open
|
||||||
|
|
||||||
sql += "INSERT INTO Action (";
|
if(action!=LOG_ACTION_NONE) {
|
||||||
sql += "HandID";
|
sql += "INSERT INTO Action (";
|
||||||
sql += ",GameID";
|
sql += "HandID";
|
||||||
sql += ",BeRo";
|
sql += ",GameID";
|
||||||
sql += ",Player";
|
sql += ",BeRo";
|
||||||
sql += ",Action";
|
sql += ",Player";
|
||||||
sql += ",Amount";
|
sql += ",Action";
|
||||||
sql += ") VALUES (";
|
sql += ",Amount";
|
||||||
sql += boost::lexical_cast<string>(curHandID);
|
sql += ") VALUES (";
|
||||||
sql += "," + boost::lexical_cast<string>(curGameID);
|
sql += boost::lexical_cast<string>(curHandID);
|
||||||
sql += "," + boost::lexical_cast<string>(bero);;
|
sql += "," + boost::lexical_cast<string>(curGameID);
|
||||||
sql += "," + boost::lexical_cast<string>(seat);
|
sql += "," + boost::lexical_cast<string>(bero);;
|
||||||
switch(action) {
|
sql += "," + boost::lexical_cast<string>(seat);
|
||||||
case LOG_ACTION_DEALER:
|
switch(action) {
|
||||||
sql += ",'starts as dealer'";
|
case LOG_ACTION_DEALER:
|
||||||
break;
|
sql += ",'starts as dealer'";
|
||||||
case LOG_ACTION_SMALL_BLIND:
|
sql += ",NULL";
|
||||||
sql += ",'posts small blind'";
|
break;
|
||||||
break;
|
case LOG_ACTION_SMALL_BLIND:
|
||||||
case LOG_ACTION_BIG_BLIND:
|
sql += ",'posts small blind'";
|
||||||
sql += ",'posts big blind'";
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
break;
|
break;
|
||||||
case LOG_ACTION_FOLD:
|
case LOG_ACTION_BIG_BLIND:
|
||||||
sql += ",'folds'";
|
sql += ",'posts big blind'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_CHECK:
|
break;
|
||||||
sql += ",'checks'";
|
case LOG_ACTION_FOLD:
|
||||||
break;
|
sql += ",'folds'";
|
||||||
case LOG_ACTION_CALL:
|
sql += ",NULL";
|
||||||
sql += ",'calls'";
|
break;
|
||||||
break;
|
case LOG_ACTION_CHECK:
|
||||||
case LOG_ACTION_BET:
|
sql += ",'checks'";
|
||||||
sql += ",'bets'";
|
sql += ",NULL";
|
||||||
break;
|
break;
|
||||||
case LOG_ACTION_ALL_IN:
|
case LOG_ACTION_CALL:
|
||||||
sql += ",'is all in with'";
|
sql += ",'calls'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_SHOW:
|
break;
|
||||||
sql += ",'shows'";
|
case LOG_ACTION_BET:
|
||||||
break;
|
sql += ",'bets'";
|
||||||
case LOG_ACTION_HAS:
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
sql += ",'has'";
|
break;
|
||||||
break;
|
case LOG_ACTION_ALL_IN:
|
||||||
case LOG_ACTION_WIN:
|
sql += ",'is all in with'";
|
||||||
sql += ",'wins'";
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
break;
|
break;
|
||||||
case LOG_ACTION_WIN_SIDE_POT:
|
case LOG_ACTION_SHOW:
|
||||||
sql += ",'wins (side pot)'";
|
sql += ",'shows'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_SIT_OUT:
|
break;
|
||||||
sql += ",'sits out'";
|
case LOG_ACTION_HAS:
|
||||||
break;
|
sql += ",'has'";
|
||||||
case LOG_ACTION_WIN_GAME:
|
sql += ",NULL";
|
||||||
sql += ",'wins game'";
|
break;
|
||||||
break;
|
case LOG_ACTION_WIN:
|
||||||
default:
|
sql += ",'wins'";
|
||||||
return;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
}
|
break;
|
||||||
if(amount>0) {
|
case LOG_ACTION_WIN_SIDE_POT:
|
||||||
sql += "," + boost::lexical_cast<string>(amount);
|
sql += ",'wins (side pot)'";
|
||||||
} else {
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
sql += ",NULL";
|
break;
|
||||||
}
|
case LOG_ACTION_SIT_OUT:
|
||||||
sql += ");";
|
sql += ",'sits out'";
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
sql += ",NULL";
|
||||||
exec_transaction();
|
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
|
void
|
||||||
Log::logBoardCards(int bero, int boardCards[5])
|
Log::logBoardCards(GameState bero, int boardCards[5])
|
||||||
{
|
{
|
||||||
if(SQLITE_LOG) {
|
if(SQLITE_LOG) {
|
||||||
|
|
||||||
@@ -351,19 +397,19 @@ Log::logBoardCards(int bero, int boardCards[5])
|
|||||||
// sqlite-db is open
|
// sqlite-db is open
|
||||||
|
|
||||||
switch(bero) {
|
switch(bero) {
|
||||||
case 2: {
|
case GAME_STATE_FLOP: {
|
||||||
sql += "UPDATE Hand SET ";
|
sql += "UPDATE Hand SET ";
|
||||||
sql += "BoardCard_1=" + boost::lexical_cast<string>(boardCards[0]) + ",";
|
sql += "BoardCard_1=" + boost::lexical_cast<string>(boardCards[0]) + ",";
|
||||||
sql += "BoardCard_2=" + boost::lexical_cast<string>(boardCards[1]) + ",";
|
sql += "BoardCard_2=" + boost::lexical_cast<string>(boardCards[1]) + ",";
|
||||||
sql += "BoardCard_3=" + boost::lexical_cast<string>(boardCards[2]);
|
sql += "BoardCard_3=" + boost::lexical_cast<string>(boardCards[2]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: {
|
case GAME_STATE_TURN: {
|
||||||
sql += "UPDATE Hand SET ";
|
sql += "UPDATE Hand SET ";
|
||||||
sql += "BoardCard_4=" + boost::lexical_cast<string>(boardCards[3]);
|
sql += "BoardCard_4=" + boost::lexical_cast<string>(boardCards[3]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: {
|
case GAME_STATE_RIVER: {
|
||||||
sql += "UPDATE Hand SET ";
|
sql += "UPDATE Hand SET ";
|
||||||
sql += "BoardCard_5=" + boost::lexical_cast<string>(boardCards[4]);
|
sql += "BoardCard_5=" + boost::lexical_cast<string>(boardCards[4]);
|
||||||
}
|
}
|
||||||
@@ -384,14 +430,14 @@ Log::logBoardCards(int bero, int boardCards[5])
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Log::logHoleCardsHandName(int bero, PlayerList activePlayerList)
|
Log::logHoleCardsHandName(GameState bero, PlayerList activePlayerList)
|
||||||
{
|
{
|
||||||
if(SQLITE_LOG) {
|
if(SQLITE_LOG) {
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
//if write logfiles is enabled
|
//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
|
// sqlite-db is open and we are in postriver or before postriver doesn't log hole cards til now
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
@@ -401,11 +447,11 @@ Log::logHoleCardsHandName(int bero, PlayerList activePlayerList)
|
|||||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||||
(*it_c)->getMyCards(myCards);
|
(*it_c)->getMyCards(myCards);
|
||||||
sql += "UPDATE Hand SET ";
|
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_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());
|
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+= ",";
|
sql+= ",";
|
||||||
}
|
}
|
||||||
if(!logHoleCardsDone) {
|
if(!logHoleCardsDone) {
|
||||||
@@ -473,13 +519,4 @@ Log::exec_transaction()
|
|||||||
// sqlite3_close(mySqliteLogDb);
|
// sqlite3_close(mySqliteLogDb);
|
||||||
// mySqliteLogDb = NULL;
|
// 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 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 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 logPlayerAction(GameState bero, int seat, PlayerActionLog action, int amount = 0);
|
||||||
void logBoardCards(int bero, int boardCards[5]);
|
PlayerActionLog transformPlayerActionLog(PlayerAction action);
|
||||||
void logHoleCardsHandName(int bero, PlayerList activePlayerList);
|
void logBoardCards(GameState bero, int boardCards[5]);
|
||||||
|
void logHoleCardsHandName(GameState bero, PlayerList activePlayerList);
|
||||||
void logAfterHand();
|
void logAfterHand();
|
||||||
void logAfterGame();
|
void logAfterGame();
|
||||||
void exec_transaction();
|
void exec_transaction();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myHtmlLogFile(0), mySqliteLogDb(0)
|
guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myHtmlLogFile(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
myW->setGuiLog(this);
|
myW->setGuiLog(this);
|
||||||
@@ -176,35 +176,6 @@ void guiLog::logPlayerActionMsg(QString msg, int action, int setValue)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
|
||||||
|
|
||||||
// if(mySqliteLogDb->isOpen()) {
|
|
||||||
|
|
||||||
// QSqlQuery query(*mySqliteLogDb);
|
|
||||||
// QString sql;
|
|
||||||
|
|
||||||
// sql = "INSERT INTO Action (HandID,GameID,BeRo,Player,Action,Amount) VALUES (";
|
|
||||||
// sql += QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10);
|
|
||||||
// sql += "," + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
|
||||||
// sql += "," + QString::number(myW->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID(),10);
|
|
||||||
// sql += "," + QString::number(playerID,10);
|
|
||||||
// sql += "," + QString::number(action,10);
|
|
||||||
// sql += "," + QString::number(setValue,10);
|
|
||||||
// sql += ")";
|
|
||||||
|
|
||||||
// if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
// if(!query.exec(sql)) {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,155 +206,6 @@ void guiLog::logNewGameHandMsg(int gameID, int handID)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
|
||||||
|
|
||||||
string sql;
|
|
||||||
char *errmsg;
|
|
||||||
|
|
||||||
if( mySqliteLogDb != 0 ) {
|
|
||||||
|
|
||||||
if(handID == 1) {
|
|
||||||
// start of a game -> insert game data
|
|
||||||
int i;
|
|
||||||
|
|
||||||
sql = "INSERT INTO Game (";
|
|
||||||
sql += "GameID";
|
|
||||||
sql += ",Startmoney";
|
|
||||||
sql += ",StartSb";
|
|
||||||
sql += ",DealerPos";
|
|
||||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i);
|
|
||||||
}
|
|
||||||
sql += ") VALUES (";
|
|
||||||
sql += boost::lexical_cast<string>(gameID);
|
|
||||||
sql += "," + boost::lexical_cast<string>(myW->getSession()->getCurrentGame()->getStartCash());
|
|
||||||
sql += "," + boost::lexical_cast<string>(myW->getSession()->getCurrentGame()->getStartSmallBlind());
|
|
||||||
sql += "," + boost::lexical_cast<string>(myW->getSession()->getCurrentGame()->getDealerPosition());
|
|
||||||
PlayerList seatList = currentHand->getSeatsList();
|
|
||||||
for(it_c = seatList->begin(); it_c!=seatList->end(); ++it_c) {
|
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
|
||||||
sql += ",\"" + (*it_c)->getMyName() +"\"";
|
|
||||||
} else {
|
|
||||||
sql += ",NULL";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sql += ")";
|
|
||||||
if(sqlite3_exec(mySqliteLogDb, sql.data(), 0, 0, &errmsg) != SQLITE_OK) {
|
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// insert hand data
|
|
||||||
sql = "INSERT INTO Hand (";
|
|
||||||
sql += "HandID";
|
|
||||||
sql += ",GameID";
|
|
||||||
sql += ",Dealer_Seat";
|
|
||||||
sql += ",Sb_Amount";
|
|
||||||
sql += ",Sb_Seat";
|
|
||||||
sql += ",Bb_Amount";
|
|
||||||
sql += ",Bb_Seat";
|
|
||||||
sql += ") VALUES (";
|
|
||||||
|
|
||||||
// // hand data
|
|
||||||
// sql = "INSERT INTO Hand (HandID,GameID,Sb_Amount,Bb_Amount";
|
|
||||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); ++it_c) {
|
|
||||||
// sql += ",Seat_" + QString::number((*it_c)->getMyID()+1,10) + "_Cash";
|
|
||||||
// }
|
|
||||||
//// for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//// sql += ",Seat_" + QString("%1").arg(i) + "_Cash";
|
|
||||||
//// }
|
|
||||||
// sql += ") VALUES (";
|
|
||||||
// sql += QString::number(handID,10);
|
|
||||||
// sql += "," + QString::number(gameID,10);
|
|
||||||
// sql += "," + QString::number(currentHand->getSmallBlind(),10);
|
|
||||||
// sql += "," + QString::number(currentHand->getSmallBlind()*2,10);
|
|
||||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); ++it_c) {
|
|
||||||
// sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
|
||||||
// }
|
|
||||||
//// for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();++it_c) {
|
|
||||||
//// if((*it_c)->getMyActiveStatus()) {
|
|
||||||
//// sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
|
||||||
//// } else {
|
|
||||||
//// sql += ",NULL";
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
// sql += ")";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// if(mySqliteLogDb->isOpen()) {
|
|
||||||
|
|
||||||
// QSqlQuery query(*mySqliteLogDb);
|
|
||||||
// QString sql;
|
|
||||||
|
|
||||||
// // beginning of a game
|
|
||||||
// if(handID == 1) {
|
|
||||||
// sql = "INSERT INTO Game (GameID,Startmoney,StartSb,DealerPos";
|
|
||||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); ++it_c) {
|
|
||||||
// sql += ",Seat_" + QString::number((*it_c)->getMyID()+1,10);
|
|
||||||
// }
|
|
||||||
//// for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//// sql += ",Seat_" + QString::number(i,10);
|
|
||||||
//// }
|
|
||||||
// sql += ") VALUES (";
|
|
||||||
// sql += QString::number(gameID,10) + ",";
|
|
||||||
// sql += QString::number(myW->getSession()->getCurrentGame()->getStartCash(),10) + ",";
|
|
||||||
// sql += QString::number(myW->getSession()->getCurrentGame()->getStartSmallBlind(),10) + ",";
|
|
||||||
// sql += QString::number(myW->getSession()->getCurrentGame()->getDealerPosition(),10);
|
|
||||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); ++it_c) {
|
|
||||||
// sql += ",'" + QString::fromUtf8((*it_c)->getMyName().c_str()) +"'";
|
|
||||||
// }
|
|
||||||
//// for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();++it_c) {
|
|
||||||
//// if((*it_c)->getMyActiveStatus()) {
|
|
||||||
//// sql += ",'" + QString::fromUtf8((*it_c)->getMyName().c_str()) +"'";
|
|
||||||
//// } else {
|
|
||||||
//// sql += ",NULL";
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
// sql += ")";
|
|
||||||
// if(!query.exec(sql)) {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // beginning of a hand
|
|
||||||
// sql = "INSERT INTO Hand (HandID,GameID,Sb_Amount,Bb_Amount";
|
|
||||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); ++it_c) {
|
|
||||||
// sql += ",Seat_" + QString::number((*it_c)->getMyID()+1,10) + "_Cash";
|
|
||||||
// }
|
|
||||||
//// for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//// sql += ",Seat_" + QString("%1").arg(i) + "_Cash";
|
|
||||||
//// }
|
|
||||||
// sql += ") VALUES (";
|
|
||||||
// sql += QString::number(handID,10);
|
|
||||||
// sql += "," + QString::number(gameID,10);
|
|
||||||
// sql += "," + QString::number(currentHand->getSmallBlind(),10);
|
|
||||||
// sql += "," + QString::number(currentHand->getSmallBlind()*2,10);
|
|
||||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); ++it_c) {
|
|
||||||
// sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
|
||||||
// }
|
|
||||||
//// for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();++it_c) {
|
|
||||||
//// if((*it_c)->getMyActiveStatus()) {
|
|
||||||
//// sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
|
||||||
//// } else {
|
|
||||||
//// sql += ",NULL";
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
// sql += ")";
|
|
||||||
|
|
||||||
// if(!query.exec(sql)) {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -431,12 +253,6 @@ void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString b
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -535,48 +351,6 @@ void guiLog::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
|
||||||
|
|
||||||
// if(mySqliteLogDb->isOpen()) {
|
|
||||||
|
|
||||||
// QSqlQuery query(*mySqliteLogDb);
|
|
||||||
// QString sql;
|
|
||||||
// sql = "UPDATE Hand SET ";
|
|
||||||
|
|
||||||
// switch (roundID) {
|
|
||||||
// case 1: round = "Flop";
|
|
||||||
// sql += "BoardCard_1 = " + QString::number(card1,10) + ",";
|
|
||||||
// sql += "BoardCard_2 = " + QString::number(card2,10) + ",";
|
|
||||||
// sql += "BoardCard_3 = " + QString::number(card3,10);
|
|
||||||
// break;
|
|
||||||
// case 2: round = "Turn";
|
|
||||||
// sql += "BoardCard_4 = " + QString::number(card4,10);
|
|
||||||
// break;
|
|
||||||
// case 3: round = "River";
|
|
||||||
// sql += "BoardCard_5 = " + QString::number(card5,10);
|
|
||||||
// break;
|
|
||||||
// default: round = "ERROR";
|
|
||||||
// }
|
|
||||||
// sql += " WHERE ";
|
|
||||||
// sql += "HandID = " + QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10) + " AND ";
|
|
||||||
// sql += "GameID = " + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
|
||||||
|
|
||||||
|
|
||||||
// if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
// if(roundID <= 3) {
|
|
||||||
// if(!query.exec(sql)) {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -623,28 +397,6 @@ void guiLog::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
|
||||||
|
|
||||||
// if(mySqliteLogDb->isOpen()) {
|
|
||||||
|
|
||||||
// QString sql = "UPDATE Hand SET ";
|
|
||||||
// sql += "Seat_" + QString::number(playerID+1,10) + "_Card_1 = " + QString::number(card1,10) + ",";
|
|
||||||
// sql += "Seat_" + QString::number(playerID+1,10) + "_Card_2 = " + QString::number(card2,10);
|
|
||||||
// sql += " WHERE ";
|
|
||||||
// sql += "HandID = " + QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10) + " AND ";
|
|
||||||
// sql += "GameID = " + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
|
||||||
|
|
||||||
// QSqlQuery query(*mySqliteLogDb);
|
|
||||||
// if(!query.exec(sql)) {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ private:
|
|||||||
QTextStream stream;
|
QTextStream stream;
|
||||||
QDir *myLogDir;
|
QDir *myLogDir;
|
||||||
QFile *myHtmlLogFile;
|
QFile *myHtmlLogFile;
|
||||||
sqlite3 *mySqliteLogDb;
|
|
||||||
QString logFileStreamString;
|
QString logFileStreamString;
|
||||||
QString myAppDataPath;
|
QString myAppDataPath;
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public:
|
|||||||
|
|
||||||
ClientCallback &GetCallback();
|
ClientCallback &GetCallback();
|
||||||
GuiInterface &GetGui();
|
GuiInterface &GetGui();
|
||||||
|
boost::shared_ptr<Log> GetClientLog();
|
||||||
AvatarManager &GetAvatarManager();
|
AvatarManager &GetAvatarManager();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -1753,6 +1753,12 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
tmpPlayer->getMyName(),
|
tmpPlayer->getMyName(),
|
||||||
netActionDone->playerAction,
|
netActionDone->playerAction,
|
||||||
netActionDone->totalPlayerBet - tmpPlayer->getMySet());
|
netActionDone->totalPlayerBet - tmpPlayer->getMySet());
|
||||||
|
client->GetClientLog()->logPlayerAction(
|
||||||
|
curGame->getCurrentHand()->getCurrentBeRo()->getMyBeRoID(),
|
||||||
|
tmpPlayer->getMyID()+1,
|
||||||
|
client->GetClientLog()->transformPlayerActionLog(PlayerAction(netActionDone->playerAction)),
|
||||||
|
netActionDone->totalPlayerBet - tmpPlayer->getMySet()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Update last players turn only after the blinds.
|
// Update last players turn only after the blinds.
|
||||||
curGame->getCurrentHand()->setPreviousPlayerID(tmpPlayer->getMyID());
|
curGame->getCurrentHand()->setPreviousPlayerID(tmpPlayer->getMyID());
|
||||||
@@ -1774,6 +1780,15 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(),
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(),
|
||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
|
||||||
client->GetGui().flushLogAtHand();
|
client->GetGui().flushLogAtHand();
|
||||||
|
client->GetClientLog()->logNewHandMsg(
|
||||||
|
curGame->getCurrentHandID(),
|
||||||
|
curGame->getDealerPosition(),
|
||||||
|
curGame->getCurrentHand()->getSmallBlind(),
|
||||||
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyID()+1,
|
||||||
|
curGame->getCurrentHand()->getSmallBlind()*2,
|
||||||
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyID()+1,
|
||||||
|
curGame->getSeatsList()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the timeout for the player.
|
// Stop the timeout for the player.
|
||||||
@@ -1837,6 +1852,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
curGame->getCurrentHand()->setPreviousPlayerID(-1);
|
curGame->getCurrentHand()->setPreviousPlayerID(-1);
|
||||||
|
|
||||||
client->GetGui().logDealBoardCardsMsg(GAME_STATE_FLOP, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
|
client->GetGui().logDealBoardCardsMsg(GAME_STATE_FLOP, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
|
||||||
|
client->GetClientLog()->logBoardCards(GAME_STATE_FLOP,tmpCards);
|
||||||
client->GetGui().refreshGameLabels(GAME_STATE_FLOP);
|
client->GetGui().refreshGameLabels(GAME_STATE_FLOP);
|
||||||
client->GetGui().refreshPot();
|
client->GetGui().refreshPot();
|
||||||
client->GetGui().refreshSet();
|
client->GetGui().refreshSet();
|
||||||
@@ -1852,6 +1868,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
curGame->getCurrentHand()->setPreviousPlayerID(-1);
|
curGame->getCurrentHand()->setPreviousPlayerID(-1);
|
||||||
|
|
||||||
client->GetGui().logDealBoardCardsMsg(GAME_STATE_TURN, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
|
client->GetGui().logDealBoardCardsMsg(GAME_STATE_TURN, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
|
||||||
|
client->GetClientLog()->logBoardCards(GAME_STATE_TURN,tmpCards);
|
||||||
client->GetGui().refreshGameLabels(GAME_STATE_TURN);
|
client->GetGui().refreshGameLabels(GAME_STATE_TURN);
|
||||||
client->GetGui().refreshPot();
|
client->GetGui().refreshPot();
|
||||||
client->GetGui().refreshSet();
|
client->GetGui().refreshSet();
|
||||||
@@ -1867,6 +1884,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
curGame->getCurrentHand()->setPreviousPlayerID(-1);
|
curGame->getCurrentHand()->setPreviousPlayerID(-1);
|
||||||
|
|
||||||
client->GetGui().logDealBoardCardsMsg(GAME_STATE_RIVER, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
|
client->GetGui().logDealBoardCardsMsg(GAME_STATE_RIVER, tmpCards[0], tmpCards[1], tmpCards[2], tmpCards[3], tmpCards[4]);
|
||||||
|
client->GetClientLog()->logBoardCards(GAME_STATE_RIVER,tmpCards);
|
||||||
client->GetGui().refreshGameLabels(GAME_STATE_RIVER);
|
client->GetGui().refreshGameLabels(GAME_STATE_RIVER);
|
||||||
client->GetGui().refreshPot();
|
client->GetGui().refreshPot();
|
||||||
client->GetGui().refreshSet();
|
client->GetGui().refreshSet();
|
||||||
|
|||||||
@@ -513,6 +513,12 @@ ClientThread::GetGui()
|
|||||||
return m_gui;
|
return m_gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<Log>
|
||||||
|
ClientThread::GetClientLog()
|
||||||
|
{
|
||||||
|
return m_clientLog;
|
||||||
|
}
|
||||||
|
|
||||||
AvatarManager &
|
AvatarManager &
|
||||||
ClientThread::GetAvatarManager()
|
ClientThread::GetAvatarManager()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -905,7 +905,7 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr<SessionData> session, boost::s
|
|||||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_avatarRequestMessage)
|
else if (packet->GetMsg()->present == PokerTHMessage_PR_avatarRequestMessage)
|
||||||
HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->choice.avatarRequestMessage);
|
HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->choice.avatarRequestMessage);
|
||||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
|
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
|
||||||
{}
|
{}
|
||||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_subscriptionRequestMessage) {
|
else if (packet->GetMsg()->present == PokerTHMessage_PR_subscriptionRequestMessage) {
|
||||||
SubscriptionRequestMessage_t *subscriptionRequest = &packet->GetMsg()->choice.subscriptionRequestMessage;
|
SubscriptionRequestMessage_t *subscriptionRequest = &packet->GetMsg()->choice.subscriptionRequestMessage;
|
||||||
if (subscriptionRequest->subscriptionAction == subscriptionAction_resubscribeGameList)
|
if (subscriptionRequest->subscriptionAction == subscriptionAction_resubscribeGameList)
|
||||||
|
|||||||
Reference in New Issue
Block a user