This commit is contained in:
doitux
2007-01-13 22:29:17 +00:00
parent ccd74ccb92
commit 507ffdd2a8
21 changed files with 176 additions and 85 deletions
+12 -9
View File
@@ -20,24 +20,27 @@
#ifndef BOARDINTERFACE_H
#define BOARDINTERFACE_H
class PlayerInterface;
class HandInterface;
class BoardInterface {
public:
virtual ~BoardInterface();
//
// virtual void setPlayer(LocalPlayer**) =0;
// virtual void setHand(LocalHand*) =0;
virtual void setPlayer(PlayerInterface**) =0;
virtual void setHand(HandInterface*) =0;
//
// virtual void setMyCards(int* theValue) =0;
// virtual void getMyCards(int* theValue) =0;
virtual void setMyCards(int* theValue) =0;
virtual void getMyCards(int* theValue) =0;
//
// virtual int getPot() const=0;
// virtual void setPot(int theValue) =0;
// virtual int getSets() const=0;
virtual int getPot() const=0;
virtual void setPot(int theValue) =0;
virtual int getSets() const=0;
//
// virtual void collectSets() const=0;
// virtual void collectPot() const=0;
virtual void collectSets() const=0;
virtual void collectPot() const=0;
};
+2 -2
View File
@@ -41,9 +41,9 @@ public:
virtual ~EngineFactory();
virtual HandInterface* createHand() =0;
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() =0;
virtual PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) =0;
};
-5
View File
@@ -19,11 +19,6 @@
***************************************************************************/
#include "handinterface.h"
HandInterface::HandInterface()
{
}
HandInterface::~HandInterface()
{
}
+37 -5
View File
@@ -20,14 +20,46 @@
#ifndef HANDINTERFACE_H
#define HANDINTERFACE_H
/**
@author FThauer FHammer <f.thauer@web.de>
*/
#include "guiinterface.h"
class HandInterface{
public:
HandInterface();
virtual ~HandInterface();
~HandInterface();
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 GuiInterface* getGuiInterface() const =0;
virtual void setMyID(const int& theValue) =0;
virtual int getMyID() const =0;
virtual void setActualQuantityPlayers(const int& theValue) =0;
virtual int getActualQuantityPlayers() const =0;
virtual void setActualRound(const int& theValue) =0;
virtual int getActualRound() const =0;
virtual void setDealerPosition(const int& theValue) =0;
virtual int getDealerPosition() const =0;
virtual void setSmallBlind(const int& theValue) =0;
virtual int getSmallBlind() const =0;
virtual void setAllInCondition(bool theValue) =0;
virtual bool getAllInCondition() const =0;
virtual void setStartCash(const int& theValue) =0;
virtual int getStartCash() const =0;
virtual void assignButtons();
virtual void highlightRoundLabel();
virtual void switchRounds();
};
+2 -2
View File
@@ -23,7 +23,7 @@
using namespace std;
LocalBoard::LocalBoard() : playerArray(0), actualHand(0), pot(0), sets(0)
LocalBoard::LocalBoard() : BoardInterface(), playerArray(0), actualHand(0), pot(0), sets(0)
{
}
@@ -32,7 +32,7 @@ LocalBoard::~LocalBoard()
{
}
void LocalBoard::setPlayer(LocalPlayer** p) { playerArray = p; }
void LocalBoard::setPlayer(PlayerInterface** p) { playerArray = p; }
void LocalBoard::setHand(LocalHand* br) { actualHand = br; }
+9 -7
View File
@@ -20,20 +20,22 @@
#ifndef LOCALBOARD_H
#define LOCALBOARD_H
#include "boardinterface.h"
#include <iostream>
class LocalPlayer;
class LocalHand;
class PlayerInterface;
class HandInterface;
class LocalBoard{
class LocalBoard : public BoardInterface{
public:
LocalBoard();
~LocalBoard();
void setPlayer(LocalPlayer**);
void setHand(LocalHand*);
void setPlayer(PlayerInterface**);
void setHand(HandInterface*);
void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
void getMyCards(int* theValue) { int i; for(i=0; i<5; i++) theValue[i] = myCards[i]; }
@@ -47,8 +49,8 @@ public:
private:
LocalPlayer **playerArray;
LocalHand *actualHand;
PlayerInterface **playerArray;
HandInterface *actualHand;
int myCards[5];
int pot;
@@ -38,11 +38,11 @@ LocalEngineFactory::~LocalEngineFactory()
}
HandInterface* LocalEngineFactory::createHand() { /*return new LocalHand;*/ }
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); }
BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
PlayerInterface* LocalEngineFactory::createPlayer() { /*return new LocalPlayer;*/ }
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;*/ }
+2 -3
View File
@@ -22,7 +22,6 @@
#include <enginefactory.h>
class BoardInterface;
class LocalEngineFactory : public EngineFactory
{
@@ -31,9 +30,9 @@ public:
~LocalEngineFactory();
HandInterface* createHand();
HandInterface* createHand(GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC);
BoardInterface* createBoard();
PlayerInterface* createPlayer();
PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB);
PreflopInterface* createPreflop();
FlopInterface* createFlop();
TurnInterface* createTurn();
+1 -1
View File
@@ -21,7 +21,7 @@
using namespace std;
LocalHand::LocalHand(GuiInterface *g, LocalBoard *b, LocalPlayer **p, int id, int qP, int dP, int sB,int sC) : 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(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)
{
int i, j;
CardsValue myCardsValue;
+21 -12
View File
@@ -20,10 +20,10 @@
#ifndef LOCALHAND_H
#define LOCALHAND_H
#include "guiinterface.h"
#include "localboard.h"
#include "localplayer.h"
#include "handinterface.h"
#include "tools.h"
#include "localpreflop.h"
#include "localflop.h"
@@ -32,23 +32,26 @@
class GuiInterface;
class LocalBoard;
class LocalPlayer;
class BoardInterface;
class PlayerInterface;
class HandInterface;
class LocalPreflop;
class LocalFlop;
class LocalTurn;
class LocalRiver;
class LocalHand {
class LocalHand : public HandInterface{
public:
LocalHand(GuiInterface*, LocalBoard*, LocalPlayer**, int, int, int, int, int);
LocalHand(GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int);
~LocalHand();
LocalPlayer** getPlayerArray() const { return playerArray; }
LocalBoard* getBoard() const { return myBoard; }
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; }
@@ -64,6 +67,9 @@ public:
void setActualRound(const int& theValue) { actualRound = theValue; }
int getActualRound() const { return actualRound; }
void setDealerPosition(const int& theValue) { dealerPosition = theValue; }
int getDealerPosition() const { return dealerPosition; }
void setSmallBlind(const int& theValue) { smallBlind = theValue; }
int getSmallBlind() const { return smallBlind; }
@@ -79,12 +85,15 @@ public:
void switchRounds();
private:
GuiInterface *myGui;
LocalBoard *myBoard;
LocalPlayer **playerArray;
BoardInterface *myBoard;
PlayerInterface **playerArray;
LocalPreflop *myPreflop;
LocalFlop *myFlop;
LocalTurn *myTurn;
+1 -1
View File
@@ -23,7 +23,7 @@
using namespace std;
LocalPlayer::LocalPlayer(LocalBoard *b, int id, int sC, bool aS, int mB) : actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myDude(0), myCardsValueInt(0), myCash(sC), mySet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), myAverageSets(0)
LocalPlayer::LocalPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) : PlayerInterface(), actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myDude(0), myCardsValueInt(0), myCash(sC), mySet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), myAverageSets(0)
{
Tools myTool;
+6 -4
View File
@@ -20,6 +20,8 @@
#ifndef LOCALPLAYER_H
#define LOCALPLAYER_H
#include "playerinterface.h"
#include "cardsvalue.h"
#include <string>
@@ -28,11 +30,11 @@
class CardsValue;
class LocalHand;
class LocalBoard;
class BoardInterface;
class LocalPlayer{
class LocalPlayer : public PlayerInterface{
public:
LocalPlayer(LocalBoard*, int, int, bool, int);
LocalPlayer(BoardInterface*, int, int, bool, int);
~LocalPlayer();
@@ -91,7 +93,7 @@ public:
private:
LocalHand *actualHand;
LocalBoard *actualBoard;
BoardInterface *actualBoard;
CardsValue *myCardsValue;
-5
View File
@@ -19,11 +19,6 @@
***************************************************************************/
#include "playerinterface.h"
PlayerInterface::PlayerInterface()
{
}
PlayerInterface::~PlayerInterface()
{
}
+50 -5
View File
@@ -20,14 +20,59 @@
#ifndef PLAYERINTERFACE_H
#define PLAYERINTERFACE_H
/**
@author FThauer FHammer <f.thauer@web.de>
*/
class PlayerInterface{
public:
PlayerInterface();
~PlayerInterface();
virtual ~PlayerInterface() =0;
virtual void setHand(HandInterface*) =0;
virtual void setMyID(const int& theValue) =0;
virtual int getMyID() const =0;
virtual void setMyDude(const int& theValue) =0;
virtual int getMyDude() const =0;
virtual void setMyName(const std::string& theValue) =0;
virtual std::string getMyName() const =0;
virtual void setMyCash(const int& theValue) =0;
virtual int getMyCash() const =0;
virtual void setMySet(const int& theValue) =0;
virtual void setMySetNull() =0;
virtual int getMySet() const =0;
virtual void setMyAction(const int& theValue) =0;
virtual int getMyAction() const =0;
virtual void setMyButton(const int& theValue) =0;
virtual int getMyButton() const =0;
virtual void setMyActiveStatus(bool theValue) =0;
virtual bool getMyActiveStatus() const =0;
virtual void setMyCards(int* theValue) =0;
virtual void getMyCards(int* theValue) =0;
virtual void setMyTurn(bool theValue) =0;
virtual bool getMyTurn() const =0;
virtual void setMyCardsValueInt(const int& theValue) =0;
virtual int getMyCardsValueInt() const =0;
virtual void setMyRoundStartCash(const int& theValue) =0;
virtual int getMyRoundStartCash() const =0;
virtual void setMyAverageSets(const int& theValue) =0;
virtual int getMyAverageSets() const =0;
virtual void action() =0;
virtual void preflopEngine() =0;
virtual void flopEngine() =0;
virtual void turnEngine() =0;
virtual void riverEngine() =0;
};
+8 -8
View File
@@ -45,23 +45,22 @@ Game::Game(GuiInterface* g, int qP, int sC, int sB) : myGui(g), actualHand(0), a
myGui->setGame(this);
//EngineFactory erstellen
EngineFactory *myFactory;
myFactory = new LocalEngineFactory; // LocalEngine erstellen
// Board erstellen
actualBoard = new LocalBoard();
actualBoard = myFactory->createBoard();
// ersten Dealer bestimmen
Tools myTool;
myTool.getRandNumber(0, startQuantityPlayers-1, 1, &dealerPosition, 0);
// Player erstellen
LocalPlayer *tempPlayer;
PlayerInterface *tempPlayer;
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
tempPlayer = new LocalPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0);
// tempPlayer = new LocalPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0);
tempPlayer = myFactory->createPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0);
playerArray[i] = tempPlayer;
}
actualBoard->setPlayer(playerArray);
@@ -85,7 +84,7 @@ Game::~Game()
delete actualHand;
actualHand = 0;
LocalPlayer *tempPlayer;
PlayerInterface *tempPlayer;
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
tempPlayer = playerArray[i];
playerArray[i] = 0;
@@ -120,8 +119,9 @@ void Game::startHand()
}
// Hand erstellen
actualHand = new LocalHand(myGui, actualBoard, playerArray, actualHandID, actualQuantityPlayers, dealerPosition, actualSmallBlind, startCash);
actualHand = myFactory->createHand(myGui, actualBoard, playerArray, actualHandID, actualQuantityPlayers, dealerPosition, actualSmallBlind, startCash);
//GUI bereinigen
myGui->nextRoundCleanGui();
+8 -6
View File
@@ -22,10 +22,11 @@
#include <iostream>
class LocalHand;
class LocalBoard;
class GuiInterface;
class LocalPlayer;
class HandInterface;
class PlayerInterface;
class BoardInterface;
class EngineFactory;
class Game {
@@ -64,11 +65,12 @@ public:
private:
EngineFactory *myFactory;
GuiInterface *myGui;
LocalHand *actualHand;
LocalBoard *actualBoard;
LocalPlayer *playerArray[5];
HandInterface *actualHand;
BoardInterface *actualBoard;
PlayerInterface *playerArray[5];
//Startvariablen
int startQuantityPlayers;
+1 -1
View File
@@ -37,7 +37,7 @@ public:
//wird nach Einbau der EngineInterfaces umbenannt in setGameInterface und cp.
virtual void setGame(Game*) =0;
virtual void setHand(LocalHand*) =0;
virtual void setHand(HandInterface*) =0;
virtual void setSession(Session*) =0;
//
virtual int getMaxQuantityPlayers() const=0;
+1 -1
View File
@@ -45,7 +45,7 @@ GuiWrapper::~GuiWrapper()
}
void GuiWrapper::setGame(Game *g) { myW->setGame(g); }
void GuiWrapper::setHand(LocalHand *lh) { myW->setHand(lh); }
void GuiWrapper::setHand(HandInterface *lh) { myW->setHand(lh); }
void GuiWrapper::setSession(Session *s) { myW->setSession(s); }
int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); }
+1 -1
View File
@@ -39,7 +39,7 @@ public:
~GuiWrapper();
void setGame(Game*);
void setHand(LocalHand*);
void setHand(HandInterface*);
void setSession(Session*);
int getMaxQuantityPlayers() const;
+6 -2
View File
@@ -21,8 +21,12 @@
#include "newgamedialogimpl.h"
#include "aboutpokerthimpl.h"
#include "handinterface.h"
#include "playerinterface.h"
#include "boardinterface.h"
#include "game.h"
#include "localhand.h"
#include "session.h"
// #include "player.h"
@@ -219,7 +223,7 @@ void mainWindowImpl::callAboutPokerthDialog() {
void mainWindowImpl::setGame(Game *g) { actualGame = g; }
void mainWindowImpl::setHand(LocalHand* br) { actualHand = br; }
void mainWindowImpl::setHand(HandInterface* br) { actualHand = br; }
void mainWindowImpl::setSession(Session* s) { mySession = s; }
+6 -3
View File
@@ -29,7 +29,10 @@
class Game;
class Session;
class LocalHand;
class BoardInterface;
class HandInterface;
class PlayerInterface;
class QColor;
@@ -39,7 +42,7 @@ Q_OBJECT
public:
mainWindowImpl(QMainWindow *parent = 0, const char *name = 0 );
void setGame(Game*);
void setHand(LocalHand*);
void setHand(HandInterface*);
void setSession(Session*);
@@ -143,7 +146,7 @@ public slots:
private:
Game *actualGame;
LocalHand *actualHand;
HandInterface *actualHand;
Session *mySession;