BeRo refactoring
This commit is contained in:
@@ -47,12 +47,7 @@ public:
|
|||||||
virtual RiverInterface* createRiver(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 BeRoInterface* createBeRo() =0;
|
||||||
virtual BeRoFactoryInterface* createBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB) =0;
|
virtual BeRoFactoryInterface* createBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB) =0;
|
||||||
|
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, int aP, int dP, int sB) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#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 //
|
|
||||||
|
|||||||
@@ -48,23 +48,26 @@ LocalBeRoFlop::~LocalBeRoFlop()
|
|||||||
void LocalBeRoFlop::run() {
|
void LocalBeRoFlop::run() {
|
||||||
|
|
||||||
cout << "LocalBeroFlopRun!!!" << endl;
|
cout << "LocalBeroFlopRun!!!" << endl;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (firstFlopRun) {
|
if (firstFlopRun) {
|
||||||
|
|
||||||
myHand->getGuiInterface()->dealFlopCards();
|
myHand->getGuiInterface()->dealFlopCards();
|
||||||
firstFlopRun = 0;
|
firstFlopRun = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
//log the turned cards
|
//log the turned cards
|
||||||
if(!logBoardCardsDone) {
|
if(!logBoardCardsDone) {
|
||||||
|
|
||||||
int tempBoardCardsArray[5];
|
int tempBoardCardsArray[5];
|
||||||
|
|
||||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||||
myHand->getGuiInterface()->logDealBoardCardsMsg(1, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]);
|
myHand->getGuiInterface()->logDealBoardCardsMsg(1, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]);
|
||||||
logBoardCardsDone = 1;
|
logBoardCardsDone = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool allHighestSet = 1;
|
bool allHighestSet = 1;
|
||||||
@@ -76,8 +79,6 @@ void LocalBeRoFlop::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << "firstflopround " << firstFlopRound << endl;
|
|
||||||
|
|
||||||
// prfen, ob Flop wirklich dran ist
|
// prfen, ob Flop wirklich dran ist
|
||||||
if(!firstFlopRound && allHighestSet) {
|
if(!firstFlopRound && allHighestSet) {
|
||||||
|
|
||||||
@@ -127,21 +128,15 @@ void LocalBeRoFlop::run() {
|
|||||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||||
|
|
||||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
|
||||||
// cout << "playersTurn " << playersTurn << endl;
|
|
||||||
|
|
||||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstFlopRound = 0; }
|
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstFlopRound = 0; }
|
||||||
|
|
||||||
if(playersTurn == 0) {
|
if(playersTurn == 0) {
|
||||||
// Wir sind dran
|
// Wir sind dran
|
||||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
|
||||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
|
||||||
myHand->getGuiInterface()->meInAction();
|
myHand->getGuiInterface()->meInAction();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Gegner sind dran
|
//Gegner sind dran
|
||||||
// cout << "NextPlayerSpeed3 start" << endl;
|
|
||||||
myHand->getGuiInterface()->flopAnimation2();
|
myHand->getGuiInterface()->flopAnimation2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,13 +71,9 @@ void LocalBeRoRiver::run() {
|
|||||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
||||||
// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl;
|
|
||||||
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cout << "allHighestSet " << allHighestSet << endl;
|
|
||||||
|
|
||||||
// cout << "firstflopround " << firstRiverRound << endl;
|
|
||||||
|
|
||||||
// prfen, ob River wirklich dran ist
|
// prfen, ob River wirklich dran ist
|
||||||
if(!firstRiverRound && allHighestSet) {
|
if(!firstRiverRound && allHighestSet) {
|
||||||
@@ -99,7 +95,6 @@ void LocalBeRoRiver::run() {
|
|||||||
myHand->getGuiInterface()->refreshCash();
|
myHand->getGuiInterface()->refreshCash();
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,0); }
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,0); }
|
||||||
|
|
||||||
|
|
||||||
myHand->switchRounds();
|
myHand->switchRounds();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -129,15 +124,11 @@ void LocalBeRoRiver::run() {
|
|||||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||||
|
|
||||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
|
||||||
// cout << "playersTurn " << playersTurn << endl;
|
|
||||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstRiverRound = 0; }
|
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstRiverRound = 0; }
|
||||||
|
|
||||||
if(playersTurn == 0) {
|
if(playersTurn == 0) {
|
||||||
// Wir sind dran
|
// Wir sind dran
|
||||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
|
||||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
|
||||||
myHand->getGuiInterface()->meInAction();
|
myHand->getGuiInterface()->meInAction();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -72,13 +72,9 @@ void LocalBeRoTurn::run() {
|
|||||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
||||||
// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl;
|
|
||||||
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cout << "allHighestSet " << allHighestSet << endl;
|
|
||||||
|
|
||||||
// cout << "firstflopround " << firstTurnRound << endl;
|
|
||||||
|
|
||||||
// prfen, ob Turn wirklich dran ist
|
// prfen, ob Turn wirklich dran ist
|
||||||
if(!firstTurnRound && allHighestSet) {
|
if(!firstTurnRound && allHighestSet) {
|
||||||
@@ -129,20 +125,15 @@ void LocalBeRoTurn::run() {
|
|||||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||||
|
|
||||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
|
||||||
// cout << "playersTurn " << playersTurn << endl;
|
|
||||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstTurnRound = 0; }
|
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstTurnRound = 0; }
|
||||||
|
|
||||||
if(playersTurn == 0) {
|
if(playersTurn == 0) {
|
||||||
// Wir sind dran
|
// Wir sind dran
|
||||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
|
||||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
|
||||||
myHand->getGuiInterface()->meInAction();
|
myHand->getGuiInterface()->meInAction();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Gegner sind dran
|
//Gegner sind dran
|
||||||
// cout << "NextPlayerSpeed3 start" << endl;
|
|
||||||
myHand->getGuiInterface()->turnAnimation2();
|
myHand->getGuiInterface()->turnAnimation2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,11 @@
|
|||||||
#include "localturn.h"
|
#include "localturn.h"
|
||||||
#include "localriver.h"
|
#include "localriver.h"
|
||||||
#include "localberofactory.h"
|
#include "localberofactory.h"
|
||||||
|
#include "localberopreflop.h"
|
||||||
|
#include "localberoflop.h"
|
||||||
|
#include "localberoturn.h"
|
||||||
|
#include "localberoriver.h"
|
||||||
|
#include "localberopostriver.h"
|
||||||
|
|
||||||
#include <configfile.h>
|
#include <configfile.h>
|
||||||
|
|
||||||
@@ -58,3 +63,20 @@ RiverInterface* LocalEngineFactory::createRiver(HandInterface* hi, int id, int a
|
|||||||
|
|
||||||
BeRoFactoryInterface* LocalEngineFactory::createBeRoFactory(HandInterface* hi, int id, int aP, int dP, int sB) { return new LocalBeRoFactory(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;
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPreflop(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoFlop(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoTurn(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoRiver(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPostRiver(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
return myBeRo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public:
|
|||||||
TurnInterface* createTurn(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);
|
RiverInterface* createRiver(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||||
BeRoFactoryInterface* createBeRoFactory(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:
|
private:
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|||||||
@@ -165,11 +165,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
|||||||
// Dealer, SB, BB bestimmen
|
// Dealer, SB, BB bestimmen
|
||||||
assignButtons();
|
assignButtons();
|
||||||
|
|
||||||
myBeRoFactory = myFactory->createBeRoFactory(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
myBeRo = myFactory->createBeRo(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
||||||
|
|
||||||
int currentRound = actualRound; // for Lothar ;-)
|
|
||||||
|
|
||||||
myBeRo = myBeRoFactory->createBeRo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,3 +79,21 @@ BeRoFactoryInterface* ClientEngineFactory::createBeRoFactory(HandInterface* hi,
|
|||||||
return new ClientBeRoFactory(hi, id, aP, dP, sB);
|
return new ClientBeRoFactory(hi, id, aP, dP, sB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<boost::shared_ptr<BeRoInterface> > ClientEngineFactory::createBeRo(HandInterface* hi, int id, int aP, int dP, int sB) {
|
||||||
|
|
||||||
|
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoPreflop(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoFlop(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoTurn(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoRiver(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
// myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoPostRiver(hi, id, aP, dP, sB)));
|
||||||
|
|
||||||
|
return myBeRo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <flopinterface.h>
|
#include <flopinterface.h>
|
||||||
#include <turninterface.h>
|
#include <turninterface.h>
|
||||||
#include <riverinterface.h>
|
#include <riverinterface.h>
|
||||||
#include <berofactoryinterface.h>
|
// #include <berofactoryinterface.h>
|
||||||
|
|
||||||
|
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
@@ -47,6 +47,7 @@ public:
|
|||||||
TurnInterface* createTurn(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);
|
RiverInterface* createRiver(HandInterface* hi, int id, int aP, int dP, int sB);
|
||||||
BeRoFactoryInterface* createBeRoFactory(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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user