From 2f76bb82f9684309e943a887ea8e37da81a267f9 Mon Sep 17 00:00:00 2001 From: doitux Date: Tue, 7 Aug 2007 00:05:29 +0000 Subject: [PATCH] BeRo refactoring --- pokerth.pro | 24 +- src/engine/berointerface.h | 2 +- src/engine/flopinterface.cpp | 26 - src/engine/flopinterface.h | 51 -- src/engine/handinterface.h | 4 - src/engine/local_engine/localbero.cpp | 98 +++- src/engine/local_engine/localbero.h | 23 +- src/engine/local_engine/localberoflop.cpp | 2 +- .../local_engine/localberopostriver.cpp | 2 +- src/engine/local_engine/localberopreflop.cpp | 2 +- src/engine/local_engine/localberoriver.cpp | 2 +- src/engine/local_engine/localberoturn.cpp | 2 +- src/engine/local_engine/localflop.cpp | 152 ------ src/engine/local_engine/localflop.h | 75 --- src/engine/local_engine/localpreflop.cpp | 124 ----- src/engine/local_engine/localpreflop.h | 63 --- src/engine/local_engine/localriver.cpp | 473 ------------------ src/engine/local_engine/localriver.h | 81 --- src/engine/local_engine/localturn.cpp | 152 ------ src/engine/local_engine/localturn.h | 73 --- src/engine/network_engine/clienthand.cpp | 3 +- src/engine/network_engine/clienthand.h | 10 - src/engine/preflopinterface.cpp | 26 - src/engine/preflopinterface.h | 41 -- src/engine/riverinterface.cpp | 26 - src/engine/riverinterface.h | 55 -- src/engine/turninterface.cpp | 26 - src/gui/generic/serverguiwrapper.cpp | 1 + src/gui/generic/serverguiwrapper.h | 1 + src/gui/guiinterface.h | 1 + src/gui/qt/guiwrapper.cpp | 2 + src/gui/qt/guiwrapper.h | 1 + src/gui/qt/mainwindow/mainwindowimpl.cpp | 16 + src/gui/qt/mainwindow/mainwindowimpl.h | 4 + 34 files changed, 155 insertions(+), 1489 deletions(-) delete mode 100644 src/engine/flopinterface.cpp delete mode 100644 src/engine/flopinterface.h delete mode 100755 src/engine/local_engine/localflop.cpp delete mode 100755 src/engine/local_engine/localflop.h delete mode 100755 src/engine/local_engine/localpreflop.cpp delete mode 100755 src/engine/local_engine/localpreflop.h delete mode 100755 src/engine/local_engine/localriver.cpp delete mode 100755 src/engine/local_engine/localriver.h delete mode 100755 src/engine/local_engine/localturn.cpp delete mode 100755 src/engine/local_engine/localturn.h delete mode 100644 src/engine/preflopinterface.cpp delete mode 100644 src/engine/preflopinterface.h delete mode 100644 src/engine/riverinterface.cpp delete mode 100644 src/engine/riverinterface.h delete mode 100644 src/engine/turninterface.cpp diff --git a/pokerth.pro b/pokerth.pro index f62499ed..2eb246a1 100755 --- a/pokerth.pro +++ b/pokerth.pro @@ -71,12 +71,8 @@ HEADERS += src/game.h \ src/core/thread.h \ src/engine/boardinterface.h \ src/engine/enginefactory.h \ - src/engine/flopinterface.h \ src/engine/handinterface.h \ src/engine/playerinterface.h \ - src/engine/preflopinterface.h \ - src/engine/riverinterface.h \ - src/engine/turninterface.h \ src/engine/berointerface.h \ src/gui/guiinterface.h \ src/net/clientcallback.h \ @@ -97,17 +93,13 @@ HEADERS += src/game.h \ src/engine/local_engine/cardsvalue.h \ src/engine/local_engine/localboard.h \ src/engine/local_engine/localenginefactory.h \ - src/engine/local_engine/localflop.h \ - src/engine/local_engine/localberoflop.h \ src/engine/local_engine/localhand.h \ src/engine/local_engine/localplayer.h \ - src/engine/local_engine/localpreflop.h \ src/engine/local_engine/localberopreflop.h \ - src/engine/local_engine/localriver.h \ + src/engine/local_engine/localberoflop.h \ + src/engine/local_engine/localberoturn.h \ src/engine/local_engine/localberoriver.h \ src/engine/local_engine/localberopostriver.h \ - src/engine/local_engine/localturn.h \ - src/engine/local_engine/localberoturn.h \ src/engine/local_engine/tools.h \ src/engine/local_engine/localbero.h \ src/engine/network_engine/clientboard.h \ @@ -162,12 +154,8 @@ SOURCES += src/game.cpp \ src/config/configfile.cpp \ src/engine/boardinterface.cpp \ src/engine/enginefactory.cpp \ - src/engine/flopinterface.cpp \ src/engine/handinterface.cpp \ src/engine/playerinterface.cpp \ - src/engine/preflopinterface.cpp \ - src/engine/riverinterface.cpp \ - src/engine/turninterface.cpp \ src/engine/berointerface.cpp \ src/gui/guiinterface.cpp \ src/core/common/thread.cpp \ @@ -178,17 +166,13 @@ SOURCES += src/game.cpp \ src/engine/local_engine/cardsvalue.cpp \ src/engine/local_engine/localboard.cpp \ src/engine/local_engine/localenginefactory.cpp \ - src/engine/local_engine/localflop.cpp \ - src/engine/local_engine/localberoflop.cpp \ src/engine/local_engine/localhand.cpp \ src/engine/local_engine/localplayer.cpp \ - src/engine/local_engine/localpreflop.cpp \ src/engine/local_engine/localberopreflop.cpp \ - src/engine/local_engine/localriver.cpp \ + src/engine/local_engine/localberoflop.cpp \ + src/engine/local_engine/localberoturn.cpp \ src/engine/local_engine/localberoriver.cpp \ src/engine/local_engine/localberopostriver.cpp \ - src/engine/local_engine/localturn.cpp \ - src/engine/local_engine/localberoturn.cpp \ src/engine/local_engine/tools.cpp \ src/engine/local_engine/localbero.cpp \ src/engine/network_engine/clientboard.cpp \ diff --git a/src/engine/berointerface.h b/src/engine/berointerface.h index 9fd78add..1b7d96ac 100644 --- a/src/engine/berointerface.h +++ b/src/engine/berointerface.h @@ -34,7 +34,7 @@ public: virtual void run() =0; - // for network + // temporary for network virtual void preflopRun() =0; virtual void flopRun() =0; virtual void turnRun() =0; diff --git a/src/engine/flopinterface.cpp b/src/engine/flopinterface.cpp deleted file mode 100644 index 220f7c0f..00000000 --- a/src/engine/flopinterface.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "flopinterface.h" - -FlopInterface::~FlopInterface() -{ -} - - diff --git a/src/engine/flopinterface.h b/src/engine/flopinterface.h deleted file mode 100644 index f9849d33..00000000 --- a/src/engine/flopinterface.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef FLOPINTERFACE_H -#define FLOPINTERFACE_H - -class FlopInterface{ -public: - - - virtual ~FlopInterface(); - - virtual void setPlayersTurn(int theValue) =0; - virtual int getPlayersTurn() const =0; - - virtual void setHighestSet(int theValue) =0; - virtual int getHighestSet() const =0; - - virtual void setFirstFlopRound(bool theValue) =0; - virtual bool getFirstFlopRound() const =0; - - virtual void setSmallBlindPosition(int theValue) =0; - virtual int getSmallBlindPosition() const =0; - - virtual void setSmallBlind(int theValue) =0; - virtual int getSmallBlind() const =0; - - virtual void resetFirstRun() =0; - - virtual void flopRun() =0; - virtual void nextPlayer2() =0; - -}; - -#endif diff --git a/src/engine/handinterface.h b/src/engine/handinterface.h index be3c38e7..6ebc4990 100644 --- a/src/engine/handinterface.h +++ b/src/engine/handinterface.h @@ -27,10 +27,6 @@ #include "guiinterface.h" #include "boardinterface.h" #include "playerinterface.h" -#include "preflopinterface.h" -#include "flopinterface.h" -#include "turninterface.h" -#include "riverinterface.h" #include "berointerface.h" class HandInterface{ diff --git a/src/engine/local_engine/localbero.cpp b/src/engine/local_engine/localbero.cpp index 32b368b7..ba99adf3 100644 --- a/src/engine/local_engine/localbero.cpp +++ b/src/engine/local_engine/localbero.cpp @@ -11,7 +11,7 @@ // #include "localbero.h" -LocalBeRo::LocalBeRo() : BeRoInterface() +LocalBeRo::LocalBeRo(HandInterface* hi, int id, int qP, int dP, int sB) : BeRoInterface(), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRun(1), firstRound(1), firstHeadsUpRound(1), playersTurn(dP), logBoardCardsDone(0) { } @@ -20,4 +20,100 @@ LocalBeRo::~LocalBeRo() { } +void LocalBeRo::run() { + + int i; + + if (firstRun) { + + myHand->getGuiInterface()->dealBeRoCards(myBeRoID); + firstRun = 0; + + } + + else { + //log the turned cards + if(!logBoardCardsDone) { + + int tempBoardCardsArray[5]; + + myHand->getBoard()->getMyCards(tempBoardCardsArray); + myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]); + logBoardCardsDone = 1; + + } + + bool allHighestSet = 1; + + // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) + for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { + if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } + } + } + + // prfen, ob Flop wirklich dran ist + if(!firstRound && allHighestSet) { + + // Flop nicht dran, weil alle Sets gleich sind + //also gehe in Turn + myHand->setActualRound(myBeRoID+1); + + //Action loeschen und ActionButtons refresh + for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); + } + //Sets in den Pot verschieben und Sets = 0 und Pot-refresh + myHand->getBoard()->collectSets(); + myHand->getBoard()->collectPot(); + myHand->getGuiInterface()->refreshPot(); + + myHand->getGuiInterface()->refreshSet(); + myHand->getGuiInterface()->refreshCash(); + for(i=0; igetGuiInterface()->refreshAction(i,0); } + + myHand->switchRounds(); + } + else { + // Flop 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); + } + + if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpRound == 1) ) { +// not first round in heads up (for headsup dealer is smallblind so it is dealers turn) + + // naechsten Spieler ermitteln + do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); + } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6); + } + else { firstHeadsUpRound = 0; } + + //Spieler-Position vor SmallBlind-Position ermitteln + int activePlayerBeforeSmallBlind = smallBlindPosition; + do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); + } while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6); + + myHand->getPlayerArray()[playersTurn]->setMyTurn(1); + //highlight active players groupbox and clear action + myHand->getGuiInterface()->refreshGroupbox(playersTurn,2); + myHand->getGuiInterface()->refreshAction(playersTurn,0); + + // wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende + if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstRound = 0; } + + if(playersTurn == 0) { + // Wir sind dran + myHand->getGuiInterface()->meInAction(); + } + else { + //Gegner sind dran + myHand->getGuiInterface()->flopAnimation2(); + } + } + } +} + diff --git a/src/engine/local_engine/localbero.h b/src/engine/local_engine/localbero.h index 32dd812d..266d75c2 100644 --- a/src/engine/local_engine/localbero.h +++ b/src/engine/local_engine/localbero.h @@ -13,13 +13,14 @@ #define LOCALBERO_H #include "berointerface.h" +#include "handinterface.h" /** @author FThauer FHammer */ class LocalBeRo : public BeRoInterface{ public: - LocalBeRo(); + LocalBeRo(HandInterface* hi, int id, int qP, int dP, int sB); ~LocalBeRo(); @@ -28,7 +29,8 @@ public: int getHighestCardsValue() const {return 0;} void setHighestCardsValue(int theValue) {} - void run() {} + void run(); + //only until bero refactoring is over void preflopRun() {} void flopRun() {} @@ -40,7 +42,24 @@ public: protected: + HandInterface* myHand; + int myBeRoID; + int myID; + int actualQuantityPlayers; + int dealerPosition; + int smallBlindPosition; + + int smallBlind; + int highestSet; + + bool firstRun; + bool firstRound; + bool firstHeadsUpRound; + int playersTurn; + + bool logBoardCardsDone; + }; diff --git a/src/engine/local_engine/localberoflop.cpp b/src/engine/local_engine/localberoflop.cpp index c1e06779..bf128a6e 100644 --- a/src/engine/local_engine/localberoflop.cpp +++ b/src/engine/local_engine/localberoflop.cpp @@ -24,7 +24,7 @@ using namespace std; -LocalBeRoFlop::LocalBeRoFlop(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), firstHeadsUpFlopRound(1), playersTurn(dP), logBoardCardsDone(0) +LocalBeRoFlop::LocalBeRoFlop(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), firstHeadsUpFlopRound(1), playersTurn(dP), logBoardCardsDone(0) { diff --git a/src/engine/local_engine/localberopostriver.cpp b/src/engine/local_engine/localberopostriver.cpp index 730f91b9..ee0f9c6a 100644 --- a/src/engine/local_engine/localberopostriver.cpp +++ b/src/engine/local_engine/localberopostriver.cpp @@ -25,7 +25,7 @@ using namespace std; -LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0) +LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0) { diff --git a/src/engine/local_engine/localberopreflop.cpp b/src/engine/local_engine/localberopreflop.cpp index 3b056320..87e25aa9 100644 --- a/src/engine/local_engine/localberopreflop.cpp +++ b/src/engine/local_engine/localberopreflop.cpp @@ -24,7 +24,7 @@ using namespace std; -LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0) +LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0) { myBeRoID = GAME_STATE_PREFLOP; diff --git a/src/engine/local_engine/localberoriver.cpp b/src/engine/local_engine/localberoriver.cpp index 7d3506fb..fd97acf4 100644 --- a/src/engine/local_engine/localberoriver.cpp +++ b/src/engine/local_engine/localberoriver.cpp @@ -25,7 +25,7 @@ using namespace std; -LocalBeRoRiver::LocalBeRoRiver(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0) +LocalBeRoRiver::LocalBeRoRiver(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0) { diff --git a/src/engine/local_engine/localberoturn.cpp b/src/engine/local_engine/localberoturn.cpp index f006b40d..4d0b3e5d 100644 --- a/src/engine/local_engine/localberoturn.cpp +++ b/src/engine/local_engine/localberoturn.cpp @@ -24,7 +24,7 @@ using namespace std; -LocalBeRoTurn::LocalBeRoTurn(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), firstHeadsUpTurnRound(1), playersTurn(dP), logBoardCardsDone(0) +LocalBeRoTurn::LocalBeRoTurn(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), firstHeadsUpTurnRound(1), playersTurn(dP), logBoardCardsDone(0) { diff --git a/src/engine/local_engine/localflop.cpp b/src/engine/local_engine/localflop.cpp deleted file mode 100755 index c3a1e28c..00000000 --- a/src/engine/local_engine/localflop.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "localflop.h" -#include -#include - -//using namespace std; - -LocalFlop::LocalFlop(HandInterface* bR, int id, int qP, int dP, int sB) : FlopInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), firstHeadsUpFlopRound(1), playersTurn(dP), logBoardCardsDone(0) - -{ - int i; - - //SmallBlind-Position ermitteln - for(i=0; igetPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i; - } - -} - - -LocalFlop::~LocalFlop() -{ -} - -void LocalFlop::flopRun() { - -// cout << "NextPlayerSpeed2 stop" << endl; - int i; - - if (firstFlopRun) { - myHand->getGuiInterface()->dealFlopCards(); - firstFlopRun = 0; - - } - - else { - //log the turned cards - if(!logBoardCardsDone) { - int tempBoardCardsArray[5]; - - myHand->getBoard()->getMyCards(tempBoardCardsArray); - myHand->getGuiInterface()->logDealBoardCardsMsg(1, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]); - logBoardCardsDone = 1; - } - - bool allHighestSet = 1; - - // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) - for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { - if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } - } - } - -// cout << "firstflopround " << firstFlopRound << endl; - - // prfen, ob Flop wirklich dran ist - if(!firstFlopRound && allHighestSet) { - - // Flop nicht dran, weil alle Sets gleich sind - //also gehe in Turn - myHand->setActualRound(2); - - //Action loeschen und ActionButtons refresh - for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); - } - //Sets in den Pot verschieben und Sets = 0 und Pot-refresh - myHand->getBoard()->collectSets(); - myHand->getBoard()->collectPot(); - myHand->getGuiInterface()->refreshPot(); - - myHand->getGuiInterface()->refreshSet(); - myHand->getGuiInterface()->refreshCash(); - for(i=0; igetGuiInterface()->refreshAction(i,0); } - - myHand->switchRounds(); - } - else { - // Flop 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(1); - } - - if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpFlopRound == 1) ) { -// not first round in heads up (for headsup dealer is smallblind so it is dealers turn) - - // naechsten Spieler ermitteln - do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); - } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6); - } - else { firstHeadsUpFlopRound = 0; } - - //Spieler-Position vor SmallBlind-Position ermitteln - int activePlayerBeforeSmallBlind = smallBlindPosition; - do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); - } while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6); - - myHand->getPlayerArray()[playersTurn]->setMyTurn(1); - //highlight active players groupbox and clear action - myHand->getGuiInterface()->refreshGroupbox(playersTurn,2); - myHand->getGuiInterface()->refreshAction(playersTurn,0); - -// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl; -// cout << "playersTurn " << playersTurn << endl; - - // wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende - if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstFlopRound = 0; } - - if(playersTurn == 0) { - // Wir sind dran -// cout << "actualRound " << myHand->getActualRound() << endl; -// cout << "highestSet vor meInAction " << highestSet << endl; - myHand->getGuiInterface()->meInAction(); - } - else { - //Gegner sind dran -// cout << "NextPlayerSpeed3 start" << endl; - myHand->getGuiInterface()->flopAnimation2(); - } - } - } -} - -void LocalFlop::nextPlayer2() { - -// cout << "NextPlayerSpeed3 stop" << endl; - myHand->getPlayerArray()[playersTurn]->action(); - -} - - diff --git a/src/engine/local_engine/localflop.h b/src/engine/local_engine/localflop.h deleted file mode 100755 index cf3f5748..00000000 --- a/src/engine/local_engine/localflop.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef LOCALFLOP_H -#define LOCALFLOP_H - -#include - -class HandInterface; - -class LocalFlop : public FlopInterface{ - -public: - LocalFlop(HandInterface*, int, int, int, int); - ~LocalFlop(); - - - void setPlayersTurn(int theValue) { playersTurn = theValue; } - int getPlayersTurn() const { return playersTurn; } - - void setHighestSet(int theValue) { highestSet = theValue; } - int getHighestSet() const { return highestSet;} - - void setFirstFlopRound(bool theValue) { firstFlopRound = theValue;} - bool getFirstFlopRound() const { return firstFlopRound;} - - void setSmallBlindPosition(int theValue) { smallBlindPosition = theValue;} - int getSmallBlindPosition() const { return smallBlindPosition; } - - void setSmallBlind(int theValue) { smallBlind = theValue; } - int getSmallBlind() const { return smallBlind; } - - void resetFirstRun() { firstFlopRun = false; } - - void flopRun(); - void nextPlayer2(); - -private: - - HandInterface *myHand; - - int myID; - int actualQuantityPlayers; - int dealerPosition; - int smallBlindPosition; - - int smallBlind; - int highestSet; - - bool firstFlopRun; - bool firstFlopRound; - bool firstHeadsUpFlopRound; - int playersTurn; - - bool logBoardCardsDone; - -}; - -#endif diff --git a/src/engine/local_engine/localpreflop.cpp b/src/engine/local_engine/localpreflop.cpp deleted file mode 100755 index f157acff..00000000 --- a/src/engine/local_engine/localpreflop.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de *Irische Segenswnsche, - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "localpreflop.h" - -#include -#include - -using namespace std; - -LocalPreflop::LocalPreflop(HandInterface* bR, int id, int qP, int dP, int sB) : PreflopInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0) - -{ -cout << "OLD PREFLOP INIT!!!" << endl; -// // BigBlind ermitteln - bigBlindPosition = dealerPosition; - while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) { - bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS); - } - -// // erste Spielernummer fr preflopRun() setzen - playersTurn = bigBlindPosition; -} - - - -LocalPreflop::~LocalPreflop() -{ - - - -} - -void LocalPreflop::preflopRun() { - - cout << "OLD PREFLOPRUN" << endl; - int i; - bool allHighestSet = 1; - - // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) - for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { - if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } - } - } - - // BigBlind ermitteln - bigBlindPosition = dealerPosition; - while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) { - bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS); - } - - // prfen, ob Preflop wirklich dran ist - if(!preflopFirstRound && allHighestSet) { - - // Preflop nicht dran, weil wir nicht mehr in erster PreflopRunde und alle Sets gleich sind - //also gehe in Flop - myHand->setActualRound(1); - - //Action loeschen und ActionButtons refresh - for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); - } - //Sets in den Pot verschieben und Sets = 0 und Pot-refresh - myHand->getBoard()->collectSets(); - myHand->getBoard()->collectPot(); - myHand->getGuiInterface()->refreshPot(); - - myHand->getGuiInterface()->refreshSet(); - myHand->getGuiInterface()->refreshCash(); - for(i=0; igetGuiInterface()->refreshAction(i,0); } - - myHand->switchRounds(); - } - else { - // Preflop ist wirklich dran - - // naechsten Spieler ermitteln - do { - - playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); - // falls BigBlind, dann PreflopFirstRound zuende - if(myHand->getPlayerArray()[playersTurn]->getMyButton() == 3) preflopFirstRound = 0; - - } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || myHand->getPlayerArray()[playersTurn]->getMyAction() == 1 || myHand->getPlayerArray()[playersTurn]->getMyAction() == 6); - - myHand->getPlayerArray()[playersTurn]->setMyTurn(1); - //highlight active players groupbox and clear action - myHand->getGuiInterface()->refreshGroupbox(playersTurn,2); - myHand->getGuiInterface()->refreshAction(playersTurn,0); - - if(playersTurn == 0) { - // Wir sind dran - myHand->getGuiInterface()->meInAction(); - } - else { - //Gegner sind dran -// cout << "NextPlayerSpeed3 start" << endl; - myHand->getGuiInterface()->preflopAnimation2(); - } - } -} - -void LocalPreflop::nextPlayer2() { -// cout << "NextPlayerSpeed3 stop" << endl; - myHand->getPlayerArray()[playersTurn]->action(); - -} diff --git a/src/engine/local_engine/localpreflop.h b/src/engine/local_engine/localpreflop.h deleted file mode 100755 index 7e3aaba4..00000000 --- a/src/engine/local_engine/localpreflop.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - *************************************************************************/ -#ifndef LOCALPREFLOP_H -#define LOCALPREFLOP_H - -#include -#include - -class HandInterface; - -class LocalPreflop : public PreflopInterface{ - -public: - LocalPreflop(HandInterface*, int, int, int, int); - ~LocalPreflop(); - - - void setPlayersTurn(int theValue) { playersTurn = theValue; } - int getPlayersTurn() const { return playersTurn; } - - void setHighestSet(int theValue) { highestSet = theValue; } - int getHighestSet() const { return highestSet;} - - void preflopRun(); - void nextPlayer2(); - - - -private: - HandInterface *myHand; - - int myID; - int actualQuantityPlayers; - int dealerPosition; - int bigBlindPosition; - - int smallBlind; - int highestSet; - - bool preflopFirstRound; - int playersTurn; - - -}; - -#endif diff --git a/src/engine/local_engine/localriver.cpp b/src/engine/local_engine/localriver.cpp deleted file mode 100755 index 02072434..00000000 --- a/src/engine/local_engine/localriver.cpp +++ /dev/null @@ -1,473 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "localriver.h" -#include -#include - -#include - -using namespace std; - -LocalRiver::LocalRiver(HandInterface* bR, int id, int qP, int dP, int sB) : RiverInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0) - -{ int i; - - //SmallBlind-Position ermitteln - for(i=0; igetPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i; - } - -} - -LocalRiver::~LocalRiver() -{ -} - - -void LocalRiver::riverRun() { - - int i; - - if (firstRiverRun) { - myHand->getGuiInterface()->dealRiverCard(); - firstRiverRun = 0; - - } - - else { - //log the turned cards - if(!logBoardCardsDone) { - int tempBoardCardsArray[5]; - - myHand->getBoard()->getMyCards(tempBoardCardsArray); - myHand->getGuiInterface()->logDealBoardCardsMsg(3, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]); - logBoardCardsDone = 1; - } - - bool allHighestSet = 1; - - // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) - for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { -// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl; - if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } - } - } -// cout << "allHighestSet " << allHighestSet << endl; - -// cout << "firstflopround " << firstRiverRound << endl; - - // prfen, ob River wirklich dran ist - if(!firstRiverRound && allHighestSet) { - - // River nicht dran, weil alle Sets gleich sind - //also gehe in Turn - myHand->setActualRound(4); - - //Action lᅵchen und ActionButtons refresh - for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); - } - //Sets in den Pot verschieben und Sets = 0 und Pot-refresh - myHand->getBoard()->collectSets(); - myHand->getBoard()->collectPot(); - myHand->getGuiInterface()->refreshPot(); - - myHand->getGuiInterface()->refreshSet(); - myHand->getGuiInterface()->refreshCash(); - for(i=0; igetGuiInterface()->refreshAction(i,0); } - - - myHand->switchRounds(); - } - else { - // River 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(3); - } - - if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpRiverRound == 1) ) { -// not first round in heads up (for headsup dealer is smallblind so it is dealers turn) - - // naechsten Spieler ermitteln - do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); - } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6); - } - else { firstHeadsUpRiverRound = 0; } - - //Spieler-Position vor SmallBlind-Position ermitteln - int activePlayerBeforeSmallBlind = smallBlindPosition; - do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); - } while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6); - - myHand->getPlayerArray()[playersTurn]->setMyTurn(1); - //highlight active players groupbox and clear action - myHand->getGuiInterface()->refreshGroupbox(playersTurn,2); - myHand->getGuiInterface()->refreshAction(playersTurn,0); - -// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl; -// cout << "playersTurn " << playersTurn << endl; - // wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende - if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstRiverRound = 0; } - - if(playersTurn == 0) { - // Wir sind dran -// cout << "actualRound " << myHand->getActualRound() << endl; -// cout << "highestSet vor meInAction " << highestSet << endl; - myHand->getGuiInterface()->meInAction(); - } - else { - //Gegner sind dran - myHand->getGuiInterface()->riverAnimation2(); - } - } - } -} - -void LocalRiver::postRiverRun() { - - int i; - - // für die Engine die durchschnittlichen Sets von Player 0 setzen --> UNUSED !!! -// if(myID < 5) { -// myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*(myID-1))/myID + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/myID); -// } else { -// myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*4)/5 + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/5); -// } - -// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl; - - //berechnen welcher Spieler gewonnen hat - for(i=0; igetPlayerArray()[i]->getMyCardsValueInt() << endl; - - if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyCardsValueInt() > highestCardsValue ) { - highestCardsValue = myHand->getPlayerArray()[i]->getMyCardsValueInt(); - } - } - - // Durchschnittsets des human player ermitteln - myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyRoundStartCash())-(myHand->getPlayerArray()[0]->getMyCash()))/(myHand->getBettingRoundsPlayed()+1)); -// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl; - - // Aggressivität des human player ermitteln - // anzahl der player die möglichkeit haben am pot teilzuhaben - int potPlayers = 0; - for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) { - potPlayers++; - } - } - - // prüfen ob nur noch der human player an der verteilung teilnimmt und myAggressive für human player setzen - myHand->getPlayerArray()[0]->setMyAggressive(potPlayers == 1 && myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1); - -// cout << "myAggressive: " << myHand->getPlayerArray()[0]->getMyAggressive() << endl; - - // Pot-Verteilung - distributePot(); - - //Pot auf 0 setzen - myHand->getBoard()->setPot(0); - - //starte die Animaionsreihe - myHand->getGuiInterface()->postRiverRunAnimation1(); -} - -void LocalRiver::nextPlayer2() { - - myHand->getPlayerArray()[playersTurn]->action(); - -} - -void LocalRiver::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; igetPlayerArray()[i]->getMyActiveStatus()) { - roundSetArray[i] = myHand->getPlayerArray()[i]->getMyRoundStartCash()-myHand->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; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) { - // nur bei den Spielen den Kartenwert eintragen, die an der Potverteilung teilnehmen - cardsValueArray[i] = myHand->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 highestCardsValueTemp ) { - highestCardsValueTemp = myHand->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 bekommt den gesamten Pot -// if(myHand->getPlayerArray()[winner]->getMyAction() != 6) { -// -// myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+myHand->getBoard()->getPot()); -// myHand->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; igetPlayerArray()[i]->getMyAction() == 1) { - - // diesen Teil aus dem Pot holen - myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]); - // Pot dementsprechend verkleinern - myHand->getBoard()->setPot(myHand->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 - myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]); - // Pot dementsprechend verkleinern - myHand->getBoard()->setPot(myHand->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 - myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]); - myHand->getBoard()->setPot(myHand->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 - myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]); - myHand->getBoard()->setPot(myHand->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 winnersMaxSet) winnersMaxSet = roundSetArray[i]; - } - - // gesamtSet aller Winner - winnersSets = 0; - for(i=0; i Spieler i gehᅵt zu den Winnern - } - - // zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte - if(!playerIsWinner && myHand->getPlayerArray()[i]->getMyAction() == 1) { - - // diesen Teil aus dem Pot holen und dem winnersPot geben - winnersPot += roundSetArray[i]; - // Pot dementsprechend verkleinern - myHand->getBoard()->setPot(myHand->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 - myHand->getBoard()->setPot(myHand->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; - myHand->getBoard()->setPot(myHand->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; - myHand->getBoard()->setPot(myHand->getBoard()->getPot() - winnersSets); - - // winnersPot verteilen (anteilmᅵig) - for(i=0; igetPlayerArray()[winnersArray[i]]->setMyCash(myHand->getPlayerArray()[winnersArray[i]]->getMyCash()+((roundSetArray[winnersArray[i]]*winnersPot)/winnersSets)); - } - - - for(i=0; igetBoard()->getPot() != 0) cout << "!!! Pot: " << myHand->getBoard()->getPot() << endl; - - delete[] winnersArray; - delete[] roundSetArray; - delete[] cardsValueArray; - - -} diff --git a/src/engine/local_engine/localriver.h b/src/engine/local_engine/localriver.h deleted file mode 100755 index 904968a8..00000000 --- a/src/engine/local_engine/localriver.h +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef LOCALRIVER_H -#define LOCALRIVER_H - -#include - -class HandInterface; - - -class LocalRiver : public RiverInterface{ -public: - LocalRiver(HandInterface*, int, int, int, int); - ~LocalRiver(); - - void setPlayersTurn(int theValue) { playersTurn = theValue; } - int getPlayersTurn() const { return playersTurn; } - - void setHighestSet(int theValue) { highestSet = theValue; } - int getHighestSet() const { return highestSet;} - - void setFirstRiverRound(bool theValue) { firstRiverRound = theValue;} - bool getFirstRiverRound() const { return firstRiverRound;} - - void setSmallBlindPosition(int theValue) { smallBlindPosition = theValue;} - int getSmallBlindPosition() const { return smallBlindPosition; } - - void setSmallBlind(int theValue) { smallBlind = theValue; } - int getSmallBlind() const { return smallBlind; } - - void setHighestCardsValue(int theValue) { highestCardsValue = theValue;} - int getHighestCardsValue() const { return highestCardsValue;} - - void resetFirstRun() { firstRiverRun = false; } - - void riverRun(); - void postRiverRun(); - void nextPlayer2(); - void distributePot(); - -private: - - HandInterface *myHand; - - int myID; - int actualQuantityPlayers; - int dealerPosition; - int smallBlindPosition; - - int smallBlind; - int highestSet; - - bool firstRiverRun; - bool firstRiverRound; - bool firstHeadsUpRiverRound; - int playersTurn; - - int highestCardsValue; - - bool logBoardCardsDone; - -}; - -#endif diff --git a/src/engine/local_engine/localturn.cpp b/src/engine/local_engine/localturn.cpp deleted file mode 100755 index 76c4ffbb..00000000 --- a/src/engine/local_engine/localturn.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "localturn.h" -#include -#include - - -//using namespace std; - -LocalTurn::LocalTurn(HandInterface* bR, int id, int qP, int dP, int sB) : TurnInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), firstHeadsUpTurnRound(1), playersTurn(dP), logBoardCardsDone(0) - -{ int i; - - //SmallBlind-Position ermitteln - for(i=0; igetPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i; - } - -} - -LocalTurn::~LocalTurn() -{ -} - - -void LocalTurn::turnRun() { - -// cout << "NextPlayerSpeed2 stop" << endl; - int i; - - if (firstTurnRun) { - myHand->getGuiInterface()->dealTurnCard(); - firstTurnRun = 0; - - } - - else { - //log the turned cards - if(!logBoardCardsDone) { - int tempBoardCardsArray[5]; - - myHand->getBoard()->getMyCards(tempBoardCardsArray); - myHand->getGuiInterface()->logDealBoardCardsMsg(2, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3]); - logBoardCardsDone = 1; - } - - bool allHighestSet = 1; - - // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) - for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { -// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl; - if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } - } - } -// cout << "allHighestSet " << allHighestSet << endl; - -// cout << "firstflopround " << firstTurnRound << endl; - - // prfen, ob Turn wirklich dran ist - if(!firstTurnRound && allHighestSet) { - - // Turn nicht dran, weil alle Sets gleich sind - //also gehe in Turn - myHand->setActualRound(3); - - //Action l�chen und ActionButtons refresh - for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); - } - //Sets in den Pot verschieben und Sets = 0 und Pot-refresh - myHand->getBoard()->collectSets(); - myHand->getBoard()->collectPot(); - myHand->getGuiInterface()->refreshPot(); - - myHand->getGuiInterface()->refreshSet(); - myHand->getGuiInterface()->refreshCash(); - for(i=0; igetGuiInterface()->refreshAction(i,0); } - - myHand->switchRounds(); - } - else { - // Turn 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(2); - } - - if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpTurnRound == 1) ) { -// not first round in heads up (for headsup dealer is smallblind so it is dealers turn) - - // naechsten Spieler ermitteln - do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); - } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6); - } - else { firstHeadsUpTurnRound = 0; } - - //Spieler-Position vor SmallBlind-Position ermitteln - int activePlayerBeforeSmallBlind = smallBlindPosition; - do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); - } while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6); - - myHand->getPlayerArray()[playersTurn]->setMyTurn(1); - //highlight active players groupbox and clear action - myHand->getGuiInterface()->refreshGroupbox(playersTurn,2); - myHand->getGuiInterface()->refreshAction(playersTurn,0); - -// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl; -// cout << "playersTurn " << playersTurn << endl; - // wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende - if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstTurnRound = 0; } - - if(playersTurn == 0) { - // Wir sind dran -// cout << "actualRound " << myHand->getActualRound() << endl; -// cout << "highestSet vor meInAction " << highestSet << endl; - myHand->getGuiInterface()->meInAction(); - } - else { - //Gegner sind dran -// cout << "NextPlayerSpeed3 start" << endl; - myHand->getGuiInterface()->turnAnimation2(); - } - } - } -} - -void LocalTurn::nextPlayer2() { -// cout << "NextPlayerSpeed3 stop" << endl; - myHand->getPlayerArray()[playersTurn]->action(); - -} - - diff --git a/src/engine/local_engine/localturn.h b/src/engine/local_engine/localturn.h deleted file mode 100755 index 40fe7053..00000000 --- a/src/engine/local_engine/localturn.h +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef LOCALTURN_H -#define LOCALTURN_H - -#include - -class HandInterface; - -class LocalTurn : public TurnInterface{ -public: - LocalTurn(HandInterface*, int, int, int, int); - ~LocalTurn(); - - void setPlayersTurn(int theValue) { playersTurn = theValue; } - int getPlayersTurn() const { return playersTurn; } - - void setHighestSet(int theValue) { highestSet = theValue; } - int getHighestSet() const { return highestSet;} - - void setFirstTurnRound(bool theValue) { firstTurnRound = theValue;} - bool getFirstTurnRound() const { return firstTurnRound;} - - void setSmallBlindPosition(int theValue) { smallBlindPosition = theValue;} - int getSmallBlindPosition() const { return smallBlindPosition; } - - void setSmallBlind(int theValue) { smallBlind = theValue; } - int getSmallBlind() const { return smallBlind; } - - void resetFirstRun() { firstTurnRun = false; } - - void turnRun(); - void nextPlayer2(); - -private: - - HandInterface *myHand; - - int myID; - int actualQuantityPlayers; - int dealerPosition; - int smallBlindPosition; - - int smallBlind; - int highestSet; - - bool firstTurnRun; - bool firstTurnRound; - bool firstHeadsUpTurnRound; - int playersTurn; - - bool logBoardCardsDone; - -}; - -#endif diff --git a/src/engine/network_engine/clienthand.cpp b/src/engine/network_engine/clienthand.cpp index 4eeb075a..1898dc9d 100644 --- a/src/engine/network_engine/clienthand.cpp +++ b/src/engine/network_engine/clienthand.cpp @@ -22,8 +22,7 @@ using namespace std; ClientHand::ClientHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) -: myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), - myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), +: myFactory(f), myGui(g), myBoard(b), playerArray(p), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0), cardsShown(false), bettingRoundsPlayed(0) { diff --git a/src/engine/network_engine/clienthand.h b/src/engine/network_engine/clienthand.h index d786fa93..6ce9e775 100644 --- a/src/engine/network_engine/clienthand.h +++ b/src/engine/network_engine/clienthand.h @@ -24,12 +24,7 @@ #include #include #include -#include -#include -#include -#include #include - #include #include @@ -97,11 +92,6 @@ class ClientHand : public HandInterface GuiInterface *myGui; BoardInterface *myBoard; PlayerInterface **playerArray; - PreflopInterface *myPreflop; - FlopInterface *myFlop; - TurnInterface *myTurn; - RiverInterface *myRiver; - BeRoInterface *myOldBeRo; std::vector > myBeRo; int myID; diff --git a/src/engine/preflopinterface.cpp b/src/engine/preflopinterface.cpp deleted file mode 100644 index 6bd352b9..00000000 --- a/src/engine/preflopinterface.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "preflopinterface.h" - -PreflopInterface::~PreflopInterface() -{ -} - - diff --git a/src/engine/preflopinterface.h b/src/engine/preflopinterface.h deleted file mode 100644 index f9c652ad..00000000 --- a/src/engine/preflopinterface.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef PREFLOPINTERFACE_H -#define PREFLOPINTERFACE_H - -class PreflopInterface{ -public: - - virtual ~PreflopInterface(); - - virtual void setPlayersTurn(int theValue) =0; - virtual int getPlayersTurn() const =0; - - virtual void setHighestSet(int theValue) =0; - virtual int getHighestSet() const =0; - - virtual void preflopRun() =0; - virtual void nextPlayer2() =0; - - - -}; - -#endif diff --git a/src/engine/riverinterface.cpp b/src/engine/riverinterface.cpp deleted file mode 100644 index d58ed590..00000000 --- a/src/engine/riverinterface.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "riverinterface.h" - -RiverInterface::~RiverInterface() -{ -} - - diff --git a/src/engine/riverinterface.h b/src/engine/riverinterface.h deleted file mode 100644 index 7dc7342d..00000000 --- a/src/engine/riverinterface.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef RIVERINTERFACE_H -#define RIVERINTERFACE_H - -class RiverInterface{ -public: - - virtual ~RiverInterface(); - - virtual void setPlayersTurn(int theValue) =0; - virtual int getPlayersTurn() const =0; - - virtual void setHighestSet(int theValue) =0; - virtual int getHighestSet() const =0; - - virtual void setFirstRiverRound(bool theValue) =0; - virtual bool getFirstRiverRound() const =0; - - virtual void setSmallBlindPosition(int theValue) =0; - virtual int getSmallBlindPosition() const =0; - - virtual void setSmallBlind(int theValue) =0; - virtual int getSmallBlind() const =0; - - virtual void setHighestCardsValue(int theValue) =0; - virtual int getHighestCardsValue() const =0; - - virtual void resetFirstRun() =0; - - virtual void riverRun() =0; - virtual void postRiverRun() =0; - virtual void nextPlayer2() =0; - virtual void distributePot() =0; - -}; - -#endif diff --git a/src/engine/turninterface.cpp b/src/engine/turninterface.cpp deleted file mode 100644 index 15b960ca..00000000 --- a/src/engine/turninterface.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "turninterface.h" - -TurnInterface::~TurnInterface() -{ -} - - diff --git a/src/gui/generic/serverguiwrapper.cpp b/src/gui/generic/serverguiwrapper.cpp index 161155e9..59414b82 100644 --- a/src/gui/generic/serverguiwrapper.cpp +++ b/src/gui/generic/serverguiwrapper.cpp @@ -64,6 +64,7 @@ void ServerGuiWrapper::refreshGameLabels(GameState state) const {} void ServerGuiWrapper::waitForGuiUpdateDone() const {} +void ServerGuiWrapper::dealBeRoCards(int myBeRoID) {} void ServerGuiWrapper::dealHoleCards() {} void ServerGuiWrapper::dealFlopCards() {} void ServerGuiWrapper::dealTurnCard() {} diff --git a/src/gui/generic/serverguiwrapper.h b/src/gui/generic/serverguiwrapper.h index 8151fcf3..7f4b4fa4 100644 --- a/src/gui/generic/serverguiwrapper.h +++ b/src/gui/generic/serverguiwrapper.h @@ -48,6 +48,7 @@ public: void waitForGuiUpdateDone() const; + void dealBeRoCards(int); void dealHoleCards(); void dealFlopCards(); void dealTurnCard(); diff --git a/src/gui/guiinterface.h b/src/gui/guiinterface.h index 8b9004ab..8eea1964 100644 --- a/src/gui/guiinterface.h +++ b/src/gui/guiinterface.h @@ -53,6 +53,7 @@ public: virtual void waitForGuiUpdateDone() const=0; + virtual void dealBeRoCards(int) =0; // // Karten-Funktionen virtual void dealHoleCards()=0; virtual void dealFlopCards()=0; diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index beb9ec47..e726365c 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -66,6 +66,8 @@ void GuiWrapper::waitForGuiUpdateDone() const myW->waitForGuiUpdateDone(); } +void GuiWrapper::dealBeRoCards(int myBeRoID) { myW->signalDealBeRoCards(myBeRoID); } + void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); } void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); } void GuiWrapper::dealTurnCard() { myW->signalDealTurnCards0(); } diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index ab7b6d15..87e10ef2 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -55,6 +55,7 @@ public: void waitForGuiUpdateDone() const; + void dealBeRoCards(int myBeRoID); void dealHoleCards(); void dealFlopCards(); void dealTurnCard(); diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 0b8211fe..9bbb50fc 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -605,6 +605,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) connect(this, SIGNAL(signalStartTimeoutAnimation(int, int)), this, SLOT(startTimeoutAnimation(int, int))); connect(this, SIGNAL(signalStopTimeoutAnimation(int)), this, SLOT(stopTimeoutAnimation(int))); + connect(this, SIGNAL(signalDealBeRoCards(int)), this, SLOT(dealBeRoCards(int))); connect(this, SIGNAL(signalDealHoleCards()), this, SLOT(dealHoleCards())); connect(this, SIGNAL(signalDealFlopCards0()), this, SLOT(dealFlopCards0())); connect(this, SIGNAL(signalDealTurnCards0()), this, SLOT(dealTurnCards0())); @@ -1307,6 +1308,21 @@ void mainWindowImpl::dealHoleCards() { } } +void mainWindowImpl::dealBeRoCards(int myBeRoID) { + + switch(myBeRoID) { + + case 1: { dealFlopCards0(); } + break; + case 2: { dealTurnCards0(); } + break; + case 3: { dealRiverCards0(); } + break; + default: { cout << "dealBeRoCards Error" << endl; } + } +} + + void mainWindowImpl::dealFlopCards0() { dealFlopCards0Timer->start(preDealCardsSpeed); } void mainWindowImpl::dealFlopCards1() { diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index 042fdf0b..06515af7 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -95,6 +95,8 @@ signals: void signalStartTimeoutAnimation(int playerId, int timeoutSec); void signalStopTimeoutAnimation(int playerId); + void signalDealBeRoCards(int myBeRoID); + void signalDealHoleCards(); void signalDealFlopCards0(); void signalDealTurnCards0(); @@ -179,6 +181,8 @@ public slots: void myActionDone(); + void dealBeRoCards(int); + void dealFlopCards0(); void dealFlopCards1(); void dealFlopCards2();