From 34b33a16e7059e82eb84465efa488fb816a914b7 Mon Sep 17 00:00:00 2001 From: doitux Date: Sun, 14 Jan 2007 13:23:04 +0000 Subject: [PATCH] --- src/engine/boardinterface.h | 4 +-- src/engine/enginefactory.h | 9 +---- src/engine/handinterface.h | 6 ++-- src/engine/local_engine/localboard.h | 4 +-- .../local_engine/localenginefactory.cpp | 9 +---- src/engine/local_engine/localenginefactory.h | 9 ++++- src/engine/local_engine/localhand.cpp | 11 +++---- src/engine/local_engine/localhand.h | 33 ++++++++----------- src/engine/local_engine/localpreflop.h | 4 +-- src/engine/preflopinterface.h | 4 +-- src/game.cpp | 7 +--- src/gui/guiinterface.h | 7 ++-- src/gui/qt/guiwrapper.cpp | 2 -- src/gui/qt/guiwrapper.h | 13 ++++---- 14 files changed, 50 insertions(+), 72 deletions(-) diff --git a/src/engine/boardinterface.h b/src/engine/boardinterface.h index fd4e7818..4cf6fe62 100644 --- a/src/engine/boardinterface.h +++ b/src/engine/boardinterface.h @@ -39,8 +39,8 @@ public: virtual void setPot(int theValue) =0; virtual int getSets() const=0; // - virtual void collectSets() const=0; - virtual void collectPot() const=0; + virtual void collectSets() =0; + virtual void collectPot() =0; }; diff --git a/src/engine/enginefactory.h b/src/engine/enginefactory.h index 0924e3fa..d600e89d 100644 --- a/src/engine/enginefactory.h +++ b/src/engine/enginefactory.h @@ -28,20 +28,13 @@ #include "turninterface.h" #include "riverinterface.h" -// class HandInterface; -// class BoardInterface; -// class PlayerInterface; -// class PreflopInterface; -// class FlopInterface; -// class TurnInterface; -// class RiverInterface; class EngineFactory{ public: virtual ~EngineFactory(); - virtual HandInterface* createHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC) =0; + virtual HandInterface* createHand(EngineFactory *f, 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; diff --git a/src/engine/handinterface.h b/src/engine/handinterface.h index 5dde6c02..a3d46dfa 100644 --- a/src/engine/handinterface.h +++ b/src/engine/handinterface.h @@ -62,10 +62,10 @@ public: virtual void setStartCash(const int& theValue) =0; virtual int getStartCash() const =0; - virtual void assignButtons(); + virtual void assignButtons() =0; - virtual void highlightRoundLabel(); - virtual void switchRounds(); + virtual void highlightRoundLabel() =0; + virtual void switchRounds() =0; }; diff --git a/src/engine/local_engine/localboard.h b/src/engine/local_engine/localboard.h index d295eeb6..4272c29b 100755 --- a/src/engine/local_engine/localboard.h +++ b/src/engine/local_engine/localboard.h @@ -44,8 +44,8 @@ public: void setPot(int theValue) { pot = theValue;} int getSets() const { return sets; } - void collectSets(); - void collectPot(); + void collectSets() ; + void collectPot() ; private: diff --git a/src/engine/local_engine/localenginefactory.cpp b/src/engine/local_engine/localenginefactory.cpp index 195eb463..3a8e22b0 100644 --- a/src/engine/local_engine/localenginefactory.cpp +++ b/src/engine/local_engine/localenginefactory.cpp @@ -19,13 +19,6 @@ ***************************************************************************/ #include "localenginefactory.h" -#include "localhand.h" -#include "localboard.h" -#include "localplayer.h" -#include "localpreflop.h" -#include "localflop.h" -#include "localturn.h" -#include "localriver.h" LocalEngineFactory::LocalEngineFactory() : EngineFactory() @@ -38,7 +31,7 @@ LocalEngineFactory::~LocalEngineFactory() } -HandInterface* LocalEngineFactory::createHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC) { return new LocalHand(g, b, p, id, qP, dP, sB, sC); } +HandInterface* LocalEngineFactory::createHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC) { return new LocalHand(f, g, b, p, id, qP, dP, sB, sC); } BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; } diff --git a/src/engine/local_engine/localenginefactory.h b/src/engine/local_engine/localenginefactory.h index 0dd709ea..3892ebec 100644 --- a/src/engine/local_engine/localenginefactory.h +++ b/src/engine/local_engine/localenginefactory.h @@ -22,6 +22,13 @@ #include +#include "localhand.h" +#include "localboard.h" +#include "localplayer.h" +#include "localpreflop.h" +#include "localflop.h" +#include "localturn.h" +#include "localriver.h" class LocalEngineFactory : public EngineFactory { @@ -30,7 +37,7 @@ public: ~LocalEngineFactory(); - HandInterface* createHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC); + HandInterface* createHand(EngineFactory *f, 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(HandInterface* hi, int id, int qP, int dP, int sB); diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 0e5998ed..3bad0e5d 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -21,7 +21,7 @@ using namespace std; -LocalHand::LocalHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC) : HandInterface(), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0) +LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC) : HandInterface(), myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0) { int i, j; CardsValue myCardsValue; @@ -29,7 +29,6 @@ LocalHand::LocalHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, in myGui->setHand(this); myBoard->setHand(this); -// myEngine->setHand(this); for(i=0; isetHand(this); @@ -72,10 +71,10 @@ LocalHand::LocalHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, in // Preflop, Flop, Turn und River erstellen - myPreflop = new LocalPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); - myFlop = new LocalFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); - myTurn = new LocalTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); - myRiver = new LocalRiver(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); //Rundenwechsel | beim ersten Durchlauf --> Preflop starten myGui->nextPlayerAnimation(); diff --git a/src/engine/local_engine/localhand.h b/src/engine/local_engine/localhand.h index 2841fbae..90fc87eb 100755 --- a/src/engine/local_engine/localhand.h +++ b/src/engine/local_engine/localhand.h @@ -20,9 +20,11 @@ #ifndef HandInterface_H #define HandInterface_H -#include "guiinterface.h" +#include "enginefactory.h" #include "handinterface.h" +#include "guiinterface.h" + #include "tools.h" #include "cardsvalue.h" @@ -32,20 +34,10 @@ #include "localriver.h" -// class GuiInterface; -class BoardInterface; -class PlayerInterface; -// class HandInterface; - -class LocalPreflop; -class LocalFlop; -class LocalTurn; -class LocalRiver; - class LocalHand : public HandInterface{ public: - LocalHand(GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int); + LocalHand(EngineFactory*, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int); ~LocalHand(); @@ -53,10 +45,10 @@ public: PlayerInterface** getPlayerArray() const { return playerArray; } BoardInterface* getBoard() const { return myBoard; } - LocalPreflop* getPreflop() const { return myPreflop; } - LocalFlop* getFlop() const { return myFlop; } - LocalTurn* getTurn() const { return myTurn; } - LocalRiver* getRiver() const { return myRiver; } + PreflopInterface* getPreflop() const { return myPreflop; } + FlopInterface* getFlop() const { return myFlop; } + TurnInterface* getTurn() const { return myTurn; } + RiverInterface* getRiver() const { return myRiver; } GuiInterface* getGuiInterface() const { return myGui; } void setMyID(const int& theValue) { myID = theValue; } @@ -92,13 +84,14 @@ public: private: + EngineFactory *myFactory; GuiInterface *myGui; BoardInterface *myBoard; PlayerInterface **playerArray; - LocalPreflop *myPreflop; - LocalFlop *myFlop; - LocalTurn *myTurn; - LocalRiver *myRiver; + PreflopInterface *myPreflop; + FlopInterface *myFlop; + TurnInterface *myTurn; + RiverInterface *myRiver; int myID; int actualQuantityPlayers; diff --git a/src/engine/local_engine/localpreflop.h b/src/engine/local_engine/localpreflop.h index a9365521..88756d48 100755 --- a/src/engine/local_engine/localpreflop.h +++ b/src/engine/local_engine/localpreflop.h @@ -40,8 +40,8 @@ public: void setHighestSet(const int& theValue) { highestSet = theValue; } int getHighestSet() const { return highestSet;} - void setLocalPreflopFirstRound(bool theValue) { preflopFirstRound = theValue; } - bool setLocalPreflopFirstRound() const { return preflopFirstRound; } + void setPreflopFirstRound(bool theValue) { preflopFirstRound = theValue; } + bool setPreflopFirstRound() const { return preflopFirstRound; } void preflopRun(); void nextPlayer2(); diff --git a/src/engine/preflopinterface.h b/src/engine/preflopinterface.h index 82e6023c..809258f8 100644 --- a/src/engine/preflopinterface.h +++ b/src/engine/preflopinterface.h @@ -31,8 +31,8 @@ public: 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 setPreflopFirstRound(bool theValue) =0; + virtual bool setPreflopFirstRound() const =0; virtual void preflopRun() =0; virtual void nextPlayer2() =0; diff --git a/src/game.cpp b/src/game.cpp index 4194e085..aabf8965 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -19,14 +19,10 @@ ***************************************************************************/ #include "game.h" -#include "localhand.h" - - #include "enginefactory.h" #include "localenginefactory.h" #include "guiinterface.h" - #include "boardinterface.h" #include "playerinterface.h" #include "handinterface.h" @@ -59,7 +55,6 @@ Game::Game(GuiInterface* g, int qP, int sC, int sB) : myGui(g), actualHand(0), a // Player erstellen PlayerInterface *tempPlayer; for(i=0; igetMaxQuantityPlayers(); i++) { -// tempPlayer = new LocalPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0); tempPlayer = myFactory->createPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0); playerArray[i] = tempPlayer; } @@ -119,7 +114,7 @@ void Game::startHand() } // Hand erstellen - actualHand = myFactory->createHand(myGui, actualBoard, playerArray, actualHandID, actualQuantityPlayers, dealerPosition, actualSmallBlind, startCash); + actualHand = myFactory->createHand(myFactory, myGui, actualBoard, playerArray, actualHandID, actualQuantityPlayers, dealerPosition, actualSmallBlind, startCash); //GUI bereinigen diff --git a/src/gui/guiinterface.h b/src/gui/guiinterface.h index 3e1d034f..de40b146 100644 --- a/src/gui/guiinterface.h +++ b/src/gui/guiinterface.h @@ -23,10 +23,9 @@ // #include #include -#include "session.h" -#include "game.h" - -#include "handinterface.h" +class Game; +class Session; +class HandInterface; class GuiInterface{ diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index a24ad55c..62b97450 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -20,8 +20,6 @@ #include "guiwrapper.h" -#include "log.h" -#include "mainwindowimpl.h" using namespace std; diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index 93b1fe7f..c9705d01 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -20,16 +20,17 @@ #ifndef GUIWRAPPER_H #define GUIWRAPPER_H -#include - #include + +#include "log.h" +#include "mainwindowimpl.h" + #include #include -class mainWindowImpl; -class Log; - - +#include "handinterface.h" +#include "session.h" +#include "game.h" class GuiWrapper : public GuiInterface {