adds activePlayerList and runningPlayerList (XVI)

This commit is contained in:
doitux
2007-09-26 22:27:05 +00:00
parent f41245f310
commit 4f7d7ee277
6 changed files with 158 additions and 158 deletions
+18 -5
View File
@@ -364,17 +364,21 @@ void LocalHand::switchRounds() {
// cout << "playerID begin switchRounds(): " << getCurrentBeRo()->get
int i;
PlayerListIterator it;
PlayerListIterator it, it_1;
PlayerListConstIterator it_c;
// refresh runningPlayerList
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); ) {
if((*it)->getMyAction() == 1 || (*it)->getMyAction() == 6) {
it = runningPlayerList->erase(it);
// it_1 = it;
// if(it_1 == runningPlayerList->begin()) it_1 = runningPlayerList->end();
// it_1--;
// getCurrentBeRo()->setCurrentPlayersTurnIt(it_1);
if(!(runningPlayerList->empty())) {
it_1 = it;
if(it_1 == runningPlayerList->begin()) it_1 = runningPlayerList->end();
it_1--;
getCurrentBeRo()->setCurrentPlayersTurnId((*it_1)->getMyUniqueID());
}
} else {
it++;
}
@@ -386,12 +390,16 @@ void LocalHand::switchRounds() {
if ((*it_c)->getMyAction() == 6) allInPlayersCounter++;
}
cout << "allInPlayersCounter: " << allInPlayersCounter << endl;
// TODO -> runningPlayerList.size()
int nonFoldPlayerCounter = 0;
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
if ((*it_c)->getMyAction() != 1) nonFoldPlayerCounter++;
}
cout << "nonFoldPlayerCounter: " << nonFoldPlayerCounter << endl;
//wenn nur noch einer nicht-folded dann gleich den Pot verteilen
if(nonFoldPlayerCounter==1) {
myBoard->collectPot();
@@ -515,11 +523,16 @@ PlayerListIterator LocalHand::getRunningPlayerIt(unsigned uniqueId) const {
PlayerListIterator it;
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); it++) {
cout << (*it)->getMyUniqueID() << " ";
if((*it)->getMyUniqueID() == uniqueId) {
break;
}
}
cout << endl;
return it;
}