BeRo refactoring
This commit is contained in:
@@ -48,23 +48,26 @@ LocalBeRoFlop::~LocalBeRoFlop()
|
||||
void LocalBeRoFlop::run() {
|
||||
|
||||
cout << "LocalBeroFlopRun!!!" << endl;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
if (firstFlopRun) {
|
||||
|
||||
myHand->getGuiInterface()->dealFlopCards();
|
||||
firstFlopRun = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
|
||||
|
||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(1, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]);
|
||||
logBoardCardsDone = 1;
|
||||
|
||||
}
|
||||
|
||||
bool allHighestSet = 1;
|
||||
@@ -76,8 +79,6 @@ void LocalBeRoFlop::run() {
|
||||
}
|
||||
}
|
||||
|
||||
// cout << "firstflopround " << firstFlopRound << endl;
|
||||
|
||||
// prfen, ob Flop wirklich dran ist
|
||||
if(!firstFlopRound && allHighestSet) {
|
||||
|
||||
@@ -127,21 +128,15 @@ void LocalBeRoFlop::run() {
|
||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||
|
||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
||||
// cout << "playersTurn " << playersTurn << endl;
|
||||
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstFlopRound = 0; }
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
// cout << "NextPlayerSpeed3 start" << endl;
|
||||
myHand->getGuiInterface()->flopAnimation2();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,13 +71,9 @@ void LocalBeRoRiver::run() {
|
||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
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; }
|
||||
}
|
||||
}
|
||||
// cout << "allHighestSet " << allHighestSet << endl;
|
||||
|
||||
// cout << "firstflopround " << firstRiverRound << endl;
|
||||
|
||||
// prfen, ob River wirklich dran ist
|
||||
if(!firstRiverRound && allHighestSet) {
|
||||
@@ -99,7 +95,6 @@ void LocalBeRoRiver::run() {
|
||||
myHand->getGuiInterface()->refreshCash();
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,0); }
|
||||
|
||||
|
||||
myHand->switchRounds();
|
||||
}
|
||||
else {
|
||||
@@ -129,15 +124,11 @@ void LocalBeRoRiver::run() {
|
||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||
|
||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
||||
// cout << "playersTurn " << playersTurn << endl;
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstRiverRound = 0; }
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -72,13 +72,9 @@ void LocalBeRoTurn::run() {
|
||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
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; }
|
||||
}
|
||||
}
|
||||
// cout << "allHighestSet " << allHighestSet << endl;
|
||||
|
||||
// cout << "firstflopround " << firstTurnRound << endl;
|
||||
|
||||
// prfen, ob Turn wirklich dran ist
|
||||
if(!firstTurnRound && allHighestSet) {
|
||||
@@ -129,20 +125,15 @@ void LocalBeRoTurn::run() {
|
||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||
|
||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
||||
// cout << "playersTurn " << playersTurn << endl;
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstTurnRound = 0; }
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
// cout << "NextPlayerSpeed3 start" << endl;
|
||||
myHand->getGuiInterface()->turnAnimation2();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
#include "localturn.h"
|
||||
#include "localriver.h"
|
||||
#include "localberofactory.h"
|
||||
#include "localberopreflop.h"
|
||||
#include "localberoflop.h"
|
||||
#include "localberoturn.h"
|
||||
#include "localberoriver.h"
|
||||
#include "localberopostriver.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); }
|
||||
|
||||
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);
|
||||
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:
|
||||
ConfigFile *myConfig;
|
||||
|
||||
@@ -165,11 +165,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
||||
// Dealer, SB, BB bestimmen
|
||||
assignButtons();
|
||||
|
||||
myBeRoFactory = myFactory->createBeRoFactory(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
||||
|
||||
int currentRound = actualRound; // for Lothar ;-)
|
||||
|
||||
myBeRo = myBeRoFactory->createBeRo();
|
||||
myBeRo = myFactory->createBeRo(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user