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
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user