more polymorphie steps for BeRo - local game --> unstable
This commit is contained in:
@@ -11,11 +11,6 @@
|
||||
//
|
||||
#include "berofactoryinterface.h"
|
||||
|
||||
BeRoFactoryInterface::BeRoFactoryInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BeRoFactoryInterface::~BeRoFactoryInterface()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,11 +15,15 @@
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
*/
|
||||
|
||||
#include <berointerface.h>
|
||||
|
||||
class BeRoFactoryInterface{
|
||||
public:
|
||||
BeRoFactoryInterface();
|
||||
|
||||
~BeRoFactoryInterface();
|
||||
virtual ~BeRoFactoryInterface();
|
||||
|
||||
virtual BeRoInterface* switchRounds() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
//
|
||||
#include "berointerface.h"
|
||||
|
||||
BeRoInterface::BeRoInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BeRoInterface::~BeRoInterface()
|
||||
{
|
||||
|
||||
@@ -17,9 +17,20 @@
|
||||
*/
|
||||
class BeRoInterface{
|
||||
public:
|
||||
BeRoInterface();
|
||||
|
||||
~BeRoInterface();
|
||||
virtual ~BeRoInterface();
|
||||
|
||||
virtual void setPlayersTurn(int) =0;
|
||||
virtual int getPlayersTurn() const =0;
|
||||
|
||||
virtual void setHighestSet(int) =0;
|
||||
virtual int getHighestSet() const =0;
|
||||
|
||||
virtual void setPreflopFirstRound(bool) =0;
|
||||
virtual bool setPreflopFirstRound() const =0;
|
||||
|
||||
virtual void preflopRun() =0;
|
||||
virtual void nextPlayer2() =0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -45,8 +45,14 @@ public:
|
||||
virtual FlopInterface* createFlop(HandInterface* hi, int id, int aP, int dP, int sB) =0;
|
||||
virtual TurnInterface* createTurn(HandInterface* hi, int id, int aP, int dP, int sB) =0;
|
||||
virtual RiverInterface* createRiver(HandInterface* hi, int id, int aP, int dP, int sB) =0;
|
||||
virtual BeRoInterface* createBeRo() =0;
|
||||
virtual BeRoFactoryInterface* createBeRoFactory() =0;
|
||||
// virtual BeRoInterface* createBeRo() =0;
|
||||
virtual BeRoFactoryInterface* createBeRoFactory(HandInterface* hi) =0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// The following code introduces the new BeRo interface step by step. This hint will be removed if refactorying was succesfull //
|
||||
|
||||
|
||||
|
||||
// new BeRo Interface code stop here //
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "flopinterface.h"
|
||||
#include "turninterface.h"
|
||||
#include "riverinterface.h"
|
||||
#include "berointerface.h"
|
||||
|
||||
class HandInterface{
|
||||
public:
|
||||
@@ -37,7 +38,7 @@ public:
|
||||
|
||||
virtual PlayerInterface** getPlayerArray() const =0;
|
||||
virtual BoardInterface* getBoard() const =0;
|
||||
virtual PreflopInterface* getPreflop() const =0;
|
||||
virtual BeRoInterface* getPreflop() const =0;
|
||||
virtual FlopInterface* getFlop() const =0;
|
||||
virtual TurnInterface* getTurn() const =0;
|
||||
virtual RiverInterface* getRiver() const =0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// C++ Implementation: localberofactory
|
||||
//
|
||||
// Description:
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: FThauer FHammer <webmaster@pokerth.net>, (C) 2007
|
||||
@@ -11,14 +11,23 @@
|
||||
//
|
||||
#include "localberofactory.h"
|
||||
|
||||
LocalBeRoFactory::LocalBeRoFactory()
|
||||
: BeRoFactoryInterface()
|
||||
{
|
||||
}
|
||||
LocalBeRoFactory::LocalBeRoFactory ( HandInterface* hi )
|
||||
: BeRoFactoryInterface() , myHand ( hi )
|
||||
{}
|
||||
|
||||
|
||||
LocalBeRoFactory::~LocalBeRoFactory()
|
||||
{}
|
||||
|
||||
BeRoInterface* LocalBeRoFactory::switchRounds()
|
||||
{
|
||||
|
||||
BeRoInterface* myBeRo = 0;
|
||||
|
||||
myBeRo = new LocalBeRoPreflop ( myHand, 0, 7, 0, 10 );
|
||||
|
||||
return myBeRo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#define LOCALBEROFACTORY_H
|
||||
|
||||
#include <berofactoryinterface.h>
|
||||
#include <berointerface.h>
|
||||
#include <handinterface.h>
|
||||
#include <localberopreflop.h>
|
||||
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
@@ -20,10 +23,16 @@
|
||||
class LocalBeRoFactory : public BeRoFactoryInterface
|
||||
{
|
||||
public:
|
||||
LocalBeRoFactory();
|
||||
LocalBeRoFactory(HandInterface* hi);
|
||||
|
||||
~LocalBeRoFactory();
|
||||
|
||||
BeRoInterface* switchRounds();
|
||||
|
||||
private:
|
||||
|
||||
HandInterface* myHand;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -57,7 +57,7 @@ TurnInterface* LocalEngineFactory::createTurn(HandInterface* hi, int id, int aP,
|
||||
|
||||
RiverInterface* LocalEngineFactory::createRiver(HandInterface* hi, int id, int aP, int dP, int sB) { return new LocalRiver(hi, id, aP, dP, sB); }
|
||||
|
||||
BeRoInterface* LocalEngineFactory::createBeRo() { return new LocalBeRo(); }
|
||||
// BeRoInterface* LocalEngineFactory::createBeRo() { return new LocalBeRo(); }
|
||||
|
||||
BeRoFactoryInterface* LocalEngineFactory::createBeRoFactory() { return new LocalBeRoFactory(); }
|
||||
BeRoFactoryInterface* LocalEngineFactory::createBeRoFactory(HandInterface* hi) { return new LocalBeRoFactory(hi); }
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <flopinterface.h>
|
||||
#include <turninterface.h>
|
||||
#include <riverinterface.h>
|
||||
#include <berointerface.h>
|
||||
// #include <berointerface.h>
|
||||
#include <berofactoryinterface.h>
|
||||
|
||||
class ConfigFile;
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
FlopInterface* createFlop(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
TurnInterface* createTurn(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
RiverInterface* createRiver(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
BeRoInterface* createBeRo();
|
||||
BeRoFactoryInterface* createBeRoFactory();
|
||||
// BeRoInterface* createBeRo();
|
||||
BeRoFactoryInterface* createBeRoFactory(HandInterface* hi);
|
||||
|
||||
private:
|
||||
ConfigFile *myConfig;
|
||||
|
||||
@@ -172,7 +172,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
||||
myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
||||
myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
||||
|
||||
myBeRo = myFactory->createBeRo();
|
||||
myBeRoFactory = myFactory->createBeRoFactory(this);
|
||||
myBeRo = myBeRoFactory->switchRounds();
|
||||
}
|
||||
|
||||
|
||||
@@ -324,7 +325,7 @@ void LocalHand::switchRounds() {
|
||||
if(playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyAction() != 6 && playerArray[i]->getMyActiveStatus() == 1) {
|
||||
tempHighestSet = 0;
|
||||
switch (actualRound) {
|
||||
case 0: {tempHighestSet = myPreflop->getHighestSet();}
|
||||
case 0: {tempHighestSet = myBeRo->getHighestSet();}
|
||||
break;
|
||||
case 1: {tempHighestSet = myFlop->getHighestSet();}
|
||||
break;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <turninterface.h>
|
||||
#include <riverinterface.h>
|
||||
#include <berointerface.h>
|
||||
#include <berofactoryinterface.h>
|
||||
|
||||
|
||||
class LocalHand : public HandInterface{
|
||||
@@ -41,7 +42,7 @@ public:
|
||||
|
||||
PlayerInterface** getPlayerArray() const { return playerArray; }
|
||||
BoardInterface* getBoard() const { return myBoard; }
|
||||
PreflopInterface* getPreflop() const { return myPreflop; }
|
||||
BeRoInterface* getPreflop() const { return myBeRo; }
|
||||
FlopInterface* getFlop() const { return myFlop; }
|
||||
TurnInterface* getTurn() const { return myTurn; }
|
||||
RiverInterface* getRiver() const { return myRiver; }
|
||||
@@ -99,6 +100,7 @@ private:
|
||||
TurnInterface *myTurn;
|
||||
RiverInterface *myRiver;
|
||||
BeRoInterface *myBeRo;
|
||||
BeRoFactoryInterface *myBeRoFactory;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
#include "clientberofactory.h"
|
||||
|
||||
ClientBeRoFactory::ClientBeRoFactory()
|
||||
ClientBeRoFactory::ClientBeRoFactory(HandInterface* hi)
|
||||
: BeRoFactoryInterface()
|
||||
{
|
||||
}
|
||||
@@ -22,3 +22,4 @@ ClientBeRoFactory::~ClientBeRoFactory()
|
||||
}
|
||||
|
||||
|
||||
BeRoInterface* ClientBeRoFactory::switchRounds() {}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define CLIENTBEROFACTORY_H
|
||||
|
||||
#include <berofactoryinterface.h>
|
||||
#include <handinterface.h>
|
||||
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
@@ -20,10 +21,12 @@
|
||||
class ClientBeRoFactory : public BeRoFactoryInterface
|
||||
{
|
||||
public:
|
||||
ClientBeRoFactory();
|
||||
ClientBeRoFactory(HandInterface* hi);
|
||||
|
||||
~ClientBeRoFactory();
|
||||
|
||||
BeRoInterface* switchRounds();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -75,12 +75,12 @@ RiverInterface* ClientEngineFactory::createRiver(HandInterface* hi, int id, int
|
||||
return new ClientRiver(hi, id, aP, dP, sB);
|
||||
}
|
||||
|
||||
BeRoInterface* ClientEngineFactory::createBeRo()
|
||||
{
|
||||
return new ClientBeRo();
|
||||
}
|
||||
// BeRoInterface* ClientEngineFactory::createBeRo()
|
||||
// {
|
||||
// return new ClientBeRo();
|
||||
// }
|
||||
|
||||
BeRoFactoryInterface* ClientEngineFactory::createBeRoFactory()
|
||||
BeRoFactoryInterface* ClientEngineFactory::createBeRoFactory(HandInterface* hi)
|
||||
{
|
||||
return new ClientBeRoFactory();
|
||||
return new ClientBeRoFactory(hi);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <flopinterface.h>
|
||||
#include <turninterface.h>
|
||||
#include <riverinterface.h>
|
||||
#include <berointerface.h>
|
||||
// #include <berointerface.h>
|
||||
#include <berofactoryinterface.h>
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
FlopInterface* createFlop(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
TurnInterface* createTurn(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
RiverInterface* createRiver(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||
BeRoInterface* createBeRo();
|
||||
BeRoFactoryInterface* createBeRoFactory();
|
||||
// BeRoInterface* createBeRo();
|
||||
BeRoFactoryInterface* createBeRoFactory(HandInterface* hi);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@ ClientHand::getBoard() const
|
||||
return myBoard;
|
||||
}
|
||||
|
||||
PreflopInterface*
|
||||
BeRoInterface*
|
||||
ClientHand::getPreflop() const
|
||||
{
|
||||
return myPreflop;
|
||||
return myBeRo;
|
||||
}
|
||||
|
||||
FlopInterface*
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <flopinterface.h>
|
||||
#include <turninterface.h>
|
||||
#include <riverinterface.h>
|
||||
#include <berointerface.h>
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
@@ -41,7 +42,7 @@ public:
|
||||
|
||||
PlayerInterface** getPlayerArray() const;
|
||||
BoardInterface* getBoard() const;
|
||||
PreflopInterface* getPreflop() const;
|
||||
BeRoInterface* getPreflop() const;
|
||||
FlopInterface* getFlop() const;
|
||||
TurnInterface* getTurn() const;
|
||||
RiverInterface* getRiver() const;
|
||||
@@ -97,6 +98,7 @@ private:
|
||||
FlopInterface *myFlop;
|
||||
TurnInterface *myTurn;
|
||||
RiverInterface *myRiver;
|
||||
BeRoInterface *myBeRo;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
|
||||
Reference in New Issue
Block a user