Merge remote-tracking branch 'origin/master'

This commit is contained in:
doitux
2012-12-09 19:44:36 +01:00
+25 -4
View File
@@ -95,6 +95,8 @@ void LocalBoard::distributePot()
// temp var
int highestCardsValue;
size_t winnerCount;
bool finalPot;
int potCarryOver = 0;
size_t mod;
bool winnerHit;
@@ -111,7 +113,7 @@ void LocalBoard::distributePot()
potLevel.push_back(playerSetsSort[i]);
// level sum
potLevel.push_back((playerSetsSort.size()-i)*potLevel[0]);
potLevel.push_back((playerSetsSort.size()-i)*potLevel[0] + potCarryOver);
// determine level highestCardsValue
for(it_c=seatsList->begin(), j=0; it_c!=seatsList->end(); ++it_c,j++) {
@@ -133,6 +135,20 @@ void LocalBoard::distributePot()
throw LocalException(__FILE__, __LINE__, ERR_NO_WINNER);
}
// check if this is the final pot level for at least one winner
finalPot = false;
for(j=2; j<potLevel.size(); j++) {
// find seat with potLevel[j]-ID
for(it=seatsList->begin(), k=0; it!=seatsList->end(); ++it, k++) {
if((*it)->getMyUniqueID() == potLevel[j] && potLevel[0] == playerSets[k]) {
finalPot = true;
break;
}
}
if(finalPot) break;
}
if(finalPot) {
// distribute the pot level sum to level winners
mod = (potLevel[1])%winnerCount;
// pot level sum divisible by winnerCount
@@ -199,6 +215,14 @@ void LocalBoard::distributePot()
}
}
}
potCarryOver = 0;
// pot refresh
pot -= potLevel[1];
} else {
potCarryOver = potLevel[1];
}
// reevaluate the player sets
for(j=0; j<playerSets.size(); j++) {
@@ -211,9 +235,6 @@ void LocalBoard::distributePot()
playerSetsSort = playerSets;
sort(playerSetsSort.begin(), playerSetsSort.end());
// pot refresh
pot -= potLevel[1];
// clear potLevel
potLevel.clear();