adds activePlayerList and runningPlayerList (V)

This commit is contained in:
doitux
2007-09-25 09:07:36 +00:00
parent f6a316fc2e
commit f39a7d393a
5 changed files with 30 additions and 37 deletions
+11 -22
View File
@@ -29,17 +29,11 @@ LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, int dP, int sB) :
{
setHighestSet(2*getSmallBlind());
// // BigBlind ermitteln
// bigBlindPosition = getDealerPosition();
bigBlindPosition = getMyHand()->getActivePlayerList()->begin();
// int i;
// for(i=0; i<MAX_NUMBER_OF_PLAYERS && getMyHand()->getPlayerArray()[bigBlindPosition]->getMyButton() != BUTTON_BIG_BLIND; i++) {
// bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS);
// }
// // BigBlind ermitteln
PlayerListIterator it;
bigBlindPosition = getMyHand()->getActivePlayerList()->begin();
for(it=getMyHand()->getActivePlayerList()->begin(); it!=getMyHand()->getActivePlayerList()->end(); it++) {
if((*it)->getMyButton() == BUTTON_BIG_BLIND) {
bigBlindPosition = it;
@@ -63,23 +57,18 @@ LocalBeRoPreflop::~LocalBeRoPreflop()
void LocalBeRoPreflop::run() {
int i;
bool allHighestSet = 1;
bool allHighestSet = true;
PlayerListIterator it;
PlayerList runningPlayerList = getMyHand()->getRunningPlayerList();
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus() && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_ALLIN) {
if(getHighestSet() != getMyHand()->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
// test if all running players have same sets (else allHighestSet = false)
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); it++) {
if(getHighestSet() != (*it)->getMySet()) {
allHighestSet = false;
}
}
// BigBlind ermitteln
// bigBlindPosition = getDealerPosition();
// for(i=0; i<MAX_NUMBER_OF_PLAYERS && getMyHand()->getPlayerArray()[bigBlindPosition]->getMyButton() != BUTTON_BIG_BLIND; i++) {
// bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS);
// }
// naechsten Spieler ermitteln
// determine next player
for(i=0; (i<MAX_NUMBER_OF_PLAYERS && (!(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyActiveStatus()) || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_FOLD || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_ALLIN)) || i==0; i++) {
setPlayersTurn((getPlayersTurn()+1)%(MAX_NUMBER_OF_PLAYERS));
@@ -34,7 +34,6 @@ public:
void run();
private:
// int bigBlindPosition;
PlayerListIterator bigBlindPosition;
};
+10
View File
@@ -969,6 +969,16 @@ void LocalPlayer::action() {
myTurn = 0;
// cout << "jetzt" << endl;
if(myAction == 1 || myAction == 6) {
PlayerListIterator it;
for(it=actualHand->getRunningPlayerList()->begin(); it!=actualHand->getRunningPlayerList()->end(); it++) {
if((*it)->getMyID() == myID) {
(*it).reset();
it = actualHand->getRunningPlayerList()->erase(it);
}
}
}
//set that i was the last active player. need this for unhighlighting groupbox
actualHand->setLastPlayersTurn(myID);
+9 -9
View File
@@ -35,8 +35,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
startQuantityPlayers(startData.numberOfPlayers),
startCash(gameData.startMoney), startSmallBlind(gameData.smallBlind),
startHandsBeforeRaiseSmallBlind(gameData.handsBeforeRaise),
myGameID(gameId), actualQuantityPlayers(startData.numberOfPlayers),
actualSmallBlind(gameData.smallBlind), actualHandID(0), dealerPosition(0)
myGameID(gameId), actualSmallBlind(gameData.smallBlind), actualHandID(0), dealerPosition(0)
{
// cout << "Create Game Object" << "\n";
int i;
@@ -102,13 +101,11 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
playerArray.push_back(tmpPlayer);
if(startQuantityPlayers > i) {
activePlayerList->push_back(tmpPlayer);
runningPlayerList->push_back(tmpPlayer);
// runningPlayerList->push_back(tmpPlayer);
}
(*runningPlayerList) = (*activePlayerList);
// playerArray[i] = myFactory->createPlayer(actualBoard, i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
playerArray[i]->setNetSessionData(myNetSession);
}
actualBoard->setPlayerLists(playerArray, activePlayerList, runningPlayerList);
@@ -161,14 +158,17 @@ void Game::initHand()
}
}
// Anzahl noch aktiver Spieler ermitteln
actualQuantityPlayers = activePlayerList->size(); // TODO -> delete !!!
//Spieler Action auf 0 setzen
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
playerArray[i]->setMyAction(0);
}
runningPlayerList->clear();
for(it=activePlayerList->begin(); it!=activePlayerList->end(); it++) {
runningPlayerList->push_back(*it);
}
// Hand erstellen
actualHand = myFactory->createHand(myFactory, myGui, actualBoard, playerArray, activePlayerList, runningPlayerList, actualHandID, startQuantityPlayers, dealerPosition, actualSmallBlind, startCash);
-5
View File
@@ -69,10 +69,6 @@ public:
int getMyGameID() const { return myGameID; }
//Zufgriff Laufvariablen
void setActualQuantityPlayers(int theValue) { actualQuantityPlayers = theValue; }
int getActualQuantityPlayers() const { return actualQuantityPlayers; }
void setActualSmallBlind(int theValue) { actualSmallBlind = theValue; }
int getActualSmallBlind() const { return actualSmallBlind; }
@@ -104,7 +100,6 @@ private:
int guiPlayerNum;
//Laufvariablen
int actualQuantityPlayers;
int actualSmallBlind;
int actualHandID;
int dealerPosition;