From 57ae6a106583120f346261ef2c18562dbc4fe7a2 Mon Sep 17 00:00:00 2001
From: doitux
Date: Sat, 10 Feb 2007 22:35:35 +0000
Subject: [PATCH] fixed dealer assignment when actualquantity players < 3
---
src/gui/qt/log.cpp | 61 ++++++++++++++++++------
src/gui/qt/mainwindow/mainwindowimpl.cpp | 29 +++++++++--
2 files changed, 70 insertions(+), 20 deletions(-)
diff --git a/src/gui/qt/log.cpp b/src/gui/qt/log.cpp
index 1c980258..046114c4 100644
--- a/src/gui/qt/log.cpp
+++ b/src/gui/qt/log.cpp
@@ -142,22 +142,53 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
stream << "##### Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" #####" << "\n";
stream << "CASH: ";
- for(i=0; igetActualHand()->getActualQuantityPlayers(); i++) {
- if(myW->getActualHand()->getPlayerArray()[i]->getMyButton() == 1) {
- if(i == myW->getActualHand()->getActualQuantityPlayers()-1) {
- stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+" (Dealer): "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$";
+ int k = 0;
+ //Aktive Spieler zählen
+ int activePlayersCounter = 0;
+ for (k=0; kgetMaxQuantityPlayers(); k++) {
+ if (myW->getActualHand()->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
+ }
+ if(activePlayersCounter > 2) {
+
+ for(i=0; igetActualHand()->getActualQuantityPlayers(); i++) {
+
+ if(myW->getActualHand()->getPlayerArray()[i]->getMyButton() == 1) {
+ if(i == myW->getActualHand()->getActualQuantityPlayers()-1) {
+ stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+" (Dealer): "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$";
+ }
+ else {
+ stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+" (Dealer): "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$, ";
+ }
}
else {
- stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+" (Dealer): "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$, ";
- }
+ if(i == myW->getActualHand()->getActualQuantityPlayers()-1) {
+ stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+": "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$";
+ }
+ else {
+ stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+": "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$, ";
+ }
+ }
}
- else {
- if(i == myW->getActualHand()->getActualQuantityPlayers()-1) {
- stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+": "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$";
+ }
+ else {
+ for(i=0; igetActualHand()->getActualQuantityPlayers(); i++) {
+
+ if(myW->getActualHand()->getPlayerArray()[i]->getMyButton() == 3) {
+ if(i == myW->getActualHand()->getActualQuantityPlayers()-1) {
+ stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+" (Dealer): "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$";
+ }
+ else {
+ stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+" (Dealer): "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$, ";
+ }
}
else {
- stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+": "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$, ";
+ if(i == myW->getActualHand()->getActualQuantityPlayers()-1) {
+ stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+": "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$";
+ }
+ else {
+ stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+": "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$, ";
+ }
}
}
}
@@ -183,11 +214,13 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
default :;
}
}
- stream << "
\n";
+
+ stream << "PREFLOP";
+ stream << "\n";
myLogFile->close();
- linesInFile = linesInFile+3;
+ linesInFile = linesInFile+2;
}
@@ -201,12 +234,10 @@ void Log::logPlayerWinsMsg(int playerID) {
QTextStream stream( myLogFile );
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
- QString msg(""+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins!!!
\n");
+ QString msg(""+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins!!!
\n");
stream << msg;
myLogFile->close();
linesInFile++;
- linesInFile++;
-
}
diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp
index e956053f..46dd4f25 100755
--- a/src/gui/qt/mainwindow/mainwindowimpl.cpp
+++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp
@@ -605,13 +605,32 @@ void mainWindowImpl::refreshButton() {
QPixmap onePix(":/graphics/graphics/1px.png");
int i;
+ int k;
+ //Aktive Spieler zählen
+ int activePlayersCounter = 0;
+ for (k=0; kgetPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
+ }
+
for (i=0; igetActualQuantityPlayers(); i++) {
- if (actualHand->getPlayerArray()[i]->getMyButton()==1) {
- buttonLabelArray[i]->setPixmap(dealerButton);
- }
- else {
- buttonLabelArray[i]->setPixmap(onePix);
+
+ if(activePlayersCounter > 2) {
+ if (actualHand->getPlayerArray()[i]->getMyButton()==1) {
+ buttonLabelArray[i]->setPixmap(dealerButton);
+ }
+ else {
+ buttonLabelArray[i]->setPixmap(onePix);
+ }
}
+ else {
+ if (actualHand->getPlayerArray()[i]->getMyButton()==3) {
+ buttonLabelArray[i]->setPixmap(dealerButton);
+ }
+ else {
+ buttonLabelArray[i]->setPixmap(onePix);
+ }
+ }
+
}
}