From 27cd08ccb0c3da656b932d62b92d1edc70a434b2 Mon Sep 17 00:00:00 2001 From: lotodore Date: Tue, 17 Apr 2007 07:28:32 +0000 Subject: [PATCH] Maximum number of players is now a constant in game_defs.h. --- src/engine/local_engine/localboard.cpp | 5 +- src/engine/local_engine/localflop.cpp | 11 ++-- src/engine/local_engine/localhand.cpp | 15 ++--- src/engine/local_engine/localpreflop.cpp | 11 ++-- src/engine/local_engine/localriver.cpp | 33 +++++------ src/engine/local_engine/localturn.cpp | 11 ++-- src/game.cpp | 16 +++--- src/game.h | 2 + src/game_defs.h | 25 ++++++++ src/gui/guiinterface.h | 3 - src/gui/qt/guiwrapper.cpp | 2 - src/gui/qt/guiwrapper.h | 2 - src/gui/qt/log/log.cpp | 13 +++-- src/gui/qt/mainwindow/mainwindowimpl.cpp | 73 +++++++++++------------- src/gui/qt/mainwindow/mainwindowimpl.h | 27 ++++----- 15 files changed, 134 insertions(+), 115 deletions(-) create mode 100644 src/game_defs.h diff --git a/src/engine/local_engine/localboard.cpp b/src/engine/local_engine/localboard.cpp index df4dbd17..727879cf 100755 --- a/src/engine/local_engine/localboard.cpp +++ b/src/engine/local_engine/localboard.cpp @@ -20,6 +20,7 @@ #include "localboard.h" #include "localhand.h" +#include using namespace std; @@ -40,7 +41,7 @@ void LocalBoard::collectSets() { sets = 0; int i; - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) sets += playerArray[i]->getMySet(); + for(i=0; igetMySet(); } @@ -48,7 +49,7 @@ void LocalBoard::collectPot() { int i; pot += sets; sets = 0; - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++){ playerArray[i]->setMySetNull(); } + for(i=0; isetMySetNull(); } } diff --git a/src/engine/local_engine/localflop.cpp b/src/engine/local_engine/localflop.cpp index 1cfdbed3..61c5c47e 100755 --- a/src/engine/local_engine/localflop.cpp +++ b/src/engine/local_engine/localflop.cpp @@ -18,6 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "localflop.h" +#include using namespace std; @@ -27,7 +28,7 @@ LocalFlop::LocalFlop(HandInterface* bR, int id, int qP, int dP, int sB) : FlopIn int i; //SmallBlind-Position ermitteln - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i; } @@ -53,7 +54,7 @@ void LocalFlop::flopRun() { bool allHighestSet = 1; // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } } @@ -69,7 +70,7 @@ void LocalFlop::flopRun() { myHand->setActualRound(2); //Action l�chen und ActionButtons refresh - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); } //Sets in den Pot verschieben und Sets = 0 und Pot-refresh @@ -94,12 +95,12 @@ void LocalFlop::flopRun() { // n�hsten Spieler ermitteln - do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers()); + do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6); //Spieler-Position vor SmallBlind-Position ermitteln int activePlayerBeforeSmallBlind = smallBlindPosition; - do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getGuiInterface()->getMaxQuantityPlayers() - 1 ) % (myHand->getGuiInterface()->getMaxQuantityPlayers()); + do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); } while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6); myHand->getPlayerArray()[playersTurn]->setMyTurn(1); diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 2e37023d..aeef1421 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -18,6 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "localhand.h" +#include using namespace std; @@ -41,7 +42,7 @@ LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, Playe // roundStartCashArray fllen - for(i=0; igetMaxQuantityPlayers(); i++) { + for(i=0; isetMyRoundStartCash(playerArray[i]->getMyCash()); } @@ -135,7 +136,7 @@ void LocalHand::assignButtons() { int i; // alle Buttons loeschen - for (i=0; igetMaxQuantityPlayers(); i++) { playerArray[i]->setMyButton(0); } + for (i=0; isetMyButton(0); } // DealerButton zuweisen playerArray[dealerPosition]->setMyButton(1); @@ -143,7 +144,7 @@ void LocalHand::assignButtons() { // Small Blind zuweisen und setzen i = dealerPosition; do { - i = (i+1)%(myGui->getMaxQuantityPlayers()); + i = (i+1)%(MAX_NUMBER_OF_PLAYERS); if(playerArray[i]->getMyActiveStatus()) { playerArray[i]->setMyButton(2); // mit SmallBlind All In ? @@ -163,7 +164,7 @@ void LocalHand::assignButtons() { // Big Blind zuweisen do { - i = (i+1)%(myGui->getMaxQuantityPlayers()); + i = (i+1)%(MAX_NUMBER_OF_PLAYERS); if(playerArray[i]->getMyActiveStatus()) { playerArray[i]->setMyButton(3); // mit BigBlind All In ? @@ -191,13 +192,13 @@ void LocalHand::switchRounds() { //Aktive Spieler z�len --> wenn nur noch einer nicht-folded dann gleich den Pot verteilen activePlayersCounter = 0; - for (i=0; igetMaxQuantityPlayers(); i++) { + for (i=0; igetMyAction() != 1 && playerArray[i]->getMyActiveStatus() == 1) activePlayersCounter++; } // Anzahl der Spieler ermitteln, welche All In sind int allInPlayersCounter = 0; - for (i=0; igetMaxQuantityPlayers(); i++) { + for (i=0; igetMyAction() == 6) allInPlayersCounter++; } @@ -222,7 +223,7 @@ void LocalHand::switchRounds() { int tempHighestSet; if(allInPlayersCounter+1 == activePlayersCounter) { // Spieler ermitteln, der noch nicht All In ist - for (i=0; igetMaxQuantityPlayers(); i++) { + for (i=0; igetMyAction() != 1 && playerArray[i]->getMyAction() != 6 && playerArray[i]->getMyActiveStatus() == 1) { tempHighestSet = 0; switch (actualRound) { diff --git a/src/engine/local_engine/localpreflop.cpp b/src/engine/local_engine/localpreflop.cpp index 00da1a35..83a353a4 100755 --- a/src/engine/local_engine/localpreflop.cpp +++ b/src/engine/local_engine/localpreflop.cpp @@ -20,6 +20,7 @@ #include "localpreflop.h" #include "handinterface.h" +#include using namespace std; @@ -33,7 +34,7 @@ LocalPreflop::LocalPreflop(HandInterface* bR, int id, int qP, int dP, int sB) : // // BigBlind ermitteln bigBlindPosition = dealerPosition; while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) { - bigBlindPosition = (bigBlindPosition+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers()); + bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS); } // // erste Spielernummer fr preflopRun() setzen @@ -56,7 +57,7 @@ void LocalPreflop::preflopRun() { bool allHighestSet = 1; // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } } @@ -65,7 +66,7 @@ void LocalPreflop::preflopRun() { // BigBlind ermitteln bigBlindPosition = dealerPosition; while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) { - bigBlindPosition = (bigBlindPosition+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers()); + bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS); } // prfen, ob Preflop wirklich dran ist @@ -76,7 +77,7 @@ void LocalPreflop::preflopRun() { myHand->setActualRound(1); //Action l�chen und ActionButtons refresh - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); } //Sets in den Pot verschieben und Sets = 0 und Pot-refresh @@ -97,7 +98,7 @@ void LocalPreflop::preflopRun() { // n�hsten Spieler ermitteln do { - playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers()); + playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); // falls BigBlind, dann PreflopFirstRound zuende if(myHand->getPlayerArray()[playersTurn]->getMyButton() == 3) preflopFirstRound = 0; diff --git a/src/engine/local_engine/localriver.cpp b/src/engine/local_engine/localriver.cpp index 5980ea86..d6d33b79 100755 --- a/src/engine/local_engine/localriver.cpp +++ b/src/engine/local_engine/localriver.cpp @@ -18,6 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "localriver.h" +#include using namespace std; @@ -27,7 +28,7 @@ LocalRiver::LocalRiver(HandInterface* bR, int id, int qP, int dP, int sB) : Rive { int i; //SmallBlind-Position ermitteln - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i; } @@ -52,7 +53,7 @@ void LocalRiver::riverRun() { bool allHighestSet = 1; // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { // cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl; if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } @@ -70,7 +71,7 @@ void LocalRiver::riverRun() { myHand->setActualRound(4); //Action lᅵchen und ActionButtons refresh - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); } //Sets in den Pot verschieben und Sets = 0 und Pot-refresh @@ -94,12 +95,12 @@ void LocalRiver::riverRun() { } // nᅵhsten Spieler ermitteln - do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers()); + do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6); //Spieler-Position vor SmallBlind-Position ermitteln int activePlayerBeforeSmallBlind = smallBlindPosition; - do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getGuiInterface()->getMaxQuantityPlayers() - 1 ) % (myHand->getGuiInterface()->getMaxQuantityPlayers()); + do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); } while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6); myHand->getPlayerArray()[playersTurn]->setMyTurn(1); @@ -138,7 +139,7 @@ void LocalRiver::postRiverRun() { // cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl; //berechnen welcher Spieler gewonnen hat - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyCardsValueInt() << endl; @@ -154,7 +155,7 @@ void LocalRiver::postRiverRun() { // Aggressivität des human player ermitteln // anzahl der player die möglichkeit haben am pot teilzuhaben int potPlayers = 0; - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) { potPlayers++; } @@ -202,14 +203,14 @@ void LocalRiver::distributePot() { ///////////////////// // winnersArray erstellen -> hier werden die winner der jeweiligen Potverteilungsrunden eingetragen - int *winnersArray = new int[myHand->getGuiInterface()->getMaxQuantityPlayers()]; + int *winnersArray = new int[MAX_NUMBER_OF_PLAYERS]; // Anzahl der winner in einer Potverteilungsrunde int winnersCounter = 0; // dieses Array ermittelt wieviel jeder Spieler wᅵrend der gesamten BettingRound gesetzt hat - int *roundSetArray = new int[myHand->getGuiInterface()->getMaxQuantityPlayers()]; - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + int *roundSetArray = new int[MAX_NUMBER_OF_PLAYERS]; + for(i=0; igetGuiInterface()->getMaxQuantityPlayers()]; + int *cardsValueArray = new int[MAX_NUMBER_OF_PLAYERS]; int playerWantsPotCounter = 0; - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) { @@ -255,7 +256,7 @@ void LocalRiver::distributePot() { highestCardsValueTemp = 0; // aktuellen highestCardsValueTemp berechnen, von denen die noch an der Potverteilung teilnehmen - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; i highestCardsValueTemp ) { highestCardsValueTemp = myHand->getPlayerArray()[i]->getMyCardsValueInt(); } @@ -264,7 +265,7 @@ void LocalRiver::distributePot() { // zu Beginn der Potverteilungsrunde die Anzahl der winner auf 0 setzen winnersCounter = 0; // Siegerposition und -anzahl von denen ermitteln, die noch an der Potverteilung teilnehmen - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyAction() == 1) { @@ -371,7 +372,7 @@ void LocalRiver::distributePot() { } // alle Spieler nacheinander durchgehen und prfen von wem die Winner wieviel Geld aus dem Pot bekommen - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; i using namespace std; @@ -27,7 +28,7 @@ LocalTurn::LocalTurn(HandInterface* bR, int id, int qP, int dP, int sB) : TurnIn { int i; //SmallBlind-Position ermitteln - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i; } @@ -53,7 +54,7 @@ void LocalTurn::turnRun() { bool allHighestSet = 1; // prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 ) - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) { // cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl; if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; } @@ -71,7 +72,7 @@ void LocalTurn::turnRun() { myHand->setActualRound(3); //Action l�chen und ActionButtons refresh - for(i=0; igetGuiInterface()->getMaxQuantityPlayers(); i++) { + for(i=0; igetPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0); } //Sets in den Pot verschieben und Sets = 0 und Pot-refresh @@ -95,12 +96,12 @@ void LocalTurn::turnRun() { } // n�hsten Spieler ermitteln - do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers()); + do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS); } while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6); //Spieler-Position vor SmallBlind-Position ermitteln int activePlayerBeforeSmallBlind = smallBlindPosition; - do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getGuiInterface()->getMaxQuantityPlayers() - 1 ) % (myHand->getGuiInterface()->getMaxQuantityPlayers()); + do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS); } while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6); myHand->getPlayerArray()[playersTurn]->setMyTurn(1); diff --git a/src/game.cpp b/src/game.cpp index 1d303055..3d5437a0 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -38,7 +38,7 @@ Game::Game(ConfigFile* c, GuiInterface* g, int qP, int sC, int sB, int gId) : my actualHandID = 0; - for(i=0; igetMaxQuantityPlayers(); i++) { + for(i=0; igetMaxQuantityPlayers(); i++) { + for(i=0; igetMaxQuantityPlayers(); i++) { + for(i=0; igetMaxQuantityPlayers(); i++) { + for(i=0; isetMyAction(0); } // Spieler mit leerem Cash auf inactive setzen - for(i=0; igetMaxQuantityPlayers(); i++) { + for(i=0; igetMyCash() == 0) playerArray[i]->setMyActiveStatus(0); } // Anzahl noch aktiver Spieler ermitteln actualQuantityPlayers = 0; - for(i=0; igetMaxQuantityPlayers(); i++) { + for(i=0; igetMyActiveStatus() != 0) actualQuantityPlayers++; } @@ -147,7 +147,7 @@ void Game::startHand() // Dealer-Button weiterschieben --> Achtung inactive do { - dealerPosition = (dealerPosition+1)%(myGui->getMaxQuantityPlayers()); + dealerPosition = (dealerPosition+1)%(MAX_NUMBER_OF_PLAYERS); } while(!(playerArray[dealerPosition]->getMyActiveStatus())); diff --git a/src/game.h b/src/game.h index 04416161..bc1e7cf0 100755 --- a/src/game.h +++ b/src/game.h @@ -24,6 +24,8 @@ #include #include +#include "game_defs.h" + class GuiInterface; class HandInterface; class PlayerInterface; diff --git a/src/game_defs.h b/src/game_defs.h new file mode 100644 index 00000000..7d73ef41 --- /dev/null +++ b/src/game_defs.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef GAME_DEFS_H +#define GAME_DEFS_H + +#define MAX_NUMBER_OF_PLAYERS 7 + +#endif diff --git a/src/gui/guiinterface.h b/src/gui/guiinterface.h index 6d6e1f07..7d73f1f0 100644 --- a/src/gui/guiinterface.h +++ b/src/gui/guiinterface.h @@ -39,9 +39,6 @@ public: virtual void setHand(HandInterface*) =0; virtual void setSession(Session*) =0; - //get - virtual int getMaxQuantityPlayers() const=0; - //refresh-Funktionen virtual void refreshSet() const=0; virtual void refreshCash() const=0; diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 4dcc1fb3..56272914 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -45,8 +45,6 @@ void GuiWrapper::setGame(Game *g) { myW->setGame(g); } void GuiWrapper::setHand(HandInterface *lh) { myW->setHand(lh); } void GuiWrapper::setSession(Session *s) { myW->setSession(s); } -int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); } - void GuiWrapper::refreshSet() const { myW->refreshSet(); } void GuiWrapper::refreshCash() const { myW->refreshCash(); } void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->refreshAction(playerID, playerAction); } diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index 46aa4681..8990b6f8 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -47,8 +47,6 @@ public: void setHand(HandInterface*); void setSession(Session*); - int getMaxQuantityPlayers() const; - void refreshSet() const; void refreshCash() const; void refreshAction(int =-1, int =-1) const; diff --git a/src/gui/qt/log/log.cpp b/src/gui/qt/log/log.cpp index b00d24ec..7e40422e 100644 --- a/src/gui/qt/log/log.cpp +++ b/src/gui/qt/log/log.cpp @@ -20,6 +20,7 @@ #include "log.h" #include "mainwindowimpl.h" +#include using namespace std; @@ -150,7 +151,7 @@ void Log::logNewGameHandMsg(int gameID, int handID) { //Aktive Spieler zählen int activePlayersCounter = 0; - for (k=0; kgetMaxQuantityPlayers(); k++) { + for (k=0; kgetActualHand()->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++; } k = 0; @@ -193,12 +194,12 @@ void Log::logNewGameHandMsg(int gameID, int handID) { } } stream << "
BLINDS: "; - for(i=0; igetMaxQuantityPlayers(); i++) { + for(i=0; igetMaxQuantityPlayers(); k++) { + for (k=0; kgetActualHand()->getPlayerArray()[k]->getMyAction() != 1 && myW->getActualHand()->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++; } if(activePlayersCounter < 3) { j=1; } @@ -206,10 +207,10 @@ void Log::logNewGameHandMsg(int gameID, int handID) { // cout << activePlayersCounter << endl; // cout << (i+myW->getActualHand()->getDealerPosition()+j)%5 << endl; - switch (myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%myW->getMaxQuantityPlayers()]->getMyButton()) { - case 2 : stream << QString::fromUtf8(myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%myW->getMaxQuantityPlayers()]->getMyName().c_str())+" ("+QString::number(myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%myW->getMaxQuantityPlayers()]->getMySet(),10)+"$), "; + switch (myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyButton()) { + case 2 : stream << QString::fromUtf8(myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$), "; break; - case 3 : stream << QString::fromUtf8(myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%myW->getMaxQuantityPlayers()]->getMyName().c_str())+" ("+QString::number(myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%myW->getMaxQuantityPlayers()]->getMySet(),10)+"$)"; + case 3 : stream << QString::fromUtf8(myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(myW->getActualHand()->getPlayerArray()[(i+myW->getActualHand()->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$)"; break; default :; } diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 3f80d687..688596c9 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -45,16 +45,11 @@ #define FORMATLEFT(X) "

(X)" #define FORMATRIGHT(X) "(X)

" -// muss mit GUI übereinstimmen -const int maxQuantityPlayersConst = 7; -// !!! in game.h ebenfalls bei playerArray[?] setzen !!! -// !!! in hand.h ebenfalls bei roundStartCashArray[?] setzen !!! -// !!! in mainwindowimpl.h ebenfalls bei *LabelArray[?] setzen !!! using namespace std; mainWindowImpl::mainWindowImpl(QMainWindow *parent) - : QMainWindow(parent), actualGame(0), actualHand(0), mySession(0), maxQuantityPlayers(maxQuantityPlayersConst), gameSpeed(0), debugMode(0), breakAfterActualHand(FALSE) + : QMainWindow(parent), actualGame(0), actualHand(0), mySession(0), gameSpeed(0), debugMode(0), breakAfterActualHand(FALSE) { int i; @@ -412,7 +407,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent) label_Pot->setFont(tmpFont2); tmpFont2.setPixelSize(10); - for (i=0; isetFont(tmpFont2); cashLabelArray[i]->setFont(tmpFont2); @@ -421,13 +416,13 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent) spinBox_set->setFont(tmpFont2); tmpFont2.setPixelSize(12); - for (i=0; isetFont(tmpFont2); } tmpFont2.setPixelSize(13); - for (i=0; isetFont(tmpFont2); } @@ -448,7 +443,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent) //Widgets Grafiken per Stylesheets setzen //Groupbox Background - for (i=1; isetStyleSheet("QGroupBox { background-image: url(:/guiv2/resources/guiv2/opponentBoxInactiveGlow.png) }"); } @@ -462,7 +457,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent) //raise actionLable above just inserted mypixmaplabel - for (i=0; iraise(); } + for (i=0; iraise(); } //ShortCuts @@ -741,7 +736,7 @@ void mainWindowImpl::callSettingsDialog() { int i,j; - for (i=1; igetIsFlipside()) { holeCardsArray[i][j]->setPixmap(*flipside, TRUE); @@ -765,7 +760,7 @@ void mainWindowImpl::setLog(Log* l) { myLog = l; } void mainWindowImpl::refreshSet() { int i; - for (i=0; igetPlayerArray()[i]->getMySet() == 0) setLabelArray[i]->setText(""); else setLabelArray[i]->setText("

Set: "+QString::number(actualHand->getPlayerArray()[i]->getMySet(),10)+" $

"); } @@ -780,11 +775,11 @@ void mainWindowImpl::refreshButton() { int k; //Aktive Spieler zählen int activePlayersCounter = 0; - for (k=0; kgetPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++; } - for (i=0; igetPlayerArray()[i]->getMyActiveStatus()) { if(activePlayersCounter > 2) { if (actualHand->getPlayerArray()[i]->getMyButton()==1) { @@ -810,7 +805,7 @@ void mainWindowImpl::refreshButton() { void mainWindowImpl::refreshPlayerName() { int i; - for (i=0; igetPlayerArray()[i]->getMyActiveStatus()) { playerNameLabelArray[i]->setText(QString::fromUtf8(actualHand->getPlayerArray()[i]->getMyName().c_str())); @@ -827,7 +822,7 @@ void mainWindowImpl::refreshPlayerAvatar() { QPixmap onePix(":/graphics/resources/graphics/1px.png"); int i; - for (i=0; igetPlayerArray()[i]->getMyActiveStatus()) { if(!i) { @@ -864,7 +859,7 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) { if(playerID == -1 || playerAction == -1) { int i; - for (i=0; i clear Pixmap if(actualHand->getPlayerArray()[i]->getMyAction() == 0) { @@ -913,7 +908,7 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) { void mainWindowImpl::refreshCash() { int i; - for (i=0; igetPlayerArray()[i]->getMyActiveStatus()) { cashLabelArray[i]->setText(QString::number(actualHand->getPlayerArray()[i]->getMyCash(),10)+" $"); @@ -931,7 +926,7 @@ void mainWindowImpl::refreshGroupbox(int playerID, int status) { if(playerID == -1 || status == -1) { int i,j; - for (i=0; igetPlayerArray()[i]->getMyTurn()) { //Groupbox glow wenn der Spiele dran ist. @@ -1061,7 +1056,7 @@ void mainWindowImpl::dealHoleCards() { // Karten der Gegner austeilen int i, j; - for(i=1; igetPlayerArray()[i]->getMyCards(tempCardsIntArray); for(j=0; j<2; j++) { if(actualHand->getPlayerArray()[i]->getMyActiveStatus()) { @@ -1631,7 +1626,7 @@ void mainWindowImpl::postRiverRunAnimation2() { //Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen int activePlayersCounter = 0; - for (i=0; igetPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++; } @@ -1648,7 +1643,7 @@ void mainWindowImpl::postRiverRunAnimation2() { int i, j; - for(i=0; igetPlayerArray()[i]->getMyCards(tempCardsIntArray); if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) { if(i) { @@ -1675,7 +1670,7 @@ void mainWindowImpl::postRiverRunAnimation2() { int tempCardsIntArray[2]; int i, j; - for(i=0; igetPlayerArray()[i]->getMyCards(tempCardsIntArray); if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) { if(i) { @@ -1698,7 +1693,7 @@ void mainWindowImpl::postRiverRunAnimation2() { else { int tempCardsIntArray[2]; int i; - for(i=0; igetPlayerArray()[i]->getMyCards(tempCardsIntArray); if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) { @@ -1718,7 +1713,7 @@ void mainWindowImpl::postRiverRunAnimation3() { // cout << "Neue Runde" << endl; //Alle Winner erhellen und "Winner" schreiben - for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) { // QPalette tempPalette = groupBoxArray[i]->palette(); @@ -1733,44 +1728,44 @@ void mainWindowImpl::postRiverRunAnimation3() { //index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation bool index0 = TRUE; - for(j=0; jgetPlayerArray()[i]->getMyBestHandPosition())[j] << endl; if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 0 ) { index0 = FALSE; } } if (index0) { holeCardsArray[i][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/} //index 1 testen bool index1 = TRUE; - for(j=0; jgetPlayerArray()[i]->getMyBestHandPosition())[j] == 1 ) { index1 = FALSE; } } if (index1) { holeCardsArray[i][1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index1" << endl;*/} //index 2 testen bool index2 = TRUE; - for(j=0; jgetPlayerArray()[i]->getMyBestHandPosition())[j] == 2 ) { index2 = FALSE; } } if (index2) { boardCardsArray[0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index2" << endl;*/} //index 3 testen bool index3 = TRUE; - for(j=0; jgetPlayerArray()[i]->getMyBestHandPosition())[j] == 3 ) { index3 = FALSE; } } if (index3) { boardCardsArray[1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index3" << endl;*/} //index 4 testen bool index4 = TRUE; - for(j=0; jgetPlayerArray()[i]->getMyBestHandPosition())[j] == 4 ) { index4 = FALSE; } } if (index4) { boardCardsArray[2]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index4" << endl;*/} //index 5 testen bool index5 = TRUE; - for(j=0; jgetPlayerArray()[i]->getMyBestHandPosition())[j] == 5 ) { index5 = FALSE; } } if (index5) { boardCardsArray[3]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index5" << endl;*/} //index 6 testen bool index6 = TRUE; - for(j=0; jgetPlayerArray()[i]->getMyBestHandPosition())[j] == 6 ) { index6 = FALSE; } } if (index6) { boardCardsArray[4]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index6" << endl;*/} @@ -1818,7 +1813,7 @@ void mainWindowImpl::postRiverRunAnimation5() { label_Pot->setText(""); - for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) { cashTopLabelArray[i]->setText(""); @@ -1828,7 +1823,7 @@ void mainWindowImpl::postRiverRunAnimation5() { else { label_Pot->setText("Pot"); - for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) { cashTopLabelArray[i]->setText("Cash:"); @@ -1888,7 +1883,7 @@ void mainWindowImpl::flipHolecardsAllIn() { if(!flipHolecardsAllInAlreadyDone) { //Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen int activePlayersCounter = 0; - for (i=0; igetPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++; } @@ -1903,7 +1898,7 @@ void mainWindowImpl::flipHolecardsAllIn() { int i, j; - for(i=0; igetPlayerArray()[i]->getMyCards(tempCardsIntArray); if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) { if(i) { @@ -1930,7 +1925,7 @@ void mainWindowImpl::flipHolecardsAllIn() { int temp2CardsIntArray[2]; int i, j; - for(i=0; igetPlayerArray()[i]->getMyCards(temp2CardsIntArray); if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) { if(i) { @@ -1993,7 +1988,7 @@ void mainWindowImpl::nextRoundCleanGui() { boardCardsArray[i]->setFadeOutAction(FALSE); } - for (i=0; isetFadeOutAction(FALSE);} } diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index e52c1c93..9e5b2cee 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -28,9 +28,10 @@ #include #include "handinterface.h" +#include "game_defs.h" -class Game; class Session; +class Game; class Log; class ConfigFile; @@ -61,8 +62,6 @@ public: void setSession(Session*); void setLog(Log*); - int getMaxQuantityPlayers() const { return maxQuantityPlayers; } - void setActualHand(HandInterface* theValue) { actualHand = theValue;} HandInterface* getActualHand() const { return actualHand;} @@ -225,7 +224,7 @@ private: MyCardsPixmapLabel *pixmapLabel_card6b; //Timer QTimer *potDistributeTimer; - QTimer *timer; + QTimer *timer; QTimer *dealFlopCards0Timer; QTimer *dealFlopCards1Timer; QTimer *dealFlopCards2Timer; @@ -258,17 +257,17 @@ private: QTimer *postRiverRunAnimation6Timer; QWidget *userWidgetsArray[4]; - QLabel *buttonLabelArray[7]; - QLabel *cashLabelArray[7]; - QLabel *cashTopLabelArray[7]; - QLabel *setLabelArray[7]; - QLabel *actionLabelArray[7]; - QLabel *playerNameLabelArray[7]; - QLabel *playerAvatarLabelArray[7]; + QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS]; + QLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS]; + QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS]; + QLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS]; + QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS]; + QLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS]; + QLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS]; - QGroupBox *groupBoxArray[7]; + QGroupBox *groupBoxArray[MAX_NUMBER_OF_PLAYERS]; MyCardsPixmapLabel *boardCardsArray[5]; - MyCardsPixmapLabel *holeCardsArray[7][2]; + MyCardsPixmapLabel *holeCardsArray[MAX_NUMBER_OF_PLAYERS][2]; QPixmap *flipside; @@ -279,8 +278,6 @@ private: createNetworkGameDialogImpl *myCreateNetworkGameDialog; waitForServerToStartGameDialogImpl *myWaitingForServerGameDialog; - int maxQuantityPlayers; - int distributePotAnimCounter; //Speed