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
+78 -58
View File
@@ -239,42 +239,57 @@ 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;
// std::_List_const_iterator<unsigned> it_c; // std::_List_const_iterator<unsigned> it_c;
std::list<int*> level; std::list<int*> level;
// for(it_c=winners.begin(); it_c != winners.end(); it_c++) { // for(it_c=winners.begin(); it_c != winners.end(); it_c++) {
// cout << (*it_c) << endl; // cout << (*it_c) << endl;
// } // }
// //
// cout << "lastActionPlayer" << currentHand->getCurrentBeRo()->getLastActionPlayer() << endl; // cout << "lastActionPlayer" << currentHand->getCurrentBeRo()->getLastActionPlayer() << endl;
// //
// int lastActionPlayer = ; // int lastActionPlayer = ;
// //
// if(lastActionPlayer == -1) { // if(lastActionPlayer == -1) {
// lastActionPlayer = 0; // lastActionPlayer = 0;
// } // }
// //
// //
// //
PlayerListConstIterator lastActionPlayerIt; PlayerListConstIterator lastActionPlayerIt;
PlayerListConstIterator it_c; PlayerListConstIterator it_c;
// cout << "lAP-Ende: " << currentHand->getLastActionPlayer() << endl; // cout << "lAP-Ende: " << currentHand->getLastActionPlayer() << endl;
// search lastActionPlayer // search lastActionPlayer
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,14 +306,16 @@ 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();
level_tmp[1] = (*lastActionPlayerIt)->getMyRoundStartCash()-(*lastActionPlayerIt)->getMyCash(); level_tmp[1] = (*lastActionPlayerIt)->getMyRoundStartCash()-(*lastActionPlayerIt)->getMyCash();
// 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);
@@ -306,8 +323,8 @@ void LocalBoard::determinePlayerNeedToShowCards() {
std::_List_iterator<int*> level_it_tmp; std::_List_iterator<int*> level_it_tmp;
std::_List_iterator<int*> next_level_it; std::_List_iterator<int*> next_level_it;
// PlayerListConstIterator firstAfterLastActionPlayerIt = lastActionPlayerIt; // PlayerListConstIterator firstAfterLastActionPlayerIt = lastActionPlayerIt;
// firstAfterLastActionPlayerIt++; // firstAfterLastActionPlayerIt++;
it_c = lastActionPlayerIt; it_c = lastActionPlayerIt;
it_c++; it_c++;
@@ -317,12 +334,12 @@ void LocalBoard::determinePlayerNeedToShowCards() {
if(it_c == activePlayerList->end()) it_c = activePlayerList->begin(); if(it_c == activePlayerList->end()) it_c = activePlayerList->begin();
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
// for(it_c = firstAfterLastActionPlayerIt; it_c != lastActionPlayerIt; it_c++) { // for(it_c = firstAfterLastActionPlayerIt; it_c != lastActionPlayerIt; it_c++) {
// if(it_c == lastActionPlayerIt) { // if(it_c == lastActionPlayerIt) {
// break; // break;
// } // }
// } // }
for(level_it = level.begin(); level_it != level.end(); level_it++) { for(level_it = level.begin(); level_it != level.end(); level_it++) {
if((*it_c)->getMyCardsValueInt() > (*level_it)[0]) { if((*it_c)->getMyCardsValueInt() > (*level_it)[0]) {
next_level_it = level_it; next_level_it = level_it;
@@ -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;
} }
@@ -383,25 +400,28 @@ void LocalBoard::determinePlayerNeedToShowCards() {
// bool showCards; // bool showCards;
// search for more player who have to show their cards (perhaps not all situation are considered yet) // search for more player who have to show their cards (perhaps not all situation are considered yet)
// for(it_c = ++lastActionPlayerIt; it_c!=activePlayerList->end(); it_c++) { // for(it_c = ++lastActionPlayerIt; it_c!=activePlayerList->end(); it_c++) {
// //
// showCards = false; // showCards = false;
// //
//// if((*it_c)->getMyCardsValueInt() >= highestCardsValueInt) { //// if((*it_c)->getMyCardsValueInt() >= highestCardsValueInt) {
//// playerNeedToShowCards.push_back((*it_c)->getMyUniqueID()); //// playerNeedToShowCards.push_back((*it_c)->getMyUniqueID());
//// highestCardsValueInt = (*it_c)->getMyCardsValueInt(); //// highestCardsValueInt = (*it_c)->getMyCardsValueInt();
//// } //// }
// } // }
// //
// for(it_c = activePlayerList->begin(); it_c!=lastActionPlayerIt; it_c++) { // for(it_c = activePlayerList->begin(); it_c!=lastActionPlayerIt; it_c++) {
//// if((*it_c)->getMyCardsValueInt() >= highestCardsValueInt) { //// if((*it_c)->getMyCardsValueInt() >= highestCardsValueInt) {
//// playerNeedToShowCards.push_back((*it_c)->getMyUniqueID()); //// playerNeedToShowCards.push_back((*it_c)->getMyUniqueID());
//// highestCardsValueInt = (*it_c)->getMyCardsValueInt(); //// highestCardsValueInt = (*it_c)->getMyCardsValueInt();
//// } //// }
// } // }
}
// sort and unique the list // sort and unique the list
playerNeedToShowCards.sort(); playerNeedToShowCards.sort();
@@ -409,9 +429,9 @@ void LocalBoard::determinePlayerNeedToShowCards() {
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;
} }