more polymorphie steps for BeRo (sry lotodore for last buggy rev)

This commit is contained in:
doitux
2007-08-05 23:57:16 +00:00
parent b68b8d48dd
commit e612b77b1b
18 changed files with 93 additions and 102 deletions
+3 -1
View File
@@ -23,7 +23,9 @@ public:
virtual ~BeRoFactoryInterface();
virtual BeRoInterface* switchRounds(int) = 0;
virtual BeRoInterface* switchRounds(BeRoInterface*, int) = 0;
virtual BeRoInterface* createBeRoPreflop() =0;
};
+4
View File
@@ -28,6 +28,10 @@ public:
virtual void setHighestSet(int) =0;
virtual int getHighestSet() const =0;
virtual void setHighestCardsValue(int theValue) =0;
virtual void resetFirstRun() =0;
virtual int getHighestCardsValue() =0;
virtual void preflopRun() =0;
virtual void flopRun() =0;
virtual void turnRun() =0;
+3 -3
View File
@@ -39,9 +39,9 @@ public:
virtual PlayerInterface** getPlayerArray() const =0;
virtual BoardInterface* getBoard() const =0;
virtual BeRoInterface* getPreflop() const =0;
virtual FlopInterface* getFlop() const =0;
virtual TurnInterface* getTurn() const =0;
virtual RiverInterface* getRiver() const =0;
virtual BeRoInterface* getFlop() const =0;
virtual BeRoInterface* getTurn() const =0;
virtual BeRoInterface* getRiver() const =0;
virtual GuiInterface* getGuiInterface() const =0;
virtual BeRoInterface* getCurrentBeRo() const =0;
+12
View File
@@ -24,7 +24,19 @@ public:
~LocalBeRo();
int getMyBeRoID() const { return myBeRoID; }
int getHighestCardsValue() {}
void setHighestCardsValue(int theValue) {}
//only until bero refactory is over
void preflopRun() {}
void flopRun() {}
void riverRun() {}
void turnRun() {}
void postRiverRun() {}
void resetFirstRun() {}
protected:
int myBeRoID;
+35 -49
View File
@@ -21,70 +21,56 @@ LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, i
LocalBeRoFactory::~LocalBeRoFactory()
{}
BeRoInterface* LocalBeRoFactory::switchRounds(int currentRound)
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()) {
BeRoInterface* myBeRo = NULL;
delete currentBeRo;
currentBeRo = NULL;
switch(currentRound) {
case GAME_STATE_PREFLOP: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
switch(currentRound) {
case GAME_STATE_PREFLOP: {
delete myBeRo;
myBeRo = NULL;
myBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
currentBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
}
break;
case GAME_STATE_FLOP: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
delete myBeRo;
myBeRo = NULL;
myBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
break;
case GAME_STATE_FLOP: {
currentBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
}
break;
case GAME_STATE_TURN: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
break;
case GAME_STATE_TURN: {
currentBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
delete myBeRo;
myBeRo = NULL;
myBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
}
break;
case GAME_STATE_RIVER: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
break;
case GAME_STATE_RIVER: {
currentBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
delete myBeRo;
myBeRo = NULL;
myBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
}
break;
case GAME_STATE_POST_RIVER: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
break;
case GAME_STATE_POST_RIVER: {
currentBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
delete myBeRo;
myBeRo = NULL;
myBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
}
break;
default: { cout << "BeRoFactory-ERROR" << endl; }
}
break;
default: { cout << "BeRoFactory-ERROR" << endl; }
}
return myBeRo;
return currentBeRo;
}
+3 -1
View File
@@ -33,7 +33,9 @@ public:
~LocalBeRoFactory();
BeRoInterface* switchRounds(int);
BeRoInterface* switchRounds(BeRoInterface*, int);
BeRoInterface* createBeRoPreflop();
private:
-6
View File
@@ -52,12 +52,6 @@ public:
void flopRun();
void nextPlayer2();
//only until bero refactory is over
void preflopRun() {}
void turnRun() {}
void riverRun() {}
void postRiverRun() {}
private:
HandInterface *myHand;
@@ -31,7 +31,6 @@ public:
LocalBeRoPreflop(HandInterface*, int, int, int, int);
~LocalBeRoPreflop();
void setPlayersTurn(int theValue) { playersTurn = theValue; }
int getPlayersTurn() const { return playersTurn; }
@@ -41,12 +40,6 @@ public:
void preflopRun();
void nextPlayer2();
//only until bero refactory is over
void flopRun() {}
void turnRun() {}
void riverRun() {}
void postRiverRun() {}
private:
HandInterface *myHand;
-5
View File
@@ -55,11 +55,6 @@ public:
void postRiverRun();
void nextPlayer2();
void distributePot();
//only until bero refactory is over
void preflopRun() {}
void flopRun() {}
void turnRun() {}
private:
-6
View File
@@ -50,12 +50,6 @@ public:
void nextPlayer2();
void turnRun();
//only until bero refactory is over
void preflopRun() {}
void flopRun() {}
void riverRun() {}
void postRiverRun() {}
private:
HandInterface *myHand;
+11 -8
View File
@@ -167,16 +167,16 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
assignButtons();
// Preflop, Flop, Turn und River erstellen
myPreflop = myFactory->createPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myFlop = myFactory->createFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
// myPreflop = myFactory->createPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
// myFlop = myFactory->createFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
// myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
// myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myBeRoFactory = myFactory->createBeRoFactory(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
int currentRound = actualRound; // for Lothar ;-)
myBeRo = myBeRoFactory->switchRounds(currentRound);
myBeRo = myBeRoFactory->createBeRoPreflop();
}
@@ -330,11 +330,11 @@ void LocalHand::switchRounds() {
switch (actualRound) {
case 0: {tempHighestSet = myBeRo->getHighestSet();}
break;
case 1: {tempHighestSet = myFlop->getHighestSet();}
case 1: {tempHighestSet = myBeRo->getHighestSet();}
break;
case 2: {tempHighestSet = myTurn->getHighestSet();}
case 2: {tempHighestSet = myBeRo->getHighestSet();}
break;
case 3: {tempHighestSet = myRiver->getHighestSet();}
case 3: {tempHighestSet = myBeRo->getHighestSet();}
break;
default: {}
}
@@ -381,7 +381,10 @@ void LocalHand::switchRounds() {
myGui->refreshGameLabels((GameState)getActualRound());
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
//
int currentRound = actualRound;
myBeRo = myBeRoFactory->switchRounds(myBeRo, currentRound);
// cout << "NextPlayerSpeed2 start" << endl;
switch(actualRound) {
+3 -3
View File
@@ -43,9 +43,9 @@ public:
PlayerInterface** getPlayerArray() const { return playerArray; }
BoardInterface* getBoard() const { return myBoard; }
BeRoInterface* getPreflop() const { return myBeRo; }
FlopInterface* getFlop() const { return myFlop; }
TurnInterface* getTurn() const { return myTurn; }
RiverInterface* getRiver() const { return myRiver; }
BeRoInterface* getFlop() const { return myBeRo; }
BeRoInterface* getTurn() const { return myBeRo; }
BeRoInterface* getRiver() const { return myBeRo; }
GuiInterface* getGuiInterface() const { return myGui; }
BeRoInterface* getCurrentBeRo() const { return myBeRo; }
@@ -10,6 +10,7 @@
//
//
#include "clientberofactory.h"
#include "berointerface.h"
ClientBeRoFactory::ClientBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB)
: BeRoFactoryInterface()
@@ -22,4 +23,6 @@ ClientBeRoFactory::~ClientBeRoFactory()
}
BeRoInterface* ClientBeRoFactory::switchRounds(int currentRound) { return NULL;}
BeRoInterface* ClientBeRoFactory::switchRounds(BeRoInterface* currentBeRo, int currentRound) { return NULL;}
BeRoInterface* ClientBeRoFactory::createBeRoPreflop() { return NULL; }
@@ -25,7 +25,9 @@ public:
~ClientBeRoFactory();
BeRoInterface* switchRounds(int);
BeRoInterface* switchRounds(BeRoInterface*, int);
BeRoInterface* createBeRoPreflop();
};
@@ -78,3 +78,4 @@ BeRoFactoryInterface* ClientEngineFactory::createBeRoFactory(HandInterface* hi,
{
return new ClientBeRoFactory(hi, id, aP, dP, sB);
}
+6 -6
View File
@@ -90,22 +90,22 @@ ClientHand::getPreflop() const
return myBeRo;
}
FlopInterface*
BeRoInterface*
ClientHand::getFlop() const
{
return myFlop;
return myBeRo;
}
TurnInterface*
BeRoInterface*
ClientHand::getTurn() const
{
return myTurn;
return myBeRo;
}
RiverInterface*
BeRoInterface*
ClientHand::getRiver() const
{
return myRiver;
return myBeRo;
}
BeRoInterface*
+3 -3
View File
@@ -43,9 +43,9 @@ public:
PlayerInterface** getPlayerArray() const;
BoardInterface* getBoard() const;
BeRoInterface* getPreflop() const;
FlopInterface* getFlop() const;
TurnInterface* getTurn() const;
RiverInterface* getRiver() const;
BeRoInterface* getFlop() const;
BeRoInterface* getTurn() const;
BeRoInterface* getRiver() const;
GuiInterface* getGuiInterface() const;
BeRoInterface* getCurrentBeRo() const;