Logs improved (Pot, Cards)
This commit is contained in:
+90
-6
@@ -83,7 +83,7 @@ Log::Log(mainWindowImpl* w) : myW(w)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Log::~Log()
|
||||
@@ -140,7 +140,7 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
|
||||
QTextStream stream( myLogFile );
|
||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||
|
||||
stream << "<p><b>##### Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" #####</b></br>";
|
||||
stream << "<p><b>####################   Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"   ####################</b></br>";
|
||||
stream << "CASH: ";
|
||||
|
||||
int k = 0;
|
||||
@@ -224,17 +224,17 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
|
||||
|
||||
}
|
||||
|
||||
void Log::logPlayerWinsMsg(int playerID) {
|
||||
void Log::logPlayerWinsMsg(int playerID, int pot) {
|
||||
|
||||
int i;
|
||||
|
||||
myW->textBrowser_Log->append(QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins!!! ");
|
||||
myW->textBrowser_Log->append(QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!! ");
|
||||
|
||||
myLogFile->open( QIODevice::ReadWrite );
|
||||
QTextStream stream( myLogFile );
|
||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||
|
||||
QString msg("</br><i>"+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins!!!</i></p>\n");
|
||||
QString msg("</br><i>"+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n");
|
||||
stream << msg;
|
||||
|
||||
myLogFile->close();
|
||||
@@ -242,18 +242,102 @@ void Log::logPlayerWinsMsg(int playerID) {
|
||||
linesInFile++;
|
||||
}
|
||||
|
||||
void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3) {
|
||||
void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) {
|
||||
|
||||
int i;
|
||||
|
||||
myLogFile->open( QIODevice::ReadWrite );
|
||||
QTextStream stream( myLogFile );
|
||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||
|
||||
QString round;
|
||||
switch (roundID) {
|
||||
|
||||
case 1: round = "Flop";
|
||||
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]");
|
||||
stream << "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+"]"+"</br>\n";
|
||||
break;
|
||||
case 2: round = "Turn";
|
||||
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]");
|
||||
stream << "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+"]"+"</br>\n";
|
||||
break;
|
||||
case 3: round = "River";
|
||||
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]");
|
||||
stream << "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+",<b>"+translateCardCode(card5).at(0)+"</b>"+translateCardCode(card5).at(1)+"]"+"</br>\n";
|
||||
break;
|
||||
default: round = "ERROR";
|
||||
}
|
||||
|
||||
myLogFile->close();
|
||||
linesInFile++;
|
||||
|
||||
}
|
||||
|
||||
void Log::logFlipHoleCardsMsg(std::string playerName, int card1, int card2) {
|
||||
|
||||
int i;
|
||||
|
||||
myLogFile->open( QIODevice::ReadWrite );
|
||||
QTextStream stream( myLogFile );
|
||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||
|
||||
myW->textBrowser_Log->append(QString::fromStdString(playerName)+" shows "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]");
|
||||
stream << QString::fromStdString(playerName)+" shows [ <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"]"+"</br>\n";
|
||||
|
||||
myLogFile->close();
|
||||
linesInFile++;
|
||||
}
|
||||
|
||||
QStringList Log::translateCardCode(int cardCode) {
|
||||
|
||||
int value = cardCode%13;
|
||||
int color = cardCode/13;
|
||||
|
||||
QStringList cardString;
|
||||
|
||||
switch (value) {
|
||||
|
||||
case 0: cardString << "2";
|
||||
break;
|
||||
case 1: cardString << "3";
|
||||
break;
|
||||
case 2: cardString << "4";
|
||||
break;
|
||||
case 3: cardString << "5";
|
||||
break;
|
||||
case 4: cardString << "6";
|
||||
break;
|
||||
case 5: cardString << "7";
|
||||
break;
|
||||
case 6: cardString << "8";
|
||||
break;
|
||||
case 7: cardString << "9";
|
||||
break;
|
||||
case 8: cardString << "10";
|
||||
break;
|
||||
case 9: cardString << "J";
|
||||
break;
|
||||
case 10: cardString << "D";
|
||||
break;
|
||||
case 11: cardString << "K";
|
||||
break;
|
||||
case 12: cardString << "A";
|
||||
break;
|
||||
default: cardString << "ERROR";
|
||||
}
|
||||
|
||||
switch (color) {
|
||||
|
||||
case 0: cardString << "d";
|
||||
break;
|
||||
case 1: cardString << "h";
|
||||
break;
|
||||
case 2: cardString << "s";
|
||||
break;
|
||||
case 3: cardString << "c";
|
||||
break;
|
||||
default: cardString << "ERROR";
|
||||
}
|
||||
|
||||
return cardString;
|
||||
}
|
||||
|
||||
+5
-4
@@ -38,12 +38,13 @@ public:
|
||||
~Log();
|
||||
|
||||
|
||||
void logPlayerActionMsg(std::string playName, int action, int setValue);
|
||||
void logPlayerActionMsg(std::string playerName, int action, int setValue);
|
||||
void logNewGameHandMsg(int gameID, int handID);
|
||||
void logPlayerWinsMsg(int playerID);
|
||||
void logDealBoardCardsMsg(int roundID, int card1, int card2 = -1, int card3 = -1);
|
||||
void logPlayerWinsMsg(int playerID, int pot);
|
||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
|
||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2);
|
||||
|
||||
void closeLogFile();
|
||||
QStringList translateCardCode(int cardCode);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -1315,7 +1315,11 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="textLabel_Cash0" />
|
||||
<widget class="QLabel" name="textLabel_Cash0" >
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="textLabel_TopCash0" />
|
||||
@@ -2918,6 +2922,9 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
@@ -3395,6 +3402,9 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -3685,6 +3695,9 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -3975,6 +3988,9 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -92,6 +92,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
|
||||
textLabel_handNumber->setFont(tmpFont);
|
||||
textLabel_gameNumber->setFont(tmpFont);
|
||||
textLabel_Sets->setFont(tmpFont);
|
||||
textLabel_Cash0->setFont(tmpFont);
|
||||
tmpFont.setPixelSize(15);
|
||||
textLabel_Pot->setFont(tmpFont);
|
||||
tmpFont.setPixelSize(21);
|
||||
@@ -683,11 +684,11 @@ void mainWindowImpl::refreshCash() {
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
|
||||
if (i==0) {
|
||||
cashLabelArray[0]->setText("<p align='center'><span style='font-size:14px'>"+QString::number(actualHand->getPlayerArray()[i]->getMyCash(),10)+" $</span></p>");
|
||||
cashLabelArray[0]->setText(QString::number(actualHand->getPlayerArray()[i]->getMyCash(),10)+" $");
|
||||
cashTopLabelArray[0]->setText("<p align='center'><span style='font-size:15px; font-weight:bold'>Cash:</span></p>");
|
||||
}
|
||||
else {
|
||||
cashLabelArray[i]->setText("<p align='center'>"+QString::number(actualHand->getPlayerArray()[i]->getMyCash(),10)+" $</p>");
|
||||
cashLabelArray[i]->setText(QString::number(actualHand->getPlayerArray()[i]->getMyCash(),10)+" $");
|
||||
cashTopLabelArray[i]->setText("<p align='center'><b>Cash:</b></p>");
|
||||
}
|
||||
} else {
|
||||
@@ -916,7 +917,8 @@ void mainWindowImpl::dealFlopCards6() {
|
||||
//ohne Eye-Candy
|
||||
boardCardsArray[2]->setPixmap(card, FALSE);
|
||||
}
|
||||
|
||||
|
||||
myLog->logDealBoardCardsMsg(1, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]);
|
||||
// stable
|
||||
// wenn alle All In
|
||||
if(actualHand->getAllInCondition()) { dealFlopCards6Timer->start(AllInDealCardsSpeed); }
|
||||
@@ -952,6 +954,7 @@ void mainWindowImpl::dealTurnCards2() {
|
||||
boardCardsArray[3]->setPixmap(card, FALSE);
|
||||
}
|
||||
|
||||
myLog->logDealBoardCardsMsg(2, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3]);
|
||||
// stable
|
||||
// wenn alle All In
|
||||
if(actualHand->getAllInCondition()) { dealTurnCards2Timer->start(AllInDealCardsSpeed);
|
||||
@@ -988,6 +991,7 @@ void mainWindowImpl::dealRiverCards2() {
|
||||
boardCardsArray[4]->setPixmap(card, FALSE);
|
||||
}
|
||||
|
||||
myLog->logDealBoardCardsMsg(3, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
||||
// stable
|
||||
// wenn alle All In
|
||||
if(actualHand->getAllInCondition()) { dealRiverCards2Timer->start(AllInDealCardsSpeed); }
|
||||
@@ -1373,17 +1377,23 @@ void mainWindowImpl::postRiverRunAnimation2() {
|
||||
int tempCardsIntArray[2];
|
||||
|
||||
int i, j;
|
||||
|
||||
|
||||
for(i=1; i<maxQuantityPlayers; i++) {
|
||||
actualHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
||||
for(j=0; j<2; j++) {
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
for(j=0; j<2; j++) {
|
||||
|
||||
holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(":/cards/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
|
||||
|
||||
}
|
||||
//Karten umdrehen Loggen
|
||||
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[i]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1]);
|
||||
|
||||
}
|
||||
}
|
||||
//Karten umdrehen für Human PlayerLoggen
|
||||
actualHand->getPlayerArray()[0]->getMyCards(tempCardsIntArray);
|
||||
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[0]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1]);
|
||||
}
|
||||
else {
|
||||
//Ohne Eye-Candy
|
||||
@@ -1398,16 +1408,23 @@ void mainWindowImpl::postRiverRunAnimation2() {
|
||||
int i, j;
|
||||
for(i=1; i<maxQuantityPlayers; i++) {
|
||||
actualHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
||||
for(j=0; j<2; j++) {
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
for(j=0; j<2; j++) {
|
||||
tempCardsPixmapArray[j].load(":/cards/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");
|
||||
holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
|
||||
|
||||
}
|
||||
//Karten umdrehen Loggen
|
||||
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[i]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1] );
|
||||
}
|
||||
}
|
||||
//Karten umdrehen für Human PlayerLoggen
|
||||
actualHand->getPlayerArray()[0]->getMyCards(tempCardsIntArray);
|
||||
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[0]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Wenn einmal umgedreht dann fertig!!
|
||||
flipHolecardsAllInAlreadyDone = TRUE;
|
||||
}
|
||||
@@ -1432,8 +1449,6 @@ void mainWindowImpl::postRiverRunAnimation3() {
|
||||
groupBoxArray[i]->setPalette(tempPalette);
|
||||
actionLabelArray[i]->setText("<p align='center'><b>- Winner -</b></p>");
|
||||
|
||||
myLog->logPlayerWinsMsg(i);
|
||||
|
||||
//nicht gewonnene Karten ausblenden
|
||||
if ( actualHand->getActivePlayersCounter() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
|
||||
|
||||
@@ -1483,6 +1498,12 @@ void mainWindowImpl::postRiverRunAnimation3() {
|
||||
}
|
||||
if (index6) { boardCardsArray[4]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index6" << endl;*/}
|
||||
}
|
||||
|
||||
//Pot-Verteilung Loggen
|
||||
//Pro Spieler den Cash aus dem Player und dem Label auslesen. Player_cash - Label_cash = Gewinnsumme
|
||||
bool toIntBool = TRUE;
|
||||
int pot = actualHand->getPlayerArray()[i]->getMyCash() - cashLabelArray[i]->text().remove(" $").toInt(&toIntBool,10) ;
|
||||
myLog->logPlayerWinsMsg(i, pot);
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -1493,6 +1514,8 @@ void mainWindowImpl::postRiverRunAnimation3() {
|
||||
holeCardsArray[i][0]->startFadeOut(guiGameSpeed);
|
||||
holeCardsArray[i][1]->startFadeOut(guiGameSpeed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1564,6 +1587,7 @@ void mainWindowImpl::postRiverRunAnimation5() {
|
||||
|
||||
void mainWindowImpl::postRiverRunAnimation6() {
|
||||
|
||||
|
||||
int i;
|
||||
refreshCash();
|
||||
refreshPot();
|
||||
@@ -1609,14 +1633,18 @@ void mainWindowImpl::flipHolecardsAllIn() {
|
||||
|
||||
for(i=1; i<maxQuantityPlayers; i++) {
|
||||
actualHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
||||
for(j=0; j<2; j++) {
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
for(j=0; j<2; j++) {
|
||||
holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(":/cards/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
|
||||
|
||||
}
|
||||
}
|
||||
//Karten umdrehen Loggen
|
||||
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[i]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1]);
|
||||
|
||||
}
|
||||
}
|
||||
//Karten umdrehen für Human PlayerLoggen
|
||||
actualHand->getPlayerArray()[0]->getMyCards(tempCardsIntArray);
|
||||
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[0]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1]);
|
||||
}
|
||||
else {
|
||||
//Ohne Eye-Candy
|
||||
@@ -1631,18 +1659,24 @@ void mainWindowImpl::flipHolecardsAllIn() {
|
||||
int i, j;
|
||||
for(i=1; i<maxQuantityPlayers; i++) {
|
||||
actualHand->getPlayerArray()[i]->getMyCards(temp2CardsIntArray);
|
||||
for(j=0; j<2; j++) {
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
for(j=0; j<2; j++) {
|
||||
|
||||
tempCardsPixmapArray[j].load(":/cards/graphics/cards/"+QString::number(temp2CardsIntArray[j], 10)+".png");
|
||||
holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
|
||||
|
||||
}
|
||||
//Karten umdrehen Loggen
|
||||
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[i]->getMyName(), temp2CardsIntArray[0], temp2CardsIntArray[1] );
|
||||
}
|
||||
}
|
||||
//Karten umdrehen für Human PlayerLoggen
|
||||
actualHand->getPlayerArray()[0]->getMyCards(temp2CardsIntArray);
|
||||
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[0]->getMyName(), temp2CardsIntArray[0], temp2CardsIntArray[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Wenn einmal umgedreht dann fertig!!
|
||||
flipHolecardsAllInAlreadyDone = TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user