bugfix: segfault in kicker detection

This commit is contained in:
doitux
2007-09-23 17:07:52 +00:00
parent d52ff7e830
commit 8f029d2ea4
4 changed files with 60 additions and 33 deletions
+26 -13
View File
@@ -106,11 +106,11 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
case 1: { case 1: {
tempBoardArray[0] = 3; tempBoardArray[0] = 5;
tempBoardArray[1] = 16; tempBoardArray[1] = 51;
tempBoardArray[2] = 29; tempBoardArray[2] = 3;
tempBoardArray[3] = 0; tempBoardArray[3] = 21;
tempBoardArray[4] = 6; tempBoardArray[4] = 13;
myBoard->setMyCards(tempBoardArray); myBoard->setMyCards(tempBoardArray);
@@ -122,8 +122,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player0 // player0
tempPlayerArray[0] = 12; tempPlayerArray[0] = 7;
tempPlayerArray[1] = 15; tempPlayerArray[1] = 37;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -134,8 +134,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player1 // player1
tempPlayerArray[0] = 10; tempPlayerArray[0] = 24;
tempPlayerArray[1] = 28; tempPlayerArray[1] = 19;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -146,7 +146,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player2 // player2
tempPlayerArray[0] = 25; /* tempPlayerArray[0] = 25;
tempPlayerArray[1] = 36; tempPlayerArray[1] = 36;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -154,12 +154,12 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
playerArray[2]->setMyCards(tempPlayerArray); playerArray[2]->setMyCards(tempPlayerArray);
playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
playerArray[2]->setMyBestHandPosition(temp5Array); playerArray[2]->setMyBestHandPosition(temp5Array);*/
// player3 // player3
tempPlayerArray[0] = 51; tempPlayerArray[0] = 38;
tempPlayerArray[1] = 34; tempPlayerArray[1] = 22;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -168,6 +168,19 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
playerArray[3]->setMyBestHandPosition(temp5Array); 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; } break;
case 2: { case 2: {
+20 -6
View File
@@ -856,17 +856,23 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
if(myID==0) { if(myID==0) {
// myActiveStatus=0; // myActiveStatus=0;
// myCash=11980; myCash=14800;
} }
if(myID==1) { if(myID==1) {
// myCash=4505; myCash=400;
} }
if(myID==2) { if(myID==2) {
// myCash=9985; myCash=4950;
} }
if(myID==3) { 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()) { switch(actualHand->getMyID()) {
case 1: { case 1: {
// myAction = PLAYER_ACTION_CALL; myAction = PLAYER_ACTION_FOLD;
// raise = 20; // raise = 20;
// if(mySet >= 40) { // if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL; // myAction = PLAYER_ACTION_CALL;
@@ -1217,7 +1223,15 @@ void LocalPlayer::preflopEngine() {
} }
break; break;
case 3: { 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; break;
default: {} default: {}
+13 -13
View File
@@ -1284,7 +1284,7 @@ QString Log::determineHandName(int myCardsValueInt) {
handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1);
/* // same hand detection // same hand detection
for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) {
if(((*it)/1000000) == (myCardsValueInt/1000000)) { if(((*it)/1000000) == (myCardsValueInt/1000000)) {
sameHandCardsValueInt.push_back(*it); sameHandCardsValueInt.push_back(*it);
@@ -1308,7 +1308,7 @@ QString Log::determineHandName(int myCardsValueInt) {
} }
} }
*/
} }
break; break;
// Full House // Full House
@@ -1321,7 +1321,7 @@ QString Log::determineHandName(int myCardsValueInt) {
handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1);
/* // same hand detection // same hand detection
for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) {
if(((*it)/1000000) == (myCardsValueInt/1000000)) { if(((*it)/1000000) == (myCardsValueInt/1000000)) {
sameHandCardsValueInt.push_back(*it); sameHandCardsValueInt.push_back(*it);
@@ -1398,7 +1398,7 @@ QString Log::determineHandName(int myCardsValueInt) {
} }
} }
} }
*/
} }
break; break;
// Straight // Straight
@@ -1410,7 +1410,7 @@ QString Log::determineHandName(int myCardsValueInt) {
case 3: { case 3: {
handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1);
/* // same hand detection // same hand detection
for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) {
if(((*it)/1000000) == (myCardsValueInt/1000000)) { if(((*it)/1000000) == (myCardsValueInt/1000000)) {
sameHandCardsValueInt.push_back(*it); sameHandCardsValueInt.push_back(*it);
@@ -1451,7 +1451,7 @@ QString Log::determineHandName(int myCardsValueInt) {
} }
} }
} }
*/
} }
break; break;
// Two Pairs // Two Pairs
@@ -1459,7 +1459,7 @@ QString Log::determineHandName(int myCardsValueInt) {
handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1)+translateCardsValueCode(myCardsValueInt).at(2); 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++) { for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) {
if(((*it)/10000) == (myCardsValueInt/10000)) { if(((*it)/10000) == (myCardsValueInt/10000)) {
sameHandCardsValueInt.push_back(*it); sameHandCardsValueInt.push_back(*it);
@@ -1483,7 +1483,7 @@ QString Log::determineHandName(int myCardsValueInt) {
} }
} }
*/
} }
break; break;
// Pair // Pair
@@ -1491,7 +1491,7 @@ QString Log::determineHandName(int myCardsValueInt) {
handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1);
/* // same hand detection // same hand detection
for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) {
if(((*it)/1000000) == (myCardsValueInt/1000000)) { if(((*it)/1000000) == (myCardsValueInt/1000000)) {
sameHandCardsValueInt.push_back(*it); sameHandCardsValueInt.push_back(*it);
@@ -1550,7 +1550,7 @@ QString Log::determineHandName(int myCardsValueInt) {
} }
} }
} }
*/
} }
break; break;
// highestCard // highestCard
@@ -1558,7 +1558,7 @@ QString Log::determineHandName(int myCardsValueInt) {
handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1); handName = translateCardsValueCode(myCardsValueInt).at(0)+translateCardsValueCode(myCardsValueInt).at(1);
/* // same hand detection // same hand detection
for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) { for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) {
if(((*it)/1000000) == (myCardsValueInt/1000000)) { if(((*it)/1000000) == (myCardsValueInt/1000000)) {
sameHandCardsValueInt.push_back(*it); sameHandCardsValueInt.push_back(*it);
@@ -1608,7 +1608,7 @@ QString Log::determineHandName(int myCardsValueInt) {
it++; it++;
} else { } else {
different = true; different = true;
sameHandCardsValueInt.erase(it); it = sameHandCardsValueInt.erase(it);
} }
} }
if(different) { if(different) {
@@ -1635,7 +1635,7 @@ QString Log::determineHandName(int myCardsValueInt) {
} }
} }
} }
*/
} }
break; break;
default: {} default: {}
+1 -1
View File
@@ -735,7 +735,7 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
startData.numberOfPlayers = gameData.maxNumberOfPlayers; startData.numberOfPlayers = gameData.maxNumberOfPlayers;
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0); Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
if(DEBUG_MODE) { if(DEBUG_MODE) {
// tmpDealerPos = 2; tmpDealerPos = 3;
} }
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos); startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);