adds activePlayerList and runningPlayerList (VIII) - BUGGY!!! - last sable rev856

This commit is contained in:
doitux
2007-09-25 12:43:58 +00:00
parent 42a8358243
commit 4efd19c758
4 changed files with 45 additions and 34 deletions
+9 -7
View File
@@ -32,16 +32,17 @@ LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, int dP, int sB) :
// // BigBlind ermitteln
PlayerListIterator it;
bigBlindPosition = getMyHand()->getActivePlayerList()->begin();
bigBlindPositionIt = getMyHand()->getActivePlayerList()->begin();
for(it=getMyHand()->getActivePlayerList()->begin(); it!=getMyHand()->getActivePlayerList()->end(); it++) {
if((*it)->getMyButton() == BUTTON_BIG_BLIND) {
bigBlindPosition = it;
}
for(bigBlindPositionIt=getMyHand()->getActivePlayerList()->begin(); bigBlindPositionIt!=getMyHand()->getActivePlayerList()->end(); bigBlindPositionIt++) {
cout << "playerID: " << (*bigBlindPositionIt)->getMyID() << " Button: " << (*bigBlindPositionIt)->getMyButton() << endl;
if((*bigBlindPositionIt)->getMyButton() == BUTTON_BIG_BLIND) break;
}
if(bigBlindPositionIt == getMyHand()->getActivePlayerList()->end()) cout << "!!!" << endl;
// // erste Spielernummer fr preflopRun() setzen
setPlayersTurn((*bigBlindPosition)->getMyID());
setPlayersTurn((*bigBlindPositionIt)->getMyID());
}
@@ -72,7 +73,8 @@ void LocalBeRoPreflop::run() {
setPlayersTurn((getPlayersTurn()+1)%(MAX_NUMBER_OF_PLAYERS));
// falls BigBlind, dann PreflopFirstRound zuende
if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND && (*bigBlindPosition)->getMySet() < 2*getSmallBlind()) setFirstRound(0);
if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND && (*bigBlindPositionIt)->getMySet() < 2*getSmallBlind()) setFirstRound(0);
// if next player is small blind and only all-in-big-blind with <= 2*smallblind is nonfold too
}
+1 -1
View File
@@ -34,7 +34,7 @@ public:
void run();
private:
PlayerListIterator bigBlindPosition;
PlayerListIterator bigBlindPositionIt;
};
#endif
+31 -19
View File
@@ -316,8 +316,8 @@ void LocalHand::assignButtons() {
}
}
//do sets
for (it=activePlayerList->begin(); it!=activePlayerList->end(); it++) {
//do sets --> TODO switch?
for (it=runningPlayerList->begin(); it!=runningPlayerList->end(); ) {
//small blind
if((*it)->getMyButton() == 2) {
@@ -332,23 +332,33 @@ void LocalHand::assignButtons() {
it = runningPlayerList->erase(it);
}
else { (*it)->setMySet(smallBlind); }
}
//big blind
if((*it)->getMyButton() == 3) {
// all in ?
if((*it)->getMyCash() <= 2*smallBlind) {
(*it)->setMySet((*it)->getMyCash());
// 1 to do not log this
(*it)->setMyAction(6,1);
// delete this player from runningPlayerList
it = runningPlayerList->erase(it);
else {
(*it)->setMySet(smallBlind);
it++;
}
else { (*it)->setMySet(2*smallBlind); }
} else {
//big blind
if((*it)->getMyButton() == 3) {
// all in ?
if((*it)->getMyCash() <= 2*smallBlind) {
(*it)->setMySet((*it)->getMyCash());
// 1 to do not log this
(*it)->setMyAction(6,1);
// delete this player from runningPlayerList
it = runningPlayerList->erase(it);
}
else {
(*it)->setMySet(2*smallBlind);
it++;
}
} else {
it++;
}
}
}
@@ -361,9 +371,11 @@ void LocalHand::switchRounds() {
PlayerListIterator it;
// refresh runningPlayerList
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); it++) {
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); ) {
if((*it)->getMyAction() == 1 || (*it)->getMyAction() == 6) {
it = runningPlayerList->erase(it);
} else {
it++;
}
}
+4 -7
View File
@@ -150,20 +150,17 @@ void Game::initHand()
// Spieler mit leerem Cash auf inactive setzen
PlayerListIterator it;
// cout << "id: " << actualHandID << endl;
for(it=activePlayerList->begin(); it!=activePlayerList->end(); it++) {
// cout << "player" << (*it)->getMyID() << ": " << (*it)->getMyCash() << endl;
for(it=activePlayerList->begin(); it!=activePlayerList->end(); ) {
if((*it)->getMyCash() == 0) {
// cout << "playerID: " << (*it)->getMyID() << endl;
(*it)->setMyActiveStatus(0);
it = activePlayerList->erase(it);
} else {
it++;
}
}
// cout << activePlayerList->size() << endl;
//Spieler Action auf 0 setzen
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
playerArray[i]->setMyAction(0);