optimizing local sqlite-logging; implementing second steps network client sqlite-logging
This commit is contained in:
@@ -83,7 +83,7 @@ void LocalBeRoPostRiver::postRiverRun()
|
||||
//Pot auf 0 setzen
|
||||
getMyHand()->getBoard()->setPot(0);
|
||||
|
||||
// logging hole Cards / Hands
|
||||
// logging
|
||||
int nonfoldPlayersCounter = 0;
|
||||
for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++;
|
||||
@@ -91,53 +91,11 @@ void LocalBeRoPostRiver::postRiverRun()
|
||||
if(nonfoldPlayersCounter>1) {
|
||||
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(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN,(*it_c)->getLastMoneyWon());
|
||||
}
|
||||
}
|
||||
|
||||
// log side pot winners
|
||||
list<unsigned> winners = getMyHand()->getBoard()->getWinners();
|
||||
list<unsigned>::iterator it_int;
|
||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() != highestCardsValue ) {
|
||||
|
||||
for(it_int = winners.begin(); it_int != winners.end(); ++it_int) {
|
||||
if((*it_int) == (*it_c)->getMyUniqueID()) {
|
||||
getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_SIDE_POT,(*it_c)->getLastMoneyWon());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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(GAME_STATE_POST_RIVER, (*it_c)->getMyID()+1, LOG_ACTION_SIT_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
// for log after every hand
|
||||
getMyHand()->getLog()->logHandWinner(getMyHand()->getActivePlayerList(), highestCardsValue, getMyHand()->getBoard()->getWinners());
|
||||
getMyHand()->getLog()->logPlayerSitsOut(getMyHand()->getActivePlayerList());
|
||||
getMyHand()->getLog()->logGameWinner(getMyHand()->getActivePlayerList());
|
||||
getMyHand()->getLog()->logAfterHand();
|
||||
|
||||
// log winner of the game if only one player is left
|
||||
int playersPositiveCashCounter = 0;
|
||||
for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++;
|
||||
}
|
||||
if (playersPositiveCashCounter==1) {
|
||||
for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
|
||||
if ((*it_c)->getMyCash() > 0) {
|
||||
getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_GAME);
|
||||
}
|
||||
}
|
||||
// for log after every game
|
||||
getMyHand()->getLog()->logAfterGame();
|
||||
}
|
||||
|
||||
//starte die Animaionsreihe
|
||||
getMyHand()->getGuiInterface()->postRiverRunAnimation1();
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ static const RoundData FlopValues[] = {
|
||||
|
||||
LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar),
|
||||
myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(PLAYER_ACTION_NONE),
|
||||
myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(PLAYER_ACTION_NONE),
|
||||
myButton(mB), myActiveStatus(aS), myStayOnTableStatus(1), myTurn(0), myCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0),
|
||||
sBluff(0), sBluffStatus(false), m_actionTimeoutCounter(0), m_isConnected(false)
|
||||
{
|
||||
@@ -3211,10 +3211,8 @@ void LocalPlayer::riverEngine()
|
||||
void LocalPlayer::evaluation(int bet, int raise)
|
||||
{
|
||||
|
||||
|
||||
int highestSet = currentHand->getCurrentBeRo()->getHighestSet();
|
||||
|
||||
// cout << "myAction(evaluation): " << myAction << endl;
|
||||
switch(myAction) {
|
||||
// none
|
||||
case 0:
|
||||
@@ -3222,30 +3220,24 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
break;
|
||||
// fold
|
||||
case 1: {
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_FOLD);
|
||||
}
|
||||
break;
|
||||
// check
|
||||
case 2: {
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_CHECK);
|
||||
}
|
||||
break;
|
||||
// call
|
||||
case 3: {
|
||||
// cout << "evaluation(call) - highestSet = " << highestSet << endl;
|
||||
// all in
|
||||
if(highestSet >= myCash + mySet) {
|
||||
mySet += myCash;
|
||||
myCash = 0;
|
||||
myAction = PLAYER_ACTION_ALLIN;
|
||||
// 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(),myID+1,LOG_ACTION_CALL,mySet);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3262,7 +3254,6 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
myCash = 0;
|
||||
myAction = PLAYER_ACTION_ALLIN;
|
||||
highestSet = mySet;
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
@@ -3270,7 +3261,6 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
myCash = myCash - bet;
|
||||
mySet = bet;
|
||||
highestSet = mySet;
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_BET,mySet);
|
||||
|
||||
}
|
||||
// lastPlayerAction für Karten umblättern reihenfolge setzrn
|
||||
@@ -3285,14 +3275,12 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
mySet += myCash;
|
||||
myCash = 0;
|
||||
myAction = PLAYER_ACTION_ALLIN;
|
||||
// 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(),myID+1,LOG_ACTION_CALL,mySet);
|
||||
}
|
||||
} else {
|
||||
if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) {
|
||||
@@ -3329,7 +3317,6 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
myAction = PLAYER_ACTION_ALLIN;
|
||||
highestSet = mySet;
|
||||
}
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
@@ -3339,26 +3326,20 @@ 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(),myID+1,LOG_ACTION_BET,mySet);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// all in
|
||||
case 6: {
|
||||
// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{}
|
||||
}
|
||||
|
||||
// cout << "highestSet(ende evaluation): " << highestSet << endl;
|
||||
|
||||
currentHand->getCurrentBeRo()->setHighestSet(highestSet);
|
||||
|
||||
// cout << "lAP: " << currentHand->getLastActionPlayer() << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -189,6 +189,14 @@ public:
|
||||
return myCardsValueInt;
|
||||
}
|
||||
|
||||
void setLogHoleCardsDone(bool theValue) {
|
||||
logHoleCardsDone = theValue;
|
||||
}
|
||||
|
||||
bool getLogHoleCardsDone() const {
|
||||
return logHoleCardsDone;
|
||||
}
|
||||
|
||||
void setMyBestHandPosition(int* theValue) {
|
||||
for (int i = 0; i < 5; i++)
|
||||
myBestHandPosition[i] = theValue[i];
|
||||
@@ -302,6 +310,7 @@ private:
|
||||
int myBestHandPosition[5];
|
||||
double myOdds;
|
||||
int myNiveau[3];
|
||||
bool logHoleCardsDone;
|
||||
|
||||
int myCards[2];
|
||||
int myCash;
|
||||
|
||||
Reference in New Issue
Block a user