BeRo refactoring

This commit is contained in:
doitux
2007-08-06 22:58:47 +00:00
parent c8207f9b8e
commit 722ab71189
15 changed files with 3 additions and 395 deletions
@@ -1,101 +0,0 @@
//
// C++ Implementation: localberofactory
//
// Description:
//
//
// Author: FThauer FHammer <webmaster@pokerth.net>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "localberofactory.h"
#include <localberopreflop.h>
#include <localberoflop.h>
#include <localberoturn.h>
#include <localberoriver.h>
#include <localberopostriver.h>
using namespace std;
LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, int sB)
: BeRoFactoryInterface() , myHand(hi), myID(id), actualQuantityPlayers(aP), dealerPosition(dP), smallBlind(sB)
{}
LocalBeRoFactory::~LocalBeRoFactory()
{}
std::vector<boost::shared_ptr<BeRoInterface> > LocalBeRoFactory::createBeRo() {
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPreflop(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoFlop(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoTurn(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoRiver(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPostRiver(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
return myBeRo;
}
BeRoInterface* LocalBeRoFactory::createBeRoPreflop() {
BeRoInterface* preflopBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
return preflopBeRo;
}
BeRoInterface* LocalBeRoFactory::switchRounds(BeRoInterface* currentBeRo, int currentRound)
{
if(currentRound != currentBeRo->getMyBeRoID()) {
delete currentBeRo;
currentBeRo = NULL;
switch(currentRound) {
case GAME_STATE_PREFLOP: {
currentBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
break;
case GAME_STATE_FLOP: {
currentBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
break;
case GAME_STATE_TURN: {
currentBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
break;
case GAME_STATE_RIVER: {
currentBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
break;
case GAME_STATE_POST_RIVER: {
currentBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
break;
default: { cout << "BeRoFactory-ERROR" << endl; }
}
}
return currentBeRo;
}
@@ -1,59 +0,0 @@
//
// C++ Interface: localberofactory
//
// Description:
//
//
// Author: FThauer FHammer <webmaster@pokerth.net>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef LOCALBEROFACTORY_H
#define LOCALBEROFACTORY_H
#include <istream>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <berofactoryinterface.h>
#include <berointerface.h>
#include <handinterface.h>
/**
@author FThauer FHammer <webmaster@pokerth.net>
*/
class LocalBeRoFactory : public BeRoFactoryInterface
{
public:
LocalBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB);
~LocalBeRoFactory();
BeRoInterface* switchRounds(BeRoInterface*, int);
BeRoInterface* createBeRoPreflop();
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo();
private:
HandInterface* myHand;
int myID;
int actualQuantityPlayers;
int dealerPosition;
int bigBlindPosition;
int smallBlind;
int highestSet;
bool preflopFirstRound;
int playersTurn;
};
#endif
@@ -22,11 +22,6 @@
#include "localhand.h"
#include "localboard.h"
#include "localplayer.h"
#include "localpreflop.h"
#include "localflop.h"
#include "localturn.h"
#include "localriver.h"
#include "localberofactory.h"
#include "localberopreflop.h"
#include "localberoflop.h"
#include "localberoturn.h"
@@ -53,16 +48,6 @@ 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); }
PreflopInterface* LocalEngineFactory::createPreflop(HandInterface* hi, int id, int aP, int dP, int sB) { return new LocalPreflop(hi, id, aP, dP, sB); }
FlopInterface* LocalEngineFactory::createFlop(HandInterface* hi, int id, int aP, int dP, int sB) { return new LocalFlop(hi, id, aP, dP, sB); }
TurnInterface* LocalEngineFactory::createTurn(HandInterface* hi, int id, int aP, int dP, int sB) { return new LocalTurn(hi, id, aP, dP, sB); }
RiverInterface* LocalEngineFactory::createRiver(HandInterface* hi, int id, int aP, int dP, int sB) { return new LocalRiver(hi, id, aP, dP, sB); }
BeRoFactoryInterface* LocalEngineFactory::createBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB) { return new LocalBeRoFactory(hi, id, aP, dP, sB); }
std::vector<boost::shared_ptr<BeRoInterface> > LocalEngineFactory::createBeRo(HandInterface* hi, int id, int aP, int dP, int sB) {
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
@@ -25,11 +25,6 @@
#include <handinterface.h>
#include <boardinterface.h>
#include <playerinterface.h>
#include <preflopinterface.h>
#include <flopinterface.h>
#include <turninterface.h>
#include <riverinterface.h>
#include <berofactoryinterface.h>
class ConfigFile;
@@ -42,11 +37,6 @@ 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);
PreflopInterface* createPreflop(HandInterface* hi, int id, int aP, int dP, int sB);
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);
BeRoFactoryInterface* createBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB);
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, int aP, int dP, int sB);
private:
-2
View File
@@ -30,7 +30,6 @@
#include <playerinterface.h>
#include <handinterface.h>
#include <berointerface.h>
#include <berofactoryinterface.h>
class LocalHand : public HandInterface{
@@ -96,7 +95,6 @@ private:
GuiInterface *myGui;
BoardInterface *myBoard;
PlayerInterface **playerArray;
BeRoFactoryInterface *myBeRoFactory;
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
int myID;