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
+2 -2
View File
@@ -340,8 +340,8 @@ mac{
INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers
} }
CONFIG += qt release #CONFIG += qt release
#CONFIG += qt warn_on debug CONFIG += qt warn_on debug
UI_DIR = uics UI_DIR = uics
TARGET = bin/pokerth TARGET = bin/pokerth
MOC_DIR = mocs MOC_DIR = mocs
+3 -1
View File
@@ -23,7 +23,9 @@ public:
virtual ~BeRoFactoryInterface(); 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 void setHighestSet(int) =0;
virtual int getHighestSet() const =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 preflopRun() =0;
virtual void flopRun() =0; virtual void flopRun() =0;
virtual void turnRun() =0; virtual void turnRun() =0;
+3 -3
View File
@@ -39,9 +39,9 @@ public:
virtual PlayerInterface** getPlayerArray() const =0; virtual PlayerInterface** getPlayerArray() const =0;
virtual BoardInterface* getBoard() const =0; virtual BoardInterface* getBoard() const =0;
virtual BeRoInterface* getPreflop() const =0; virtual BeRoInterface* getPreflop() const =0;
virtual FlopInterface* getFlop() const =0; virtual BeRoInterface* getFlop() const =0;
virtual TurnInterface* getTurn() const =0; virtual BeRoInterface* getTurn() const =0;
virtual RiverInterface* getRiver() const =0; virtual BeRoInterface* getRiver() const =0;
virtual GuiInterface* getGuiInterface() const =0; virtual GuiInterface* getGuiInterface() const =0;
virtual BeRoInterface* getCurrentBeRo() const =0; virtual BeRoInterface* getCurrentBeRo() const =0;
+12
View File
@@ -25,6 +25,18 @@ public:
int getMyBeRoID() const { return myBeRoID; } 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: protected:
int myBeRoID; int myBeRoID;
+31 -45
View File
@@ -21,70 +21,56 @@ LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, i
LocalBeRoFactory::~LocalBeRoFactory() 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) { switch(currentRound) {
case GAME_STATE_PREFLOP: { case GAME_STATE_PREFLOP: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
delete myBeRo; currentBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
myBeRo = NULL;
myBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
} }
} break;
break; case GAME_STATE_FLOP: {
case GAME_STATE_FLOP: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
delete myBeRo; currentBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
myBeRo = NULL;
myBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
} }
} break;
break; case GAME_STATE_TURN: {
case GAME_STATE_TURN: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
delete myBeRo; currentBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
myBeRo = NULL;
myBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
} }
} break;
break; case GAME_STATE_RIVER: {
case GAME_STATE_RIVER: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
delete myBeRo; currentBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
myBeRo = NULL;
myBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
} }
} break;
break; case GAME_STATE_POST_RIVER: {
case GAME_STATE_POST_RIVER: {
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
delete myBeRo; currentBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
myBeRo = NULL;
myBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
} }
break;
default: { cout << "BeRoFactory-ERROR" << endl; }
} }
break;
default: { cout << "BeRoFactory-ERROR" << endl; }
} }
return currentBeRo;
return myBeRo;
} }
+3 -1
View File
@@ -33,7 +33,9 @@ public:
~LocalBeRoFactory(); ~LocalBeRoFactory();
BeRoInterface* switchRounds(int); BeRoInterface* switchRounds(BeRoInterface*, int);
BeRoInterface* createBeRoPreflop();
private: private:
-6
View File
@@ -52,12 +52,6 @@ public:
void flopRun(); void flopRun();
void nextPlayer2(); void nextPlayer2();
//only until bero refactory is over
void preflopRun() {}
void turnRun() {}
void riverRun() {}
void postRiverRun() {}
private: private:
HandInterface *myHand; HandInterface *myHand;
@@ -31,7 +31,6 @@ public:
LocalBeRoPreflop(HandInterface*, int, int, int, int); LocalBeRoPreflop(HandInterface*, int, int, int, int);
~LocalBeRoPreflop(); ~LocalBeRoPreflop();
void setPlayersTurn(int theValue) { playersTurn = theValue; } void setPlayersTurn(int theValue) { playersTurn = theValue; }
int getPlayersTurn() const { return playersTurn; } int getPlayersTurn() const { return playersTurn; }
@@ -41,12 +40,6 @@ public:
void preflopRun(); void preflopRun();
void nextPlayer2(); void nextPlayer2();
//only until bero refactory is over
void flopRun() {}
void turnRun() {}
void riverRun() {}
void postRiverRun() {}
private: private:
HandInterface *myHand; HandInterface *myHand;
-5
View File
@@ -56,11 +56,6 @@ public:
void nextPlayer2(); void nextPlayer2();
void distributePot(); void distributePot();
//only until bero refactory is over
void preflopRun() {}
void flopRun() {}
void turnRun() {}
private: private:
HandInterface *myHand; HandInterface *myHand;
-6
View File
@@ -50,12 +50,6 @@ public:
void nextPlayer2(); void nextPlayer2();
void turnRun(); void turnRun();
//only until bero refactory is over
void preflopRun() {}
void flopRun() {}
void riverRun() {}
void postRiverRun() {}
private: private:
HandInterface *myHand; HandInterface *myHand;
+11 -8
View File
@@ -167,16 +167,16 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
assignButtons(); assignButtons();
// Preflop, Flop, Turn und River erstellen // Preflop, Flop, Turn und River erstellen
myPreflop = myFactory->createPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); // myPreflop = myFactory->createPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myFlop = myFactory->createFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); // myFlop = myFactory->createFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); // myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); // myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myBeRoFactory = myFactory->createBeRoFactory(this, myID, actualQuantityPlayers, dealerPosition, smallBlind); myBeRoFactory = myFactory->createBeRoFactory(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
int currentRound = actualRound; // for Lothar ;-) int currentRound = actualRound; // for Lothar ;-)
myBeRo = myBeRoFactory->switchRounds(currentRound); myBeRo = myBeRoFactory->createBeRoPreflop();
} }
@@ -330,11 +330,11 @@ void LocalHand::switchRounds() {
switch (actualRound) { switch (actualRound) {
case 0: {tempHighestSet = myBeRo->getHighestSet();} case 0: {tempHighestSet = myBeRo->getHighestSet();}
break; break;
case 1: {tempHighestSet = myFlop->getHighestSet();} case 1: {tempHighestSet = myBeRo->getHighestSet();}
break; break;
case 2: {tempHighestSet = myTurn->getHighestSet();} case 2: {tempHighestSet = myBeRo->getHighestSet();}
break; break;
case 3: {tempHighestSet = myRiver->getHighestSet();} case 3: {tempHighestSet = myBeRo->getHighestSet();}
break; break;
default: {} default: {}
} }
@@ -382,6 +382,9 @@ void LocalHand::switchRounds() {
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl; // /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
// //
int currentRound = actualRound;
myBeRo = myBeRoFactory->switchRounds(myBeRo, currentRound);
// cout << "NextPlayerSpeed2 start" << endl; // cout << "NextPlayerSpeed2 start" << endl;
switch(actualRound) { switch(actualRound) {
+3 -3
View File
@@ -43,9 +43,9 @@ public:
PlayerInterface** getPlayerArray() const { return playerArray; } PlayerInterface** getPlayerArray() const { return playerArray; }
BoardInterface* getBoard() const { return myBoard; } BoardInterface* getBoard() const { return myBoard; }
BeRoInterface* getPreflop() const { return myBeRo; } BeRoInterface* getPreflop() const { return myBeRo; }
FlopInterface* getFlop() const { return myFlop; } BeRoInterface* getFlop() const { return myBeRo; }
TurnInterface* getTurn() const { return myTurn; } BeRoInterface* getTurn() const { return myBeRo; }
RiverInterface* getRiver() const { return myRiver; } BeRoInterface* getRiver() const { return myBeRo; }
GuiInterface* getGuiInterface() const { return myGui; } GuiInterface* getGuiInterface() const { return myGui; }
BeRoInterface* getCurrentBeRo() const { return myBeRo; } BeRoInterface* getCurrentBeRo() const { return myBeRo; }
@@ -10,6 +10,7 @@
// //
// //
#include "clientberofactory.h" #include "clientberofactory.h"
#include "berointerface.h"
ClientBeRoFactory::ClientBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB) ClientBeRoFactory::ClientBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB)
: BeRoFactoryInterface() : 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(); ~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); return new ClientBeRoFactory(hi, id, aP, dP, sB);
} }
+6 -6
View File
@@ -90,22 +90,22 @@ ClientHand::getPreflop() const
return myBeRo; return myBeRo;
} }
FlopInterface* BeRoInterface*
ClientHand::getFlop() const ClientHand::getFlop() const
{ {
return myFlop; return myBeRo;
} }
TurnInterface* BeRoInterface*
ClientHand::getTurn() const ClientHand::getTurn() const
{ {
return myTurn; return myBeRo;
} }
RiverInterface* BeRoInterface*
ClientHand::getRiver() const ClientHand::getRiver() const
{ {
return myRiver; return myBeRo;
} }
BeRoInterface* BeRoInterface*
+3 -3
View File
@@ -43,9 +43,9 @@ public:
PlayerInterface** getPlayerArray() const; PlayerInterface** getPlayerArray() const;
BoardInterface* getBoard() const; BoardInterface* getBoard() const;
BeRoInterface* getPreflop() const; BeRoInterface* getPreflop() const;
FlopInterface* getFlop() const; BeRoInterface* getFlop() const;
TurnInterface* getTurn() const; BeRoInterface* getTurn() const;
RiverInterface* getRiver() const; BeRoInterface* getRiver() const;
GuiInterface* getGuiInterface() const; GuiInterface* getGuiInterface() const;
BeRoInterface* getCurrentBeRo() const; BeRoInterface* getCurrentBeRo() const;