diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 7f268f99..701de8d3 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -24,14 +24,18 @@ using namespace std; LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) : HandInterface(), myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0) { - int i, j; + int i, j, k; CardsValue myCardsValue; myGui->setHand(this); myBoard->setHand(this); - for(i=0; isetHand(this); + for(i=0; igetMyActiveStatus() != 0) { + playerArray[i]->setHand(this); + } + } // roundStartCashArray fllen @@ -47,8 +51,8 @@ LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, Playe // Karten generieren und Board sowie Player zuweisen Tools myTool; - int *cardsArray = new int[2*startQuantityPlayers+5]; - myTool.getRandNumber(0, 51, 2*startQuantityPlayers+5, cardsArray, 1); + int *cardsArray = new int[2*actualQuantityPlayers+5]; + myTool.getRandNumber(0, 51, 2*actualQuantityPlayers+5, cardsArray, 1); int tempBoardArray[5]; int tempPlayerArray[2]; int tempPlayerAndBoardArray[7]; @@ -56,19 +60,23 @@ LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, Playe tempBoardArray[i] = cardsArray[i]; tempPlayerAndBoardArray[i+2] = cardsArray[i]; } + k = 0; myBoard->setMyCards(tempBoardArray); for(i=0; isetMyCards(tempPlayerArray); - playerArray[i]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[i]->getMyBestHandPosition())); - // myBestHandPosition auf Fehler ueberpruefen - for(j=0; j<5; j++) { - if((playerArray[i]->getMyBestHandPosition())[i] == -1) { - cout << "FEHLER bei myBestHandPosition-Ermittlung!!!" << endl; + if(playerArray[i]->getMyActiveStatus() != 0) { + for(j=0; j<2; j++) { + tempPlayerArray[j] = cardsArray[2*k+j+5]; + tempPlayerAndBoardArray[j] = cardsArray[2*k+j+5]; } + playerArray[i]->setMyCards(tempPlayerArray); + playerArray[i]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[i]->getMyBestHandPosition())); + // myBestHandPosition auf Fehler ueberpruefen + for(j=0; j<5; j++) { + if((playerArray[i]->getMyBestHandPosition())[j] == -1) { + cout << "FEHLER bei myBestHandPosition-Ermittlung!!!" << endl; + } + } + k++; } } @@ -81,10 +89,10 @@ LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, Playe } // Preflop, Flop, Turn und River erstellen - myPreflop = myFactory->createPreflop(this, myID, startQuantityPlayers, dealerPosition, smallBlind); - myFlop = myFactory->createFlop(this, myID, startQuantityPlayers, dealerPosition, smallBlind); - myTurn = myFactory->createTurn(this, myID, startQuantityPlayers, dealerPosition, smallBlind); - myRiver = myFactory->createRiver(this, myID, startQuantityPlayers, dealerPosition, smallBlind); + 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();