prepare implementing new cards value function for calculating odds: rename myCards to myHoleCards

This commit is contained in:
floty
2014-05-26 12:41:21 +02:00
parent 6dffbaeea5
commit 590f9f7a33
13 changed files with 107 additions and 104 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
for(it=seatsList->begin(); it!=seatsList->end(); ++it) { for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
(*it)->setHand(this); (*it)->setHand(this);
// set myFlipCards 0 // set myFlipCards 0
(*it)->setMyCardsFlip(0, 0); (*it)->setMyHoleCardsFlip(0, 0);
} }
// generate cards and assign to board and player // generate cards and assign to board and player
@@ -97,7 +97,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
// complete whole player hand // complete whole player hand
for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j]; for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j];
(*it)->setMyCards(tempPlayerArray); (*it)->setMyHoleCards(tempPlayerArray);
(*it)->setMyCardsValueInt(CardsValue::cardsValueOld(tempPlayerAndBoardArray, bestHandPos)); (*it)->setMyCardsValueInt(CardsValue::cardsValueOld(tempPlayerAndBoardArray, bestHandPos));
(*it)->setMyBestHandPosition(bestHandPos); (*it)->setMyBestHandPosition(bestHandPos);
(*it)->setMyRoundStartCash((*it)->getMyCash()); (*it)->setMyRoundStartCash((*it)->getMyCash());
+43 -39
View File
@@ -861,7 +861,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, bool sotS, int mB) LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB)
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), : PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar),
myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), 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(sotS), myTurn(0), myCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(sotS), myTurn(0), myHoleCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0),
sBluff(0), sBluffStatus(false), m_actionTimeoutCounter(0), m_isSessionActive(false), m_isKicked(false), m_isMuted(false) sBluff(0), sBluffStatus(false), m_actionTimeoutCounter(0), m_isSessionActive(false), m_isKicked(false), m_isMuted(false)
{ {
@@ -870,7 +870,7 @@ LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType ty
myNiveau[i] = 0; myNiveau[i] = 0;
} }
for(i=0; i<2; i++) { for(i=0; i<2; i++) {
myCards[i] = -1; myHoleCards[i] = -1;
} }
// myBestHandPosition mit -1 initialisieren // myBestHandPosition mit -1 initialisieren
@@ -1070,7 +1070,7 @@ void LocalPlayer::preflopEngine()
myNiveau[2] += (21-myCash/individualHighestSet)/2; myNiveau[2] += (21-myCash/individualHighestSet)/2;
} }
// cout << myID << ": " << myHoleCardsValue << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << myCards[0] << " " << myCards[1] << endl; // cout << myID << ": " << myHoleCardsValue << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << myHoleCards[0] << " " << myHoleCards[1] << endl;
// count number of active human players // count number of active human players
size_t countHumanPlayers = 0; size_t countHumanPlayers = 0;
@@ -1530,7 +1530,7 @@ void LocalPlayer::turnEngine()
// int boardCards[5]; // int boardCards[5];
// int i; // int i;
// for(i=0; i<2; i++) tempArray[i] = myCards[i]; // for(i=0; i<2; i++) tempArray[i] = myHoleCards[i];
// currentBoard->getMyCards(boardCards); // currentBoard->getMyCards(boardCards);
// for(i=0; i<4; i++) tempArray[2+i] = boardCards[i]; // for(i=0; i<4; i++) tempArray[2+i] = boardCards[i];
@@ -1804,7 +1804,7 @@ void LocalPlayer::riverEngine()
// int boardCards[5]; // int boardCards[5];
// int i; // int i;
// for(i=0; i<2; i++) tempArray[i] = myCards[i]; // for(i=0; i<2; i++) tempArray[i] = myHoleCards[i];
// currentBoard->getMyCards(boardCards); // currentBoard->getMyCards(boardCards);
// for(i=0; i<4; i++) tempArray[2+i] = boardCards[i]; // for(i=0; i<4; i++) tempArray[2+i] = boardCards[i];
@@ -2821,9 +2821,9 @@ void LocalPlayer::calcMyOdds()
switch(currentHand->getCurrentRound()) { switch(currentHand->getCurrentRound()) {
case 0: { case GAME_STATE_PREFLOP: {
handCode = CardsValue::holeCardsToIntCode(myCards); handCode = CardsValue::holeCardsToIntCode(myHoleCards);
// übergang solange preflopValue und flopValue noch nicht bereinigt // übergang solange preflopValue und flopValue noch nicht bereinigt
int players = currentHand->getActivePlayerList()->size(); int players = currentHand->getActivePlayerList()->size();
@@ -2841,14 +2841,14 @@ void LocalPlayer::calcMyOdds()
} }
break; break;
case 1: { case GAME_STATE_FLOP: {
int tempArray[5]; int tempArray[5];
int boardCards[5]; int boardCards[5];
int i; int i;
for(i=0; i<2; i++) tempArray[i] = myCards[i]; for(i=0; i<2; i++) tempArray[i] = myHoleCards[i];
currentHand->getBoard()->getMyCards(boardCards); currentHand->getBoard()->getMyCards(boardCards);
for(i=0; i<3; i++) tempArray[2+i] = boardCards[i]; for(i=0; i<3; i++) tempArray[2+i] = boardCards[i];
@@ -2886,9 +2886,7 @@ void LocalPlayer::calcMyOdds()
} }
break; break;
case 2: { case GAME_STATE_TURN: {
// Prozent ausrechnen
int i, j, k; int i, j, k;
int tempBoardCardsArray[5]; int tempBoardCardsArray[5];
@@ -2896,8 +2894,8 @@ void LocalPlayer::calcMyOdds()
int tempOpponentCardsArray[7]; int tempOpponentCardsArray[7];
currentHand->getBoard()->getMyCards(tempBoardCardsArray); currentHand->getBoard()->getMyCards(tempBoardCardsArray);
tempMyCardsArray[0] = myCards[0]; tempMyCardsArray[0] = myHoleCards[0];
tempMyCardsArray[1] = myCards[1]; tempMyCardsArray[1] = myHoleCards[1];
tempMyCardsArray[2] = tempBoardCardsArray[0]; tempMyCardsArray[2] = tempBoardCardsArray[0];
tempMyCardsArray[3] = tempBoardCardsArray[1]; tempMyCardsArray[3] = tempBoardCardsArray[1];
tempMyCardsArray[4] = tempBoardCardsArray[2]; tempMyCardsArray[4] = tempBoardCardsArray[2];
@@ -2908,6 +2906,12 @@ void LocalPlayer::calcMyOdds()
tempOpponentCardsArray[4] = tempBoardCardsArray[2]; tempOpponentCardsArray[4] = tempBoardCardsArray[2];
tempOpponentCardsArray[5] = tempBoardCardsArray[3]; tempOpponentCardsArray[5] = tempBoardCardsArray[3];
int myCards[4] = { 0,0,0,0 };
int opponentCards[4] = { 0,0,0,0 };
int tempMyCardsValue; int tempMyCardsValue;
int tempOpponentCardsValue; int tempOpponentCardsValue;
@@ -2915,11 +2919,11 @@ void LocalPlayer::calcMyOdds()
int countMy = 0; int countMy = 0;
for(i=0; i<49; i++) { for(i=0; i<49; i++) {
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
for(j=i+1; j<50; j++) { for(j=i+1; j<50; j++) {
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
for(k=j+1; k<51; k++) { for(k=j+1; k<51; k++) {
if(k != myCards[0] && k != myCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) { if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
countAll++; countAll++;
@@ -2942,7 +2946,7 @@ void LocalPlayer::calcMyOdds()
} }
break; break;
case 3: { case GAME_STATE_RIVER: {
// Prozent ausrechnen // Prozent ausrechnen
@@ -2952,8 +2956,8 @@ void LocalPlayer::calcMyOdds()
int tempOpponentCardsArray[7]; int tempOpponentCardsArray[7];
currentHand->getBoard()->getMyCards(tempBoardCardsArray); currentHand->getBoard()->getMyCards(tempBoardCardsArray);
tempMyCardsArray[0] = myCards[0]; tempMyCardsArray[0] = myHoleCards[0];
tempMyCardsArray[1] = myCards[1]; tempMyCardsArray[1] = myHoleCards[1];
tempMyCardsArray[2] = tempBoardCardsArray[0]; tempMyCardsArray[2] = tempBoardCardsArray[0];
tempMyCardsArray[3] = tempBoardCardsArray[1]; tempMyCardsArray[3] = tempBoardCardsArray[1];
tempMyCardsArray[4] = tempBoardCardsArray[2]; tempMyCardsArray[4] = tempBoardCardsArray[2];
@@ -2973,9 +2977,9 @@ void LocalPlayer::calcMyOdds()
int countMy = 0; int countMy = 0;
for(i=0; i<49; i++) { for(i=0; i<49; i++) {
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
for(j=i+1; j<50; j++) { for(j=i+1; j<50; j++) {
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
countAll++; countAll++;
@@ -3277,7 +3281,7 @@ void LocalPlayer::preflopEngine3()
// cout << "preflop-bluff " << bluff << endl; // cout << "preflop-bluff " << bluff << endl;
// Potential // Potential
int potential = 10*(4*(CardsValue::holeCardsClass(myCards[0], myCards[1]))+1*tempRand)/50-myDude; int potential = 10*(4*(CardsValue::holeCardsClass(myHoleCards[0], myHoleCards[1]))+1*tempRand)/50-myDude;
int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet;
@@ -3287,7 +3291,7 @@ void LocalPlayer::preflopEngine3()
Tools::GetRand(2, 3, 1, &tempFold); Tools::GetRand(2, 3, 1, &tempFold);
// FOLD --> wenn Potential negativ oder HighestSet zu hoch // FOLD --> wenn Potential negativ oder HighestSet zu hoch
if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * currentHand->getSmallBlind() && potential<4)) && CardsValue::holeCardsClass(myCards[0], myCards[1]) < 9 && bluff > 15) { if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * currentHand->getSmallBlind() && potential<4)) && CardsValue::holeCardsClass(myHoleCards[0], myHoleCards[1]) < 9 && bluff > 15) {
myAction = PLAYER_ACTION_FOLD; myAction = PLAYER_ACTION_FOLD;
} else { } else {
// RAISE --> wenn hohes Potential // RAISE --> wenn hohes Potential
@@ -3443,8 +3447,8 @@ void LocalPlayer::flopEngine3()
int tempOpponentCardsArray[7]; int tempOpponentCardsArray[7];
currentHand->getBoard()->getMyCards(tempBoardCardsArray); currentHand->getBoard()->getMyCards(tempBoardCardsArray);
tempMyCardsArray[0] = myCards[0]; tempMyCardsArray[0] = myHoleCards[0];
tempMyCardsArray[1] = myCards[1]; tempMyCardsArray[1] = myHoleCards[1];
tempMyCardsArray[2] = tempBoardCardsArray[0]; tempMyCardsArray[2] = tempBoardCardsArray[0];
tempMyCardsArray[3] = tempBoardCardsArray[1]; tempMyCardsArray[3] = tempBoardCardsArray[1];
tempMyCardsArray[4] = tempBoardCardsArray[2]; tempMyCardsArray[4] = tempBoardCardsArray[2];
@@ -3460,13 +3464,13 @@ void LocalPlayer::flopEngine3()
int countMy = 0; int countMy = 0;
for(i=0; i<49; i++) { for(i=0; i<49; i++) {
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
for(j=i+1; j<50; j++) { for(j=i+1; j<50; j++) {
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
for(k=j+1; k<51; k++) { for(k=j+1; k<51; k++) {
if(k != myCards[0] && k != myCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) { if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
for(l=k+1; l<52; l++) { for(l=k+1; l<52; l++) {
if(l != myCards[0] && l != myCards[1] && l != tempBoardCardsArray[0] && l != tempBoardCardsArray[1] && l != tempBoardCardsArray[2]) { if(l != myHoleCards[0] && l != myHoleCards[1] && l != tempBoardCardsArray[0] && l != tempBoardCardsArray[1] && l != tempBoardCardsArray[2]) {
countAll++; countAll++;
@@ -3614,8 +3618,8 @@ void LocalPlayer::turnEngine3()
int tempOpponentCardsArray[7]; int tempOpponentCardsArray[7];
currentHand->getBoard()->getMyCards(tempBoardCardsArray); currentHand->getBoard()->getMyCards(tempBoardCardsArray);
tempMyCardsArray[0] = myCards[0]; tempMyCardsArray[0] = myHoleCards[0];
tempMyCardsArray[1] = myCards[1]; tempMyCardsArray[1] = myHoleCards[1];
tempMyCardsArray[2] = tempBoardCardsArray[0]; tempMyCardsArray[2] = tempBoardCardsArray[0];
tempMyCardsArray[3] = tempBoardCardsArray[1]; tempMyCardsArray[3] = tempBoardCardsArray[1];
tempMyCardsArray[4] = tempBoardCardsArray[2]; tempMyCardsArray[4] = tempBoardCardsArray[2];
@@ -3633,11 +3637,11 @@ void LocalPlayer::turnEngine3()
int countMy = 0; int countMy = 0;
for(i=0; i<49; i++) { for(i=0; i<49; i++) {
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
for(j=i+1; j<50; j++) { for(j=i+1; j<50; j++) {
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
for(k=j+1; k<51; k++) { for(k=j+1; k<51; k++) {
if(k != myCards[0] && k != myCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) { if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
countAll++; countAll++;
@@ -3780,8 +3784,8 @@ void LocalPlayer::riverEngine3()
int tempOpponentCardsArray[7]; int tempOpponentCardsArray[7];
currentHand->getBoard()->getMyCards(tempBoardCardsArray); currentHand->getBoard()->getMyCards(tempBoardCardsArray);
tempMyCardsArray[0] = myCards[0]; tempMyCardsArray[0] = myHoleCards[0];
tempMyCardsArray[1] = myCards[1]; tempMyCardsArray[1] = myHoleCards[1];
tempMyCardsArray[2] = tempBoardCardsArray[0]; tempMyCardsArray[2] = tempBoardCardsArray[0];
tempMyCardsArray[3] = tempBoardCardsArray[1]; tempMyCardsArray[3] = tempBoardCardsArray[1];
tempMyCardsArray[4] = tempBoardCardsArray[2]; tempMyCardsArray[4] = tempBoardCardsArray[2];
@@ -3801,9 +3805,9 @@ void LocalPlayer::riverEngine3()
int countMy = 0; int countMy = 0;
for(i=0; i<49; i++) { for(i=0; i<49; i++) {
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
for(j=i+1; j<50; j++) { for(j=i+1; j<50; j++) {
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
countAll++; countAll++;
+14 -14
View File
@@ -157,13 +157,13 @@ public:
return myStayOnTableStatus; return myStayOnTableStatus;
} }
void setMyCards(int* theValue) { void setMyHoleCards(int* theValue) {
int i; int i;
for(i=0; i<2; i++) myCards[i] = theValue[i]; for(i=0; i<2; i++) myHoleCards[i] = theValue[i];
} }
void getMyCards(int* theValue) const { void getMyHoleCards(int* theValue) const {
int i; int i;
for(i=0; i<2; i++) theValue[i] = myCards[i]; for(i=0; i<2; i++) theValue[i] = myHoleCards[i];
} }
void setMyTurn(bool theValue) { void setMyTurn(bool theValue) {
@@ -173,27 +173,27 @@ public:
return myTurn; return myTurn;
} }
void setMyCardsFlip(bool theValue, int state) { void setMyHoleCardsFlip(bool theValue, int state) {
myCardsFlip = theValue; myHoleCardsFlip = theValue;
// log flipping cards // log flipping cards
if(myCardsFlip) { if(myHoleCardsFlip) {
switch(state) { switch(state) {
case 1: case 1:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt); currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt);
break; break;
case 2: case 2:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]); currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1]);
break; break;
case 3: case 3:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has"); currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt, "has");
break; break;
default: default:
; ;
} }
} }
} }
bool getMyCardsFlip() const { bool getMyHoleCardsFlip() const {
return myCardsFlip; return myHoleCardsFlip;
} }
void setMyCardsValueInt(int theValue) { void setMyCardsValueInt(int theValue) {
@@ -329,7 +329,7 @@ private:
int myNiveau[3]; int myNiveau[3];
bool logHoleCardsDone; bool logHoleCardsDone;
int myCards[2]; int myHoleCards[2];
int myCash; int myCash;
int mySet; int mySet;
int myLastRelativeSet; int myLastRelativeSet;
@@ -338,7 +338,7 @@ private:
bool myActiveStatus; // 0 = inactive, 1 = active bool myActiveStatus; // 0 = inactive, 1 = active
bool myStayOnTableStatus; // 0 = left, 1 = stay bool myStayOnTableStatus; // 0 = left, 1 = stay
bool myTurn; // 0 = no, 1 = yes bool myTurn; // 0 = no, 1 = yes
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped, bool myHoleCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
int myRoundStartCash; int myRoundStartCash;
int lastMoneyWon; int lastMoneyWon;
+1 -1
View File
@@ -601,7 +601,7 @@ Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerI
if( mySqliteLogDb != 0) { if( mySqliteLogDb != 0) {
int myCards[2]; int myCards[2];
player->getMyCards(myCards); player->getMyHoleCards(myCards);
sql += "UPDATE Hand SET "; sql += "UPDATE Hand SET ";
if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0) { if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0) {
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName(player->getMyCardsValueInt(),activePlayerList) + "\""; sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName(player->getMyCardsValueInt(),activePlayerList) + "\"";
+1 -1
View File
@@ -44,7 +44,7 @@ ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boos
for(it=seatsList->begin(); it!=seatsList->end(); ++it) { for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
(*it)->setHand(this); (*it)->setHand(this);
// myFlipCards auf 0 setzen // myFlipCards auf 0 setzen
(*it)->setMyCardsFlip(0, 0); (*it)->setMyHoleCardsFlip(0, 0);
} }
// roundStartCashArray fuellen // roundStartCashArray fuellen
+14 -14
View File
@@ -38,12 +38,12 @@ using namespace std;
ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB) ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB)
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type), : PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type),
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0), myName(name), myAvatar(avatar), 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(sotS), myTurn(false), myCardsFlip(false), myRoundStartCash(0), myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(sotS), myTurn(false), myHoleCardsFlip(false), myRoundStartCash(0),
lastMoneyWon(0), sBluff(0), sBluffStatus(false), m_isSessionActive(false), m_isKicked(false), m_isMuted(false) lastMoneyWon(0), sBluff(0), sBluffStatus(false), m_isSessionActive(false), m_isKicked(false), m_isMuted(false)
{ {
myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0; myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0;
myNiveau[0] = myNiveau[1] = myNiveau[2] = 0; myNiveau[0] = myNiveau[1] = myNiveau[2] = 0;
myCards[0] = myCards[1] = 0; myHoleCards[0] = myHoleCards[1] = 0;
myAverageSets[0] = myAverageSets[1] = myAverageSets[2] = myAverageSets[3] = 0; myAverageSets[0] = myAverageSets[1] = myAverageSets[2] = myAverageSets[3] = 0;
myAggressive[0] = myAggressive[1] = myAggressive[2] = myAggressive[3] = myAggressive[4] = myAggressive[5] = myAggressive[6] = false; myAggressive[0] = myAggressive[1] = myAggressive[2] = myAggressive[3] = myAggressive[4] = myAggressive[5] = myAggressive[6] = false;
} }
@@ -264,19 +264,19 @@ ClientPlayer::getMyStayOnTableStatus() const
} }
void void
ClientPlayer::setMyCards(int* theValue) ClientPlayer::setMyHoleCards(int* theValue)
{ {
boost::recursive_mutex::scoped_lock lock(m_syncMutex); boost::recursive_mutex::scoped_lock lock(m_syncMutex);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
myCards[i] = theValue[i]; myHoleCards[i] = theValue[i];
} }
void void
ClientPlayer::getMyCards(int* theValue) const ClientPlayer::getMyHoleCards(int* theValue) const
{ {
boost::recursive_mutex::scoped_lock lock(m_syncMutex); boost::recursive_mutex::scoped_lock lock(m_syncMutex);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
theValue[i] = myCards[i]; theValue[i] = myHoleCards[i];
} }
void void
@@ -294,21 +294,21 @@ ClientPlayer::getMyTurn() const
} }
void void
ClientPlayer::setMyCardsFlip(bool theValue, int state) ClientPlayer::setMyHoleCardsFlip(bool theValue, int state)
{ {
boost::recursive_mutex::scoped_lock lock(m_syncMutex); boost::recursive_mutex::scoped_lock lock(m_syncMutex);
myCardsFlip = theValue; myHoleCardsFlip = theValue;
// log flipping cards // log flipping cards
if (myCardsFlip) { if (myHoleCardsFlip) {
switch(state) { switch(state) {
case 1: case 1:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt); currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt);
break; break;
case 2: case 2:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]); currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1]);
break; break;
case 3: case 3:
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has"); currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt, "has");
break; break;
default: default:
; ;
@@ -317,10 +317,10 @@ ClientPlayer::setMyCardsFlip(bool theValue, int state)
} }
bool bool
ClientPlayer::getMyCardsFlip() const ClientPlayer::getMyHoleCardsFlip() const
{ {
boost::recursive_mutex::scoped_lock lock(m_syncMutex); boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return myCardsFlip; return myHoleCardsFlip;
} }
void void
+6 -6
View File
@@ -89,14 +89,14 @@ public:
void setMyStayOnTableStatus(bool theValue); void setMyStayOnTableStatus(bool theValue);
bool getMyStayOnTableStatus() const; bool getMyStayOnTableStatus() const;
void setMyCards(int* theValue); void setMyHoleCards(int* theValue);
void getMyCards(int* theValue) const; void getMyHoleCards(int* theValue) const;
void setMyTurn(bool theValue); void setMyTurn(bool theValue);
bool getMyTurn() const; bool getMyTurn() const;
void setMyCardsFlip(bool theValue, int state); void setMyHoleCardsFlip(bool theValue, int state);
bool getMyCardsFlip() const; bool getMyHoleCardsFlip() const;
void setMyCardsValueInt(int theValue); void setMyCardsValueInt(int theValue);
int getMyCardsValueInt() const; int getMyCardsValueInt() const;
@@ -184,7 +184,7 @@ private:
int myNiveau[3]; int myNiveau[3];
bool logHoleCardsDone; bool logHoleCardsDone;
int myCards[2]; int myHoleCards[2];
int myCash; int myCash;
int mySet; int mySet;
int myLastRelativeSet; int myLastRelativeSet;
@@ -193,7 +193,7 @@ private:
bool myActiveStatus; // 0 = inactive, 1 = active bool myActiveStatus; // 0 = inactive, 1 = active
bool myStayOnTableStatus; // 0 = left, 1 = stay bool myStayOnTableStatus; // 0 = left, 1 = stay
bool myTurn; // 0 = no, 1 = yes bool myTurn; // 0 = no, 1 = yes
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped, bool myHoleCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
int myRoundStartCash; int myRoundStartCash;
int lastMoneyWon; int lastMoneyWon;
+4 -4
View File
@@ -87,14 +87,14 @@ public:
virtual void setMyStayOnTableStatus(bool theValue) =0; virtual void setMyStayOnTableStatus(bool theValue) =0;
virtual bool getMyStayOnTableStatus() const =0; virtual bool getMyStayOnTableStatus() const =0;
virtual void setMyCards(int* theValue) =0; virtual void setMyHoleCards(int* theValue) =0;
virtual void getMyCards(int* theValue) const =0; virtual void getMyHoleCards(int* theValue) const =0;
virtual void setMyTurn(bool theValue) =0; virtual void setMyTurn(bool theValue) =0;
virtual bool getMyTurn() const =0; virtual bool getMyTurn() const =0;
virtual void setMyCardsFlip(bool theValue, int state) =0; virtual void setMyHoleCardsFlip(bool theValue, int state) =0;
virtual bool getMyCardsFlip() const =0; virtual bool getMyHoleCardsFlip() const =0;
virtual void setMyCardsValueInt(int theValue) =0; virtual void setMyCardsValueInt(int theValue) =0;
virtual int getMyCardsValueInt() const =0; virtual int getMyCardsValueInt() const =0;
+7 -7
View File
@@ -834,7 +834,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
QPixmap tempCardsPixmapArray[2]; QPixmap tempCardsPixmapArray[2];
int tempCardsIntArray[2]; int tempCardsIntArray[2];
humanPlayer->getMyCards(tempCardsIntArray); humanPlayer->getMyHoleCards(tempCardsIntArray);
if(myConfig->readConfigInt("AntiPeekMode")) { if(myConfig->readConfigInt("AntiPeekMode")) {
holeCardsArray[0][0]->setPixmap(flipside, true); holeCardsArray[0][0]->setPixmap(flipside, true);
tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png")); tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png"));
@@ -1440,7 +1440,7 @@ void gameTableImpl::dealHoleCards()
PlayerListConstIterator it_c; PlayerListConstIterator it_c;
PlayerList seatsList = currentGame->getSeatsList(); PlayerList seatsList = currentGame->getSeatsList();
for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) { for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
(*it_c)->getMyCards(tempCardsIntArray); (*it_c)->getMyHoleCards(tempCardsIntArray);
for(j=0; j<2; j++) { for(j=0; j<2; j++) {
if((*it_c)->getMyActiveStatus()) { if((*it_c)->getMyActiveStatus()) {
if (( (*it_c)->getMyID() == 0) || (currentGame->getCurrentHand()->getLog() && currentGame->getCurrentHand()->getLog()->getDebugMode()) ) { if (( (*it_c)->getMyID() == 0) || (currentGame->getCurrentHand()->getLog() && currentGame->getCurrentHand()->getLog()->getDebugMode()) ) {
@@ -2550,7 +2550,7 @@ void gameTableImpl::postRiverRunAnimation2()
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
//set Player value (logging) for all in already shown cards //set Player value (logging) for all in already shown cards
(*it_c)->setMyCardsFlip(1,3); (*it_c)->setMyHoleCardsFlip(1,3);
} }
} }
} }
@@ -2843,7 +2843,7 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
if((*it_c)->getMyUniqueID() == playerId) { if((*it_c)->getMyUniqueID() == playerId) {
(*it_c)->getMyCards(tempCardsIntArray); (*it_c)->getMyHoleCards(tempCardsIntArray);
for(j=0; j<2; j++) { for(j=0; j<2; j++) {
if(showFlipcardAnimation) { // with Eye-Candy if(showFlipcardAnimation) { // with Eye-Candy
@@ -2855,9 +2855,9 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
} }
//set Player value (logging) //set Player value (logging)
if(currentHand->getCurrentRound() < GAME_STATE_RIVER || allIn) { if(currentHand->getCurrentRound() < GAME_STATE_RIVER || allIn) {
(*it_c)->setMyCardsFlip(1,2); //for bero before postriver or allin just log the hole cards (*it_c)->setMyHoleCardsFlip(1,2); //for bero before postriver or allin just log the hole cards
} else { } else {
(*it_c)->setMyCardsFlip(1,1); //for postriver log the value (*it_c)->setMyHoleCardsFlip(1,1); //for postriver log the value
} }
} }
} }
@@ -4014,7 +4014,7 @@ void gameTableImpl::refreshCardsChance(GameState bero)
int boardCards[5]; int boardCards[5];
int holeCards[2]; int holeCards[2];
humanPlayer->getMyCards(holeCards); humanPlayer->getMyHoleCards(holeCards);
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards); myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
if(humanPlayer->getMyAction() == PLAYER_ACTION_FOLD) { if(humanPlayer->getMyAction() == PLAYER_ACTION_FOLD) {
+1 -1
View File
@@ -470,7 +470,7 @@ void guiLog::showLog(QString fileStringPdb, QTextBrowser *tb_tmp, int uniqueGame
int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
{ {
bool neu = true; bool neu = true;
result_struct results; result_struct results;
results.result_Session = 0; results.result_Session = 0;
+6 -6
View File
@@ -772,9 +772,9 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
} }
break; break;
case ERR_SOCK_CONNECT_IPV6_FAILED: { case ERR_SOCK_CONNECT_IPV6_FAILED: {
MyMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not connect to the server.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."), tr("Could not connect to the server.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_CONNECT_TIMEOUT: { case ERR_SOCK_CONNECT_TIMEOUT: {
@@ -784,9 +784,9 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
} }
break; break;
case ERR_SOCK_CONNECT_IPV6_TIMEOUT: { case ERR_SOCK_CONNECT_IPV6_TIMEOUT: {
MyMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Connection timed out.\nPlease check the server address.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."), tr("Connection timed out.\nPlease check the server address.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_SELECT_FAILED: { case ERR_SOCK_SELECT_FAILED: {
+5 -6
View File
@@ -535,8 +535,7 @@ ClientStateStartConnect::TimerTimeout(const boost::system::error_code& ec, boost
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec); client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
if (client->GetContext().GetAddrFamily() == AF_INET6) { if (client->GetContext().GetAddrFamily() == AF_INET6) {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_TIMEOUT, 0); throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_TIMEOUT, 0);
} } else {
else {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0); throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
} }
} }
@@ -1652,7 +1651,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
// Basic synchronisation before a new hand is started. // Basic synchronisation before a new hand is started.
client->GetGui().waitForGuiUpdateDone(); client->GetGui().waitForGuiUpdateDone();
// Start new hand. // Start new hand.
client->GetGame()->getSeatsList()->front()->setMyCards(myCards); client->GetGame()->getSeatsList()->front()->setMyHoleCards(myCards);
client->GetGame()->initHand(); client->GetGame()->initHand();
client->GetGame()->getCurrentHand()->setSmallBlind(netHandStart.smallblind()); client->GetGame()->getCurrentHand()->setSmallBlind(netHandStart.smallblind());
client->GetGame()->getCurrentHand()->getCurrentBeRo()->setMinimumRaise(2 * netHandStart.smallblind()); client->GetGame()->getCurrentHand()->getCurrentBeRo()->setMinimumRaise(2 * netHandStart.smallblind());
@@ -1692,7 +1691,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
int bestHandPos[5]; int bestHandPos[5];
tmpCards[0] = static_cast<int>(r.resultcard1()); tmpCards[0] = static_cast<int>(r.resultcard1());
tmpCards[1] = static_cast<int>(r.resultcard2()); tmpCards[1] = static_cast<int>(r.resultcard2());
tmpPlayer->setMyCards(tmpCards); tmpPlayer->setMyHoleCards(tmpCards);
for (int num = 0; num < 5; num++) { for (int num = 0; num < 5; num++) {
bestHandPos[num] = r.besthandposition(num); bestHandPos[num] = r.besthandposition(num);
} }
@@ -1940,7 +1939,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
int tmpCards[2]; int tmpCards[2];
tmpCards[0] = static_cast<int>(p.allincard1()); tmpCards[0] = static_cast<int>(p.allincard1());
tmpCards[1] = static_cast<int>(p.allincard2()); tmpCards[1] = static_cast<int>(p.allincard2());
tmpPlayer->setMyCards(tmpCards); tmpPlayer->setMyHoleCards(tmpCards);
} }
client->GetGui().flipHolecardsAllIn(); client->GetGui().flipHolecardsAllIn();
if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) { if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) {
@@ -2012,7 +2011,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
int bestHandPos[5]; int bestHandPos[5];
tmpCards[0] = static_cast<int>(r.resultcard1()); tmpCards[0] = static_cast<int>(r.resultcard1());
tmpCards[1] = static_cast<int>(r.resultcard2()); tmpCards[1] = static_cast<int>(r.resultcard2());
tmpPlayer->setMyCards(tmpCards); tmpPlayer->setMyHoleCards(tmpCards);
for (int num = 0; num < 5; num++) { for (int num = 0; num < 5; num++) {
bestHandPos[num] = r.besthandposition(num); bestHandPos[num] = r.besthandposition(num);
} }
+3 -3
View File
@@ -210,7 +210,7 @@ SetPlayerResult(PlayerResult &playerResult, boost::shared_ptr<PlayerInterface> t
playerResult.set_playerid(tmpPlayer->getMyUniqueID()); playerResult.set_playerid(tmpPlayer->getMyUniqueID());
int tmpCards[2]; int tmpCards[2];
int bestHandPos[5]; int bestHandPos[5];
tmpPlayer->getMyCards(tmpCards); tmpPlayer->getMyHoleCards(tmpCards);
playerResult.set_resultcard1(tmpCards[0]); playerResult.set_resultcard1(tmpCards[0]);
playerResult.set_resultcard2(tmpCards[1]); playerResult.set_resultcard2(tmpCards[1]);
tmpPlayer->getMyBestHandPosition(bestHandPos); tmpPlayer->getMyBestHandPosition(bestHandPos);
@@ -999,7 +999,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
AllInShowCardsMessage::PlayerAllIn *playerAllIn = netAllInShow->add_playersallin(); AllInShowCardsMessage::PlayerAllIn *playerAllIn = netAllInShow->add_playersallin();
playerAllIn->set_playerid((*i)->getMyUniqueID()); playerAllIn->set_playerid((*i)->getMyUniqueID());
int tmpCards[2]; int tmpCards[2];
(*i)->getMyCards(tmpCards); (*i)->getMyHoleCards(tmpCards);
playerAllIn->set_allincard1(tmpCards[0]); playerAllIn->set_allincard1(tmpCards[0]);
playerAllIn->set_allincard2(tmpCards[1]); playerAllIn->set_allincard2(tmpCards[1]);
++i; ++i;
@@ -1257,7 +1257,7 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
if (tmpSession) { if (tmpSession) {
int cards[2]; int cards[2];
bool errorFlag = false; bool errorFlag = false;
tmpPlayer->getMyCards(cards); tmpPlayer->getMyHoleCards(cards);
boost::shared_ptr<NetPacket> notifyCards = CreateNetPacketHandStart(*server); boost::shared_ptr<NetPacket> notifyCards = CreateNetPacketHandStart(*server);
HandStartMessage *netHandStart = notifyCards->GetMsg()->mutable_handstartmessage(); HandStartMessage *netHandStart = notifyCards->GetMsg()->mutable_handstartmessage();