From 8f029d2ea43bcaed4844e566d118c45d4e3ebec6 Mon Sep 17 00:00:00 2001 From: doitux Date: Sun, 23 Sep 2007 17:07:52 +0000 Subject: [PATCH] bugfix: segfault in kicker detection --- src/engine/local_engine/localhand.cpp | 39 ++++++++++++++++-------- src/engine/local_engine/localplayer.cpp | 26 ++++++++++++---- src/gui/qt/mainwindow/log/log.cpp | 26 ++++++++-------- src/gui/qt/mainwindow/mainwindowimpl.cpp | 2 +- 4 files changed, 60 insertions(+), 33 deletions(-) diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 16d9daa7..f681abb9 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -106,11 +106,11 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI case 1: { - tempBoardArray[0] = 3; - tempBoardArray[1] = 16; - tempBoardArray[2] = 29; - tempBoardArray[3] = 0; - tempBoardArray[4] = 6; + tempBoardArray[0] = 5; + tempBoardArray[1] = 51; + tempBoardArray[2] = 3; + tempBoardArray[3] = 21; + tempBoardArray[4] = 13; myBoard->setMyCards(tempBoardArray); @@ -122,8 +122,8 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player0 - tempPlayerArray[0] = 12; - tempPlayerArray[1] = 15; + tempPlayerArray[0] = 7; + tempPlayerArray[1] = 37; tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[1] = tempPlayerArray[1]; @@ -134,8 +134,8 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player1 - tempPlayerArray[0] = 10; - tempPlayerArray[1] = 28; + tempPlayerArray[0] = 24; + tempPlayerArray[1] = 19; tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[1] = tempPlayerArray[1]; @@ -146,7 +146,7 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player2 - tempPlayerArray[0] = 25; +/* tempPlayerArray[0] = 25; tempPlayerArray[1] = 36; tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[1] = tempPlayerArray[1]; @@ -154,12 +154,12 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI playerArray[2]->setMyCards(tempPlayerArray); playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); - playerArray[2]->setMyBestHandPosition(temp5Array); + playerArray[2]->setMyBestHandPosition(temp5Array);*/ // player3 - tempPlayerArray[0] = 51; - tempPlayerArray[1] = 34; + tempPlayerArray[0] = 38; + tempPlayerArray[1] = 22; tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[1] = tempPlayerArray[1]; @@ -168,6 +168,19 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI playerArray[3]->setMyBestHandPosition(temp5Array); + // player4 + + tempPlayerArray[0] = 25; + tempPlayerArray[1] = 16; + tempPlayerAndBoardArray[0] = tempPlayerArray[0]; + tempPlayerAndBoardArray[1] = tempPlayerArray[1]; + + playerArray[3]->setMyCards(tempPlayerArray); + playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); + + playerArray[3]->setMyBestHandPosition(temp5Array); + + } break; case 2: { diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index 0359dd84..be42fba3 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -856,17 +856,23 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq if(myID==0) { // myActiveStatus=0; -// myCash=11980; + myCash=14800; } if(myID==1) { -// myCash=4505; + myCash=400; } if(myID==2) { -// myCash=9985; + myCash=4950; } if(myID==3) { -// myCash=8530; + myCash=5250; + } + if(myID==4) { + myCash=5100; + } + if(myID==5) { + myCash=4500; } } @@ -1195,7 +1201,7 @@ void LocalPlayer::preflopEngine() { switch(actualHand->getMyID()) { case 1: { -// myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_FOLD; // raise = 20; // if(mySet >= 40) { // myAction = PLAYER_ACTION_CALL; @@ -1217,7 +1223,15 @@ void LocalPlayer::preflopEngine() { } break; case 3: { -// myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_CALL; + } + break; + case 4: { + myAction = PLAYER_ACTION_CALL; + } + break; + case 5: { + myAction = PLAYER_ACTION_FOLD; } break; default: {} diff --git a/src/gui/qt/mainwindow/log/log.cpp b/src/gui/qt/mainwindow/log/log.cpp index b8d410f1..e90b5428 100644 --- a/src/gui/qt/mainwindow/log/log.cpp +++ b/src/gui/qt/mainwindow/log/log.cpp @@ -1284,7 +1284,7 @@ QString Log::determineHandName(int myCardsValueInt) { handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); -/* // same hand detection + // same hand detection for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { if(((*it)/1000000) == (myCardsValueInt/1000000)) { sameHandCardsValueInt.push_back(*it); @@ -1308,7 +1308,7 @@ QString Log::determineHandName(int myCardsValueInt) { } } -*/ + } break; // Full House @@ -1321,7 +1321,7 @@ QString Log::determineHandName(int myCardsValueInt) { handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); -/* // same hand detection + // same hand detection for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { if(((*it)/1000000) == (myCardsValueInt/1000000)) { sameHandCardsValueInt.push_back(*it); @@ -1398,7 +1398,7 @@ QString Log::determineHandName(int myCardsValueInt) { } } } -*/ + } break; // Straight @@ -1410,7 +1410,7 @@ QString Log::determineHandName(int myCardsValueInt) { case 3: { handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); -/* // same hand detection + // same hand detection for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { if(((*it)/1000000) == (myCardsValueInt/1000000)) { sameHandCardsValueInt.push_back(*it); @@ -1451,7 +1451,7 @@ QString Log::determineHandName(int myCardsValueInt) { } } } -*/ + } break; // Two Pairs @@ -1459,7 +1459,7 @@ QString Log::determineHandName(int myCardsValueInt) { handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1)+translateCardsValueCode(myCardsValueInt).at(2); -/* // same hand detection + // same hand detection for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { if(((*it)/10000) == (myCardsValueInt/10000)) { sameHandCardsValueInt.push_back(*it); @@ -1483,7 +1483,7 @@ QString Log::determineHandName(int myCardsValueInt) { } } -*/ + } break; // Pair @@ -1491,7 +1491,7 @@ QString Log::determineHandName(int myCardsValueInt) { handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); -/* // same hand detection + // same hand detection for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { if(((*it)/1000000) == (myCardsValueInt/1000000)) { sameHandCardsValueInt.push_back(*it); @@ -1550,7 +1550,7 @@ QString Log::determineHandName(int myCardsValueInt) { } } } -*/ + } break; // highestCard @@ -1558,7 +1558,7 @@ QString Log::determineHandName(int myCardsValueInt) { handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); -/* // same hand detection + // same hand detection for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { if(((*it)/1000000) == (myCardsValueInt/1000000)) { sameHandCardsValueInt.push_back(*it); @@ -1608,7 +1608,7 @@ QString Log::determineHandName(int myCardsValueInt) { it++; } else { different = true; - sameHandCardsValueInt.erase(it); + it = sameHandCardsValueInt.erase(it); } } if(different) { @@ -1635,7 +1635,7 @@ QString Log::determineHandName(int myCardsValueInt) { } } } -*/ + } break; default: {} diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index b473922b..2804138c 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -735,7 +735,7 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) { startData.numberOfPlayers = gameData.maxNumberOfPlayers; Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0); if(DEBUG_MODE) { -// tmpDealerPos = 2; + tmpDealerPos = 3; } startData.startDealerPlayerId = static_cast(tmpDealerPos);