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 "localflop.h"
|
2007-04-17 07:28:32 +00:00
|
|
|
#include <game_defs.h>
|
2007-05-15 20:37:37 +00:00
|
|
|
#include <handinterface.h>
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-05-15 20:37:37 +00:00
|
|
|
//using namespace std;
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-05-20 13:03:43 +00:00
|
|
|
LocalFlop::LocalFlop(HandInterface* bR, int id, int qP, int dP, int sB) : FlopInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), firstHeadsUpFlopRound(1), playersTurn(dP)
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
//SmallBlind-Position ermitteln
|
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 (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalFlop::~LocalFlop()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalFlop::flopRun() {
|
|
|
|
|
|
|
|
|
|
// cout << "NextPlayerSpeed2 stop" << endl;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (firstFlopRun) {
|
|
|
|
|
myHand->getGuiInterface()->dealFlopCards();
|
2007-01-13 16:54:08 +00:00
|
|
|
firstFlopRun = 0;
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
bool allHighestSet = 1;
|
|
|
|
|
|
|
|
|
|
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 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(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
|
|
|
|
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// cout << "firstflopround " << firstFlopRound << endl;
|
|
|
|
|
|
|
|
|
|
// prfen, ob Flop wirklich dran ist
|
|
|
|
|
if(!firstFlopRound && allHighestSet) {
|
|
|
|
|
|
|
|
|
|
// Flop nicht dran, weil alle Sets gleich sind
|
|
|
|
|
//also gehe in Turn
|
|
|
|
|
myHand->setActualRound(2);
|
|
|
|
|
|
2007-05-14 21:18:24 +00:00
|
|
|
//Action loeschen und ActionButtons refresh
|
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(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
|
|
|
|
|
}
|
|
|
|
|
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
|
|
|
|
myHand->getBoard()->collectSets();
|
|
|
|
|
myHand->getBoard()->collectPot();
|
2007-01-13 14:27:56 +00:00
|
|
|
myHand->getGuiInterface()->refreshPot();
|
2007-03-29 22:58:04 +00:00
|
|
|
|
|
|
|
|
myHand->getGuiInterface()->refreshSet();
|
|
|
|
|
myHand->getGuiInterface()->refreshCash();
|
|
|
|
|
myHand->getGuiInterface()->refreshAction();
|
|
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
myHand->switchRounds();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Flop ist wirklich dran
|
2007-03-09 03:53:39 +00:00
|
|
|
|
|
|
|
|
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
|
|
|
|
if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
|
|
|
|
myHand->setBettingRoundsPlayed(1);
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-20 13:03:43 +00:00
|
|
|
if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpFlopRound == 1) ) {
|
|
|
|
|
// not first round in heads up (for headsup dealer is smallblind so it is dealers turn)
|
|
|
|
|
|
|
|
|
|
// naechsten Spieler ermitteln
|
|
|
|
|
do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS);
|
|
|
|
|
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6);
|
|
|
|
|
}
|
|
|
|
|
else { firstHeadsUpFlopRound = 0; }
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
//Spieler-Position vor SmallBlind-Position ermitteln
|
|
|
|
|
int activePlayerBeforeSmallBlind = smallBlindPosition;
|
2007-04-17 07:28:32 +00:00
|
|
|
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS);
|
2007-01-13 02:40:33 +00:00
|
|
|
} while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6);
|
|
|
|
|
|
2007-01-13 16:54:08 +00:00
|
|
|
myHand->getPlayerArray()[playersTurn]->setMyTurn(1);
|
2007-03-29 22:58:04 +00:00
|
|
|
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
|
|
|
|
// cout << "playersTurn " << playersTurn << endl;
|
2007-05-20 13:03:43 +00:00
|
|
|
|
2007-01-13 02:40:33 +00:00
|
|
|
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
2007-01-13 16:54:08 +00:00
|
|
|
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstFlopRound = 0; }
|
2007-05-11 12:01:13 +00:00
|
|
|
|
2007-05-14 21:18:24 +00:00
|
|
|
if(playersTurn == 0) {
|
|
|
|
|
// Wir sind dran
|
|
|
|
|
// cout << "actualRound " << myHand->getActualRound() << endl;
|
|
|
|
|
// cout << "highestSet vor meInAction " << highestSet << endl;
|
|
|
|
|
myHand->getGuiInterface()->meInAction();
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
2007-05-14 21:18:24 +00:00
|
|
|
else {
|
|
|
|
|
//Gegner sind dran
|
|
|
|
|
// cout << "NextPlayerSpeed3 start" << endl;
|
|
|
|
|
myHand->getGuiInterface()->flopAnimation2();
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalFlop::nextPlayer2() {
|
|
|
|
|
|
|
|
|
|
// cout << "NextPlayerSpeed3 stop" << endl;
|
|
|
|
|
myHand->getPlayerArray()[playersTurn]->action();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|