From 28f33dea760b67233a6fb9cee41c7dcdcab2d154 Mon Sep 17 00:00:00 2001 From: floty Date: Sun, 7 Oct 2007 12:00:34 +0000 Subject: [PATCH] --- src/engine/local_engine/localbero.cpp | 186 ++++++++++++-------------- 1 file changed, 85 insertions(+), 101 deletions(-) diff --git a/src/engine/local_engine/localbero.cpp b/src/engine/local_engine/localbero.cpp index 3f0c52d3..517d4970 100644 --- a/src/engine/local_engine/localbero.cpp +++ b/src/engine/local_engine/localbero.cpp @@ -45,19 +45,6 @@ LocalBeRo::LocalBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState g - - - - - - - - - - - - - @@ -92,109 +79,117 @@ void LocalBeRo::nextPlayer() { void LocalBeRo::run() { - if (firstRun || firstRunGui) { + if(firstRunGui) { + firstRunGui = false; + myHand->getGuiInterface()->dealBeRoCards(myBeRoID); + } + else { - // HACK - if(firstRunGui) { - firstRunGui = false; - myHand->getGuiInterface()->dealBeRoCards(myBeRoID); - } + if(firstRun) { - firstRun = false; -/* - - // 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 = smallBlindPositionIt; - for(i=0; igetActivePlayerList()->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 { - 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; - - - -*/ - - - - - - - - if(!(myHand->getAllInCondition())) { - + firstRun = false; + /* // determine smallBlindPosition - // PlayerListIterator smallBlindPositionIt; + PlayerListIterator smallBlindPositionIt; - // for(smallBlindPositionIt=myHand->getActivePlayerList()->begin(); smallBlindPositionIt!=myHand->getActivePlayerList()->end(); smallBlindPositionIt++) { - // if((*smallBlindPositionIt)->getMyButton() == BUTTON_SMALL_BLIND) break; - // } + 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 - bool runningPlayerFound = false; if(myHand->getActivePlayerList()->size() > 2) { - - it_1 = myHand->getActivePlayerIt(smallBlindPositionId); - assert( it_1 != myHand->getActivePlayerList()->end() ); - + it_1 = smallBlindPositionIt; for(i=0; igetActivePlayerList()->size(); i++) { - if(it_1 == myHand->getActivePlayerList()->begin()) it_1 = myHand->getActivePlayerList()->end(); it_1--; - - it_2 = myHand->getRunningPlayerIt((*it_1)->getMyUniqueID()); + it_2 = find(myHand->getRunningPlayerList()->begin(), myHand->getRunningPlayerList()->end(), *it_1); // running player found if(it_2 != myHand->getRunningPlayerList()->end()) { - firstRoundLastPlayersTurnId = (*it_2)->getMyUniqueID(); - runningPlayerFound = true; + lastPlayersTurnIt = it_2; break; } } - assert(runningPlayerFound); } // heads up: bigBlind begins -> dealer/smallBlind is running player before bigBlind else { - firstRoundLastPlayersTurnId = smallBlindPositionId; + 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; + } } - currentPlayersTurnId = firstRoundLastPlayersTurnId; + currentPlayersTurnIt = lastPlayersTurnIt; + + + + */ + + + + + + + + if(!(myHand->getAllInCondition())) { + + + + // 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 + bool runningPlayerFound = false; + if(myHand->getActivePlayerList()->size() > 2) { + + it_1 = myHand->getActivePlayerIt(smallBlindPositionId); + assert( it_1 != myHand->getActivePlayerList()->end() ); + + for(i=0; igetActivePlayerList()->size(); i++) { + + if(it_1 == myHand->getActivePlayerList()->begin()) it_1 = myHand->getActivePlayerList()->end(); + it_1--; + + it_2 = myHand->getRunningPlayerIt((*it_1)->getMyUniqueID()); + // running player found + if(it_2 != myHand->getRunningPlayerList()->end()) { + firstRoundLastPlayersTurnId = (*it_2)->getMyUniqueID(); + runningPlayerFound = true; + break; + } + } + assert(runningPlayerFound); + } + // heads up: bigBlind begins -> dealer/smallBlind is running player before bigBlind + else { + firstRoundLastPlayersTurnId = smallBlindPositionId; + } + + currentPlayersTurnId = firstRoundLastPlayersTurnId; + + + + } + + + @@ -210,17 +205,6 @@ void LocalBeRo::run() { - - - - - - - - } - - else { - //log the turned cards if(!logBoardCardsDone) {