bugfix: playerNeedToShowCards-List for all in situations

This commit is contained in:
floty
2010-09-04 23:30:55 +00:00
parent 0829e80d49
commit 0380ae0ced
+36 -16
View File
@@ -239,9 +239,24 @@ void LocalBoard::distributePot() {
void LocalBoard::determinePlayerNeedToShowCards() { void LocalBoard::determinePlayerNeedToShowCards() {
playerNeedToShowCards.clear(); playerNeedToShowCards.clear();
// in All In Condition everybody have to show the cards
if(currentHand->getAllInCondition()) {
PlayerListConstIterator it_c;
for(it_c = activePlayerList->begin(); it_c != activePlayerList->end(); it_c++) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
playerNeedToShowCards.push_back((*it_c)->getMyUniqueID());
}
}
}
else {
// all winners have to show their cards // all winners have to show their cards
// playerNeedToShowCards = winners; // playerNeedToShowCards = winners;
@@ -274,7 +289,7 @@ void LocalBoard::determinePlayerNeedToShowCards() {
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)->getMyUniqueID() == currentHand->getLastActionPlayer() && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { if((*it_c)->getMyUniqueID() == currentHand->getLastActionPlayer() && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
lastActionPlayerIt = it_c; lastActionPlayerIt = it_c;
// cout << (*it_c)->getMyUniqueID() << endl; cout << (*it_c)->getMyUniqueID() << endl;
break; break;
} }
} }
@@ -291,6 +306,8 @@ void LocalBoard::determinePlayerNeedToShowCards() {
// the player who has done the last action has to show his cards first // the player who has done the last action has to show his cards first
playerNeedToShowCards.push_back((*lastActionPlayerIt)->getMyUniqueID()); playerNeedToShowCards.push_back((*lastActionPlayerIt)->getMyUniqueID());
cout << (*lastActionPlayerIt)->getMyUniqueID() << " - " << (*lastActionPlayerIt)->getMyName() << endl;
int *level_tmp = new int[2]; int *level_tmp = new int[2];
// get position und cardsValue of the player who show his cards first // get position und cardsValue of the player who show his cards first
level_tmp[0] = (*lastActionPlayerIt)->getMyCardsValueInt(); level_tmp[0] = (*lastActionPlayerIt)->getMyCardsValueInt();
@@ -298,7 +315,7 @@ void LocalBoard::determinePlayerNeedToShowCards() {
// level_tmp = {(*lastActionPlayerIt)->getMyCardsValueInt(),(*lastActionPlayerIt)->getMyRoundStartCash()-(*lastActionPlayerIt)->getMyCash()}; // level_tmp = {(*lastActionPlayerIt)->getMyCardsValueInt(),(*lastActionPlayerIt)->getMyRoundStartCash()-(*lastActionPlayerIt)->getMyCash()};
// cout << level_tmp[0] << "," << level_tmp[1] << endl; cout << level_tmp[0] << "," << level_tmp[1] << endl;
level.push_back(level_tmp); level.push_back(level_tmp);
@@ -340,9 +357,9 @@ void LocalBoard::determinePlayerNeedToShowCards() {
next_level_it = level_it; next_level_it = level_it;
next_level_it++; next_level_it++;
// for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) { for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) {
// cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl; cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl;
// } }
if(next_level_it == level.end() || (*it_c)->getMyRoundStartCash()-(*it_c)->getMyCash() > (*next_level_it)[1]) { if(next_level_it == level.end() || (*it_c)->getMyRoundStartCash()-(*it_c)->getMyCash() > (*next_level_it)[1]) {
@@ -359,15 +376,15 @@ void LocalBoard::determinePlayerNeedToShowCards() {
level_tmp[0] = (*it_c)->getMyCardsValueInt(); level_tmp[0] = (*it_c)->getMyCardsValueInt();
level_tmp[1] = (*it_c)->getMyRoundStartCash()-(*it_c)->getMyCash(); level_tmp[1] = (*it_c)->getMyRoundStartCash()-(*it_c)->getMyCash();
// for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) { for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) {
// cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl; cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl;
// } }
level.insert(level_it,level_tmp); level.insert(level_it,level_tmp);
// for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) { for(level_it_tmp = level.begin(); level_it_tmp != level.end(); level_it_tmp++) {
// cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl; cout << (*level_it_tmp)[0] << "," << (*level_it_tmp)[1] << endl;
// } }
break; break;
} }
@@ -403,15 +420,18 @@ void LocalBoard::determinePlayerNeedToShowCards() {
//// } //// }
// } // }
}
// sort and unique the list // sort and unique the list
playerNeedToShowCards.sort(); playerNeedToShowCards.sort();
playerNeedToShowCards.unique(); playerNeedToShowCards.unique();
std::_List_iterator<unsigned> playerNeedToShowCardsIt; std::_List_iterator<unsigned> playerNeedToShowCardsIt;
// for(playerNeedToShowCardsIt = playerNeedToShowCards.begin(); playerNeedToShowCardsIt!=playerNeedToShowCards.end(); playerNeedToShowCardsIt++) { for(playerNeedToShowCardsIt = playerNeedToShowCards.begin(); playerNeedToShowCardsIt!=playerNeedToShowCards.end(); playerNeedToShowCardsIt++) {
// cout << (*playerNeedToShowCardsIt) << '\t'; cout << (*playerNeedToShowCardsIt) << '\t';
// } }
// cout << endl; cout << endl;
} }