diff --git a/src/engine/enginefactory.h b/src/engine/enginefactory.h index ffd8dc56..0924e3fa 100644 --- a/src/engine/enginefactory.h +++ b/src/engine/enginefactory.h @@ -28,13 +28,13 @@ #include "turninterface.h" #include "riverinterface.h" -class HandInterface; -class BoardInterface; -class PlayerInterface; -class PreflopInterface; -class FlopInterface; -class TurnInterface; -class RiverInterface; +// class HandInterface; +// class BoardInterface; +// class PlayerInterface; +// class PreflopInterface; +// class FlopInterface; +// class TurnInterface; +// class RiverInterface; class EngineFactory{ public: @@ -44,6 +44,10 @@ public: virtual HandInterface* createHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC) =0; virtual BoardInterface* createBoard() =0; virtual PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) =0; + virtual PreflopInterface* createPreflop(HandInterface* hi, int id, int qP, int dP, int sB) =0; + virtual FlopInterface* createFlop(HandInterface* hi, int id, int qP, int dP, int sB) =0; + virtual TurnInterface* createTurn(HandInterface* hi, int id, int qP, int dP, int sB) =0; + virtual RiverInterface* createRiver(HandInterface* hi, int id, int qP, int dP, int sB) =0; }; diff --git a/src/engine/flopinterface.cpp b/src/engine/flopinterface.cpp index ee38a770..220f7c0f 100644 --- a/src/engine/flopinterface.cpp +++ b/src/engine/flopinterface.cpp @@ -19,11 +19,6 @@ ***************************************************************************/ #include "flopinterface.h" -FlopInterface::FlopInterface() -{ -} - - FlopInterface::~FlopInterface() { } diff --git a/src/engine/flopinterface.h b/src/engine/flopinterface.h index 3de9cd1d..14c65f81 100644 --- a/src/engine/flopinterface.h +++ b/src/engine/flopinterface.h @@ -20,14 +20,29 @@ #ifndef FLOPINTERFACE_H #define FLOPINTERFACE_H -/** - @author FThauer FHammer -*/ class FlopInterface{ public: - FlopInterface(); - ~FlopInterface(); + + virtual ~FlopInterface(); + + virtual void setPlayersTurn(const int& theValue) =0; + virtual int getPlayersTurn() const =0; + + virtual void setHighestSet(const int& theValue) =0; + virtual int getHighestSet() const =0; + + virtual void setFirstFlopRound(bool theValue) =0; + virtual bool getFirstFlopRound() const =0; + + virtual void setSmallBlindPosition(const int& theValue) =0; + virtual int getSmallBlindPosition() const =0; + + virtual void setSmallBlind(const int& theValue) =0; + virtual int getSmallBlind() const =0; + + virtual void flopRun() =0; + virtual void nextPlayer2() =0; }; diff --git a/src/engine/handinterface.h b/src/engine/handinterface.h index 8234643e..df04aecb 100644 --- a/src/engine/handinterface.h +++ b/src/engine/handinterface.h @@ -21,6 +21,10 @@ #define HANDINTERFACE_H #include "guiinterface.h" +#include "preflopinterface.h" +#include "flopinterface.h" +#include "turninterface.h" +#include "riverinterface.h" class HandInterface{ public: @@ -29,10 +33,10 @@ public: virtual PlayerInterface** getPlayerArray() const =0; virtual BoardInterface* getBoard() const =0; -// virtual LocalPreflop* getPreflop() const =0; -// virtual LocalFlop* getFlop() const =0; -// virtual LocalTurn* getTurn() const =0; -// virtual LocalRiver* getRiver() const =0; + virtual PreflopInterface* getPreflop() const =0; + virtual FlopInterface* getFlop() const =0; + virtual TurnInterface* getTurn() const =0; + virtual RiverInterface* getRiver() const =0; virtual GuiInterface* getGuiInterface() const =0; virtual void setMyID(const int& theValue) =0; diff --git a/src/engine/local_engine/localenginefactory.cpp b/src/engine/local_engine/localenginefactory.cpp index cc42ff71..195eb463 100644 --- a/src/engine/local_engine/localenginefactory.cpp +++ b/src/engine/local_engine/localenginefactory.cpp @@ -44,10 +44,10 @@ BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; } PlayerInterface* LocalEngineFactory::createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) { return new LocalPlayer(b, id, sC, aS, mB); } -PreflopInterface* LocalEngineFactory::createPreflop() {/* return new LocalPreflop;*/ } +PreflopInterface* LocalEngineFactory::createPreflop(HandInterface* hi, int id, int qP, int dP, int sB) { return new LocalPreflop(hi, id, qP, dP, sB); } -FlopInterface* LocalEngineFactory::createFlop() { /*return new LocalFlop;*/ } +FlopInterface* LocalEngineFactory::createFlop(HandInterface* hi, int id, int qP, int dP, int sB) { return new LocalFlop(hi, id, qP, dP, sB); } -TurnInterface* LocalEngineFactory::createTurn() { /*return new LocalTurn;*/ } +TurnInterface* LocalEngineFactory::createTurn(HandInterface* hi, int id, int qP, int dP, int sB) { return new LocalTurn(hi, id, qP, dP, sB); } -RiverInterface* LocalEngineFactory::createRiver() { /*return new LocalRiver;*/ } +RiverInterface* LocalEngineFactory::createRiver(HandInterface* hi, int id, int qP, int dP, int sB) { return new LocalRiver(hi, id, qP, dP, sB); } diff --git a/src/engine/local_engine/localenginefactory.h b/src/engine/local_engine/localenginefactory.h index 8ba24313..0dd709ea 100644 --- a/src/engine/local_engine/localenginefactory.h +++ b/src/engine/local_engine/localenginefactory.h @@ -33,10 +33,10 @@ public: HandInterface* createHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC); BoardInterface* createBoard(); PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB); - PreflopInterface* createPreflop(); - FlopInterface* createFlop(); - TurnInterface* createTurn(); - RiverInterface* createRiver(); + PreflopInterface* createPreflop(HandInterface* hi, int id, int qP, int dP, int sB); + FlopInterface* createFlop(HandInterface* hi, int id, int qP, int dP, int sB); + TurnInterface* createTurn(HandInterface* hi, int id, int qP, int dP, int sB); + RiverInterface* createRiver(HandInterface* hi, int id, int qP, int dP, int sB); }; #endif diff --git a/src/engine/local_engine/localflop.cpp b/src/engine/local_engine/localflop.cpp index 51748485..5664c6c0 100755 --- a/src/engine/local_engine/localflop.cpp +++ b/src/engine/local_engine/localflop.cpp @@ -18,11 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "localflop.h" -#include "localhand.h" using namespace std; -LocalFlop::LocalFlop(LocalHand* bR, int id, int qP, int dP, int sB) : myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), playersTurn(dP) +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), playersTurn(dP) { int i; diff --git a/src/engine/local_engine/localflop.h b/src/engine/local_engine/localflop.h index 4dda1158..8ec7c9b1 100755 --- a/src/engine/local_engine/localflop.h +++ b/src/engine/local_engine/localflop.h @@ -20,14 +20,15 @@ #ifndef LOCALFLOP_H #define LOCALFLOP_H +#include "flopinterface.h" +#include "handinterface.h" + #include -class LocalHand; - -class LocalFlop { +class LocalFlop : public FlopInterface{ public: - LocalFlop(LocalHand*, int, int, int, int); + LocalFlop(HandInterface*, int, int, int, int); ~LocalFlop(); @@ -52,7 +53,7 @@ public: private: - LocalHand *myHand; + HandInterface *myHand; int myID; int actualQuantityPlayers; diff --git a/src/engine/local_engine/localhand.h b/src/engine/local_engine/localhand.h index 3194df05..2841fbae 100755 --- a/src/engine/local_engine/localhand.h +++ b/src/engine/local_engine/localhand.h @@ -17,14 +17,15 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef LOCALHAND_H -#define LOCALHAND_H +#ifndef HandInterface_H +#define HandInterface_H #include "guiinterface.h" #include "handinterface.h" #include "tools.h" +#include "cardsvalue.h" #include "localpreflop.h" #include "localflop.h" #include "localturn.h" @@ -50,7 +51,7 @@ public: - PlayerInterface** getPlayerArray() const { return playerArray; } + PlayerInterface** getPlayerArray() const { return playerArray; } BoardInterface* getBoard() const { return myBoard; } LocalPreflop* getPreflop() const { return myPreflop; } LocalFlop* getFlop() const { return myFlop; } diff --git a/src/engine/local_engine/localplayer.h b/src/engine/local_engine/localplayer.h index 30ffaad9..757b968c 100755 --- a/src/engine/local_engine/localplayer.h +++ b/src/engine/local_engine/localplayer.h @@ -29,7 +29,7 @@ class CardsValue; -class LocalHand; +class HandInterface; class BoardInterface; class LocalPlayer : public PlayerInterface{ @@ -38,7 +38,7 @@ public: ~LocalPlayer(); - void setHand(LocalHand*); + void setHand(HandInterface*); void setMyID(const int& theValue) { myID = theValue; } int getMyID() const { return myID; } @@ -92,7 +92,7 @@ public: private: - LocalHand *actualHand; + HandInterface *actualHand; BoardInterface *actualBoard; CardsValue *myCardsValue; diff --git a/src/engine/local_engine/localpreflop.cpp b/src/engine/local_engine/localpreflop.cpp index aa94507c..bbfdbce9 100755 --- a/src/engine/local_engine/localpreflop.cpp +++ b/src/engine/local_engine/localpreflop.cpp @@ -18,11 +18,12 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "localpreflop.h" -#include "localhand.h" + +#include "handinterface.h" using namespace std; -LocalPreflop::LocalPreflop(LocalHand* bR, int id, int qP, int dP, int sB) : myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0) +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) { diff --git a/src/engine/local_engine/localpreflop.h b/src/engine/local_engine/localpreflop.h index 88d502eb..a9365521 100755 --- a/src/engine/local_engine/localpreflop.h +++ b/src/engine/local_engine/localpreflop.h @@ -20,14 +20,16 @@ #ifndef LOCALPREFLOP_H #define LOCALPREFLOP_H +#include "preflopinterface.h" + #include -class LocalHand; +class HandInterface; -class LocalPreflop { +class LocalPreflop : public PreflopInterface{ public: - LocalPreflop(LocalHand*, int, int, int, int); + LocalPreflop(HandInterface*, int, int, int, int); ~LocalPreflop(); @@ -46,7 +48,7 @@ public: private: - LocalHand *myHand; + HandInterface *myHand; int myID; int actualQuantityPlayers; diff --git a/src/engine/local_engine/localriver.cpp b/src/engine/local_engine/localriver.cpp index 22d876e8..992d18f9 100755 --- a/src/engine/local_engine/localriver.cpp +++ b/src/engine/local_engine/localriver.cpp @@ -19,11 +19,10 @@ ***************************************************************************/ #include "localriver.h" -#include "localhand.h" using namespace std; -LocalRiver::LocalRiver(LocalHand* bR, int id, int qP, int dP, int sB) : myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), playersTurn(dP), highestCardsValue(0) +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), playersTurn(dP), highestCardsValue(0) { int i; diff --git a/src/engine/local_engine/localriver.h b/src/engine/local_engine/localriver.h index 344fceba..963c4cf4 100755 --- a/src/engine/local_engine/localriver.h +++ b/src/engine/local_engine/localriver.h @@ -20,14 +20,16 @@ #ifndef LOCALRIVER_H #define LOCALRIVER_H +#include "riverinterface.h" + #include -class LocalHand; +#include "handinterface.h" -class LocalRiver { +class LocalRiver : public RiverInterface{ public: - LocalRiver(LocalHand*, int, int, int, int); + LocalRiver(HandInterface*, int, int, int, int); ~LocalRiver(); @@ -56,7 +58,7 @@ public: private: - LocalHand *myHand; + HandInterface *myHand; int myID; int actualQuantityPlayers; diff --git a/src/engine/local_engine/localturn.cpp b/src/engine/local_engine/localturn.cpp index 2bf5aa07..40a87918 100755 --- a/src/engine/local_engine/localturn.cpp +++ b/src/engine/local_engine/localturn.cpp @@ -18,11 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "localturn.h" -#include "localhand.h" + using namespace std; -LocalTurn::LocalTurn(LocalHand* bR, int id, int qP, int dP, int sB) : myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), playersTurn(dP) +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), playersTurn(dP) { int i; diff --git a/src/engine/local_engine/localturn.h b/src/engine/local_engine/localturn.h index 7d202846..a97d48ad 100755 --- a/src/engine/local_engine/localturn.h +++ b/src/engine/local_engine/localturn.h @@ -20,14 +20,16 @@ #ifndef LOCALTURN_H #define LOCALTURN_H +#include "turninterface.h" + +#include "handinterface.h" + #include -class LocalHand; - -class LocalTurn { +class LocalTurn : public TurnInterface{ public: - LocalTurn(LocalHand*, int, int, int, int); + LocalTurn(HandInterface*, int, int, int, int); ~LocalTurn(); @@ -51,7 +53,7 @@ public: private: - LocalHand *myHand; + HandInterface *myHand; int myID; int actualQuantityPlayers; diff --git a/src/engine/preflopinterface.h b/src/engine/preflopinterface.h index b297177e..82e6023c 100644 --- a/src/engine/preflopinterface.h +++ b/src/engine/preflopinterface.h @@ -25,6 +25,18 @@ public: virtual ~PreflopInterface(); + virtual void setPlayersTurn(const int& theValue) =0; + virtual int getPlayersTurn() const =0; + + virtual void setHighestSet(const int& theValue) =0; + virtual int getHighestSet() const =0; + + virtual void setLocalPreflopFirstRound(bool theValue) =0; + virtual bool setLocalPreflopFirstRound() const =0; + + virtual void preflopRun() =0; + virtual void nextPlayer2() =0; + }; diff --git a/src/engine/riverinterface.cpp b/src/engine/riverinterface.cpp index 12bc18ba..d58ed590 100644 --- a/src/engine/riverinterface.cpp +++ b/src/engine/riverinterface.cpp @@ -19,11 +19,6 @@ ***************************************************************************/ #include "riverinterface.h" -RiverInterface::RiverInterface() -{ -} - - RiverInterface::~RiverInterface() { } diff --git a/src/engine/riverinterface.h b/src/engine/riverinterface.h index 113a8d37..eecaea8b 100644 --- a/src/engine/riverinterface.h +++ b/src/engine/riverinterface.h @@ -20,14 +20,33 @@ #ifndef RIVERINTERFACE_H #define RIVERINTERFACE_H -/** - @author FThauer FHammer -*/ class RiverInterface{ public: - RiverInterface(); - ~RiverInterface(); + virtual ~RiverInterface(); + + virtual void setPlayersTurn(const int& theValue) =0; + virtual int getPlayersTurn() const =0; + + virtual void setHighestSet(const int& theValue) =0; + virtual int getHighestSet() const =0; + + virtual void setFirstRiverRound(bool theValue) =0; + virtual bool getFirstRiverRound() const =0; + + virtual void setSmallBlindPosition(const int& theValue) =0; + virtual int getSmallBlindPosition() const =0; + + virtual void setSmallBlind(const int& theValue) =0; + virtual int getSmallBlind() const =0; + + virtual void setHighestCardsValue(const int& theValue) =0; + virtual int getHighestCardsValue() const =0; + + virtual void riverRun() =0; + virtual void postRiverRun() =0; + virtual void nextPlayer2() =0; + virtual void distributePot() =0; }; diff --git a/src/engine/turninterface.cpp b/src/engine/turninterface.cpp index 642786bb..15b960ca 100644 --- a/src/engine/turninterface.cpp +++ b/src/engine/turninterface.cpp @@ -19,11 +19,6 @@ ***************************************************************************/ #include "turninterface.h" -TurnInterface::TurnInterface() -{ -} - - TurnInterface::~TurnInterface() { } diff --git a/src/engine/turninterface.h b/src/engine/turninterface.h index 30d8609a..1b275efa 100644 --- a/src/engine/turninterface.h +++ b/src/engine/turninterface.h @@ -20,14 +20,28 @@ #ifndef TURNINTERFACE_H #define TURNINTERFACE_H -/** - @author FThauer FHammer -*/ + class TurnInterface{ public: - TurnInterface(); + virtual ~TurnInterface(); - ~TurnInterface(); + virtual void setPlayersTurn(const int& theValue) =0; + virtual int getPlayersTurn() const =0; + + virtual void setHighestSet(const int& theValue) =0; + virtual int getHighestSet() const=0; + + virtual void setFirstTurnRound(bool theValue) =0; + virtual bool getFirstTurnRound() const =0; + + virtual void setSmallBlindPosition(const int& theValue) =0; + virtual int getSmallBlindPosition() const =0; + + virtual void setSmallBlind(const int& theValue) =0; + virtual int getSmallBlind() const =0; + + virtual void turnRun() =0; + virtual void nextPlayer2() =0; };