adds activePlayerList and runningPlayerList (XV) - !!! BROKEN !!! - last sable rev866

This commit is contained in:
doitux
2007-09-26 20:11:49 +00:00
parent 1f21fe815e
commit f41245f310
+162
View File
@@ -77,6 +77,107 @@ void LocalBeRo::run() {
PlayerListIterator it;
if (firstRun) {
/*
// PlayerListIterator it;
// search bigBlindPosition in runningPlayerList -> old: delete
// it_1 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *bigBlindPositionIt);
// search bigBlindPosition in runningPlayerList
// PlayerListIterator bigBlindPositionIt = getMyHand()->getRunningPlayerIt(getBigBlindPositionId());
// more than 2 players are still active -> runningPlayerList is not empty
if(getMyHand()->getActivePlayerList()->size() > 2) {
// bigBlindPlayer not found in runningPlayerList (he is all in) -> bigBlindPlayer is not the running player before first action player
if(bigBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
// search smallBlindPosition in runningPlayerList
PlayerListIterator smallBlindPositionIt = getMyHand()->getRunningPlayerIt(getSmallBlindPositionId());
// if(smallBlindPositionIt == getMyHand()->getActivePlayerList()->begin()) smallBlindPositionIt = getMyHand()->getActivePlayerList()->end();
// smallBlindPositionIt--;
// it_2 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *smallBlindPositionIt);
// smallBlindPlayer not found in runningPlayerList (he is all in) -> next active player before smallBlindPlayer is running player before first action player
if(smallBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
it = getMyHand()->getActivePlayerIt(getSmallBlindPositionId());
assert(it != getMyHand()->getActivePlayerList()->end());
if(it == getMyHand()->getActivePlayerList()->begin()) it = getMyHand()->getActivePlayerList()->end();
it--;
setFirstRoundLastPlayersTurnId( (*it)->getMyUniqueID() );
// it_3 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *it_2);
// if(it_3 == getMyHand()->getRunningPlayerList()->end()) {
// cout << "ERROR - lastPlayersTurnIt-detection in localBeRoPreflop" << endl;
// } else {
// setLastPlayersTurnIt(it_3);
// }
}
// smallBlindPlayer found in runningPlayerList -> running player before first action player
else {
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
}
}
// bigBlindPlayer found in runningPlayerList -> player before first action player
else {
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
}
}
// heads up -> dealer/smallBlindPlayer is first action player and bigBlindPlayer is player before
else {
// bigBlindPlayer not found in runningPlayerList (he is all in) -> only smallBlind has to choose fold or call the bigBlindAmount
if(bigBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
// search smallBlindPosition in runningPlayerList
PlayerListIterator smallBlindPositionIt = getMyHand()->getRunningPlayerIt(getSmallBlindPositionId());
// smallBlindPlayer not found in runningPlayerList (he is all in) -> no running player -> showdown and no firstRoundLastPlayersTurnId is used
if(smallBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
}
// smallBlindPlayer found in runningPlayerList -> running player before first action player (himself)
else {
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
}
}
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
}
setCurrentPlayersTurnId( getFirstRoundLastPlayersTurnId() );
// determine smallBlindPosition
PlayerListIterator smallBlindPositionIt;
@@ -123,6 +224,67 @@ void LocalBeRo::run() {
*/
// determine smallBlindPosition
// PlayerListIterator smallBlindPositionIt;
// for(smallBlindPositionIt=myHand->getActivePlayerList()->begin(); smallBlindPositionIt!=myHand->getActivePlayerList()->end(); smallBlindPositionIt++) {
// if((*smallBlindPositionIt)->getMyButton() == BUTTON_SMALL_BLIND) break;
// }
// determine running player before smallBlind (for heads up: determine dealer/smallblind)
PlayerListIterator it_1, it_2;
size_t i;
// running player before smallBlind
if(myHand->getActivePlayerList()->size() > 2) {
it_1 = myHand->getActivePlayerIt(smallBlindPositionId);
assert( it_1 != myHand->getActivePlayerList()->end() );
for(i=0; i<myHand->getActivePlayerList()->size(); i++) {
if(it_1 == myHand->getActivePlayerList()->begin()) it_1 = myHand->getActivePlayerList()->end();
it_1--;
it_2 = find(myHand->getRunningPlayerList()->begin(), myHand->getRunningPlayerList()->end(), *it_1);
// running player found
if(it_2 != myHand->getRunningPlayerList()->end()) {
lastPlayersTurnIt = it_2;
break;
}
}
}
// heads up: bigBlind begins -> dealer/smallBlind is running player before bigBlind
else {
//TODO
// it_1 = find(myHand->getRunningPlayerList()->begin(), myHand->getRunningPlayerList()->end(), *smallBlindPositionIt);
if( it_1 == myHand->getRunningPlayerList()->end() ) {
cout << "ERROR - lastPlayersTurnIt-detection in localBeRo" << endl;
}
// smallBlind found
else {
lastPlayersTurnIt = it_1;
}
}
currentPlayersTurnIt = lastPlayersTurnIt;
myHand->getGuiInterface()->dealBeRoCards(myBeRoID);
firstRun = false;