This commit is contained in:
doitux
2007-08-10 23:16:21 +00:00
parent 8319442b6a
commit a9a2d33e3f
13 changed files with 48 additions and 33 deletions
+4 -1
View File
@@ -20,6 +20,9 @@
#ifndef BOARDINTERFACE_H
#define BOARDINTERFACE_H
#include <vector>
#include <boost/shared_ptr.hpp>
class PlayerInterface;
class HandInterface;
@@ -29,7 +32,7 @@ public:
virtual ~BoardInterface();
//
virtual void setPlayer(PlayerInterface**) =0;
virtual void setPlayer(std::vector<boost::shared_ptr<PlayerInterface> >) =0;
virtual void setHand(HandInterface*) =0;
//
virtual void setMyCards(int* theValue) =0;
+2 -2
View File
@@ -33,9 +33,9 @@ public:
virtual ~EngineFactory();
virtual HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) =0;
virtual HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > p, int id, int sP, int aP, int dP, int sB,int sC) =0;
virtual BoardInterface* createBoard() =0;
virtual PlayerInterface* createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) =0;
virtual boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) =0;
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, int aP, int dP, int sB) =0;
};
+1 -1
View File
@@ -36,7 +36,7 @@ public:
virtual void start() = 0;
virtual PlayerInterface** getPlayerArray() const =0;
virtual std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const =0;
virtual BoardInterface* getBoard() const =0;
virtual boost::shared_ptr<BeRoInterface> getPreflop() const =0;
virtual boost::shared_ptr<BeRoInterface> getFlop() const =0;
+1 -1
View File
@@ -33,7 +33,7 @@ LocalBoard::~LocalBoard()
{
}
void LocalBoard::setPlayer(PlayerInterface** p) { playerArray = p; }
void LocalBoard::setPlayer(std::vector<boost::shared_ptr<PlayerInterface> > p) { playerArray = p; }
void LocalBoard::setHand(HandInterface* br) { currentHand = br; }
+3 -2
View File
@@ -22,6 +22,7 @@
#include <iostream>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boardinterface.h>
@@ -34,7 +35,7 @@ public:
LocalBoard();
~LocalBoard();
void setPlayer(PlayerInterface**);
void setPlayer(std::vector<boost::shared_ptr<PlayerInterface> >);
void setHand(HandInterface*);
void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
@@ -52,7 +53,7 @@ public:
private:
PlayerInterface **playerArray;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
HandInterface *currentHand;
int myCards[5];
@@ -42,11 +42,11 @@ LocalEngineFactory::~LocalEngineFactory()
}
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) { return new LocalHand(f, g, b, p, id, sP, aP, dP, sB, sC); }
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > p, int id, int sP, int aP, int dP, int sB,int sC) { return new LocalHand(f, g, b, p, id, sP, aP, dP, sB, sC); }
BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
PlayerInterface* LocalEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) { return new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB); }
boost::shared_ptr<PlayerInterface> LocalEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) { return new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB); }
std::vector<boost::shared_ptr<BeRoInterface> > LocalEngineFactory::createBeRo(HandInterface* hi, int id, int aP, int dP, int sB) {
+5 -2
View File
@@ -26,6 +26,9 @@
#include <boardinterface.h>
#include <playerinterface.h>
#include <boost/shared_ptr.hpp>
#include <vector>
class ConfigFile;
class LocalEngineFactory : public EngineFactory
@@ -34,9 +37,9 @@ public:
LocalEngineFactory(ConfigFile*);
~LocalEngineFactory();
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC);
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > p, int id, int sP, int aP, int dP, int sB,int sC);
BoardInterface* createBoard();
PlayerInterface* createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, int aP, int dP, int sB);
private:
+1 -1
View File
@@ -26,7 +26,7 @@
using namespace std;
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > p, int id, int sP, int aP, int dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myBeRo(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
cardsShown(false), bettingRoundsPlayed(0)
{
+3 -3
View File
@@ -34,12 +34,12 @@
class LocalHand : public HandInterface{
public:
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int, int);
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, std::vector<boost::shared_ptr<PlayerInterface> >, int, int, int, int, int, int);
~LocalHand();
void start();
PlayerInterface** getPlayerArray() const { return playerArray; }
std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const { return playerArray; }
BoardInterface* getBoard() const { return myBoard; }
boost::shared_ptr<BeRoInterface> getPreflop() const { return myBeRo[GAME_STATE_PREFLOP]; }
boost::shared_ptr<BeRoInterface> getFlop() const { return myBeRo[GAME_STATE_FLOP]; }
@@ -94,7 +94,7 @@ private:
boost::shared_ptr<EngineFactory> myFactory;
GuiInterface *myGui;
BoardInterface *myBoard;
PlayerInterface **playerArray;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
int myID;
@@ -35,7 +35,7 @@ ClientEngineFactory::~ClientEngineFactory()
}
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > p, int id, int sP, int aP, int dP, int sB,int sC)
{
return new ClientHand(f, g, b, p, id, sP, aP, dP, sB, sC);
}
@@ -45,7 +45,7 @@ BoardInterface* ClientEngineFactory::createBoard()
return new ClientBoard;
}
PlayerInterface* ClientEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
boost::shared_ptr<PlayerInterface> ClientEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
{
return new ClientPlayer(NULL, b, id, uniqueId, type, name, avatar, sC, aS, mB);
}
@@ -25,6 +25,10 @@
#include <boardinterface.h>
#include <playerinterface.h>
#include <boost/shared_ptr.hpp>
#include <vector>
class ConfigFile;
class ClientEngineFactory : public EngineFactory
@@ -35,7 +39,7 @@ public:
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC);
BoardInterface* createBoard();
PlayerInterface* createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, int aP, int dP, int sB);
};