diff --git a/pokerth.pro b/pokerth.pro index 62c216af..fec9ee36 100755 --- a/pokerth.pro +++ b/pokerth.pro @@ -340,8 +340,8 @@ mac{ INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers } -CONFIG += qt release -#CONFIG += qt warn_on debug +#CONFIG += qt release +CONFIG += qt warn_on debug UI_DIR = uics TARGET = bin/pokerth MOC_DIR = mocs diff --git a/src/engine/berofactoryinterface.h b/src/engine/berofactoryinterface.h index d4fa46d1..fc935af9 100644 --- a/src/engine/berofactoryinterface.h +++ b/src/engine/berofactoryinterface.h @@ -23,7 +23,9 @@ public: virtual ~BeRoFactoryInterface(); - virtual BeRoInterface* switchRounds(int) = 0; + virtual BeRoInterface* switchRounds(BeRoInterface*, int) = 0; + + virtual BeRoInterface* createBeRoPreflop() =0; }; diff --git a/src/engine/berointerface.h b/src/engine/berointerface.h index 99097e9e..ab28e158 100644 --- a/src/engine/berointerface.h +++ b/src/engine/berointerface.h @@ -28,6 +28,10 @@ public: virtual void setHighestSet(int) =0; virtual int getHighestSet() const =0; + virtual void setHighestCardsValue(int theValue) =0; + virtual void resetFirstRun() =0; + virtual int getHighestCardsValue() =0; + virtual void preflopRun() =0; virtual void flopRun() =0; virtual void turnRun() =0; diff --git a/src/engine/handinterface.h b/src/engine/handinterface.h index 2f657386..c8be2644 100644 --- a/src/engine/handinterface.h +++ b/src/engine/handinterface.h @@ -39,9 +39,9 @@ public: virtual PlayerInterface** getPlayerArray() const =0; virtual BoardInterface* getBoard() const =0; virtual BeRoInterface* getPreflop() const =0; - virtual FlopInterface* getFlop() const =0; - virtual TurnInterface* getTurn() const =0; - virtual RiverInterface* getRiver() const =0; + virtual BeRoInterface* getFlop() const =0; + virtual BeRoInterface* getTurn() const =0; + virtual BeRoInterface* getRiver() const =0; virtual GuiInterface* getGuiInterface() const =0; virtual BeRoInterface* getCurrentBeRo() const =0; diff --git a/src/engine/local_engine/localbero.h b/src/engine/local_engine/localbero.h index 24a7f06e..a55d5ac7 100644 --- a/src/engine/local_engine/localbero.h +++ b/src/engine/local_engine/localbero.h @@ -24,7 +24,19 @@ public: ~LocalBeRo(); int getMyBeRoID() const { return myBeRoID; } + + int getHighestCardsValue() {} + void setHighestCardsValue(int theValue) {} + //only until bero refactory is over + void preflopRun() {} + void flopRun() {} + void riverRun() {} + void turnRun() {} + void postRiverRun() {} + + void resetFirstRun() {} + protected: int myBeRoID; diff --git a/src/engine/local_engine/localberofactory.cpp b/src/engine/local_engine/localberofactory.cpp index 4b80ed3d..6ee4c1da 100644 --- a/src/engine/local_engine/localberofactory.cpp +++ b/src/engine/local_engine/localberofactory.cpp @@ -21,70 +21,56 @@ LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, i LocalBeRoFactory::~LocalBeRoFactory() {} -BeRoInterface* LocalBeRoFactory::switchRounds(int currentRound) +BeRoInterface* LocalBeRoFactory::createBeRoPreflop() { + + BeRoInterface* preflopBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); + + return preflopBeRo; + +} + +BeRoInterface* LocalBeRoFactory::switchRounds(BeRoInterface* currentBeRo, int currentRound) { + if(currentRound != currentBeRo->getMyBeRoID()) { - BeRoInterface* myBeRo = NULL; + delete currentBeRo; + currentBeRo = NULL; - switch(currentRound) { - case GAME_STATE_PREFLOP: { - if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) { + switch(currentRound) { + case GAME_STATE_PREFLOP: { - delete myBeRo; - myBeRo = NULL; - - myBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); + currentBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); } - } - break; - case GAME_STATE_FLOP: { - if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) { - - delete myBeRo; - myBeRo = NULL; - - myBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); + break; + case GAME_STATE_FLOP: { + + currentBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); } - } - break; - case GAME_STATE_TURN: { - if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) { + break; + case GAME_STATE_TURN: { + + currentBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); - delete myBeRo; - myBeRo = NULL; - - myBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); } - } - break; - case GAME_STATE_RIVER: { - if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) { + break; + case GAME_STATE_RIVER: { + + currentBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); - delete myBeRo; - myBeRo = NULL; - - myBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); } - } - break; - case GAME_STATE_POST_RIVER: { - if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) { + break; + case GAME_STATE_POST_RIVER: { + + currentBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); - delete myBeRo; - myBeRo = NULL; - - myBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind ); } + break; + default: { cout << "BeRoFactory-ERROR" << endl; } } - break; - default: { cout << "BeRoFactory-ERROR" << endl; } + } - - - - - return myBeRo; + return currentBeRo; } diff --git a/src/engine/local_engine/localberofactory.h b/src/engine/local_engine/localberofactory.h index 415b899e..779dbfee 100644 --- a/src/engine/local_engine/localberofactory.h +++ b/src/engine/local_engine/localberofactory.h @@ -33,7 +33,9 @@ public: ~LocalBeRoFactory(); - BeRoInterface* switchRounds(int); + BeRoInterface* switchRounds(BeRoInterface*, int); + + BeRoInterface* createBeRoPreflop(); private: diff --git a/src/engine/local_engine/localberoflop.h b/src/engine/local_engine/localberoflop.h index 113cf46a..0c4b6425 100644 --- a/src/engine/local_engine/localberoflop.h +++ b/src/engine/local_engine/localberoflop.h @@ -52,12 +52,6 @@ public: void flopRun(); void nextPlayer2(); - //only until bero refactory is over - void preflopRun() {} - void turnRun() {} - void riverRun() {} - void postRiverRun() {} - private: HandInterface *myHand; diff --git a/src/engine/local_engine/localberopreflop.h b/src/engine/local_engine/localberopreflop.h index 45953438..74eababc 100644 --- a/src/engine/local_engine/localberopreflop.h +++ b/src/engine/local_engine/localberopreflop.h @@ -31,7 +31,6 @@ public: LocalBeRoPreflop(HandInterface*, int, int, int, int); ~LocalBeRoPreflop(); - void setPlayersTurn(int theValue) { playersTurn = theValue; } int getPlayersTurn() const { return playersTurn; } @@ -41,12 +40,6 @@ public: void preflopRun(); void nextPlayer2(); - //only until bero refactory is over - void flopRun() {} - void turnRun() {} - void riverRun() {} - void postRiverRun() {} - private: HandInterface *myHand; diff --git a/src/engine/local_engine/localberoriver.h b/src/engine/local_engine/localberoriver.h index 407b8dcc..2679ba7e 100644 --- a/src/engine/local_engine/localberoriver.h +++ b/src/engine/local_engine/localberoriver.h @@ -55,11 +55,6 @@ public: void postRiverRun(); void nextPlayer2(); void distributePot(); - - //only until bero refactory is over - void preflopRun() {} - void flopRun() {} - void turnRun() {} private: diff --git a/src/engine/local_engine/localberoturn.h b/src/engine/local_engine/localberoturn.h index 29efaad3..8af1ec06 100644 --- a/src/engine/local_engine/localberoturn.h +++ b/src/engine/local_engine/localberoturn.h @@ -50,12 +50,6 @@ public: void nextPlayer2(); void turnRun(); - //only until bero refactory is over - void preflopRun() {} - void flopRun() {} - void riverRun() {} - void postRiverRun() {} - private: HandInterface *myHand; diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index af49c97d..f535bfb1 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -167,16 +167,16 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI assignButtons(); // Preflop, Flop, Turn und River erstellen - myPreflop = myFactory->createPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); - myFlop = myFactory->createFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); - myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); - myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); +// myPreflop = myFactory->createPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); +// myFlop = myFactory->createFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); +// myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); +// myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); myBeRoFactory = myFactory->createBeRoFactory(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); int currentRound = actualRound; // for Lothar ;-) - myBeRo = myBeRoFactory->switchRounds(currentRound); + myBeRo = myBeRoFactory->createBeRoPreflop(); } @@ -330,11 +330,11 @@ void LocalHand::switchRounds() { switch (actualRound) { case 0: {tempHighestSet = myBeRo->getHighestSet();} break; - case 1: {tempHighestSet = myFlop->getHighestSet();} + case 1: {tempHighestSet = myBeRo->getHighestSet();} break; - case 2: {tempHighestSet = myTurn->getHighestSet();} + case 2: {tempHighestSet = myBeRo->getHighestSet();} break; - case 3: {tempHighestSet = myRiver->getHighestSet();} + case 3: {tempHighestSet = myBeRo->getHighestSet();} break; default: {} } @@ -381,7 +381,10 @@ void LocalHand::switchRounds() { myGui->refreshGameLabels((GameState)getActualRound()); // /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl; // + + int currentRound = actualRound; + myBeRo = myBeRoFactory->switchRounds(myBeRo, currentRound); // cout << "NextPlayerSpeed2 start" << endl; switch(actualRound) { diff --git a/src/engine/local_engine/localhand.h b/src/engine/local_engine/localhand.h index 2dd50637..52e6b704 100755 --- a/src/engine/local_engine/localhand.h +++ b/src/engine/local_engine/localhand.h @@ -43,9 +43,9 @@ public: PlayerInterface** getPlayerArray() const { return playerArray; } BoardInterface* getBoard() const { return myBoard; } BeRoInterface* getPreflop() const { return myBeRo; } - FlopInterface* getFlop() const { return myFlop; } - TurnInterface* getTurn() const { return myTurn; } - RiverInterface* getRiver() const { return myRiver; } + BeRoInterface* getFlop() const { return myBeRo; } + BeRoInterface* getTurn() const { return myBeRo; } + BeRoInterface* getRiver() const { return myBeRo; } GuiInterface* getGuiInterface() const { return myGui; } BeRoInterface* getCurrentBeRo() const { return myBeRo; } diff --git a/src/engine/network_engine/clientberofactory.cpp b/src/engine/network_engine/clientberofactory.cpp index ff0b153a..270d3722 100644 --- a/src/engine/network_engine/clientberofactory.cpp +++ b/src/engine/network_engine/clientberofactory.cpp @@ -10,6 +10,7 @@ // // #include "clientberofactory.h" +#include "berointerface.h" ClientBeRoFactory::ClientBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB) : BeRoFactoryInterface() @@ -22,4 +23,6 @@ ClientBeRoFactory::~ClientBeRoFactory() } -BeRoInterface* ClientBeRoFactory::switchRounds(int currentRound) { return NULL;} +BeRoInterface* ClientBeRoFactory::switchRounds(BeRoInterface* currentBeRo, int currentRound) { return NULL;} + +BeRoInterface* ClientBeRoFactory::createBeRoPreflop() { return NULL; } diff --git a/src/engine/network_engine/clientberofactory.h b/src/engine/network_engine/clientberofactory.h index 0fe5e96a..bd50d68b 100644 --- a/src/engine/network_engine/clientberofactory.h +++ b/src/engine/network_engine/clientberofactory.h @@ -25,7 +25,9 @@ public: ~ClientBeRoFactory(); - BeRoInterface* switchRounds(int); + BeRoInterface* switchRounds(BeRoInterface*, int); + + BeRoInterface* createBeRoPreflop(); }; diff --git a/src/engine/network_engine/clientenginefactory.cpp b/src/engine/network_engine/clientenginefactory.cpp index 2551ffd2..42b20f6d 100644 --- a/src/engine/network_engine/clientenginefactory.cpp +++ b/src/engine/network_engine/clientenginefactory.cpp @@ -78,3 +78,4 @@ BeRoFactoryInterface* ClientEngineFactory::createBeRoFactory(HandInterface* hi, { return new ClientBeRoFactory(hi, id, aP, dP, sB); } + diff --git a/src/engine/network_engine/clienthand.cpp b/src/engine/network_engine/clienthand.cpp index 9ee24102..099e1cfd 100644 --- a/src/engine/network_engine/clienthand.cpp +++ b/src/engine/network_engine/clienthand.cpp @@ -90,22 +90,22 @@ ClientHand::getPreflop() const return myBeRo; } -FlopInterface* +BeRoInterface* ClientHand::getFlop() const { - return myFlop; + return myBeRo; } -TurnInterface* +BeRoInterface* ClientHand::getTurn() const { - return myTurn; + return myBeRo; } -RiverInterface* +BeRoInterface* ClientHand::getRiver() const { - return myRiver; + return myBeRo; } BeRoInterface* diff --git a/src/engine/network_engine/clienthand.h b/src/engine/network_engine/clienthand.h index 001c7953..06dfe30f 100644 --- a/src/engine/network_engine/clienthand.h +++ b/src/engine/network_engine/clienthand.h @@ -43,9 +43,9 @@ public: PlayerInterface** getPlayerArray() const; BoardInterface* getBoard() const; BeRoInterface* getPreflop() const; - FlopInterface* getFlop() const; - TurnInterface* getTurn() const; - RiverInterface* getRiver() const; + BeRoInterface* getFlop() const; + BeRoInterface* getTurn() const; + BeRoInterface* getRiver() const; GuiInterface* getGuiInterface() const; BeRoInterface* getCurrentBeRo() const;