Two step initialization for engine. First step: Create and initialize objects (constructor). Second step: Start the engine, update the UI.

This commit is contained in:
lotodore
2007-05-12 22:00:59 +00:00
parent 7c6337d810
commit 6fbef0af20
15 changed files with 79 additions and 74 deletions
+2
View File
@@ -33,6 +33,8 @@ public:
virtual ~HandInterface();
virtual void start() = 0;
virtual PlayerInterface** getPlayerArray() const =0;
virtual BoardInterface* getBoard() const =0;
virtual PreflopInterface* getPreflop() const =0;
+22 -26
View File
@@ -44,12 +44,6 @@ LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, Playe
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
playerArray[i]->setMyRoundStartCash(playerArray[i]->getMyCash());
}
// Dealer, SB, BB bestimmen
assignButtons();
// myGui->refreshAll();
// Karten generieren und Board sowie Player zuweisen
Tools myTool;
@@ -64,7 +58,6 @@ LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, Playe
tempPlayerAndBoardArray[i+2] = cardsArray[i];
}
k = 0;
myBoard->setMyCards(tempBoardArray);
for(i=0; i<startQuantityPlayers; i++) {
@@ -93,6 +86,12 @@ LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, Playe
k++;
}
}
delete[] cardsArray;
// myFlipCards auf 0 setzen
for(i=0; i<startQuantityPlayers; i++) {
playerArray[i]->setMyCardsFlip(0);
}
// // // !!!!!!!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
@@ -154,31 +153,14 @@ LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, Playe
// // // seven-two, the others have Ace-King, Ace-Jack, Ace-Nine. The pot is obviously split.
/////////////////////
// Karten austeilen
myGui->dealHoleCards();
// myFlipCards auf 0 setzen
for(i=0; i<startQuantityPlayers; i++) {
playerArray[i]->setMyCardsFlip(0);
}
// Dealer, SB, BB bestimmen
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);
//Rundenwechsel | beim ersten Durchlauf --> Preflop starten
myGui->nextPlayerAnimation();
delete[] cardsArray;
}
@@ -197,6 +179,20 @@ LocalHand::~LocalHand()
}
void LocalHand::start() {
/////////////////////
// Karten austeilen
myGui->dealHoleCards();
getBoard()->collectSets();
getGuiInterface()->refreshPot();
//Rundenwechsel | beim ersten Durchlauf --> Preflop starten
myGui->nextPlayerAnimation();
}
void LocalHand::assignButtons() {
int i;
+4 -4
View File
@@ -37,11 +37,11 @@
class LocalHand : public HandInterface{
public:
LocalHand(EngineFactory*, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int, int);
LocalHand(EngineFactory*, GuiInterface*, BoardInterface*, PlayerInterface**, int, int, int, int, int, int);
~LocalHand();
~LocalHand();
void start();
PlayerInterface** getPlayerArray() const { return playerArray; }
BoardInterface* getBoard() const { return myBoard; }
-4
View File
@@ -27,10 +27,6 @@ using namespace std;
LocalPreflop::LocalPreflop(HandInterface* bR, int id, int qP, int dP, int sB) : PreflopInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0)
{
myHand->getBoard()->collectSets();
myHand->getGuiInterface()->refreshPot();
// // BigBlind ermitteln
bigBlindPosition = dealerPosition;
while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) {