This commit is contained in:
doitux
2007-01-14 13:23:04 +00:00
parent c198ff21a9
commit 34b33a16e7
14 changed files with 50 additions and 72 deletions
+2 -2
View File
@@ -39,8 +39,8 @@ public:
virtual void setPot(int theValue) =0; virtual void setPot(int theValue) =0;
virtual int getSets() const=0; virtual int getSets() const=0;
// //
virtual void collectSets() const=0; virtual void collectSets() =0;
virtual void collectPot() const=0; virtual void collectPot() =0;
}; };
+1 -8
View File
@@ -28,20 +28,13 @@
#include "turninterface.h" #include "turninterface.h"
#include "riverinterface.h" #include "riverinterface.h"
// class HandInterface;
// class BoardInterface;
// class PlayerInterface;
// class PreflopInterface;
// class FlopInterface;
// class TurnInterface;
// class RiverInterface;
class EngineFactory{ class EngineFactory{
public: public:
virtual ~EngineFactory(); 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 BoardInterface* createBoard() =0;
virtual PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) =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 PreflopInterface* createPreflop(HandInterface* hi, int id, int qP, int dP, int sB) =0;
+3 -3
View File
@@ -62,10 +62,10 @@ public:
virtual void setStartCash(const int& theValue) =0; virtual void setStartCash(const int& theValue) =0;
virtual int getStartCash() const =0; virtual int getStartCash() const =0;
virtual void assignButtons(); virtual void assignButtons() =0;
virtual void highlightRoundLabel(); virtual void highlightRoundLabel() =0;
virtual void switchRounds(); virtual void switchRounds() =0;
}; };
+2 -2
View File
@@ -44,8 +44,8 @@ public:
void setPot(int theValue) { pot = theValue;} void setPot(int theValue) { pot = theValue;}
int getSets() const { return sets; } int getSets() const { return sets; }
void collectSets(); void collectSets() ;
void collectPot(); void collectPot() ;
private: private:
@@ -19,13 +19,6 @@
***************************************************************************/ ***************************************************************************/
#include "localenginefactory.h" #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() LocalEngineFactory::LocalEngineFactory()
: EngineFactory() : 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; } BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
+8 -1
View File
@@ -22,6 +22,13 @@
#include <enginefactory.h> #include <enginefactory.h>
#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 class LocalEngineFactory : public EngineFactory
{ {
@@ -30,7 +37,7 @@ public:
~LocalEngineFactory(); ~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(); BoardInterface* createBoard();
PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB); PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB);
PreflopInterface* createPreflop(HandInterface* hi, int id, int qP, int dP, int sB); PreflopInterface* createPreflop(HandInterface* hi, int id, int qP, int dP, int sB);
+5 -6
View File
@@ -21,7 +21,7 @@
using namespace std; 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; int i, j;
CardsValue myCardsValue; CardsValue myCardsValue;
@@ -29,7 +29,6 @@ LocalHand::LocalHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, in
myGui->setHand(this); myGui->setHand(this);
myBoard->setHand(this); myBoard->setHand(this);
// myEngine->setHand(this);
for(i=0; i<actualQuantityPlayers; i++) playerArray[i]->setHand(this); for(i=0; i<actualQuantityPlayers; i++) playerArray[i]->setHand(this);
@@ -72,10 +71,10 @@ LocalHand::LocalHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, in
// Preflop, Flop, Turn und River erstellen // Preflop, Flop, Turn und River erstellen
myPreflop = new LocalPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); myPreflop = myFactory->createPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myFlop = new LocalFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); myFlop = myFactory->createFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myTurn = new LocalTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myRiver = new LocalRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
//Rundenwechsel | beim ersten Durchlauf --> Preflop starten //Rundenwechsel | beim ersten Durchlauf --> Preflop starten
myGui->nextPlayerAnimation(); myGui->nextPlayerAnimation();
+13 -20
View File
@@ -20,9 +20,11 @@
#ifndef HandInterface_H #ifndef HandInterface_H
#define HandInterface_H #define HandInterface_H
#include "guiinterface.h" #include "enginefactory.h"
#include "handinterface.h" #include "handinterface.h"
#include "guiinterface.h"
#include "tools.h" #include "tools.h"
#include "cardsvalue.h" #include "cardsvalue.h"
@@ -32,20 +34,10 @@
#include "localriver.h" #include "localriver.h"
// class GuiInterface;
class BoardInterface;
class PlayerInterface;
// class HandInterface;
class LocalPreflop;
class LocalFlop;
class LocalTurn;
class LocalRiver;
class LocalHand : public HandInterface{ class LocalHand : public HandInterface{
public: public:
LocalHand(GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int); LocalHand(EngineFactory*, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int);
~LocalHand(); ~LocalHand();
@@ -53,10 +45,10 @@ public:
PlayerInterface** getPlayerArray() const { return playerArray; } PlayerInterface** getPlayerArray() const { return playerArray; }
BoardInterface* getBoard() const { return myBoard; } BoardInterface* getBoard() const { return myBoard; }
LocalPreflop* getPreflop() const { return myPreflop; } PreflopInterface* getPreflop() const { return myPreflop; }
LocalFlop* getFlop() const { return myFlop; } FlopInterface* getFlop() const { return myFlop; }
LocalTurn* getTurn() const { return myTurn; } TurnInterface* getTurn() const { return myTurn; }
LocalRiver* getRiver() const { return myRiver; } RiverInterface* getRiver() const { return myRiver; }
GuiInterface* getGuiInterface() const { return myGui; } GuiInterface* getGuiInterface() const { return myGui; }
void setMyID(const int& theValue) { myID = theValue; } void setMyID(const int& theValue) { myID = theValue; }
@@ -92,13 +84,14 @@ public:
private: private:
EngineFactory *myFactory;
GuiInterface *myGui; GuiInterface *myGui;
BoardInterface *myBoard; BoardInterface *myBoard;
PlayerInterface **playerArray; PlayerInterface **playerArray;
LocalPreflop *myPreflop; PreflopInterface *myPreflop;
LocalFlop *myFlop; FlopInterface *myFlop;
LocalTurn *myTurn; TurnInterface *myTurn;
LocalRiver *myRiver; RiverInterface *myRiver;
int myID; int myID;
int actualQuantityPlayers; int actualQuantityPlayers;
+2 -2
View File
@@ -40,8 +40,8 @@ public:
void setHighestSet(const int& theValue) { highestSet = theValue; } void setHighestSet(const int& theValue) { highestSet = theValue; }
int getHighestSet() const { return highestSet;} int getHighestSet() const { return highestSet;}
void setLocalPreflopFirstRound(bool theValue) { preflopFirstRound = theValue; } void setPreflopFirstRound(bool theValue) { preflopFirstRound = theValue; }
bool setLocalPreflopFirstRound() const { return preflopFirstRound; } bool setPreflopFirstRound() const { return preflopFirstRound; }
void preflopRun(); void preflopRun();
void nextPlayer2(); void nextPlayer2();
+2 -2
View File
@@ -31,8 +31,8 @@ public:
virtual void setHighestSet(const int& theValue) =0; virtual void setHighestSet(const int& theValue) =0;
virtual int getHighestSet() const =0; virtual int getHighestSet() const =0;
virtual void setLocalPreflopFirstRound(bool theValue) =0; virtual void setPreflopFirstRound(bool theValue) =0;
virtual bool setLocalPreflopFirstRound() const =0; virtual bool setPreflopFirstRound() const =0;
virtual void preflopRun() =0; virtual void preflopRun() =0;
virtual void nextPlayer2() =0; virtual void nextPlayer2() =0;
+1 -6
View File
@@ -19,14 +19,10 @@
***************************************************************************/ ***************************************************************************/
#include "game.h" #include "game.h"
#include "localhand.h"
#include "enginefactory.h" #include "enginefactory.h"
#include "localenginefactory.h" #include "localenginefactory.h"
#include "guiinterface.h" #include "guiinterface.h"
#include "boardinterface.h" #include "boardinterface.h"
#include "playerinterface.h" #include "playerinterface.h"
#include "handinterface.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 // Player erstellen
PlayerInterface *tempPlayer; PlayerInterface *tempPlayer;
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) { for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
// tempPlayer = new LocalPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0);
tempPlayer = myFactory->createPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0); tempPlayer = myFactory->createPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0);
playerArray[i] = tempPlayer; playerArray[i] = tempPlayer;
} }
@@ -119,7 +114,7 @@ void Game::startHand()
} }
// Hand erstellen // 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 //GUI bereinigen
+3 -4
View File
@@ -23,10 +23,9 @@
// #include <iostream> // #include <iostream>
#include <string> #include <string>
#include "session.h" class Game;
#include "game.h" class Session;
class HandInterface;
#include "handinterface.h"
class GuiInterface{ class GuiInterface{
-2
View File
@@ -20,8 +20,6 @@
#include "guiwrapper.h" #include "guiwrapper.h"
#include "log.h"
#include "mainwindowimpl.h"
using namespace std; using namespace std;
+7 -6
View File
@@ -20,16 +20,17 @@
#ifndef GUIWRAPPER_H #ifndef GUIWRAPPER_H
#define GUIWRAPPER_H #define GUIWRAPPER_H
#include <qapplication.h>
#include <guiinterface.h> #include <guiinterface.h>
#include "log.h"
#include "mainwindowimpl.h"
#include <string> #include <string>
#include <iostream> #include <iostream>
class mainWindowImpl; #include "handinterface.h"
class Log; #include "session.h"
#include "game.h"
class GuiWrapper : public GuiInterface class GuiWrapper : public GuiInterface
{ {