sqlite-log: implementing action logging
This commit is contained in:
@@ -486,26 +486,35 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//do sets --> TODO switch?
|
||||
for (it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); ++it_c) {
|
||||
|
||||
//big blind
|
||||
if((*it_c)->getMyButton() == BUTTON_BIG_BLIND) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3229,12 +3229,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
{}
|
||||
break;
|
||||
// fold
|
||||
case 1:
|
||||
{}
|
||||
case 1: {
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_FOLD);
|
||||
}
|
||||
break;
|
||||
// check
|
||||
case 2:
|
||||
{}
|
||||
case 2: {
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CHECK);
|
||||
}
|
||||
break;
|
||||
// call
|
||||
case 3: {
|
||||
@@ -3244,12 +3246,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
mySet += myCash;
|
||||
myCash = 0;
|
||||
myAction = 6;
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3266,6 +3270,7 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
myCash = 0;
|
||||
myAction = 6;
|
||||
highestSet = mySet;
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
@@ -3273,6 +3278,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);
|
||||
|
||||
}
|
||||
// lastPlayerAction für Karten umblättern reihenfolge setzrn
|
||||
@@ -3287,12 +3293,14 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
mySet += myCash;
|
||||
myCash = 0;
|
||||
myAction = 6;
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
myCash = myCash - highestSet + mySet;
|
||||
mySet = highestSet;
|
||||
myAction = 3;
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_CALL,mySet);
|
||||
}
|
||||
} else {
|
||||
if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) {
|
||||
@@ -3329,6 +3337,7 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
myAction = 6;
|
||||
highestSet = mySet;
|
||||
}
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
// sonst
|
||||
else {
|
||||
@@ -3338,13 +3347,15 @@ void LocalPlayer::evaluation(int bet, int raise)
|
||||
highestSet = mySet;
|
||||
// lastPlayerAction für Karten umblättern reihenfolge setzrn
|
||||
currentHand->setLastActionPlayer(myUniqueID);
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_BET,mySet);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// all in
|
||||
case 6:
|
||||
{}
|
||||
case 6: {
|
||||
currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound()+1,myID+1,LOG_ACTION_ALL_IN,mySet);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{}
|
||||
|
||||
@@ -34,23 +34,25 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
|
||||
unsigned char rand_buf[4];
|
||||
unsigned int randNumber;
|
||||
|
||||
int i,j;
|
||||
int i;
|
||||
|
||||
if (!different) {
|
||||
|
||||
for (i=0; i<howMany; i++) {
|
||||
int counter(0);
|
||||
while(counter < howMany) {
|
||||
|
||||
if(!RAND_bytes(rand_buf, 4)) {
|
||||
LOG_MSG("RAND_bytes failed!");
|
||||
}
|
||||
|
||||
randNumber = 0;
|
||||
for(j=0; j<4; j++) {
|
||||
randNumber += (rand_buf[j] << 8*j);
|
||||
for(i=0; i<4; i++) {
|
||||
randNumber += (rand_buf[i] << 8*i);
|
||||
}
|
||||
|
||||
if(randNumber < ( (unsigned int) ( ((double)numeric_limits<unsigned int>::max()) / r ) ) * r) {
|
||||
randArray[i] = start + (randNumber % r);
|
||||
randArray[counter] = start + (randNumber % r);
|
||||
counter++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,8 +75,8 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
|
||||
}
|
||||
|
||||
randNumber = 0;
|
||||
for(j=0; j<4; j++) {
|
||||
randNumber += (rand_buf[j] << 8*j);
|
||||
for(i=0; i<4; i++) {
|
||||
randNumber += (rand_buf[i] << 8*i);
|
||||
}
|
||||
|
||||
if(randNumber < ( (unsigned int) ( ((double)numeric_limits<unsigned int>::max()) / r ) ) * r) {
|
||||
|
||||
Reference in New Issue
Block a user