2007-01-13 02:40:33 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* Copyright (C) 2006 by FThauer FHammer *
|
|
|
|
|
* f.thauer@web.de *
|
|
|
|
|
* *
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
#include "localhand.h"
|
2007-05-15 20:37:37 +00:00
|
|
|
#include "tools.h"
|
|
|
|
|
#include "cardsvalue.h"
|
2007-04-17 07:28:32 +00:00
|
|
|
#include <game_defs.h>
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-06-07 19:37:35 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
using namespace std;
|
|
|
|
|
|
2007-08-10 23:16:21 +00:00
|
|
|
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > p, int id, int sP, int aP, int dP, int sB,int sC)
|
2007-08-10 18:44:41 +00:00
|
|
|
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myBeRo(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
|
2007-06-06 21:16:52 +00:00
|
|
|
cardsShown(false), bettingRoundsPlayed(0)
|
2007-01-13 02:40:33 +00:00
|
|
|
{
|
2007-01-28 00:17:49 +00:00
|
|
|
|
2007-03-05 23:25:34 +00:00
|
|
|
int i, j, k;
|
2007-03-29 22:58:04 +00:00
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
CardsValue myCardsValue;
|
|
|
|
|
|
|
|
|
|
myBoard->setHand(this);
|
|
|
|
|
|
2007-03-05 23:25:34 +00:00
|
|
|
for(i=0; i<startQuantityPlayers; i++) {
|
2007-06-14 20:29:59 +00:00
|
|
|
playerArray[i]->setHand(this);
|
2007-06-03 13:36:24 +00:00
|
|
|
// myFlipCards auf 0 setzen
|
|
|
|
|
playerArray[i]->setMyCardsFlip(0, 0);
|
2007-03-05 23:25:34 +00:00
|
|
|
}
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// roundStartCashArray fllen
|
2007-04-17 07:28:32 +00:00
|
|
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
2007-01-13 02:40:33 +00:00
|
|
|
playerArray[i]->setMyRoundStartCash(playerArray[i]->getMyCash());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Karten generieren und Board sowie Player zuweisen
|
2007-03-05 23:25:34 +00:00
|
|
|
int *cardsArray = new int[2*actualQuantityPlayers+5];
|
2007-05-21 19:00:06 +00:00
|
|
|
Tools::getRandNumber(0, 51, 2*actualQuantityPlayers+5, cardsArray, 1);
|
2007-01-13 02:40:33 +00:00
|
|
|
int tempBoardArray[5];
|
|
|
|
|
int tempPlayerArray[2];
|
|
|
|
|
int tempPlayerAndBoardArray[7];
|
2007-03-30 12:44:16 +00:00
|
|
|
int sBluff;
|
2007-01-13 02:40:33 +00:00
|
|
|
for(i=0; i<5; i++) {
|
|
|
|
|
tempBoardArray[i] = cardsArray[i];
|
|
|
|
|
tempPlayerAndBoardArray[i+2] = cardsArray[i];
|
|
|
|
|
}
|
2007-04-03 10:55:16 +00:00
|
|
|
|
2007-03-05 23:25:34 +00:00
|
|
|
k = 0;
|
2007-01-13 02:40:33 +00:00
|
|
|
myBoard->setMyCards(tempBoardArray);
|
2007-03-05 19:21:41 +00:00
|
|
|
for(i=0; i<startQuantityPlayers; i++) {
|
2007-03-05 23:25:34 +00:00
|
|
|
if(playerArray[i]->getMyActiveStatus() != 0) {
|
2007-06-11 17:48:22 +00:00
|
|
|
|
|
|
|
|
int bestHandPos[5];
|
|
|
|
|
playerArray[i]->getMyBestHandPosition(bestHandPos);
|
|
|
|
|
|
2007-03-05 23:25:34 +00:00
|
|
|
for(j=0; j<2; j++) {
|
|
|
|
|
tempPlayerArray[j] = cardsArray[2*k+j+5];
|
|
|
|
|
tempPlayerAndBoardArray[j] = cardsArray[2*k+j+5];
|
2007-01-28 00:17:49 +00:00
|
|
|
}
|
2007-03-05 23:25:34 +00:00
|
|
|
playerArray[i]->setMyCards(tempPlayerArray);
|
2007-06-11 17:48:22 +00:00
|
|
|
playerArray[i]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray, bestHandPos));
|
|
|
|
|
playerArray[i]->setMyBestHandPosition(bestHandPos);
|
2007-03-30 12:44:16 +00:00
|
|
|
|
2007-03-05 23:25:34 +00:00
|
|
|
// myBestHandPosition auf Fehler ueberpruefen
|
|
|
|
|
for(j=0; j<5; j++) {
|
2007-06-11 17:48:22 +00:00
|
|
|
if (bestHandPos[j] == -1) {
|
2007-08-25 15:50:26 +00:00
|
|
|
cout << "ERROR getMyBestHandPosition in localhand.cpp" << endl;
|
2007-03-05 23:25:34 +00:00
|
|
|
}
|
|
|
|
|
}
|
2007-03-30 12:44:16 +00:00
|
|
|
|
|
|
|
|
// sBluff für alle aktiver Spieler außer human player setzen
|
|
|
|
|
if(i) {
|
2007-05-21 19:00:06 +00:00
|
|
|
Tools::getRandNumber(1,100,1,&sBluff,0);
|
2007-03-30 12:44:16 +00:00
|
|
|
playerArray[i]->setSBluff(sBluff);
|
2007-03-30 13:03:04 +00:00
|
|
|
playerArray[i]->setSBluffStatus(0);
|
2007-03-30 12:44:16 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-05 23:25:34 +00:00
|
|
|
k++;
|
2007-01-28 00:17:49 +00:00
|
|
|
}
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
2007-05-12 22:00:59 +00:00
|
|
|
delete[] cardsArray;
|
|
|
|
|
|
2007-08-10 18:44:41 +00:00
|
|
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
|
2007-04-30 11:53:40 +00:00
|
|
|
|
2007-08-24 15:15:01 +00:00
|
|
|
if(DEBUG_MODE) {
|
|
|
|
|
|
2007-09-01 16:32:36 +00:00
|
|
|
int temp5Array[5];
|
|
|
|
|
|
|
|
|
|
switch(myID) {
|
|
|
|
|
|
|
|
|
|
case 1: {
|
2007-08-25 20:09:40 +00:00
|
|
|
|
2007-09-23 17:07:52 +00:00
|
|
|
tempBoardArray[0] = 5;
|
|
|
|
|
tempBoardArray[1] = 51;
|
|
|
|
|
tempBoardArray[2] = 3;
|
|
|
|
|
tempBoardArray[3] = 21;
|
|
|
|
|
tempBoardArray[4] = 13;
|
2007-09-01 16:32:36 +00:00
|
|
|
|
|
|
|
|
myBoard->setMyCards(tempBoardArray);
|
|
|
|
|
|
|
|
|
|
tempPlayerAndBoardArray[2] = tempBoardArray[0];
|
|
|
|
|
tempPlayerAndBoardArray[3] = tempBoardArray[1];
|
|
|
|
|
tempPlayerAndBoardArray[4] = tempBoardArray[2];
|
|
|
|
|
tempPlayerAndBoardArray[5] = tempBoardArray[3];
|
|
|
|
|
tempPlayerAndBoardArray[6] = tempBoardArray[4];
|
2007-08-25 20:09:40 +00:00
|
|
|
|
2007-09-01 16:32:36 +00:00
|
|
|
// player0
|
|
|
|
|
|
2007-09-23 17:07:52 +00:00
|
|
|
tempPlayerArray[0] = 7;
|
|
|
|
|
tempPlayerArray[1] = 37;
|
2007-09-02 19:20:49 +00:00
|
|
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
|
|
|
|
|
playerArray[0]->setMyCards(tempPlayerArray);
|
|
|
|
|
playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
|
|
|
|
|
playerArray[0]->setMyBestHandPosition(temp5Array);
|
|
|
|
|
|
|
|
|
|
// player1
|
|
|
|
|
|
2007-09-23 17:07:52 +00:00
|
|
|
tempPlayerArray[0] = 24;
|
|
|
|
|
tempPlayerArray[1] = 19;
|
2007-09-01 16:32:36 +00:00
|
|
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
|
|
|
|
|
playerArray[1]->setMyCards(tempPlayerArray);
|
|
|
|
|
playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
|
|
|
|
|
playerArray[1]->setMyBestHandPosition(temp5Array);
|
|
|
|
|
|
2007-09-03 15:59:55 +00:00
|
|
|
// player2
|
|
|
|
|
|
2007-09-23 17:07:52 +00:00
|
|
|
/* tempPlayerArray[0] = 25;
|
2007-09-03 15:59:55 +00:00
|
|
|
tempPlayerArray[1] = 36;
|
|
|
|
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
|
|
|
|
|
playerArray[2]->setMyCards(tempPlayerArray);
|
|
|
|
|
playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
|
2007-09-23 17:07:52 +00:00
|
|
|
playerArray[2]->setMyBestHandPosition(temp5Array);*/
|
2007-09-03 15:59:55 +00:00
|
|
|
|
|
|
|
|
// player3
|
|
|
|
|
|
2007-09-23 17:07:52 +00:00
|
|
|
tempPlayerArray[0] = 38;
|
|
|
|
|
tempPlayerArray[1] = 22;
|
2007-09-03 15:59:55 +00:00
|
|
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
|
|
|
|
|
playerArray[3]->setMyCards(tempPlayerArray);
|
|
|
|
|
playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
|
|
|
|
|
playerArray[3]->setMyBestHandPosition(temp5Array);
|
2007-09-02 19:20:49 +00:00
|
|
|
|
2007-09-23 17:07:52 +00:00
|
|
|
// player4
|
|
|
|
|
|
|
|
|
|
tempPlayerArray[0] = 25;
|
|
|
|
|
tempPlayerArray[1] = 16;
|
|
|
|
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
|
|
|
|
|
playerArray[3]->setMyCards(tempPlayerArray);
|
|
|
|
|
playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
|
|
|
|
|
playerArray[3]->setMyBestHandPosition(temp5Array);
|
|
|
|
|
|
|
|
|
|
|
2007-09-02 19:20:49 +00:00
|
|
|
} break;
|
|
|
|
|
case 2: {
|
|
|
|
|
|
|
|
|
|
// tempBoardArray[0] = 32;
|
|
|
|
|
// tempBoardArray[1] = 26;
|
|
|
|
|
// tempBoardArray[2] = 28;
|
|
|
|
|
// tempBoardArray[3] = 38;
|
|
|
|
|
// tempBoardArray[4] = 7;
|
|
|
|
|
//
|
|
|
|
|
// myBoard->setMyCards(tempBoardArray);
|
|
|
|
|
//
|
|
|
|
|
// tempPlayerAndBoardArray[2] = tempBoardArray[0];
|
|
|
|
|
// tempPlayerAndBoardArray[3] = tempBoardArray[1];
|
|
|
|
|
// tempPlayerAndBoardArray[4] = tempBoardArray[2];
|
|
|
|
|
// tempPlayerAndBoardArray[5] = tempBoardArray[3];
|
|
|
|
|
// tempPlayerAndBoardArray[6] = tempBoardArray[4];
|
|
|
|
|
//
|
|
|
|
|
// // player0
|
|
|
|
|
//
|
|
|
|
|
// tempPlayerArray[0] = 45;
|
|
|
|
|
// tempPlayerArray[1] = 35;
|
|
|
|
|
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
//
|
|
|
|
|
// playerArray[0]->setMyCards(tempPlayerArray);
|
|
|
|
|
// playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
//
|
|
|
|
|
// playerArray[0]->setMyBestHandPosition(temp5Array);
|
|
|
|
|
//
|
|
|
|
|
// // player1
|
|
|
|
|
//
|
|
|
|
|
// tempPlayerArray[0] = 34;
|
|
|
|
|
// tempPlayerArray[1] = 39;
|
|
|
|
|
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
//
|
|
|
|
|
// playerArray[1]->setMyCards(tempPlayerArray);
|
|
|
|
|
// playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
//
|
|
|
|
|
// playerArray[1]->setMyBestHandPosition(temp5Array);
|
|
|
|
|
|
|
|
|
|
// // player2
|
|
|
|
|
//
|
|
|
|
|
// tempPlayerArray[0] = 7;
|
|
|
|
|
// tempPlayerArray[1] = 17;
|
|
|
|
|
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
//
|
|
|
|
|
// playerArray[2]->setMyCards(tempPlayerArray);
|
|
|
|
|
// playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
//
|
|
|
|
|
// playerArray[2]->setMyBestHandPosition(temp5Array);
|
|
|
|
|
//
|
|
|
|
|
// // player3
|
|
|
|
|
//
|
|
|
|
|
// tempPlayerArray[0] = 26;
|
|
|
|
|
// tempPlayerArray[1] = 28;
|
|
|
|
|
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
|
|
|
|
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
|
|
|
//
|
|
|
|
|
// playerArray[3]->setMyCards(tempPlayerArray);
|
2007-09-01 16:32:36 +00:00
|
|
|
// playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
|
|
|
|
//
|
|
|
|
|
// playerArray[3]->setMyBestHandPosition(temp5Array);
|
|
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
default: {}
|
2007-08-24 15:15:01 +00:00
|
|
|
|
2007-08-25 20:09:40 +00:00
|
|
|
}
|
2007-08-11 14:36:20 +00:00
|
|
|
|
2007-09-01 16:32:36 +00:00
|
|
|
|
|
|
|
|
|
2007-08-11 14:36:20 +00:00
|
|
|
}
|
|
|
|
|
|
2007-08-10 18:44:41 +00:00
|
|
|
// ----------------------------------------
|
2007-04-30 11:53:40 +00:00
|
|
|
|
2007-05-12 22:00:59 +00:00
|
|
|
// Dealer, SB, BB bestimmen
|
|
|
|
|
assignButtons();
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-08-06 22:39:46 +00:00
|
|
|
myBeRo = myFactory->createBeRo(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalHand::~LocalHand()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-12 22:00:59 +00:00
|
|
|
void LocalHand::start() {
|
|
|
|
|
|
|
|
|
|
/////////////////////
|
|
|
|
|
|
|
|
|
|
// Karten austeilen
|
|
|
|
|
myGui->dealHoleCards();
|
|
|
|
|
|
|
|
|
|
getBoard()->collectSets();
|
|
|
|
|
getGuiInterface()->refreshPot();
|
|
|
|
|
|
|
|
|
|
//Rundenwechsel | beim ersten Durchlauf --> Preflop starten
|
|
|
|
|
myGui->nextPlayerAnimation();
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
void LocalHand::assignButtons() {
|
|
|
|
|
|
2007-08-08 12:54:20 +00:00
|
|
|
int i,j;
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-05-18 11:38:37 +00:00
|
|
|
//Aktive Spieler zählen
|
|
|
|
|
int activePlayersCounter = 0;
|
|
|
|
|
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
|
|
|
if (playerArray[i]->getMyActiveStatus() == 1) activePlayersCounter++;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
// alle Buttons loeschen
|
2007-04-17 07:28:32 +00:00
|
|
|
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { playerArray[i]->setMyButton(0); }
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
// DealerButton zuweisen
|
|
|
|
|
playerArray[dealerPosition]->setMyButton(1);
|
|
|
|
|
|
2007-05-18 11:38:37 +00:00
|
|
|
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
2007-01-13 02:40:33 +00:00
|
|
|
i = dealerPosition;
|
2007-08-08 12:54:20 +00:00
|
|
|
|
|
|
|
|
for(j=0; (j<MAX_NUMBER_OF_PLAYERS && !(playerArray[i]->getMyActiveStatus())) || j==0; j++) {
|
|
|
|
|
|
2007-04-17 07:28:32 +00:00
|
|
|
i = (i+1)%(MAX_NUMBER_OF_PLAYERS);
|
2007-01-13 02:40:33 +00:00
|
|
|
if(playerArray[i]->getMyActiveStatus()) {
|
2007-05-18 11:38:37 +00:00
|
|
|
if(activePlayersCounter > 2) playerArray[i]->setMyButton(2); //small blind normal
|
2007-08-08 12:54:20 +00:00
|
|
|
else playerArray[i]->setMyButton(3); //big blind in heads up
|
2007-05-18 11:38:37 +00:00
|
|
|
}
|
2007-08-08 12:54:20 +00:00
|
|
|
}
|
2007-05-18 11:38:37 +00:00
|
|
|
|
|
|
|
|
// assign big blind next to small blind. ATTENTION: in heads up it is small blind
|
2007-08-08 12:54:20 +00:00
|
|
|
for(j=0; (j<MAX_NUMBER_OF_PLAYERS && !(playerArray[i]->getMyActiveStatus())) || j==0; j++) {
|
|
|
|
|
|
2007-05-18 11:38:37 +00:00
|
|
|
i = (i+1)%(MAX_NUMBER_OF_PLAYERS);
|
|
|
|
|
if(playerArray[i]->getMyActiveStatus()) {
|
|
|
|
|
if(activePlayersCounter > 2) playerArray[i]->setMyButton(3); //big blind normal
|
|
|
|
|
else playerArray[i]->setMyButton(2); //small blind in heads up
|
|
|
|
|
|
|
|
|
|
}
|
2007-08-08 12:54:20 +00:00
|
|
|
}
|
2007-05-18 11:38:37 +00:00
|
|
|
|
|
|
|
|
//do sets
|
|
|
|
|
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
|
|
|
|
|
|
|
|
if(playerArray[i]->getMyButton() == 2) {
|
|
|
|
|
//small blind
|
2007-01-13 02:40:33 +00:00
|
|
|
// mit SmallBlind All In ?
|
|
|
|
|
if(playerArray[i]->getMyCash() <= smallBlind) {
|
|
|
|
|
|
|
|
|
|
playerArray[i]->setMySet(playerArray[i]->getMyCash());
|
2007-06-05 21:20:32 +00:00
|
|
|
// 1 to do not log this
|
|
|
|
|
playerArray[i]->setMyAction(6,1);
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// sonst
|
2007-05-18 11:38:37 +00:00
|
|
|
else { playerArray[i]->setMySet(smallBlind); }
|
|
|
|
|
}
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-05-18 11:38:37 +00:00
|
|
|
if(playerArray[i]->getMyButton() == 3) {
|
|
|
|
|
//big blind
|
2007-01-13 02:40:33 +00:00
|
|
|
// mit BigBlind All In ?
|
|
|
|
|
if(playerArray[i]->getMyCash() <= 2*smallBlind) {
|
|
|
|
|
|
|
|
|
|
playerArray[i]->setMySet(playerArray[i]->getMyCash());
|
2007-06-05 21:20:32 +00:00
|
|
|
// 1 to do not log this
|
|
|
|
|
playerArray[i]->setMyAction(6,1);
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// sonst
|
2007-05-18 11:38:37 +00:00
|
|
|
else { playerArray[i]->setMySet(2*smallBlind); }
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
2007-06-08 19:37:21 +00:00
|
|
|
|
2007-05-18 11:38:37 +00:00
|
|
|
}
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LocalHand::switchRounds() {
|
|
|
|
|
|
2007-05-26 12:40:45 +00:00
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
int i;
|
|
|
|
|
|
2007-04-03 10:55:16 +00:00
|
|
|
// cout <<" ------- HandID: " << myID << " | actualround: " << actualRound << " ---------" << endl;
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-06-09 10:10:39 +00:00
|
|
|
//Aktive Spieler z�len
|
2007-01-28 14:48:18 +00:00
|
|
|
activePlayersCounter = 0;
|
2007-04-17 07:28:32 +00:00
|
|
|
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
2007-01-13 02:40:33 +00:00
|
|
|
if (playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyActiveStatus() == 1) activePlayersCounter++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Anzahl der Spieler ermitteln, welche All In sind
|
|
|
|
|
int allInPlayersCounter = 0;
|
2007-06-08 19:37:21 +00:00
|
|
|
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
2007-01-13 02:40:33 +00:00
|
|
|
if (playerArray[i]->getMyAction() == 6) allInPlayersCounter++;
|
|
|
|
|
}
|
2007-06-09 10:10:39 +00:00
|
|
|
|
|
|
|
|
//wenn nur noch einer nicht-folded dann gleich den Pot verteilen
|
2007-01-13 02:40:33 +00:00
|
|
|
if(activePlayersCounter==1) {
|
|
|
|
|
myBoard->collectPot();
|
2007-01-13 14:27:56 +00:00
|
|
|
myGui->refreshPot();
|
2007-01-13 02:40:33 +00:00
|
|
|
myGui->refreshSet();
|
|
|
|
|
actualRound = 4;
|
|
|
|
|
}
|
|
|
|
|
// prfen der All In Kondition
|
|
|
|
|
// fr All In Prozedur mssen mindestens zwei aktive Player vorhanden sein
|
|
|
|
|
else {
|
2007-04-03 10:55:16 +00:00
|
|
|
|
|
|
|
|
// cout << "activplayerscounter: " << activePlayersCounter << " | allInPlayersCounter: " << allInPlayersCounter << " | " << endl;
|
|
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
// 1) wenn alle All In
|
|
|
|
|
if(allInPlayersCounter == activePlayersCounter) {
|
2007-01-13 16:54:08 +00:00
|
|
|
allInCondition = 1;
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2) alle bis auf einen All In und der hat HighestSet
|
|
|
|
|
int tempHighestSet;
|
|
|
|
|
if(allInPlayersCounter+1 == activePlayersCounter) {
|
2007-04-17 07:28:32 +00:00
|
|
|
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
2007-05-23 20:03:10 +00:00
|
|
|
// Spieler ermitteln, der noch nicht All In ist
|
2007-01-13 02:40:33 +00:00
|
|
|
if(playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyAction() != 6 && playerArray[i]->getMyActiveStatus() == 1) {
|
|
|
|
|
tempHighestSet = 0;
|
2007-08-06 20:35:26 +00:00
|
|
|
tempHighestSet = myBeRo[actualRound]->getHighestSet();
|
2007-04-03 10:55:16 +00:00
|
|
|
// cout << "tempHighestSet: " << tempHighestSet << "playerArray[i]->getMySet(): " << playerArray[i]->getMySet() << endl;
|
|
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
if(playerArray[i]->getMySet() >= tempHighestSet) {
|
2007-01-13 16:54:08 +00:00
|
|
|
allInCondition = 1;
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
2007-05-23 20:03:10 +00:00
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
2007-05-23 20:03:10 +00:00
|
|
|
|
|
|
|
|
// HeadsUp-Ausnahme -> spieler ermitteln, der all in ist und als bb nur weniger als sb setzen konnte
|
2007-06-08 19:37:21 +00:00
|
|
|
if(activePlayersCounter==2 && playerArray[i]->getMyAction() == 6 && playerArray[i]->getMyActiveStatus() == 1 && playerArray[i]->getMyButton()==3 && playerArray[i]->getMySet()<=smallBlind) {
|
2007-05-23 20:03:10 +00:00
|
|
|
allInCondition = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// beim Vorliegen einer All In Kondition -> Ausfhrung einer Sonderprozedur
|
|
|
|
|
if(allInCondition) {
|
|
|
|
|
myBoard->collectPot();
|
2007-01-13 14:27:56 +00:00
|
|
|
myGui->refreshPot();
|
|
|
|
|
myGui->refreshSet();
|
2007-01-29 09:11:44 +00:00
|
|
|
myGui->flipHolecardsAllIn();
|
2007-06-13 20:02:40 +00:00
|
|
|
|
2007-05-26 17:06:03 +00:00
|
|
|
if (actualRound < 4) // do not increment past 4
|
|
|
|
|
actualRound++;
|
2007-06-13 20:02:40 +00:00
|
|
|
|
|
|
|
|
//log board cards for allin
|
|
|
|
|
if(actualRound >= 1) {
|
|
|
|
|
int tempBoardCardsArray[5];
|
|
|
|
|
|
|
|
|
|
myBoard->getMyCards(tempBoardCardsArray);
|
|
|
|
|
myGui->logDealBoardCardsMsg(actualRound, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-29 22:58:04 +00:00
|
|
|
//unhighlight actual players groupbox
|
2007-05-26 19:28:34 +00:00
|
|
|
if(playerArray[lastPlayersTurn]->getMyActiveStatus() == 1) myGui->refreshGroupbox(lastPlayersTurn,1);
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-06-07 14:06:22 +00:00
|
|
|
myGui->refreshGameLabels((GameState)getActualRound());
|
2007-01-13 02:40:33 +00:00
|
|
|
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
|
|
|
|
|
//
|
2007-08-05 23:57:16 +00:00
|
|
|
|
2007-08-05 13:07:23 +00:00
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
// cout << "NextPlayerSpeed2 start" << endl;
|
|
|
|
|
switch(actualRound) {
|
|
|
|
|
case 0: {
|
|
|
|
|
// Preflop starten
|
|
|
|
|
myGui->preflopAnimation1();
|
|
|
|
|
} break;
|
|
|
|
|
case 1: {
|
|
|
|
|
// Flop starten
|
|
|
|
|
myGui->flopAnimation1();
|
|
|
|
|
} break;
|
|
|
|
|
case 2: {
|
|
|
|
|
// Turn starten
|
|
|
|
|
myGui->turnAnimation1();
|
|
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
case 3: {
|
|
|
|
|
// River starten
|
|
|
|
|
myGui->riverAnimation1();
|
|
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
case 4: {
|
|
|
|
|
// PostRiver starten
|
|
|
|
|
myGui->postRiverAnimation1();
|
|
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
default: {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|