Maximum number of players is now a constant in game_defs.h.

This commit is contained in:
lotodore
2007-04-17 07:28:32 +00:00
parent 496261de7b
commit 27cd08ccb0
15 changed files with 134 additions and 115 deletions
-3
View File
@@ -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;
-2
View File
@@ -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); }
-2
View File
@@ -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;
+7 -6
View File
@@ -20,6 +20,7 @@
#include "log.h"
#include "mainwindowimpl.h"
#include <game_defs.h>
using namespace std;
@@ -150,7 +151,7 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
//Aktive Spieler zählen
int activePlayersCounter = 0;
for (k=0; k<myW->getMaxQuantityPlayers(); k++) {
for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
if (myW->getActualHand()->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
}
k = 0;
@@ -193,12 +194,12 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
}
}
stream << "</br>BLINDS: ";
for(i=0; i<myW->getMaxQuantityPlayers(); i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
j = 0;
//Aktive Spieler zählen
int activePlayersCounter = 0;
for (k=0; k<myW->getMaxQuantityPlayers(); k++) {
for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
if (myW->getActualHand()->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 :;
}
+34 -39
View File
@@ -45,16 +45,11 @@
#define FORMATLEFT(X) "<p align='center'>(X)"
#define FORMATRIGHT(X) "(X)</p>"
// 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; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
cashTopLabelArray[i]->setFont(tmpFont2);
cashLabelArray[i]->setFont(tmpFont2);
@@ -421,13 +416,13 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
spinBox_set->setFont(tmpFont2);
tmpFont2.setPixelSize(12);
for (i=0; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
setLabelArray[i]->setFont(tmpFont2);
}
tmpFont2.setPixelSize(13);
for (i=0; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
playerNameLabelArray[i]->setFont(tmpFont2);
}
@@ -448,7 +443,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
//Widgets Grafiken per Stylesheets setzen
//Groupbox Background
for (i=1; i<maxQuantityPlayers; i++) {
for (i=1; i<MAX_NUMBER_OF_PLAYERS; i++) {
groupBoxArray[i]->setStyleSheet("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; i<maxQuantityPlayers; i++) { actionLabelArray[i]->raise(); }
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { actionLabelArray[i]->raise(); }
//ShortCuts
@@ -741,7 +736,7 @@ void mainWindowImpl::callSettingsDialog() {
int i,j;
for (i=1; i<maxQuantityPlayers; i++ ) {
for (i=1; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
for ( j=0; j<=1; j++ ) {
if (holeCardsArray[i][j]->getIsFlipside()) {
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; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[i]->getMySet() == 0) setLabelArray[i]->setText("");
else setLabelArray[i]->setText("<p align='center'><b>Set:</b> "+QString::number(actualHand->getPlayerArray()[i]->getMySet(),10)+" $</p>");
}
@@ -780,11 +775,11 @@ void mainWindowImpl::refreshButton() {
int k;
//Aktive Spieler zählen
int activePlayersCounter = 0;
for (k=0; k<maxQuantityPlayers; k++) {
for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
if (actualHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
}
for (i=0; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[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<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
//if no action --> 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; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for(i=1; i<MAX_NUMBER_OF_PLAYERS; i++) {
actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if (actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
}
@@ -1648,7 +1643,7 @@ void mainWindowImpl::postRiverRunAnimation2() {
int i, j;
for(i=0; i<maxQuantityPlayers; i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[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; j<maxQuantityPlayers; j++) {
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
// cout << (actualHand->getPlayerArray()[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; j<maxQuantityPlayers; j++) {
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
if ((actualHand->getPlayerArray()[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; j<maxQuantityPlayers; j++) {
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
if ((actualHand->getPlayerArray()[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; j<maxQuantityPlayers; j++) {
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
if ((actualHand->getPlayerArray()[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; j<maxQuantityPlayers; j++) {
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
if ((actualHand->getPlayerArray()[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; j<maxQuantityPlayers; j++) {
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
if ((actualHand->getPlayerArray()[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; j<maxQuantityPlayers; j++) {
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
if ((actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[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("<span style='font-weight:bold'>Pot</span>");
for(i=0; i<maxQuantityPlayers; i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) {
cashTopLabelArray[i]->setText("<b>Cash:</b>");
@@ -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; i<maxQuantityPlayers; i++) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if (actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
}
@@ -1903,7 +1898,7 @@ void mainWindowImpl::flipHolecardsAllIn() {
int i, j;
for(i=0; i<maxQuantityPlayers; i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++) {
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
actualHand->getPlayerArray()[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; i<maxQuantityPlayers; i++ ) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
for ( j=0; j<=1; j++ ) { holeCardsArray[i][j]->setFadeOutAction(FALSE);}
}
+12 -15
View File
@@ -28,9 +28,10 @@
#include <QtCore>
#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