cleaning code and hopefully last part of refactoring playerArray to playerLists ;)
This commit is contained in:
@@ -37,7 +37,7 @@ public:
|
||||
|
||||
virtual ~BoardInterface();
|
||||
//
|
||||
virtual void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList) =0;
|
||||
virtual void setPlayerLists(PlayerList, PlayerList, PlayerList) =0;
|
||||
virtual void setHand(HandInterface*) =0;
|
||||
//
|
||||
virtual void setMyCards(int* theValue) =0;
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
virtual ~EngineFactory();
|
||||
|
||||
virtual HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0;
|
||||
virtual HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0;
|
||||
virtual BoardInterface* createBoard() =0;
|
||||
virtual boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) =0;
|
||||
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB) =0;
|
||||
|
||||
@@ -36,7 +36,6 @@ public:
|
||||
|
||||
virtual void start() = 0;
|
||||
|
||||
// virtual std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const =0; // delete
|
||||
virtual PlayerList getSeatsList() const =0;
|
||||
virtual PlayerList getActivePlayerList() const =0;
|
||||
virtual PlayerList getRunningPlayerList() const =0;
|
||||
|
||||
@@ -54,24 +54,7 @@ LocalBeRo::LocalBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState g
|
||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// int i;
|
||||
|
||||
//SmallBlind-Position ermitteln
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LocalBeRo::~LocalBeRo()
|
||||
@@ -80,11 +63,6 @@ LocalBeRo::~LocalBeRo()
|
||||
|
||||
void LocalBeRo::nextPlayer() {
|
||||
|
||||
// myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
|
||||
// cout << "playerID in nextPlayer(): " << (*currentPlayersTurnIt)->getMyID() << endl;
|
||||
|
||||
PlayerListConstIterator currentPlayersTurnConstIt = myHand->getRunningPlayerIt(currentPlayersTurnId);
|
||||
if(currentPlayersTurnConstIt == myHand->getRunningPlayerList()->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
@@ -106,69 +84,8 @@ void LocalBeRo::run() {
|
||||
|
||||
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; 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 {
|
||||
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())) {
|
||||
|
||||
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -201,31 +118,11 @@ void LocalBeRo::run() {
|
||||
// heads up: bigBlind begins -> dealer/smallBlind is running player before bigBlind
|
||||
else {
|
||||
firstRoundLastPlayersTurnId = smallBlindPositionId;
|
||||
}
|
||||
|
||||
}
|
||||
currentPlayersTurnId = firstRoundLastPlayersTurnId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
|
||||
@@ -248,18 +145,11 @@ void LocalBeRo::run() {
|
||||
|
||||
bool allHighestSet = true;
|
||||
|
||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
||||
// if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
||||
// }
|
||||
// }
|
||||
|
||||
PlayerListIterator it;
|
||||
PlayerListIterator it_c;
|
||||
|
||||
|
||||
// test if all running players have same sets (else allHighestSet = false)
|
||||
// check if all running players have same sets (else allHighestSet = false)
|
||||
for( it_c = myHand->getRunningPlayerList()->begin(); it_c != myHand->getRunningPlayerList()->end(); it_c++) {
|
||||
if(highestSet != (*it_c)->getMySet()) {
|
||||
allHighestSet = false;
|
||||
@@ -276,11 +166,6 @@ void LocalBeRo::run() {
|
||||
//also gehe in naechste bero
|
||||
myHand->setCurrentRound(myBeRoID+1);
|
||||
|
||||
//Action loeschen und ActionButtons refresh
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
|
||||
// }
|
||||
|
||||
//Action loeschen und ActionButtons refresh
|
||||
for(it_c=myHand->getRunningPlayerList()->begin(); it_c!=myHand->getRunningPlayerList()->end(); it_c++) {
|
||||
(*it_c)->setMyAction(PLAYER_ACTION_NONE);
|
||||
@@ -300,11 +185,6 @@ void LocalBeRo::run() {
|
||||
else {
|
||||
// aktuelle bero ist wirklich dran
|
||||
|
||||
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||
// if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
// myHand->setBettingRoundsPlayed(myBeRoID);
|
||||
// }
|
||||
|
||||
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||
it_c = myHand->getActivePlayerIt(0);
|
||||
if( it_c != myHand->getActivePlayerList()->end() ) {
|
||||
@@ -313,77 +193,22 @@ void LocalBeRo::run() {
|
||||
myHand->setBettingRoundsPlayed(myBeRoID);
|
||||
}
|
||||
}
|
||||
|
||||
// determine next running player
|
||||
PlayerListConstIterator currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
//// !!!!!!!!!!!!!!!!1!!!! very buggy, rule breaking -> TODO !!!!!!!!!!!!11!!!!!!!! //////////////
|
||||
|
||||
//// headsup:
|
||||
//// preflop: dealer is small blind and begins
|
||||
//// flop, trun, river: big blind begins
|
||||
|
||||
//// !!!!!!!!! attention: exception if player failed before !!!!!!!!
|
||||
|
||||
// if( !(myHand->getCurrentQuantityPlayers() < 3 && firstHeadsUpRound == 1) || myHand->getPlayerArray()[playersTurn]->getMyActiveStatus() == 0 ) {
|
||||
// not first round in heads up (for headsup dealer is smallblind so it is dealers turn)
|
||||
|
||||
// naechsten Spieler ermitteln
|
||||
// int i;
|
||||
// for(i=0; (i<MAX_NUMBER_OF_PLAYERS && ((myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) == 0 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6)) || i==0; i++) {
|
||||
// playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
// }
|
||||
// firstHeadsUpRound = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
// determine next running player
|
||||
// currentPlayersTurnIt++;
|
||||
// if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
|
||||
|
||||
|
||||
// determine next running player
|
||||
PlayerListConstIterator currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
currentPlayersTurnIt++;
|
||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
|
||||
|
||||
currentPlayersTurnIt++;
|
||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
|
||||
|
||||
currentPlayersTurnId = (*currentPlayersTurnIt)->getMyUniqueID();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// else { firstHeadsUpRound = 0; }
|
||||
|
||||
////// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ////////////////
|
||||
|
||||
//Spieler-Position vor SmallBlind-Position ermitteln
|
||||
// int activePlayerBeforeSmallBlind = smallBlindPosition;
|
||||
|
||||
// for(i=0; (i<MAX_NUMBER_OF_PLAYERS && !(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6) || i==0; i++) {
|
||||
|
||||
// activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS);
|
||||
// }
|
||||
|
||||
// myHand->getPlayerArray()[playersTurn]->setMyTurn(1);
|
||||
|
||||
currentPlayersTurnId = (*currentPlayersTurnIt)->getMyUniqueID();
|
||||
|
||||
//highlight active players groupbox and clear action
|
||||
myHand->getGuiInterface()->refreshGroupbox(currentPlayersTurnId,2);
|
||||
myHand->getGuiInterface()->refreshAction(currentPlayersTurnId,0);
|
||||
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
// ausnahme bei heads up !!! --> TODO
|
||||
// if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind && myHand->getActivePlayerList()->size() >= 3) { firstRound = 0; }
|
||||
// if(myHand->getActivePlayerList()->size() < 3 && (myHand->getPlayerArray()[playersTurn]->getMyID() == dealerPosition || myHand->getPlayerArray()[playersTurn]->getMyID() == smallBlindPosition)) { firstRound = 0; }
|
||||
|
||||
currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
@@ -396,11 +221,6 @@ void LocalBeRo::run() {
|
||||
firstRound = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if( currentPlayersTurnId == 0) {
|
||||
// Wir sind dran
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
@@ -413,5 +233,3 @@ void LocalBeRo::run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,22 +37,12 @@ void LocalBeRoPostRiver::run() {
|
||||
}
|
||||
|
||||
void LocalBeRoPostRiver::postRiverRun() {
|
||||
|
||||
// int i;
|
||||
|
||||
int i;
|
||||
PlayerListConstIterator it_c;
|
||||
PlayerListIterator it;
|
||||
|
||||
//berechnen welcher Spieler gewonnen hat
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
//
|
||||
// if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus() && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD && getMyHand()->getPlayerArray()[i]->getMyCardsValueInt() > highestCardsValue ) {
|
||||
// highestCardsValue = getMyHand()->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//berechnen welcher Spieler gewonnen hat
|
||||
// who is the winner
|
||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
|
||||
|
||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() > highestCardsValue ) {
|
||||
@@ -60,22 +50,7 @@ void LocalBeRoPostRiver::postRiverRun() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Durchschnittsets des human player ermitteln
|
||||
// getMyHand()->getPlayerArray()[0]->setMyAverageSets(((getMyHand()->getPlayerArray()[0]->getMyRoundStartCash())-(getMyHand()->getPlayerArray()[0]->getMyCash()))/(getMyHand()->getBettingRoundsPlayed()+1));
|
||||
|
||||
// Aggressivität des human player ermitteln
|
||||
// anzahl der player die möglichkeit haben am pot teilzuhaben
|
||||
int potPlayers = 0;
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus() && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
// potPlayers++;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
|
||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
@@ -83,11 +58,6 @@ void LocalBeRoPostRiver::postRiverRun() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// prüfen ob nur noch der human player an der verteilung teilnimmt und myAggressive für human player setzen
|
||||
// getMyHand()->getPlayerArray()[0]->setMyAggressive(potPlayers == 1 && getMyHand()->getPlayerArray()[0]->getMyActiveStatus() && getMyHand()->getPlayerArray()[0]->getMyAction() != PLAYER_ACTION_FOLD);
|
||||
|
||||
|
||||
// prüfen ob nur noch der human player an der verteilung teilnimmt und myAggressive für human player setzen
|
||||
it = getMyHand()->getActivePlayerIt(0);
|
||||
if( it != getMyHand()->getActivePlayerList()->end() ) {
|
||||
@@ -96,8 +66,6 @@ void LocalBeRoPostRiver::postRiverRun() {
|
||||
}
|
||||
}
|
||||
|
||||
// cout << "myAggressive: " << getMyHand()->getPlayerArray()[0]->getMyAggressive() << endl;
|
||||
|
||||
// Pot-Verteilung
|
||||
getMyHand()->getBoard()->distributePot();
|
||||
|
||||
@@ -107,279 +75,3 @@ void LocalBeRoPostRiver::postRiverRun() {
|
||||
//starte die Animaionsreihe
|
||||
getMyHand()->getGuiInterface()->postRiverRunAnimation1();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
void LocalBeRoPostRiver::distributePot() {
|
||||
|
||||
// int potCalcAllinArray[5][2]; // 0 -> ID , 1 -> AllInCash
|
||||
|
||||
int i, j;
|
||||
|
||||
////////////////////
|
||||
// (1) EINLEITUNG //
|
||||
////////////////////
|
||||
|
||||
// die Potverteilung gliedert sich in mehrere Runden:
|
||||
// in der ersten Runden sucht sich der Winner der BettingRound seinen zustehenden Anteil am Pot raus. das kann alles oder nur ein Teil sein (z.b. wenn er mit wenig allin gegangen ist und der Rest weitergespielt hat)
|
||||
// in den darauffolgenden Verteilungsrunden suchen sich die jeweils nᅵhsten Winner aus dem noch brig gebliebenen Pot ihren zustehenden Anteil raus
|
||||
// die gesamte Potverteilung ist zuende, wenn der Pot leer ist und nichts mehr zu holen ist
|
||||
|
||||
|
||||
/////////////////////
|
||||
// (2) HILFSMITTEL //
|
||||
/////////////////////
|
||||
|
||||
// winnersArray erstellen -> hier werden die winner der jeweiligen Potverteilungsrunden eingetragen
|
||||
int *winnersArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
|
||||
// Anzahl der winner in einer Potverteilungsrunde
|
||||
int winnersCounter = 0;
|
||||
|
||||
// dieses Array ermittelt wieviel jeder Spieler wᅵrend der gesamten BettingRound gesetzt hat
|
||||
int *roundSetArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// Standardwert fr nicht mehr aktive
|
||||
roundSetArray[i] = 0;
|
||||
// nur fr die Spieler ermitteln, die noch aktiv sind (inkl. der gefoldeten)
|
||||
if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
roundSetArray[i] = getMyHand()->getPlayerArray()[i]->getMyRoundStartCash()-getMyHand()->getPlayerArray()[i]->getMyCash();
|
||||
}
|
||||
}
|
||||
|
||||
// hier steht der CardsValue der Spieler drin die an der Potverteilung teilnehmen (d.h. aktiv und nicht gefoldet), bei allen anderen steht ne 0
|
||||
int *cardsValueArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
int playerWantsPotCounter = 0;
|
||||
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// Standardwert
|
||||
cardsValueArray[i] = 0;
|
||||
if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus() && getMyHand()->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
// nur bei den Spielen den Kartenwert eintragen, die an der Potverteilung teilnehmen
|
||||
cardsValueArray[i] = getMyHand()->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
playerWantsPotCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
int winner;
|
||||
int highestCardsValueTemp;
|
||||
|
||||
// fr SplitPotBerechnung;
|
||||
int winnersSets;
|
||||
int winnersMaxSet;
|
||||
int winnersPot;
|
||||
bool playerIsWinner;
|
||||
|
||||
|
||||
|
||||
//////////////////////
|
||||
// (3) DIE SCHLEIFE //
|
||||
//////////////////////
|
||||
|
||||
|
||||
// Potverteilungsrunden -> solange noch was aus dem pot zu vergeben ist
|
||||
while(playerWantsPotCounter != 0 ) {
|
||||
|
||||
// highestCardsValueTemp zu Beginn der aktuellen Potverteilungsrunde auf Null setzen
|
||||
highestCardsValueTemp = 0;
|
||||
|
||||
// aktuellen highestCardsValueTemp berechnen, von denen die noch an der Potverteilung teilnehmen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(cardsValueArray[i] > highestCardsValueTemp ) {
|
||||
highestCardsValueTemp = getMyHand()->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
}
|
||||
}
|
||||
|
||||
// zu Beginn der Potverteilungsrunde die Anzahl der winner auf 0 setzen
|
||||
winnersCounter = 0;
|
||||
// Siegerposition und -anzahl von denen ermitteln, die noch an der Potverteilung teilnehmen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(cardsValueArray[i] == highestCardsValueTemp ) {
|
||||
winnersArray[winnersCounter] = i;
|
||||
winnersCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// A) nur einer hat aktulle Potverteilungsrunde gewonnen gewonnen
|
||||
// --------------------------------------------------------------
|
||||
if(winnersCounter == 1) {
|
||||
|
||||
// winnerID ist an der ersten Stelle im winnersArray
|
||||
winner = winnersArray[0];
|
||||
|
||||
// Winner ist nicht All In gegangen -> bekommt den gesamten Pot
|
||||
// if(getMyHand()->getPlayerArray()[winner]->getMyAction() != 6) {
|
||||
//
|
||||
// getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+getMyHand()->getBoard()->getPot());
|
||||
// getMyHand()->getBoard()->setPot(0);
|
||||
// playerWantsPotCounter = 1;
|
||||
//
|
||||
// }
|
||||
// Winner ist All In gegangen -> von denen die weniger gesetzt oder gefoldet hatten alles nehmen und von denen die mehr gesetzt hatten nur die eigenen Sets nehmen
|
||||
// else {
|
||||
|
||||
// alle Spieler nacheinander durchgehen und prfen von wem man wieviel Geld aus dem Pot bekommt
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
|
||||
if(i != winner && getMyHand()->getPlayerArray()[i]->getMyAction() == 1) {
|
||||
|
||||
// diesen Teil aus dem Pot holen
|
||||
getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]);
|
||||
// Pot dementsprechend verkleinern
|
||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[i]);
|
||||
// deren Sets auf Null seztzen -> in den nᅵhsten Potverteilungsrunden nimmt der Winner dann von diesen Spielern 0 Dollar aus dem Pot
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
|
||||
// nun nur von den Spielern holen, die noch an der Potverteilung teilnehmen und natrlich nicht von einem selber
|
||||
if(i != winner && cardsValueArray[i] != 0) {
|
||||
|
||||
// zuerst alle rauspicken, die weniger oder das gleiche gesetzt hatten
|
||||
if(roundSetArray[winner] >= roundSetArray[i]) {
|
||||
|
||||
// von denen alles holen
|
||||
getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]);
|
||||
// Pot dementsprechend verkleinern
|
||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[i]);
|
||||
// diese Spieler dann von der weiteren Potverteilung ausschlieᅵn
|
||||
cardsValueArray[i] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// deren Sets auf Null seztzen, da sie schon alles abgegeben haben
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
// nun alle Spieler die mehr gesetzt hatten
|
||||
else {
|
||||
|
||||
// den eigenen Setanteil aus dem Pot holen
|
||||
getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]);
|
||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[winner]);
|
||||
// den Set des Gegners um den bereits abgenommenen Setanteil verkleinern
|
||||
roundSetArray[i] = roundSetArray[i] - roundSetArray[winner];
|
||||
// diese Spieler nehmen an der weiteren Potverteilung teil
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// // }
|
||||
|
||||
// zum Scluss noch eingenen Set wieder holen
|
||||
getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]);
|
||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[winner]);
|
||||
// nicht mehr an der weiteren Potverteilung teilnehmen, da man sich alles geholt hat was einem zusteht
|
||||
cardsValueArray[winner] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// eigene Sets auf Null seztzen, da sie eben eingesammelt wurden
|
||||
roundSetArray[winner] = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// B) mehrere haben die aktuelle Potverteilungsrunde gewonnen -> SplitPot
|
||||
// ----------------------------------------------------------------------
|
||||
else {
|
||||
|
||||
// hierfr wird ein temporᅵer WinnersPot erstellt; dort flieᅵn erstmal alle zustehenden Anteile aus dem Pot rauf; am Ende wird dies auf die Winners verteilt
|
||||
winnersPot = 0;
|
||||
// hᅵhster Set aller Winner
|
||||
winnersMaxSet = 0;
|
||||
|
||||
// den hᅵhsten Set aller Winner ermitteln
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
if(roundSetArray[winnersArray[i]] > winnersMaxSet) winnersMaxSet = roundSetArray[i];
|
||||
}
|
||||
|
||||
// gesamtSet aller Winner
|
||||
winnersSets = 0;
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
winnersSets += roundSetArray[winnersArray[i]];
|
||||
}
|
||||
|
||||
// alle Spieler nacheinander durchgehen und prfen von wem die Winner wieviel Geld aus dem Pot bekommen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
// prfen ob Spieler i zu den Winnern gehᅵt
|
||||
playerIsWinner = 0;
|
||||
for(j=0; j<winnersCounter; j++) {
|
||||
if(winnersArray[j] == i) playerIsWinner = 1; // -> Spieler i gehᅵt zu den Winnern
|
||||
}
|
||||
|
||||
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
|
||||
if(!playerIsWinner && getMyHand()->getPlayerArray()[i]->getMyAction() == 1) {
|
||||
|
||||
// diesen Teil aus dem Pot holen und dem winnersPot geben
|
||||
winnersPot += roundSetArray[i];
|
||||
// Pot dementsprechend verkleinern
|
||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[i]);
|
||||
// deren Sets auf Null seztzen -> in den nᅵhsten Potverteilungsrunden nehmen die Winner dann von diesen Spielern 0 Dollar aus dem Pot
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
|
||||
// nun nur von den Spielern holen, die noch an der Potverteilung teilnehmen und natrlich nicht zu den Winnern gehᅵen
|
||||
if(!playerIsWinner && cardsValueArray[i] != 0) {
|
||||
|
||||
// zuerst alle rauspicken, die weniger oder das gleiche gesetzt hatten
|
||||
if(winnersMaxSet >= roundSetArray[i]) {
|
||||
|
||||
// von denen alles holen
|
||||
winnersPot += roundSetArray[i];
|
||||
// Pot dementsprechend verkleinern
|
||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[i]);
|
||||
// diese Spieler dann von der weiteren Potverteilung ausschlieᅵn
|
||||
cardsValueArray[i] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// deren Sets auf Null seztzen, da sie schon alles abgegeben haben
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
// nun alle Spieler die mehr gesetzt hatten
|
||||
else {
|
||||
|
||||
// den eigenen Setanteil aus dem Pot holen
|
||||
winnersPot += winnersMaxSet;
|
||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - winnersMaxSet);
|
||||
// den Set des Gegners um den bereits abgenommenen Setanteil verkleinern
|
||||
roundSetArray[i] = roundSetArray[i] - winnersMaxSet;
|
||||
// diese Spieler nehmen an der weiteren Potverteilung teil
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// zum Schluss noch die eingenen Set aus dem Pot holen
|
||||
winnersPot += winnersSets;
|
||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - winnersSets);
|
||||
|
||||
// winnersPot verteilen (anteilmᅵig)
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
getMyHand()->getPlayerArray()[winnersArray[i]]->setMyCash(getMyHand()->getPlayerArray()[winnersArray[i]]->getMyCash()+((roundSetArray[winnersArray[i]]*winnersPot)/winnersSets));
|
||||
}
|
||||
|
||||
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
// nicht mehr an der weiteren Potverteilung teilnehmen, da man sich alle Winner dieser Verteilungsrunde ihren Anteil geholt haben
|
||||
cardsValueArray[winnersArray[i]] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// Sets auf Null seztzen, da sie eben eingesammelt wurden
|
||||
roundSetArray[winnersArray[i]] = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(getMyHand()->getBoard()->getPot() != 0) cout << "!!! Pot: " << getMyHand()->getBoard()->getPot() << endl;
|
||||
|
||||
delete[] winnersArray;
|
||||
delete[] roundSetArray;
|
||||
delete[] cardsValueArray;
|
||||
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@@ -29,183 +29,92 @@ using namespace std;
|
||||
|
||||
LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, unsigned dP, int sB) : LocalBeRo(hi, id, dP, sB, GAME_STATE_PREFLOP)
|
||||
{
|
||||
// PlayerListConstIterator it_c;
|
||||
|
||||
setHighestSet(2*getSmallBlind());
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
LocalBeRoPreflop::~LocalBeRoPreflop()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LocalBeRoPreflop::run() {
|
||||
|
||||
if(getFirstRun()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// determine bigBlindPosition -> old: delete
|
||||
// for(bigBlindPositionIt=getMyHand()->getActivePlayerList()->begin(); bigBlindPositionIt!=getMyHand()->getActivePlayerList()->end(); bigBlindPositionIt++) {
|
||||
// if((*bigBlindPositionIt)->getMyButton() == BUTTON_BIG_BLIND) break;
|
||||
// }
|
||||
|
||||
|
||||
// search player in runningPlayerList before first action player -> run() determine next player who will do first action
|
||||
// PlayerListIterator it_1, it_2, it_3;
|
||||
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());
|
||||
if(it == getMyHand()->getActivePlayerList()->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
|
||||
PlayerListIterator it;
|
||||
|
||||
// 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());
|
||||
|
||||
// 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());
|
||||
if(it == getMyHand()->getActivePlayerList()->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
if(it == getMyHand()->getActivePlayerList()->begin()) it = getMyHand()->getActivePlayerList()->end();
|
||||
it--;
|
||||
|
||||
setFirstRoundLastPlayersTurnId( (*it)->getMyUniqueID() );
|
||||
|
||||
}
|
||||
// smallBlindPlayer found in runningPlayerList -> running player before first action player
|
||||
else {
|
||||
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
|
||||
}
|
||||
|
||||
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
|
||||
// bigBlindPlayer found in runningPlayerList -> player before first action player
|
||||
else {
|
||||
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
|
||||
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
|
||||
}
|
||||
}
|
||||
// bigBlindPlayer found in runningPlayerList -> player before first action player
|
||||
// heads up -> dealer/smallBlindPlayer is first action player and bigBlindPlayer is player before
|
||||
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()) {
|
||||
|
||||
|
||||
// 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() );
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
|
||||
}
|
||||
// smallBlindPlayer found in runningPlayerList -> running player before first action player (himself)
|
||||
else {
|
||||
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentPlayersTurnId( getFirstRoundLastPlayersTurnId() );
|
||||
|
||||
// cout << "playerID constructor beropreflop: " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
||||
|
||||
|
||||
/////////////// testing
|
||||
|
||||
|
||||
|
||||
|
||||
// it_1 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *bigBlindPositionIt);
|
||||
|
||||
// bigBlindPosition is not all in
|
||||
// if(it!=getMyHand()->getRunningPlayerList()->end()) {
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
// if(it_1!=getMyHand()->getRunningPlayerList()->end()) {
|
||||
// cout << getMyHand()->getMyID() << ": " << "gefunden!" << endl;
|
||||
// cout << "\t PlayerID: " << (*it_1)->getMyID() << endl;
|
||||
// it_2 = it_1;
|
||||
// if(it_1 == getMyHand()->getRunningPlayerList()->begin()) it_1 = getMyHand()->getRunningPlayerList()->end();
|
||||
// it_1--;
|
||||
// cout << "\t PlayerID vor bigBlind: " << (*it_1)->getMyID() << endl;
|
||||
// cout << "\t PlayerID vor bigBlind: " << (*it_2)->getMyID() << endl;
|
||||
// } else {
|
||||
// cout << getMyHand()->getMyID() << ": " << "nicht gefunden" << endl;
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
//////////////// old
|
||||
|
||||
// set first runningPlayer before bigBlindPlayer to playersTurn -> run() determine next one who will do first action
|
||||
// setPlayersTurn((*bigBlindPositionIt)->getMyID());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
setCurrentPlayersTurnId( getFirstRoundLastPlayersTurnId() );
|
||||
|
||||
setFirstRun(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int i;
|
||||
bool allHighestSet = true;
|
||||
// PlayerListIterator it;
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
|
||||
|
||||
// test if all running players have same sets (else allHighestSet = false)
|
||||
// check if all running players have same sets (else allHighestSet = false)
|
||||
for(it_c=getMyHand()->getRunningPlayerList()->begin(); it_c!=getMyHand()->getRunningPlayerList()->end(); it_c++) {
|
||||
if(getHighestSet() != (*it_c)->getMySet()) {
|
||||
allHighestSet = false;
|
||||
@@ -214,17 +123,6 @@ void LocalBeRoPreflop::run() {
|
||||
}
|
||||
|
||||
// determine next player
|
||||
|
||||
// cout << "playerID begin preflopRun(): " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
||||
|
||||
// it++;
|
||||
|
||||
|
||||
|
||||
// cout << "size: " << getMyHand()->getRunningPlayerList()->size() << endl;
|
||||
|
||||
// cout << "currentPlayerID: " << getCurrentPlayersTurnId() << endl;
|
||||
|
||||
PlayerListConstIterator currentPlayersTurnIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
||||
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
@@ -234,72 +132,6 @@ void LocalBeRoPreflop::run() {
|
||||
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) currentPlayersTurnIt = getMyHand()->getRunningPlayerList()->begin();
|
||||
|
||||
setCurrentPlayersTurnId( (*currentPlayersTurnIt)->getMyUniqueID() );
|
||||
|
||||
// setCurrentPlayersTurnIt(++getCurrentPlayersTurnIt());
|
||||
// if(getCurrentPlayersTurnIt() == getMyHand()->getRunningPlayerList()->end()) setCurrentPlayersTurnIt(getMyHand()->getRunningPlayerList()->begin());
|
||||
|
||||
// if(getCurrentPlayersTurnIt() == getMyHand()->getRunningPlayerList()->end()) cout << "!!!" << endl;
|
||||
|
||||
// cout << "playerID middle preflopRun(): " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PlayerListConstIterator currentPlayersTurnConstIt;
|
||||
// exceptions
|
||||
// no.1: if in first Preflop Round next player is small blind and only all-in-big-blind with less than smallblind amount is nonfold too -> preflop is over
|
||||
// if(getFirstRound()) {
|
||||
// PlayerListConstIterator bigBlindPositionIt = getMyHand()->getActivePlayerIt(getBigBlindPositionId());
|
||||
// assert(bigBlindPositionIt != getMyHand()->getActivePlayerList()->end());
|
||||
//
|
||||
// currentPlayersTurnConstIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
||||
// assert(currentPlayersTurnConstIt != getMyHand()->getRunningPlayerList()->end());
|
||||
//
|
||||
// int nonFoldPlayerCounter = 0;
|
||||
// for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
|
||||
// if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonFoldPlayerCounter++;
|
||||
// }
|
||||
//
|
||||
// if((*currentPlayersTurnConstIt)->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() <= getSmallBlind() && nonFoldPlayerCounter == 2) {
|
||||
// setFirstRound(false);
|
||||
// allHighestSet = true;
|
||||
// getMyHand()->setAllInCondition(true);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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));
|
||||
// // falls BigBlind, dann PreflopFirstRound zuende
|
||||
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND && (*bigBlindPositionIt)->getMySet() < 2*getSmallBlind()) setFirstRound(false);
|
||||
// // if next player is small blind and only all-in-big-blind with <= 2*smallblind is nonfold too
|
||||
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() <= getSmallBlind() && getMyHand()->getRunningPlayerList()->size() == 1) {
|
||||
// setFirstRound(false);
|
||||
// allHighestSet = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// cout << "firstRound. " << getFirstRound() << " - allHighestSet: " << allHighestSet << endl;
|
||||
|
||||
// prfen, ob Preflop wirklich dran ist
|
||||
if(!getFirstRound() && allHighestSet) {
|
||||
@@ -308,19 +140,11 @@ void LocalBeRoPreflop::run() {
|
||||
//also gehe in Flop
|
||||
getMyHand()->setCurrentRound(GAME_STATE_FLOP);
|
||||
|
||||
// exception no.1 - see above
|
||||
// if(getMyHand()->getAllInCondition()) getMyHand()->setCurrentRound(GAME_STATE_PREFLOP);;
|
||||
|
||||
//Action loeschen und ActionButtons refresh
|
||||
for(it_c=getMyHand()->getRunningPlayerList()->begin(); it_c!=getMyHand()->getRunningPlayerList()->end(); it_c++) {
|
||||
(*it_c)->setMyAction(PLAYER_ACTION_NONE);
|
||||
}
|
||||
|
||||
//Action loeschen und ActionButtons refresh
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_ALLIN) getMyHand()->getPlayerArray()[i]->setMyAction(PLAYER_ACTION_NONE);
|
||||
// }
|
||||
|
||||
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
||||
getMyHand()->getBoard()->collectSets();
|
||||
getMyHand()->getBoard()->collectPot();
|
||||
@@ -333,36 +157,17 @@ void LocalBeRoPreflop::run() {
|
||||
getMyHand()->switchRounds();
|
||||
}
|
||||
else {
|
||||
// Preflop ist wirklich dran
|
||||
|
||||
// falls BigBlind, dann PreflopFirstRound zuende
|
||||
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND) setFirstRound(0);
|
||||
|
||||
// lastPlayersTurn -> PreflopFirstRound is over
|
||||
// if( (*(getCurrentPlayersTurnIt())) == (*(getLastPlayersTurnIt())) ) {
|
||||
// setFirstRound(false);
|
||||
// }
|
||||
|
||||
// lastPlayersTurn -> PreflopFirstRound is over
|
||||
if( getCurrentPlayersTurnId() == getFirstRoundLastPlayersTurnId() ) {
|
||||
setFirstRound(false);
|
||||
}
|
||||
|
||||
|
||||
// getMyHand()->getPlayerArray()[getPlayersTurn()]->setMyTurn(1);
|
||||
|
||||
currentPlayersTurnIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
||||
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
(*currentPlayersTurnIt)->setMyTurn(true);
|
||||
|
||||
// (*(getCurrentPlayersTurnIt()))->setMyTurn(true);
|
||||
|
||||
//highlight active players groupbox and clear action
|
||||
// getMyHand()->getGuiInterface()->refreshGroupbox(getPlayersTurn(),2);
|
||||
// getMyHand()->getGuiInterface()->refreshAction(getPlayersTurn(),PLAYER_ACTION_NONE);
|
||||
|
||||
//highlight active players groupbox and clear action
|
||||
getMyHand()->getGuiInterface()->refreshGroupbox( getCurrentPlayersTurnId() , 2 );
|
||||
getMyHand()->getGuiInterface()->refreshAction( getCurrentPlayersTurnId() , PLAYER_ACTION_NONE );
|
||||
@@ -374,7 +179,6 @@ void LocalBeRoPreflop::run() {
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
// cout << "NextPlayerSpeed3 start" << endl;
|
||||
getMyHand()->getGuiInterface()->beRoAnimation2(getMyBeRoID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,17 +26,15 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalBoard::LocalBoard() : BoardInterface(), /*playerArray(0),*/ currentHand(0), pot(0), sets(0)
|
||||
LocalBoard::LocalBoard() : BoardInterface(), currentHand(0), pot(0), sets(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LocalBoard::~LocalBoard()
|
||||
{
|
||||
}
|
||||
|
||||
void LocalBoard::setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> > sl_old, */PlayerList sl, PlayerList apl, PlayerList rpl) {
|
||||
// playerArray = sl_old; // delete
|
||||
void LocalBoard::setPlayerLists(PlayerList sl, PlayerList apl, PlayerList rpl) {
|
||||
seatsList = sl;
|
||||
activePlayerList = apl;
|
||||
runningPlayerList = rpl;
|
||||
@@ -47,22 +45,18 @@ void LocalBoard::setHand(HandInterface* br) { currentHand = br; }
|
||||
void LocalBoard::collectSets() {
|
||||
|
||||
sets = 0;
|
||||
// int i;
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) sets += playerArray[i]->getMySet(); //delete
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
||||
sets += (*it_c)->getMySet();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LocalBoard::collectPot() {
|
||||
// int i;
|
||||
|
||||
pot += sets;
|
||||
sets = 0;
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++){ playerArray[i]->setMySetNull(); }
|
||||
|
||||
PlayerListIterator it;
|
||||
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
|
||||
@@ -79,16 +73,6 @@ void LocalBoard::distributePot() {
|
||||
PlayerListIterator it;
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
// filling player sets vector
|
||||
// vector<int> playerSets;
|
||||
// for(i=0; i<(size_t)MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(playerArray[i]->getMyActiveStatus()) {
|
||||
// playerSets.push_back(((playerArray[i]->getMyRoundStartCash())-(playerArray[i]->getMyCash())));
|
||||
// } else {
|
||||
// playerSets.push_back(0);
|
||||
// }
|
||||
// }
|
||||
|
||||
// filling player sets vector
|
||||
vector<int> playerSets;
|
||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
||||
@@ -99,7 +83,6 @@ void LocalBoard::distributePot() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sort player sets asc
|
||||
vector<int> playerSetsSort = playerSets;
|
||||
sort(playerSetsSort.begin(), playerSetsSort.end());
|
||||
@@ -130,30 +113,14 @@ void LocalBoard::distributePot() {
|
||||
potLevel.push_back((playerSetsSort.size()-i)*potLevel[0]);
|
||||
|
||||
// determine level highestCardsValue
|
||||
// for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
|
||||
// if(playerArray[j]->getMyCardsValueInt() > highestCardsValue && playerArray[j]->getMyActiveStatus() && playerArray[j]->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
||||
// highestCardsValue = playerArray[j]->getMyCardsValueInt();
|
||||
// }
|
||||
// }
|
||||
|
||||
// determine level highestCardsValue
|
||||
j=0;
|
||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++,j++) {
|
||||
for(it_c=seatsList->begin(), j=0; it_c!=seatsList->end(); it_c++,j++) {
|
||||
if((*it_c)->getMyActiveStatus() && (*it_c)->getMyCardsValueInt() > highestCardsValue && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
||||
highestCardsValue = (*it_c)->getMyCardsValueInt();
|
||||
}
|
||||
}
|
||||
|
||||
// level winners
|
||||
// for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
|
||||
// if(highestCardsValue == playerArray[j]->getMyCardsValueInt() && playerArray[j]->getMyActiveStatus() && playerArray[j]->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
||||
// potLevel.push_back(playerArray[j]->getMyID());
|
||||
// }
|
||||
// }
|
||||
|
||||
// level winners
|
||||
j=0;
|
||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++,j++) {
|
||||
for(it_c=seatsList->begin(), j=0; it_c!=seatsList->end(); it_c++,j++) {
|
||||
if((*it_c)->getMyActiveStatus() && highestCardsValue == (*it_c)->getMyCardsValueInt() && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
||||
potLevel.push_back((*it_c)->getMyUniqueID());
|
||||
}
|
||||
@@ -169,9 +136,6 @@ void LocalBoard::distributePot() {
|
||||
mod = (potLevel[1])%winnerCount;
|
||||
// pot level sum divisible by winnerCount
|
||||
if(mod == 0) {
|
||||
// for(j=2; j<potLevel.size(); j++) {
|
||||
// playerArray[potLevel[j]]->setMyCash(playerArray[potLevel[j]]->getMyCash() + ((potLevel[1])/winnerCount));
|
||||
// }
|
||||
|
||||
for(j=2; j<potLevel.size(); j++) {
|
||||
it = currentHand->getSeatIt(potLevel[j]);
|
||||
@@ -207,13 +171,6 @@ void LocalBoard::distributePot() {
|
||||
|
||||
}
|
||||
|
||||
// if(j<mod) {
|
||||
// playerArray[winnerPointer]->setMyCash(playerArray[winnerPointer]->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
|
||||
// } else {
|
||||
// playerArray[winnerPointer]->setMyCash(playerArray[winnerPointer]->getMyCash() + (int)((potLevel[1])/winnerCount));
|
||||
// }
|
||||
|
||||
|
||||
it = currentHand->getSeatIt(winnerPointer);
|
||||
if(it == seatsList->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
@@ -260,18 +217,12 @@ void LocalBoard::distributePot() {
|
||||
if(pot!=0) cout << "distributePot-ERROR: Pot = " << pot << endl;
|
||||
|
||||
int sum = 0;
|
||||
// for(i=0; i<(size_t)MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(playerArray[i]->getMyActiveStatus())
|
||||
// sum += playerArray[i]->getMyCash();
|
||||
// }
|
||||
|
||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||
sum += (*it_c)->getMyCash();
|
||||
}
|
||||
|
||||
|
||||
if(sum != (currentHand->getStartQuantityPlayers() * currentHand->getStartCash()))
|
||||
cout << "distributePot-ERROR: PlayersSumCash = " << sum << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
LocalBoard();
|
||||
~LocalBoard();
|
||||
|
||||
void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList);
|
||||
void setPlayerLists(PlayerList, PlayerList, PlayerList);
|
||||
void setHand(HandInterface*);
|
||||
|
||||
void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
|
||||
@@ -55,7 +55,6 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
|
||||
PlayerList seatsList;
|
||||
PlayerList activePlayerList;
|
||||
PlayerList runningPlayerList;
|
||||
|
||||
@@ -42,7 +42,7 @@ LocalEngineFactory::~LocalEngineFactory()
|
||||
}
|
||||
|
||||
|
||||
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) { return new LocalHand(f, g, b, /*sl_old,*/ sl, apl, rpl, id, sP, dP, sB, sC); }
|
||||
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) { return new LocalHand(f, g, b, sl, apl, rpl, id, sP, dP, sB, sC); }
|
||||
|
||||
BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
LocalEngineFactory(ConfigFile*);
|
||||
~LocalEngineFactory();
|
||||
|
||||
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
|
||||
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
|
||||
BoardInterface* createBoard();
|
||||
boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB);
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC)
|
||||
: myFactory(f), myGui(g), myBoard(b), /*playerArray(sl_old),*/ seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(false),
|
||||
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC)
|
||||
: myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(false),
|
||||
cardsShown(false), bettingRoundsPlayed(0)
|
||||
{
|
||||
|
||||
@@ -41,25 +41,13 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
||||
|
||||
myBoard->setHand(this);
|
||||
|
||||
// for(i=0; i<startQuantityPlayers; i++) {
|
||||
// playerArray[i]->setHand(this);
|
||||
// // myFlipCards auf 0 setzen
|
||||
// playerArray[i]->setMyCardsFlip(0, 0);
|
||||
// }
|
||||
|
||||
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
|
||||
(*it)->setHand(this);
|
||||
// myFlipCards auf 0 setzen
|
||||
// set myFlipCards 0
|
||||
(*it)->setMyCardsFlip(0, 0);
|
||||
}
|
||||
|
||||
|
||||
// roundStartCashArray fllen
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// playerArray[i]->setMyRoundStartCash(playerArray[i]->getMyCash());
|
||||
// }
|
||||
|
||||
// Karten generieren und Board sowie Player zuweisen
|
||||
// generate cards and assign to board and player
|
||||
int *cardsArray = new int[2*activePlayerList->size()+5];
|
||||
Tools::getRandNumber(0, 51, 2*activePlayerList->size()+5, cardsArray, 1);
|
||||
int tempBoardArray[5];
|
||||
@@ -88,14 +76,14 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
||||
(*it)->setMyBestHandPosition(bestHandPos);
|
||||
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
||||
|
||||
// myBestHandPosition auf Fehler ueberpruefen
|
||||
// error-check
|
||||
for(j=0; j<5; j++) {
|
||||
if (bestHandPos[j] == -1) {
|
||||
cout << "ERROR getMyBestHandPosition in localhand.cpp" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// sBluff für alle aktiver Spieler außer human player setzen --> TODO for ai-player in internet
|
||||
// set sBluff for all players --> TODO for ai-player in internet
|
||||
if((*it)->getMyID() != 0) {
|
||||
Tools::getRandNumber(1,100,1,&sBluff,0);
|
||||
(*it)->setSBluff(sBluff);
|
||||
@@ -327,7 +315,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
// Dealer, SB, BB bestimmen
|
||||
// determine dealer, SB, BB
|
||||
assignButtons();
|
||||
|
||||
myBeRo = myFactory->createBeRo(this, myID, dealerPosition, smallBlind);
|
||||
@@ -351,13 +339,13 @@ void LocalHand::start() {
|
||||
else { cout << "Log Error: cannot find sBID or bBID" << "\n"; }
|
||||
myGui->flushLogAtHand();
|
||||
|
||||
// Karten austeilen
|
||||
// deal cards
|
||||
myGui->dealHoleCards();
|
||||
|
||||
getBoard()->collectSets();
|
||||
getGuiInterface()->refreshPot();
|
||||
|
||||
//Rundenwechsel | beim ersten Durchlauf --> Preflop starten
|
||||
// change rounds | first start preflop
|
||||
myGui->nextPlayerAnimation();
|
||||
}
|
||||
|
||||
@@ -367,18 +355,12 @@ void LocalHand::assignButtons() {
|
||||
PlayerListIterator it;
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
// alle Buttons loeschen
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { playerArray[i]->setMyButton(0); }
|
||||
|
||||
// alle Buttons loeschen
|
||||
// delete all buttons
|
||||
for (it=seatsList->begin(); it!=seatsList->end(); it++) {
|
||||
(*it)->setMyButton(BUTTON_NONE);
|
||||
}
|
||||
|
||||
// DealerButton zuweisen
|
||||
// playerArray[dealerPosition]->setMyButton(1);
|
||||
|
||||
// DealerButton zuweisen
|
||||
// assign dealer button
|
||||
it = getSeatIt(dealerPosition);
|
||||
if(it == seatsList->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
@@ -386,32 +368,6 @@ void LocalHand::assignButtons() {
|
||||
(*it)->setMyButton(BUTTON_DEALER);
|
||||
|
||||
|
||||
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
||||
// i = dealerPosition;
|
||||
//
|
||||
// for(j=0; (j<MAX_NUMBER_OF_PLAYERS && !(playerArray[i]->getMyActiveStatus())) || j==0; j++) {
|
||||
//
|
||||
// i = (i+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
// if(playerArray[i]->getMyActiveStatus()) {
|
||||
// if(activePlayerList->size() > 2) playerArray[i]->setMyButton(2); //small blind normal
|
||||
// else playerArray[i]->setMyButton(3); //big blind in heads up
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// assign big blind next to small blind. ATTENTION: in heads up it is small blind
|
||||
// for(j=0; (j<MAX_NUMBER_OF_PLAYERS && !(playerArray[i]->getMyActiveStatus())) || j==0; j++) {
|
||||
//
|
||||
// i = (i+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
// if(playerArray[i]->getMyActiveStatus()) {
|
||||
// if(activePlayerList->size() > 2) playerArray[i]->setMyButton(3); //big blind normal
|
||||
// else playerArray[i]->setMyButton(2); //small blind in heads up
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
||||
// assign big blind next to small blind. ATTENTION: in heads up it is small blind
|
||||
bool nextActivePlayerFound = false;
|
||||
@@ -445,24 +401,6 @@ void LocalHand::assignButtons() {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//do sets --> TODO switch?
|
||||
for (it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); it_c++) {
|
||||
|
||||
@@ -475,8 +413,6 @@ void LocalHand::assignButtons() {
|
||||
(*it_c)->setMySet((*it_c)->getMyCash());
|
||||
// 1 to do not log this
|
||||
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
||||
// delete this player from runningPlayerList
|
||||
// it_c = runningPlayerList->erase(it_c);
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -493,8 +429,6 @@ void LocalHand::assignButtons() {
|
||||
(*it_c)->setMySet((*it_c)->getMyCash());
|
||||
// 1 to do not log this
|
||||
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
||||
// delete this player from runningPlayerList
|
||||
// it_c = runningPlayerList->erase(it_c);
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -507,8 +441,6 @@ void LocalHand::assignButtons() {
|
||||
|
||||
void LocalHand::switchRounds() {
|
||||
|
||||
// cout << "playerID begin switchRounds(): " << getCurrentBeRo()->get
|
||||
|
||||
PlayerListIterator it, it_1;
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
@@ -530,51 +462,38 @@ void LocalHand::switchRounds() {
|
||||
}
|
||||
}
|
||||
|
||||
// Anzahl der Spieler ermitteln, welche All In sind
|
||||
// determine number of all in players
|
||||
int allInPlayersCounter = 0;
|
||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||
if ((*it_c)->getMyAction() == PLAYER_ACTION_ALLIN) allInPlayersCounter++;
|
||||
}
|
||||
|
||||
// cout << "allInPlayersCounter: " << allInPlayersCounter << endl;
|
||||
|
||||
// TODO -> runningPlayerList.size()
|
||||
// determine number of non-fold players
|
||||
int nonFoldPlayerCounter = 0;
|
||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonFoldPlayerCounter++;
|
||||
}
|
||||
|
||||
// cout << "nonFoldPlayerCounter: " << nonFoldPlayerCounter << endl;
|
||||
|
||||
//wenn nur noch einer nicht-folded dann gleich den Pot verteilen
|
||||
// if only one player non-fold -> distribute pot
|
||||
if(nonFoldPlayerCounter==1) {
|
||||
myBoard->collectPot();
|
||||
myGui->refreshPot();
|
||||
myGui->refreshSet();
|
||||
currentRound = 4;
|
||||
}
|
||||
// prfen der All In Kondition
|
||||
// fr All In Prozedur mssen mindestens zwei aktive Player vorhanden sein
|
||||
|
||||
// check for all in condition
|
||||
// for all in condition at least two active players have to remain
|
||||
else {
|
||||
|
||||
// 1) wenn alle All In
|
||||
// 1) all players all in
|
||||
if(allInPlayersCounter == nonFoldPlayerCounter) {
|
||||
allInCondition = true;
|
||||
}
|
||||
|
||||
// 2) alle bis auf einen All In und der hat HighestSet
|
||||
// 2) all players but one all in and he has highest set
|
||||
if(allInPlayersCounter+1 == nonFoldPlayerCounter) {
|
||||
|
||||
// TODO -> runningPlayerList s.u.
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
//
|
||||
// if(playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyAction() != 6 && playerArray[i]->getMyActiveStatus() == 1 && playerArray[i]->getMySet() >= myBeRo[currentRound]->getHighestSet()) {
|
||||
// allInCondition = 1;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
for(it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); it_c++) {
|
||||
|
||||
if((*it_c)->getMySet() >= myBeRo[currentRound]->getHighestSet()) {
|
||||
@@ -583,54 +502,34 @@ void LocalHand::switchRounds() {
|
||||
|
||||
}
|
||||
|
||||
// if( (*(runningPlayerList.begin()))->getMySet() >= myBeRo[currentRound]->getHighestSet() ) {
|
||||
// allInCondition = 1;
|
||||
// }
|
||||
|
||||
// // HeadsUp-Ausnahme -> spieler ermitteln, der all in ist und als bb nur weniger als sb setzen konnte
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
//
|
||||
// if(activePlayerList->size()==2 && playerArray[i]->getMyAction() == 6 && playerArray[i]->getMyActiveStatus() == 1 && playerArray[i]->getMyButton()==3 && playerArray[i]->getMySet()<=smallBlind) {
|
||||
// allInCondition = 1;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// exception
|
||||
// no.1: if in first Preflop Round next player is small blind and only all-in-big-blind with less than smallblind amount and other all-in players with less than small blind are nonfold too -> preflop is over
|
||||
PlayerListConstIterator smallBlindIt_c = getRunningPlayerIt(myBeRo[currentRound]->getSmallBlindPositionId());
|
||||
PlayerListConstIterator bigBlindIt_c = getActivePlayerIt(myBeRo[currentRound]->getBigBlindPositionId());
|
||||
if(smallBlindIt_c!=runningPlayerList->end() && bigBlindIt_c!=activePlayerList->end() && currentRound == GAME_STATE_PREFLOP && myBeRo[currentRound]->getFirstRound()) {
|
||||
// determine player who are all in with less than small blind amount
|
||||
int tempCounter = 0;
|
||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||
if((*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMySet() <= smallBlind) {
|
||||
tempCounter++;
|
||||
PlayerListConstIterator smallBlindIt_c = getRunningPlayerIt(myBeRo[currentRound]->getSmallBlindPositionId());
|
||||
PlayerListConstIterator bigBlindIt_c = getActivePlayerIt(myBeRo[currentRound]->getBigBlindPositionId());
|
||||
if(smallBlindIt_c!=runningPlayerList->end() && bigBlindIt_c!=activePlayerList->end() && currentRound == GAME_STATE_PREFLOP && myBeRo[currentRound]->getFirstRound()) {
|
||||
// determine player who are all in with less than small blind amount
|
||||
int tempCounter = 0;
|
||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||
if((*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMySet() <= smallBlind) {
|
||||
tempCounter++;
|
||||
}
|
||||
}
|
||||
if( (*bigBlindIt_c)->getMySet() <= smallBlind && tempCounter == allInPlayersCounter) {
|
||||
allInCondition = true;
|
||||
}
|
||||
}
|
||||
if( (*bigBlindIt_c)->getMySet() <= smallBlind && tempCounter == allInPlayersCounter) {
|
||||
allInCondition = true;
|
||||
|
||||
// no.2: heads up -> detect player who is all in and bb but could set less than sb
|
||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||
|
||||
if(activePlayerList->size()==2 && (*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMyButton()==BUTTON_BIG_BLIND && (*it_c)->getMySet()<=smallBlind) {
|
||||
allInCondition = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// HeadsUp-Ausnahme -> spieler ermitteln, der all in ist und als bb nur weniger als sb setzen konnte
|
||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||
|
||||
if(activePlayerList->size()==2 && (*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMyButton()==BUTTON_BIG_BLIND && (*it_c)->getMySet()<=smallBlind) {
|
||||
allInCondition = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// beim Vorliegen einer All In Kondition -> Ausfhrung einer Sonderprozedur
|
||||
// special routine
|
||||
if(allInCondition) {
|
||||
myBoard->collectPot();
|
||||
myGui->refreshPot();
|
||||
@@ -650,12 +549,6 @@ void LocalHand::switchRounds() {
|
||||
|
||||
}
|
||||
|
||||
//unhighlight current players groupbox
|
||||
// if(playerArray[lastPlayersTurn]->getMyActiveStatus() == 1) myGui->refreshGroupbox(lastPlayersTurn,1);
|
||||
|
||||
|
||||
|
||||
|
||||
//unhighlight current players groupbox
|
||||
it_c = getActivePlayerIt(lastPlayersTurn);
|
||||
if( it_c != activePlayerList->end() ) {
|
||||
@@ -663,34 +556,29 @@ void LocalHand::switchRounds() {
|
||||
myGui->refreshGroupbox(lastPlayersTurn,1);
|
||||
}
|
||||
|
||||
|
||||
myGui->refreshGameLabels((GameState)getCurrentRound());
|
||||
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
|
||||
//
|
||||
|
||||
|
||||
// cout << "NextPlayerSpeed2 start" << endl;
|
||||
switch(currentRound) {
|
||||
case 0: {
|
||||
// Preflop starten
|
||||
// start preflop
|
||||
myGui->preflopAnimation1();
|
||||
} break;
|
||||
case 1: {
|
||||
// Flop starten
|
||||
// start flop
|
||||
myGui->flopAnimation1();
|
||||
} break;
|
||||
case 2: {
|
||||
// Turn starten
|
||||
// start turn
|
||||
myGui->turnAnimation1();
|
||||
|
||||
} break;
|
||||
case 3: {
|
||||
// River starten
|
||||
// start river
|
||||
myGui->riverAnimation1();
|
||||
|
||||
} break;
|
||||
case 4: {
|
||||
// PostRiver starten
|
||||
// start post river
|
||||
myGui->postRiverAnimation1();
|
||||
|
||||
} break;
|
||||
@@ -736,15 +624,11 @@ PlayerListIterator LocalHand::getRunningPlayerIt(unsigned uniqueId) const {
|
||||
|
||||
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); it++) {
|
||||
|
||||
// cout << (*it)->getMyUniqueID() << " ";
|
||||
|
||||
if((*it)->getMyUniqueID() == uniqueId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// cout << endl;
|
||||
|
||||
return it;
|
||||
|
||||
}
|
||||
|
||||
@@ -34,12 +34,11 @@
|
||||
|
||||
class LocalHand : public HandInterface{
|
||||
public:
|
||||
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, /*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int);
|
||||
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int);
|
||||
~LocalHand();
|
||||
|
||||
void start();
|
||||
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const { return playerArray; }
|
||||
PlayerList getSeatsList() const {return seatsList;}
|
||||
PlayerList getActivePlayerList() const {return activePlayerList;}
|
||||
PlayerList getRunningPlayerList() const {return runningPlayerList;}
|
||||
@@ -97,7 +96,6 @@ private:
|
||||
GuiInterface *myGui;
|
||||
BoardInterface *myBoard;
|
||||
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
|
||||
PlayerList seatsList;
|
||||
PlayerList activePlayerList;
|
||||
PlayerList runningPlayerList;
|
||||
@@ -106,7 +104,7 @@ private:
|
||||
|
||||
int myID;
|
||||
int startQuantityPlayers;
|
||||
unsigned dealerPosition; // -1 -> neutral
|
||||
unsigned dealerPosition;
|
||||
int currentRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
|
||||
int smallBlind;
|
||||
int startCash;
|
||||
|
||||
@@ -1079,16 +1079,6 @@ void LocalPlayer::preflopEngine() {
|
||||
|
||||
// cout << myID << ": " << myHoleCardsValue << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << myCards[0] << " " << myCards[1] << endl;
|
||||
|
||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||
// int aggValue = (int)(((currentHand->getPlayerArray()[0]->getMyAggressive()*1.0)/7.0 - 1.0/currentHand->getActivePlayerList()->size())*21.0);
|
||||
//
|
||||
// if(currentHand->getPlayerArray()[0]->getMyActiveStatus() && currentHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
// myNiveau[0] -= aggValue;
|
||||
// myNiveau[2] -= aggValue;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||
it_c = currentHand->getActivePlayerIt(0);
|
||||
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
||||
@@ -1394,15 +1384,6 @@ void LocalPlayer::flopEngine() {
|
||||
int individualHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
|
||||
if(individualHighestSet > myCash) individualHighestSet = myCash;
|
||||
|
||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist
|
||||
// int aggValue = (int)(((currentHand->getPlayerArray()[0]->getMyAggressive()*1.0)/7.0 - 1.0/currentHand->getActivePlayerList()->size())*21.0);
|
||||
//
|
||||
// if(currentHand->getPlayerArray()[0]->getMyActiveStatus() && currentHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
// for(i=0; i<3; i++) {
|
||||
// myNiveau[i] -= aggValue;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||
it_c = currentHand->getActivePlayerIt(0);
|
||||
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
||||
@@ -2032,17 +2013,6 @@ void LocalPlayer::turnEngine() {
|
||||
// 3. Call -- Raise
|
||||
myNiveau[2] = 69 + myDude4/* - 6*(currentHand->getActivePlayerList().size() - 2)*/;
|
||||
|
||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist
|
||||
// int aggValue = (int)(((currentHand->getPlayerArray()[0]->getMyAggressive()*1.0)/7.0 - 1.0/currentHand->getActivePlayerList()->size())*21.0);
|
||||
//
|
||||
// if(currentHand->getPlayerArray()[0]->getMyActiveStatus() && currentHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
// for(i=0; i<3; i++) {
|
||||
// myNiveau[i] -= aggValue;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||
it_c = currentHand->getActivePlayerIt(0);
|
||||
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
||||
@@ -2436,16 +2406,6 @@ void LocalPlayer::riverEngine() {
|
||||
// 3. Call -- Raise
|
||||
myNiveau[2] = 69 + myDude4/* - 6*(currentHand->getActivePlayerList().size() - 2)*/;
|
||||
|
||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist
|
||||
// int aggValue = (int)(((currentHand->getPlayerArray()[0]->getMyAggressive()*1.0)/7.0 - 1.0/currentHand->getActivePlayerList()->size())*21.0);
|
||||
//
|
||||
// if(currentHand->getPlayerArray()[0]->getMyActiveStatus() && currentHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
// for(i=0; i<3; i++) {
|
||||
// myNiveau[i] -= aggValue;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||
it_c = currentHand->getActivePlayerIt(0);
|
||||
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
using namespace std;
|
||||
|
||||
ClientBoard::ClientBoard()
|
||||
: /*playerArray(0),*/ currentHand(0), pot(0), sets(0)
|
||||
: currentHand(0), pot(0), sets(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -34,10 +34,9 @@ ClientBoard::~ClientBoard()
|
||||
}
|
||||
|
||||
void
|
||||
ClientBoard::setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl)
|
||||
ClientBoard::setPlayerLists(PlayerList sl, PlayerList apl, PlayerList rpl)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||
// playerArray = sl_old; // delete
|
||||
seatsList = sl;
|
||||
activePlayerList = apl;
|
||||
runningPlayerList = rpl;
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
ClientBoard();
|
||||
~ClientBoard();
|
||||
|
||||
void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList);
|
||||
void setPlayerLists(PlayerList, PlayerList, PlayerList);
|
||||
void setHand(HandInterface*);
|
||||
|
||||
void setMyCards(int* theValue);
|
||||
@@ -55,7 +55,6 @@ public:
|
||||
private:
|
||||
mutable boost::recursive_mutex m_syncMutex;
|
||||
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
|
||||
PlayerList seatsList;
|
||||
PlayerList activePlayerList;
|
||||
PlayerList runningPlayerList;
|
||||
|
||||
@@ -35,9 +35,9 @@ ClientEngineFactory::~ClientEngineFactory()
|
||||
}
|
||||
|
||||
|
||||
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
|
||||
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
|
||||
{
|
||||
return new ClientHand(f, g, b, /*sl_old,*/ sl, apl, rpl, id, sP, dP, sB, sC);
|
||||
return new ClientHand(f, g, b, sl, apl, rpl, id, sP, dP, sB, sC);
|
||||
}
|
||||
|
||||
BoardInterface* ClientEngineFactory::createBoard()
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
ClientEngineFactory();
|
||||
~ClientEngineFactory();
|
||||
|
||||
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
|
||||
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
|
||||
BoardInterface* createBoard();
|
||||
boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB);
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, /*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
|
||||
: myFactory(f), myGui(g), myBoard(b), /*playerArray(sl_old),*/ seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0),
|
||||
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
|
||||
: myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0),
|
||||
smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(0),
|
||||
cardsShown(false), bettingRoundsPlayed(0)
|
||||
{
|
||||
@@ -67,12 +67,6 @@ ClientHand::start()
|
||||
{
|
||||
}
|
||||
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> >
|
||||
// ClientHand::getPlayerArray() const
|
||||
// {
|
||||
// return playerArray;
|
||||
// }
|
||||
|
||||
PlayerList
|
||||
ClientHand::getSeatsList() const
|
||||
{
|
||||
|
||||
@@ -32,12 +32,11 @@
|
||||
class ClientHand : public HandInterface
|
||||
{
|
||||
public:
|
||||
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, /*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList , int, int, int, int, int );
|
||||
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerList, PlayerList, PlayerList , int, int, int, int, int );
|
||||
~ClientHand();
|
||||
|
||||
void start();
|
||||
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const;
|
||||
PlayerList getSeatsList() const;
|
||||
PlayerList getActivePlayerList() const;
|
||||
PlayerList getRunningPlayerList() const;
|
||||
@@ -97,7 +96,6 @@ class ClientHand : public HandInterface
|
||||
GuiInterface *myGui;
|
||||
BoardInterface *myBoard;
|
||||
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
|
||||
PlayerList seatsList;
|
||||
PlayerList activePlayerList;
|
||||
PlayerList runningPlayerList;
|
||||
|
||||
+24
-94
@@ -40,22 +40,14 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
|
||||
blindsList = myGameData.manualBlindsList;
|
||||
|
||||
|
||||
if(DEBUG_MODE) {
|
||||
startSmallBlind = 10;
|
||||
currentSmallBlind = startSmallBlind;
|
||||
}
|
||||
|
||||
// cout << "Create Game Object" << "\n";
|
||||
int i;
|
||||
|
||||
currentHandID = 0;
|
||||
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// playerArray[i] = 0;
|
||||
// }
|
||||
|
||||
// Dealer Position bestimmen
|
||||
// determine dealer position
|
||||
PlayerDataList::const_iterator player_i = playerDataList.begin();
|
||||
PlayerDataList::const_iterator player_end = playerDataList.end();
|
||||
|
||||
@@ -67,17 +59,18 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
}
|
||||
if (player_i == player_end)
|
||||
throw LocalException(__FILE__, __LINE__, ERR_DEALER_NOT_FOUND);
|
||||
|
||||
dealerPosition = startData.startDealerPlayerId;
|
||||
|
||||
// Board erstellen
|
||||
// create board
|
||||
currentBoard = myFactory->createBoard();
|
||||
|
||||
// create player lists
|
||||
seatsList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
||||
activePlayerList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
||||
runningPlayerList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
||||
|
||||
// Player erstellen
|
||||
|
||||
// create player
|
||||
player_i = playerDataList.begin();
|
||||
player_end = playerDataList.end();
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
@@ -99,24 +92,22 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
++player_i;
|
||||
}
|
||||
|
||||
// create Player Objects
|
||||
// create player objects
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(currentBoard, i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
|
||||
|
||||
tmpPlayer->setNetSessionData(myNetSession);
|
||||
|
||||
// fill player lists
|
||||
// playerArray.push_back(tmpPlayer); // delete
|
||||
seatsList->push_back(tmpPlayer);
|
||||
if(startQuantityPlayers > i) {
|
||||
activePlayerList->push_back(tmpPlayer);
|
||||
}
|
||||
|
||||
(*runningPlayerList) = (*activePlayerList);
|
||||
|
||||
// playerArray[i]->setNetSessionData(myNetSession); // delete
|
||||
|
||||
}
|
||||
currentBoard->setPlayerLists(/*playerArray,*/ seatsList, activePlayerList, runningPlayerList); // delete playerArray
|
||||
|
||||
currentBoard->setPlayerLists(seatsList, activePlayerList, runningPlayerList);
|
||||
|
||||
//start timer
|
||||
blindsTimer.reset();
|
||||
@@ -125,13 +116,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
|
||||
Game::~Game()
|
||||
{
|
||||
// cout << "Delete Game Object" << "\n";
|
||||
|
||||
delete currentBoard;
|
||||
currentBoard = 0;
|
||||
delete currentHand;
|
||||
currentHand = 0;
|
||||
|
||||
}
|
||||
|
||||
HandInterface *Game::getCurrentHand()
|
||||
@@ -149,38 +137,31 @@ void Game::initHand()
|
||||
|
||||
size_t i;
|
||||
PlayerListConstIterator it_c;
|
||||
PlayerListIterator it, it_2;
|
||||
PlayerListIterator it;
|
||||
|
||||
currentHandID++;
|
||||
|
||||
// calculate smallBlind
|
||||
raiseBlinds();
|
||||
|
||||
//Spieler Action auf 0 setzen
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// playerArray[i]->setMyAction(0);
|
||||
// }
|
||||
|
||||
//Spieler Action auf 0 setzen
|
||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
||||
(*it_c)->setMyAction(PLAYER_ACTION_NONE);
|
||||
// set player action none
|
||||
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
|
||||
(*it)->setMyAction(PLAYER_ACTION_NONE);
|
||||
}
|
||||
|
||||
// Spieler mit leerem Cash auf inactive setzen
|
||||
// set player with empty cash inactive
|
||||
it = activePlayerList->begin();
|
||||
|
||||
while( it!=activePlayerList->end() ) {
|
||||
|
||||
if((*it)->getMyCash() == 0) {
|
||||
// cout << "playerID: " << (*it)->getMyID() << endl;
|
||||
(*it)->setMyActiveStatus(0);
|
||||
(*it)->setMyActiveStatus(false);
|
||||
it = activePlayerList->erase(it);
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
// eventuell vorhandene Hand löschen
|
||||
// delete possible existing hands
|
||||
if(currentHand) {
|
||||
delete currentHand;
|
||||
currentHand = 0;
|
||||
@@ -189,17 +170,10 @@ void Game::initHand()
|
||||
runningPlayerList->clear();
|
||||
(*runningPlayerList) = (*activePlayerList);
|
||||
|
||||
// Hand erstellen
|
||||
currentHand = myFactory->createHand(myFactory, myGui, currentBoard, /*playerArray,*/ seatsList, activePlayerList, runningPlayerList, currentHandID, startQuantityPlayers, dealerPosition, currentSmallBlind, startCash); // delete playerArray
|
||||
// create Hand
|
||||
currentHand = myFactory->createHand(myFactory, myGui, currentBoard, seatsList, activePlayerList, runningPlayerList, currentHandID, startQuantityPlayers, dealerPosition, currentSmallBlind, startCash);
|
||||
|
||||
|
||||
// Dealer-Button weiterschieben --> Achtung inactive -> TODO exception-rule !!! DELETE
|
||||
// for(i=0; (i<MAX_NUMBER_OF_PLAYERS && !(playerArray[dealerPosition]->getMyActiveStatus())) || i==0; i++) {
|
||||
//
|
||||
// dealerPosition = (dealerPosition+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
// }
|
||||
|
||||
// Dealer-Button weiterschieben --> Achtung inactive -> TODO exception-rule !!!
|
||||
// shifting dealer button -> TODO exception-rule !!!
|
||||
bool nextDealerFound = false;
|
||||
PlayerListConstIterator dealerPositionIt = currentHand->getSeatIt(dealerPosition);
|
||||
if(dealerPositionIt == seatsList->end()) {
|
||||
@@ -211,10 +185,10 @@ void Game::initHand()
|
||||
dealerPositionIt++;
|
||||
if(dealerPositionIt == seatsList->end()) dealerPositionIt = seatsList->begin();
|
||||
|
||||
it = currentHand->getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
||||
if(it != activePlayerList->end() ) {
|
||||
it_c = currentHand->getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
||||
if(it_c != activePlayerList->end() ) {
|
||||
nextDealerFound = true;
|
||||
dealerPosition = (*it)->getMyUniqueID();
|
||||
dealerPosition = (*it_c)->getMyUniqueID();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -228,10 +202,9 @@ void Game::initHand()
|
||||
|
||||
void Game::startHand()
|
||||
{
|
||||
//GUI bereinigen
|
||||
myGui->nextRoundCleanGui();
|
||||
|
||||
//Log new Hand
|
||||
// log new hand
|
||||
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
||||
myGui->flushLogAtGame(myGameID);
|
||||
|
||||
@@ -265,84 +238,41 @@ boost::shared_ptr<PlayerInterface> Game::getCurrentPlayer()
|
||||
|
||||
void Game::raiseBlinds() {
|
||||
|
||||
// cout << "timer minutes " << blindsTimer.elapsed().total_seconds()/60 << "\n";
|
||||
// cout << "gameData.RaiseIntervalMode " << myGameData.RaiseIntervalMode << "\n";
|
||||
// cout << "gameData.raiseMode " << myGameData.raiseMode << "\n";
|
||||
// cout << "gameData.afterManualBlindsMode " << myGameData.afterManualBlindsMode << "\n";
|
||||
|
||||
bool raiseBlinds = false;
|
||||
|
||||
if (myGameData.raiseIntervalMode == RAISE_ON_HANDNUMBER) {
|
||||
|
||||
if (lastHandBlindsRaised + myGameData.raiseSmallBlindEveryHandsValue <= currentHandID) {
|
||||
raiseBlinds = true;
|
||||
lastHandBlindsRaised = currentHandID;
|
||||
|
||||
// cout << "raise now on hands \n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (lastTimeBlindsRaised + myGameData.raiseSmallBlindEveryMinutesValue <= blindsTimer.elapsed().total_seconds()/60) {
|
||||
raiseBlinds = true;
|
||||
lastTimeBlindsRaised = blindsTimer.elapsed().total_seconds()/60;
|
||||
|
||||
// cout << "raise now on minutes \n";
|
||||
}
|
||||
}
|
||||
|
||||
if (raiseBlinds) {
|
||||
|
||||
// At this point, the blinds must be raised
|
||||
// Now we check how the blinds should be raised
|
||||
|
||||
// Now we check how the blinds should be raised
|
||||
if (myGameData.raiseMode == DOUBLE_BLINDS) {
|
||||
currentSmallBlind *= 2;
|
||||
// cout << "double small blind \n";
|
||||
}
|
||||
else {
|
||||
// Increase the position of the list
|
||||
/* list<int> blindsList = myGameData.manualBlindsList;*/
|
||||
// list<int>::iterator it;
|
||||
|
||||
if(!blindsList.empty()) {
|
||||
|
||||
currentSmallBlind = blindsList.front();
|
||||
blindsList.pop_front();
|
||||
|
||||
// it = find(blindsList.begin(), blindsList.end(), currentSmallBlind);
|
||||
// if(it != blindsList.end()) {
|
||||
// it++;
|
||||
// cout << "increase position in blindslist \n";
|
||||
// }
|
||||
// else {
|
||||
// cout << "blindslist exceeds\n";
|
||||
// if(currentSmallBlind == myGameData.firstSmallBlind) {
|
||||
// it = blindsList.begin();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// else { cout << "blindslist is empty \n"; }
|
||||
// Check if we can get an element of the list or the position exceeds the lis
|
||||
// if (blindsList.empty() || it == blindsList.end()) {
|
||||
|
||||
else {
|
||||
|
||||
// The position exceeds the list
|
||||
if (myGameData.afterManualBlindsMode == AFTERMB_DOUBLE_BLINDS) {
|
||||
currentSmallBlind *= 2;
|
||||
// cout << "after blindslist double blind\n";
|
||||
}
|
||||
else {
|
||||
if(myGameData.afterManualBlindsMode == AFTERMB_RAISE_ABOUT) {
|
||||
currentSmallBlind += myGameData.afterMBAlwaysRaiseValue;
|
||||
// cout << "after blindslist increase about x \n";
|
||||
}
|
||||
// else { /* Stay at last blind */ cout << "after blindslist stay at last blind \n"; }
|
||||
}
|
||||
// } else {
|
||||
// Grab the blinds amount from the list
|
||||
// currentSmallBlind = *it;
|
||||
// cout << "set new small blind from blindslist \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-7
@@ -56,12 +56,10 @@ public:
|
||||
HandInterface *getCurrentHand();
|
||||
const HandInterface *getCurrentHand() const;
|
||||
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const {return playerArray;}
|
||||
PlayerList getSeatsList() const {return seatsList;}
|
||||
PlayerList getActivePlayerList() const {return activePlayerList;}
|
||||
PlayerList getRunningPlayerList() const {return runningPlayerList;}
|
||||
|
||||
//Zufgriff Startvariablen
|
||||
void setStartQuantityPlayers(int theValue) { startQuantityPlayers = theValue; }
|
||||
int getStartQuantityPlayers() const { return startQuantityPlayers; }
|
||||
|
||||
@@ -91,21 +89,18 @@ private:
|
||||
HandInterface *currentHand;
|
||||
BoardInterface *currentBoard;
|
||||
|
||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // available seats --> seatList !!! TODO // delete
|
||||
PlayerList seatsList;
|
||||
PlayerList activePlayerList; // used seats
|
||||
PlayerList runningPlayerList; // nonfolded and nonallin active players
|
||||
|
||||
// boost::shared_ptr<PlayerInterface> playerArray[MAX_NUMBER_OF_PLAYERS];
|
||||
|
||||
//Startvariablen
|
||||
// start variables
|
||||
int startQuantityPlayers;
|
||||
int startCash;
|
||||
int startSmallBlind;
|
||||
int myGameID;
|
||||
int guiPlayerNum;
|
||||
|
||||
//Laufvariablen
|
||||
// running variables
|
||||
int currentSmallBlind;
|
||||
int currentHandID;
|
||||
unsigned dealerPosition;
|
||||
|
||||
@@ -70,8 +70,6 @@ Log::Log(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), m
|
||||
stream << "<body style=\"font-size:smaller\">\n";
|
||||
stream << "<img src='logo.png'>\n";
|
||||
stream << "<h3><b>Log-File for PokerTH 0.6 Session started on "+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>\n";
|
||||
// stream << "</body>\n";
|
||||
// stream << "</html>\n";
|
||||
myLogFile->close();
|
||||
|
||||
//Zu alte Dateien löschen!!!
|
||||
@@ -151,195 +149,11 @@ void Log::logPlayerActionMsg(QString msg, int action, int setValue) {
|
||||
|
||||
void Log::logNewGameHandMsg(int gameID, int handID) {
|
||||
|
||||
// int i, j, k;
|
||||
PlayerListConstIterator it_c;
|
||||
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||
|
||||
myW->textBrowser_Log->append("<span style=\"font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
||||
|
||||
|
||||
// if(myConfig->readConfigInt("LogOnOff")) {
|
||||
// //if write logfiles is enabled
|
||||
//
|
||||
// logFileStreamString += "<p><b>####################   Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"   ####################</b></br>";
|
||||
// logFileStreamString += "BLIND LEVEL: "+QString::number(currentHand->getSmallBlind())+"$/"+QString::number(currentHand->getSmallBlind()*2)+"$</br>";
|
||||
// logFileStreamString += "CASH: ";
|
||||
//
|
||||
// //Aktive Spieler zählen
|
||||
// // int activePlayersCounter = 0;
|
||||
// // for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
||||
// // if (currentHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
||||
// // }
|
||||
// int k = 0;
|
||||
// // if(currentHand->getActivePlayerList()->size() > 2) {
|
||||
// //
|
||||
// // for(i=0; i<currentHand->getStartQuantityPlayers(); i++) {
|
||||
// //
|
||||
// // if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
// // //print cash only for active players
|
||||
// //
|
||||
// //
|
||||
// // if(currentHand->getPlayerArray()[i]->getMyButton() == 1) {
|
||||
// // if(k==1) { logFileStreamString += ", "; }
|
||||
// // k=1;
|
||||
// // logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+" (Dealer): "+QString::number(currentHand->getPlayerArray()[i]->getMyCash(),10)+"$";
|
||||
// // }
|
||||
// // else {
|
||||
// // if(k==1) { logFileStreamString += ", "; }
|
||||
// // k=1;
|
||||
// // logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+": "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // else {
|
||||
// // for(i=0; i<currentHand->getStartQuantityPlayers(); i++) {
|
||||
// // if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
// // //print cash only for active players
|
||||
// // if(currentHand->getPlayerArray()[i]->getMyButton() == 2) {
|
||||
// // if(k==1) { logFileStreamString += ", "; }
|
||||
// // k=1;
|
||||
// // logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+" (Dealer): "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
||||
// // }
|
||||
// // else {
|
||||
// // if(k==1) { logFileStreamString += ", "; }
|
||||
// // k=1;
|
||||
// // logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+": "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// //print cash only for active players
|
||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
//
|
||||
// if(currentHand->getActivePlayerList()->size() > 2) {
|
||||
//
|
||||
// if((*it_c)->getMyButton() == BUTTON_DEALER) {
|
||||
// if(k==1) { logFileStreamString += ", "; }
|
||||
// k=1;
|
||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" (Dealer): "+QString::number((*it_c)->getMyCash(),10)+"$";
|
||||
// }
|
||||
// else {
|
||||
// if(k==1) { logFileStreamString += ", "; }
|
||||
// k=1;
|
||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+": "+QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+"$";
|
||||
// }
|
||||
// }
|
||||
// // heads up
|
||||
// else {
|
||||
//
|
||||
// if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
||||
// if(k==1) { logFileStreamString += ", "; }
|
||||
// k=1;
|
||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" (Dealer): "+QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+"$";
|
||||
// }
|
||||
// else {
|
||||
// if(k==1) { logFileStreamString += ", "; }
|
||||
// k=1;
|
||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+": "+QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+"$";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// /* // log blinds
|
||||
// logFileStreamString += "</br>BLINDS: ";
|
||||
// // for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// //
|
||||
// // j = 0;
|
||||
// // //Aktive Spieler zählen
|
||||
// // int activePlayersCounter = 0;
|
||||
// // for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
||||
// // if (currentHand->getPlayerArray()[k]->getMyAction() != 1 && currentHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
||||
// // }
|
||||
// //
|
||||
// // switch (currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyButton()) {
|
||||
// // case 2 : logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$), ";
|
||||
// // break;
|
||||
// // case 3 : logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$)";
|
||||
// // break;
|
||||
// // default :;
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// // for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
// //
|
||||
// // switch ( (*it_c)->getMyButton() ) {
|
||||
// // case 2 : logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$), ";
|
||||
// // break;
|
||||
// // case 3 : logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$)";
|
||||
// // break;
|
||||
// // default : ;
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// cout << "SB: " << currentHand->getCurrentBeRo()->getSmallBlindPositionId() << endl;
|
||||
// cout << "BB: " << currentHand->getCurrentBeRo()->getBigBlindPositionId() << endl;
|
||||
//
|
||||
// // smallBlind
|
||||
// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getSmallBlindPositionId());
|
||||
// if(it_c != currentHand->getActivePlayerList()->end()) {
|
||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$), ";
|
||||
// }
|
||||
//
|
||||
// // bigBlind
|
||||
// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getBigBlindPositionId());
|
||||
// if(it_c != currentHand->getActivePlayerList()->end()) {
|
||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$)";
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// logFileStreamString += "</br></br><b>PREFLOP</b>";
|
||||
// logFileStreamString += "</br>\n";*/
|
||||
// /*
|
||||
// if(myConfig->readConfigInt("LogInterval") < 2) {
|
||||
// // write for log after every action and after every hand
|
||||
// writeLogFileStream(logFileStreamString);
|
||||
// logFileStreamString = "";
|
||||
// }
|
||||
// else {
|
||||
// // write for log after every game
|
||||
// if(gameID > lastGameID) {
|
||||
// writeLogFileStream(logFileStreamString);
|
||||
// logFileStreamString = "";
|
||||
// lastGameID = gameID;
|
||||
// }
|
||||
// }*/
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
@@ -354,99 +168,40 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Log::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName) {
|
||||
|
||||
// log blinds
|
||||
// log blinds
|
||||
logFileStreamString += "BLINDS: ";
|
||||
/*
|
||||
cout << "SB: " << sbName << endl;
|
||||
cout << "BB: " << bbName << endl; */
|
||||
|
||||
// smallBlind
|
||||
// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getSmallBlindPositionId());
|
||||
// if(it_c != currentHand->getActivePlayerList()->end()) {
|
||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$), ";
|
||||
// }*/
|
||||
|
||||
logFileStreamString += sbName+" ("+QString::number(sbSet,10)+"$), ";
|
||||
|
||||
// bigBlind
|
||||
// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getBigBlindPositionId());
|
||||
// if(it_c != currentHand->getActivePlayerList()->end()) {
|
||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$)";
|
||||
// }
|
||||
logFileStreamString += bbName+" ("+QString::number(bbSet,10)+"$)";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
if(currentHand->getActivePlayerList()->size() > 2) {
|
||||
if((*it_c)->getMyButton() == BUTTON_DEALER) {
|
||||
|
||||
// logFileStreamString += "</br></br>DEALER: " + QString::fromUtf8((*it_c)->getMyName().c_str());
|
||||
|
||||
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
||||
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
||||
// logFileStreamString += "</br></br>DEALER: " + QString::fromUtf8((*it_c)->getMyName().c_str());
|
||||
|
||||
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
logFileStreamString += "</br></br><b>PREFLOP</b>";
|
||||
logFileStreamString += "</br>\n";
|
||||
}
|
||||
|
||||
void Log::logPlayerWinsMsg(QString playerName, int pot, bool main) {
|
||||
|
||||
// HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||
|
||||
// myW->textBrowser_Log->append(QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" wins "+QString::number(pot,10)+"$!!! ");
|
||||
|
||||
// PlayerListConstIterator playerConstIt = currentHand->getActivePlayerIt(playerID);
|
||||
// assert( playerConstIt != currentHand->getActivePlayerList()->end() );
|
||||
if(main) {
|
||||
myW->textBrowser_Log->append("<span style=\"color:#FFFF00;\">"+playerName+" wins "+QString::number(pot,10)+"$</span>");
|
||||
} else {
|
||||
@@ -456,22 +211,12 @@ void Log::logPlayerWinsMsg(QString playerName, int pot, bool main) {
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
// if (cardsValueInt != -1) {
|
||||
// myW->textBrowser_Log->append(QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$ with "+translateCardsValueCode(cardsValueInt).at(0)+"!!! ");
|
||||
// stream << "</br><i>"+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
|
||||
// }
|
||||
// else {
|
||||
|
||||
|
||||
// logFileStreamString += "</br><i>"+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
|
||||
|
||||
logFileStreamString += "</br><i>"+playerName+" wins "+QString::number(pot,10)+"$";
|
||||
if(!main) {
|
||||
logFileStreamString += " (side pot)";
|
||||
}
|
||||
logFileStreamString += "</i>\n";
|
||||
|
||||
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
writeLogFileStream(logFileStreamString);
|
||||
logFileStreamString = "";
|
||||
@@ -488,7 +233,6 @@ void Log::logPlayerSitsOut(QString playerName) {
|
||||
|
||||
logFileStreamString += "</br><i><span style=\"font-size:smaller;\">"+playerName+" sits out</span></i>\n";
|
||||
|
||||
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
writeLogFileStream(logFileStreamString);
|
||||
logFileStreamString = "";
|
||||
@@ -1469,8 +1213,6 @@ QStringList Log::translateCardsValueCode(int cardsValueCode) {
|
||||
|
||||
QString Log::determineHandName(int myCardsValueInt) {
|
||||
|
||||
// size_t i;
|
||||
|
||||
list<int> shownCardsValueInt;
|
||||
list<int> sameHandCardsValueInt;
|
||||
bool different = false;
|
||||
@@ -1478,14 +1220,6 @@ QString Log::determineHandName(int myCardsValueInt) {
|
||||
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
// collect cardsValueInt of all players who will show their cards
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
// shownCardsValueInt.push_back(currentHand->getPlayerArray()[i]->getMyCardsValueInt());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// collect cardsValueInt of all players who will show their cards
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
@@ -1502,12 +1236,6 @@ QString Log::determineHandName(int myCardsValueInt) {
|
||||
}
|
||||
}
|
||||
|
||||
// for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) {
|
||||
// cout << *it << endl;
|
||||
// }
|
||||
//
|
||||
// cout << endl;
|
||||
|
||||
QString handName;
|
||||
|
||||
switch(myCardsValueInt/100000000) {
|
||||
|
||||
@@ -1030,24 +1030,6 @@ void mainWindowImpl::callSettingsDialog() {
|
||||
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
|
||||
if (mySettingsDialog->getPlayerNickIsChanged() && mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
|
||||
|
||||
|
||||
|
||||
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
// currentHand->getPlayerArray()[0]->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[1]->setMyName(mySettingsDialog->lineEdit_Opponent1Name->text().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[2]->setMyName(mySettingsDialog->lineEdit_Opponent2Name->text().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[3]->setMyName(mySettingsDialog->lineEdit_Opponent3Name->text().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[4]->setMyName(mySettingsDialog->lineEdit_Opponent4Name->text().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[5]->setMyName(mySettingsDialog->lineEdit_Opponent5Name->text().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[6]->setMyName(mySettingsDialog->lineEdit_Opponent6Name->text().toUtf8().constData());
|
||||
// mySettingsDialog->setPlayerNickIsChanged(FALSE);
|
||||
//
|
||||
// refreshPlayerName();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Game *currentGame = mySession->getCurrentGame();
|
||||
PlayerListIterator it = currentGame->getSeatsList()->begin();
|
||||
(*it)->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData());
|
||||
@@ -1064,27 +1046,6 @@ void mainWindowImpl::callSettingsDialog() {
|
||||
|
||||
if(mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
|
||||
|
||||
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
// currentHand->getPlayerArray()[0]->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[1]->setMyAvatar(mySettingsDialog->pushButton_Opponent1Avatar->getMyLink().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[2]->setMyAvatar(mySettingsDialog->pushButton_Opponent2Avatar->getMyLink().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[3]->setMyAvatar(mySettingsDialog->pushButton_Opponent3Avatar->getMyLink().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[4]->setMyAvatar(mySettingsDialog->pushButton_Opponent4Avatar->getMyLink().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[5]->setMyAvatar(mySettingsDialog->pushButton_Opponent5Avatar->getMyLink().toUtf8().constData());
|
||||
// currentHand->getPlayerArray()[6]->setMyAvatar(mySettingsDialog->pushButton_Opponent6Avatar->getMyLink().toUtf8().constData());
|
||||
//
|
||||
// //avatar refresh
|
||||
// refreshPlayerAvatar();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Game *currentGame = mySession->getCurrentGame();
|
||||
PlayerListIterator it = currentGame->getSeatsList()->begin();
|
||||
(*it)->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData());
|
||||
@@ -1097,13 +1058,6 @@ void mainWindowImpl::callSettingsDialog() {
|
||||
|
||||
//avatar refresh
|
||||
refreshPlayerAvatar();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Flipside refresh
|
||||
@@ -1212,12 +1166,6 @@ void mainWindowImpl::setSession(boost::shared_ptr<Session> session) { mySession
|
||||
//refresh-Funktionen
|
||||
void mainWindowImpl::refreshSet() {
|
||||
|
||||
// int i;
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMySet() == 0) setLabelArray[i]->setText("");
|
||||
// else setLabelArray[i]->setText("Set: "+QString::number(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMySet(),10)+" $");
|
||||
// }
|
||||
|
||||
Game *currentGame = mySession->getCurrentGame();
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
@@ -1238,59 +1186,10 @@ void mainWindowImpl::refreshButton() {
|
||||
QPixmap bigblindButton(myAppDataPath +"gfx/gui/table/default/bigblindPuck.png");
|
||||
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
||||
|
||||
// int i;
|
||||
// int k;
|
||||
//Aktive Spieler zählen
|
||||
// int activePlayersCounter = 0;
|
||||
// for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
||||
// if (mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
||||
// }
|
||||
|
||||
Game *currentGame = mySession->getCurrentGame();
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
// if(activePlayersCounter > 2) {
|
||||
// switch (currentHand->getPlayerArray()[i]->getMyButton()) {
|
||||
//
|
||||
// case 1 : buttonLabelArray[i]->setPixmap(dealerButton);
|
||||
// break;
|
||||
// case 2 : {
|
||||
// if ( myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(smallblindButton);
|
||||
// else { buttonLabelArray[i]->setPixmap(onePix); }
|
||||
// }
|
||||
// break;
|
||||
// case 3 : {
|
||||
// if (myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(bigblindButton);
|
||||
// else { buttonLabelArray[i]->setPixmap(onePix); }
|
||||
// }
|
||||
// break;
|
||||
// default: buttonLabelArray[i]->setPixmap(onePix);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// switch (currentHand->getPlayerArray()[i]->getMyButton()) {
|
||||
//
|
||||
// case 2 : buttonLabelArray[i]->setPixmap(dealerButton);
|
||||
// break;
|
||||
// case 3 : {
|
||||
// if (myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(bigblindButton);
|
||||
// else { buttonLabelArray[i]->setPixmap(onePix); }
|
||||
// }
|
||||
// break;
|
||||
// default: buttonLabelArray[i]->setPixmap(onePix);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else { buttonLabelArray[i]->setPixmap(onePix); }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
|
||||
if( (*it_c)->getMyActiveStatus() ) {
|
||||
if( currentGame->getActivePlayerList()->size() > 2 ) {
|
||||
@@ -1342,18 +1241,6 @@ void mainWindowImpl::refreshButton() {
|
||||
|
||||
void mainWindowImpl::refreshPlayerName() {
|
||||
|
||||
// int i;
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
// playerNameLabelArray[i]->setText(QString::fromUtf8(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMyName().c_str()));
|
||||
//
|
||||
// } else {
|
||||
// playerNameLabelArray[i]->setText("");
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
@@ -1385,36 +1272,9 @@ QStringList mainWindowImpl::getPlayerNicksList() {
|
||||
void mainWindowImpl::refreshPlayerAvatar() {
|
||||
|
||||
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
||||
// int i;
|
||||
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
//
|
||||
// if(!i) {
|
||||
// if(currentHand->getPlayerArray()[0]->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyAvatar().c_str())).exists()) {
|
||||
// playerAvatarLabelArray[0]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/genereticAvatar.png"));
|
||||
// }
|
||||
// else {
|
||||
// playerAvatarLabelArray[0]->setPixmap(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyAvatar().c_str()));
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// if(currentHand->getPlayerArray()[i]->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyAvatar().c_str())).exists()) {
|
||||
// playerAvatarLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/genereticAvatar.png"));
|
||||
// }
|
||||
// else {
|
||||
// playerAvatarLabelArray[i]->setPixmap(QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyAvatar().c_str()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// playerAvatarLabelArray[i]->setPixmap(onePix);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
@@ -1431,7 +1291,6 @@ void mainWindowImpl::refreshPlayerAvatar() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
||||
@@ -1446,38 +1305,6 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
||||
|
||||
if(playerID == -1 || playerAction == -1) {
|
||||
|
||||
// int i;
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
//
|
||||
// //if no action --> clear Pixmap
|
||||
// if(currentHand->getPlayerArray()[i]->getMyAction() == 0) {
|
||||
// actionLabelArray[i]->setPixmap(onePix);
|
||||
// }
|
||||
// else {
|
||||
// // if(i!=0 || ( i==0 && currentHand->getPlayerArray()[0]->getMyAction() != 1) ) {
|
||||
// //paint action pixmap
|
||||
// actionLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[currentHand->getPlayerArray()[i]->getMyAction()]+".png"));
|
||||
// // }
|
||||
// }
|
||||
//
|
||||
// if (currentHand->getPlayerArray()[i]->getMyAction()==1) {
|
||||
// // groupBoxArray[i]->setDisabled(TRUE);
|
||||
//
|
||||
// if(i != 0) {
|
||||
// holeCardsArray[i][0]->setPixmap(onePix, FALSE);
|
||||
// holeCardsArray[i][1]->setPixmap(onePix, FALSE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||
|
||||
@@ -1486,10 +1313,8 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
||||
actionLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
|
||||
}
|
||||
else {
|
||||
// if(i!=0 || ( i==0 && currentHand->getPlayerArray()[0]->getMyAction() != 1) ) {
|
||||
//paint action pixmap
|
||||
actionLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[(*it_c)->getMyAction()]+".png"));
|
||||
// }
|
||||
actionLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[(*it_c)->getMyAction()]+".png"));
|
||||
}
|
||||
|
||||
if ((*it_c)->getMyAction()==1) {
|
||||
@@ -1501,19 +1326,6 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
//if no action --> clear Pixmap
|
||||
@@ -1546,22 +1358,8 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
||||
|
||||
void mainWindowImpl::refreshCash() {
|
||||
|
||||
// int i;
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
//
|
||||
// cashLabelArray[i]->setText(QString::number(currentHand->getPlayerArray()[i]->getMyCash(),10)+" $");
|
||||
// cashTopLabelArray[i]->setText("Cash:");
|
||||
//
|
||||
// } else {
|
||||
// cashLabelArray[i]->setText("");
|
||||
// cashTopLabelArray[i]->setText("");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
@@ -1582,64 +1380,10 @@ void mainWindowImpl::refreshCash() {
|
||||
|
||||
void mainWindowImpl::refreshGroupbox(int playerID, int status) {
|
||||
|
||||
// int i;
|
||||
int j;
|
||||
|
||||
if(playerID == -1 || status == -1) {
|
||||
|
||||
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
//
|
||||
// if(currentHand->getPlayerArray()[i]->getMyTurn()) {
|
||||
// //Groupbox glow wenn der Spiele dran ist.
|
||||
// if(i==0) {
|
||||
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxActiveGlow.png) }");
|
||||
// }
|
||||
// else {
|
||||
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxActiveGlow.png) }");
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// //Groupbox auf Hintergrundfarbe setzen wenn der Spiele nicht dran aber aktiv ist.
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
// if(i==0) {
|
||||
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow.png) }");
|
||||
// //show buttons
|
||||
// for(j=0; j<3; j++) {
|
||||
// userWidgetsArray[j]->show();
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
|
||||
// }
|
||||
// }
|
||||
// //Groupbox verdunkeln wenn der Spiele inactive ist.
|
||||
// else {
|
||||
// if(i==0) {
|
||||
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow.png) }");
|
||||
// //hide buttons
|
||||
// for(j=0; j<4; j++) {
|
||||
// userWidgetsArray[j]->hide();
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
PlayerListConstIterator it_c;
|
||||
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||
@@ -1682,19 +1426,6 @@ void mainWindowImpl::refreshGroupbox(int playerID, int status) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
switch(status) {
|
||||
@@ -1781,14 +1512,8 @@ void mainWindowImpl::refreshGameLabels(int gameState) {
|
||||
|
||||
void mainWindowImpl::refreshAll() {
|
||||
|
||||
// int i;
|
||||
|
||||
refreshSet();
|
||||
refreshButton();
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// refreshAction( i, mySession->getCurrentGame()->getPlayerArray()[i]->getMyAction());
|
||||
// }
|
||||
|
||||
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
PlayerListConstIterator it_c;
|
||||
@@ -1796,10 +1521,6 @@ void mainWindowImpl::refreshAll() {
|
||||
refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
refreshCash();
|
||||
refreshGroupbox();
|
||||
refreshPlayerName();
|
||||
@@ -1808,12 +1529,7 @@ void mainWindowImpl::refreshAll() {
|
||||
|
||||
void mainWindowImpl::refreshChangePlayer() {
|
||||
|
||||
// int i;
|
||||
|
||||
refreshSet();
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// refreshAction( i, mySession->getCurrentGame()->getPlayerArray()[i]->getMyAction());
|
||||
// }
|
||||
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
PlayerListConstIterator it_c;
|
||||
@@ -1849,42 +1565,8 @@ void mainWindowImpl::dealHoleCards() {
|
||||
int tempCardsIntArray[2];
|
||||
|
||||
// Karten der Gegner und eigene Karten austeilen
|
||||
// int i;
|
||||
int j;
|
||||
Game *currentGame = mySession->getCurrentGame();
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// currentGame->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
||||
// for(j=0; j<2; j++) {
|
||||
// if(currentGame->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
// if ((i == 0) || DEBUG_MODE) {
|
||||
// if(myConfig->readConfigInt("AntiPeekMode")) {
|
||||
// holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
|
||||
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
|
||||
// holeCardsArray[i][j]->setFrontPixmap(tempCardsPixmapArray[j]);
|
||||
// }
|
||||
// else {
|
||||
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
|
||||
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j],FALSE);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
|
||||
// /* holeCardsArray[i][j]->setStyleSheet("QLabel:hover { background-image:url(:/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");*/
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
//
|
||||
// holeCardsArray[i][j]->setPixmap(onePix, FALSE);
|
||||
// // holeCardsArray[i][j]->repaint();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
for(it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
|
||||
@@ -2403,14 +2085,6 @@ int mainWindowImpl::getMyCallAmount() {
|
||||
|
||||
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
|
||||
|
||||
// if (currentHand->getPlayerArray()[0]->getMyCash()+currentHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
|
||||
//
|
||||
// return currentHand->getPlayerArray()[0]->getMyCash();
|
||||
// }
|
||||
// else {
|
||||
// return tempHighestSet - currentHand->getPlayerArray()[0]->getMySet();
|
||||
// }
|
||||
|
||||
if (currentHand->getSeatsList()->front()->getMyCash()+currentHand->getSeatsList()->front()->getMySet() <= tempHighestSet) {
|
||||
|
||||
return currentHand->getSeatsList()->front()->getMyCash();
|
||||
@@ -2506,7 +2180,7 @@ void mainWindowImpl::mySet(){
|
||||
|
||||
// cout << "Set-Value " << spinBox_set->value() << endl;
|
||||
currentHand->getSeatsList()->front()->setMySet(spinBox_set->value());
|
||||
// cout << "MySET " << currentHand->getPlayerArray()[0]->getMySet() << endl;
|
||||
|
||||
if (spinBox_set->value() >= tempCash ) {
|
||||
|
||||
currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
|
||||
@@ -2709,7 +2383,6 @@ void mainWindowImpl::nextPlayerAnimation() {
|
||||
|
||||
//refresh Change Player
|
||||
refreshSet();
|
||||
// refreshAction(currentHand->getLastPlayersTurn(), currentHand->getPlayerArray()[currentHand->getLastPlayersTurn()]->getMyAction());
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
for(it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||
@@ -2791,17 +2464,8 @@ void mainWindowImpl::postRiverRunAnimation2() {
|
||||
horizontalSlider_bet->setDisabled(TRUE);
|
||||
spinBox_set->setDisabled(TRUE);
|
||||
|
||||
|
||||
// int i;
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
|
||||
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
||||
// int activePlayersCounter = 0;
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus()) activePlayersCounter++;
|
||||
// }
|
||||
|
||||
|
||||
int nonfoldPlayersCounter = 0;
|
||||
PlayerListConstIterator it_c;
|
||||
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
@@ -2809,100 +2473,6 @@ void mainWindowImpl::postRiverRunAnimation2() {
|
||||
nonfoldPlayersCounter++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if(nonfoldPlayersCounter!=1) {
|
||||
//
|
||||
// if(!flipHolecardsAllInAlreadyDone) {
|
||||
//
|
||||
// //TODO - Turn cards like in the rules
|
||||
//
|
||||
// // postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
|
||||
//
|
||||
// // //Config? mit oder ohne Eye-Candy?
|
||||
// if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
// // mit Eye-Candy
|
||||
//
|
||||
// //TempArrays
|
||||
// int tempCardsIntArray[2];
|
||||
//
|
||||
// int i, j;
|
||||
//
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
||||
// for(j=0; j<2; j++) {
|
||||
//
|
||||
// holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
|
||||
// }
|
||||
// }
|
||||
// //set Player value (logging)
|
||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// //Ohne Eye-Candy
|
||||
//
|
||||
// //Karten der aktiven Spieler umdrehen
|
||||
// QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
||||
//
|
||||
// //TempArrays
|
||||
// QPixmap tempCardsPixmapArray[2];
|
||||
// int tempCardsIntArray[2];
|
||||
//
|
||||
// int i, j;
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
||||
// for(j=0; j<2; j++) {
|
||||
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
|
||||
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// //set Player value (logging)
|
||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //Wenn einmal umgedreht dann fertig!!
|
||||
// flipHolecardsAllInAlreadyDone = TRUE;
|
||||
// }
|
||||
// else {
|
||||
// int tempCardsIntArray[2];
|
||||
// int i;
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
//
|
||||
// //set Player value (logging)
|
||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,3);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// postRiverRunAnimation2Timer->start(postRiverRunAnimationSpeed);
|
||||
// }
|
||||
// else { postRiverRunAnimation3(); }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(nonfoldPlayersCounter!=1) {
|
||||
|
||||
if(!flipHolecardsAllInAlreadyDone) {
|
||||
@@ -3015,100 +2585,9 @@ void mainWindowImpl::postRiverRunAnimation2_flipHoleCards2() {
|
||||
|
||||
void mainWindowImpl::postRiverRunAnimation3() {
|
||||
|
||||
// int i;
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
//Alle Winner erhellen und "Winner" schreiben
|
||||
|
||||
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
//
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
|
||||
//
|
||||
// // QPalette tempPalette = groupBoxArray[i]->palette();
|
||||
// // tempPalette.setColor(QPalette::Window, highlight);
|
||||
// // groupBoxArray[i]->setPalette(tempPalette);
|
||||
// actionLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_winner.png"));
|
||||
//
|
||||
// //show winnercards if more than one player is active TODO
|
||||
// if ( currentHand->getActivePlayerList()->size() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
|
||||
//
|
||||
// int j;
|
||||
// int bestHandPos[5];
|
||||
// currentHand->getPlayerArray()[i]->getMyBestHandPosition(bestHandPos);
|
||||
//
|
||||
// //index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation
|
||||
// bool index0 = TRUE;
|
||||
// for(j=0; j<5; j++) {
|
||||
// // cout << (currentHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
|
||||
// if (bestHandPos[j] == 0 ) { index0 = FALSE; }
|
||||
// }
|
||||
// if (index0) { holeCardsArray[i][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/}
|
||||
// //index 1 testen
|
||||
// bool index1 = TRUE;
|
||||
// for(j=0; j<5; j++) {
|
||||
// if (bestHandPos[j] == 1 ) { index1 = FALSE; }
|
||||
// }
|
||||
// if (index1) { holeCardsArray[i][1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index1" << endl;*/}
|
||||
// //index 2 testen
|
||||
// bool index2 = TRUE;
|
||||
// for(j=0; j<5; j++) {
|
||||
// if (bestHandPos[j] == 2 ) { index2 = FALSE; }
|
||||
// }
|
||||
// if (index2) { boardCardsArray[0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index2" << endl;*/}
|
||||
// //index 3 testen
|
||||
// bool index3 = TRUE;
|
||||
// for(j=0; j<5; j++) {
|
||||
// if (bestHandPos[j] == 3 ) { index3 = FALSE; }
|
||||
// }
|
||||
// if (index3) { boardCardsArray[1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index3" << endl;*/}
|
||||
// //index 4 testen
|
||||
// bool index4 = TRUE;
|
||||
// for(j=0; j<5; j++) {
|
||||
// if (bestHandPos[j] == 4 ) { index4 = FALSE; }
|
||||
// }
|
||||
// if (index4) { boardCardsArray[2]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index4" << endl;*/}
|
||||
// //index 5 testen
|
||||
// bool index5 = TRUE;
|
||||
// for(j=0; j<5; j++) {
|
||||
// if (bestHandPos[j] == 5 ) { index5 = FALSE; }
|
||||
// }
|
||||
// if (index5) { boardCardsArray[3]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index5" << endl;*/}
|
||||
// //index 6 testen
|
||||
// bool index6 = TRUE;
|
||||
// for(j=0; j<5; j++) {
|
||||
// if (bestHandPos[j] == 6 ) { index6 = FALSE; }
|
||||
// }
|
||||
// if (index6) { boardCardsArray[4]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index6" << endl;*/}
|
||||
// }
|
||||
// //Pot-Verteilung Loggen
|
||||
// //Pro Spieler den Cash aus dem Player und dem Label auslesen. Player_cash - Label_cash = Gewinnsumme
|
||||
// bool toIntBool = TRUE;
|
||||
// int pot = currentHand->getPlayerArray()[i]->getMyCash() - cashLabelArray[i]->text().remove(" $").toInt(&toIntBool,10) ;
|
||||
// //Wenn River dann auch das Blatt loggen!
|
||||
// // if (textLabel_handLabel->text() == "River") {
|
||||
//
|
||||
// //set Player value (logging)
|
||||
// currentHand->getPlayerArray()[i]->setMyWinnerState(1, pot);
|
||||
//
|
||||
// // }
|
||||
// // else {
|
||||
// // myLog->logPlayerWinsMsg(i, pot);
|
||||
// // }
|
||||
// }
|
||||
// else {
|
||||
//
|
||||
// if( currentHand->getActivePlayerList()->size() != 1 && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus() && myConfig->readConfigInt("ShowFadeOutCardsAnimation") ) {
|
||||
//
|
||||
// //aufgedeckte Gegner auch ausblenden
|
||||
// holeCardsArray[i][0]->startFadeOut(guiGameSpeed);
|
||||
// holeCardsArray[i][1]->startFadeOut(guiGameSpeed);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
int nonfoldPlayerCounter = 0;
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
@@ -3140,7 +2619,6 @@ void mainWindowImpl::postRiverRunAnimation3() {
|
||||
//index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation
|
||||
bool index0 = TRUE;
|
||||
for(j=0; j<5; j++) {
|
||||
// cout << (currentHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
|
||||
if (bestHandPos[j] == 0 ) { index0 = FALSE; }
|
||||
}
|
||||
if (index0) { holeCardsArray[(*it_c)->getMyID()][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/}
|
||||
@@ -3242,42 +2720,8 @@ void mainWindowImpl::postRiverRunAnimation4() {
|
||||
|
||||
void mainWindowImpl::postRiverRunAnimation5() {
|
||||
|
||||
// int i;
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
|
||||
//CashTopLabel und PotLabel blinken lassen
|
||||
// if (distributePotAnimCounter<10) {
|
||||
//
|
||||
// if (distributePotAnimCounter==0 || distributePotAnimCounter==2 || distributePotAnimCounter==4 || distributePotAnimCounter==6 || distributePotAnimCounter==8) {
|
||||
//
|
||||
// label_Pot->setText("");
|
||||
//
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
|
||||
//
|
||||
// cashTopLabelArray[i]->setText("");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// label_Pot->setText("Pot");
|
||||
//
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
|
||||
//
|
||||
// cashTopLabelArray[i]->setText("Cash:");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// distributePotAnimCounter++;
|
||||
// }
|
||||
// else {
|
||||
// potDistributeTimer->stop();
|
||||
// postRiverRunAnimation5Timer->start(gameSpeed);
|
||||
// }
|
||||
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
if (distributePotAnimCounter<10) {
|
||||
@@ -3329,16 +2773,9 @@ void mainWindowImpl::postRiverRunAnimation6() {
|
||||
|
||||
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
|
||||
int playersPositiveCashCounter = 0;
|
||||
// for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
|
||||
// // cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
|
||||
//
|
||||
// if (currentHand->getPlayerArray()[i]->getMyCash() > 0)
|
||||
// playersPositiveCashCounter++;
|
||||
// }
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
// cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
|
||||
|
||||
if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++;
|
||||
}
|
||||
@@ -3347,18 +2784,6 @@ void mainWindowImpl::postRiverRunAnimation6() {
|
||||
|
||||
if (playersPositiveCashCounter==1) {
|
||||
|
||||
// for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
|
||||
// // cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
|
||||
// if (currentHand->get/*PlayerArray*/()[i]->getMyCash() > 0) {
|
||||
// (statisticArray[currentHand->getPlayerArray()[i]->getMyDude4()+7])++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// for(i=0; i<15; i++) {
|
||||
// cout << i-7 << ": " << statisticArray[i] << " | ";
|
||||
// }
|
||||
// cout << endl;
|
||||
|
||||
callNewGameDialog();
|
||||
//Bei Cancel nichts machen!!!
|
||||
return;
|
||||
@@ -3369,76 +2794,8 @@ void mainWindowImpl::postRiverRunAnimation6() {
|
||||
|
||||
void mainWindowImpl::flipHolecardsAllIn() {
|
||||
|
||||
// int i;
|
||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||
|
||||
// if(!flipHolecardsAllInAlreadyDone) {
|
||||
// //Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
||||
// int activePlayersCounter = 0;
|
||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
|
||||
// }
|
||||
//
|
||||
// if(activePlayersCounter!=1) {
|
||||
//
|
||||
// //Config? mit oder ohne Eye-Candy?
|
||||
// if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
// // mit Eye-Candy
|
||||
//
|
||||
// //TempArrays
|
||||
// int tempCardsIntArray[2];
|
||||
//
|
||||
// int i, j;
|
||||
//
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
||||
// for(j=0; j<2; j++) {
|
||||
// holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
|
||||
// }
|
||||
// }
|
||||
// //set Player value (logging)
|
||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,2);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// //Ohne Eye-Candy
|
||||
//
|
||||
// //Karten der aktiven Spieler umdrehen
|
||||
// QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
||||
//
|
||||
// //TempArrays
|
||||
// QPixmap tempCardsPixmapArray[2];
|
||||
// int temp2CardsIntArray[2];
|
||||
//
|
||||
// int i, j;
|
||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// currentHand->getPlayerArray()[i]->getMyCards(temp2CardsIntArray);
|
||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
||||
// for(j=0; j<2; j++) {
|
||||
//
|
||||
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(temp2CardsIntArray[j], 10)+".png");
|
||||
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
|
||||
// }
|
||||
// }
|
||||
// //set Player value (logging)
|
||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,2);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(!flipHolecardsAllInAlreadyDone) {
|
||||
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
||||
int nonfoldPlayersCounter = 0;
|
||||
|
||||
@@ -720,24 +720,6 @@ void
|
||||
ClientThread::RemoveDisconnectedPlayers()
|
||||
{
|
||||
// This should only be called between hands.
|
||||
// if (m_game.get())
|
||||
// {
|
||||
// for (int i = 0; i < m_game->getStartQuantityPlayers(); i++)
|
||||
// {
|
||||
// boost::shared_ptr<PlayerInterface> tmpPlayer = m_game->getPlayerArray()[i];
|
||||
// if (tmpPlayer->getMyActiveStatus())
|
||||
// {
|
||||
// // If a player is not in the player data list, it was disconnected.
|
||||
// if (!GetPlayerDataByUniqueId(tmpPlayer->getMyUniqueID()).get())
|
||||
// {
|
||||
// tmpPlayer->setMyCash(0);
|
||||
// tmpPlayer->setMyActiveStatus(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// This should only be called between hands.
|
||||
if (m_game.get())
|
||||
{
|
||||
PlayerListIterator it;
|
||||
|
||||
Reference in New Issue
Block a user