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:
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user