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
+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;