logging-bugfixes

This commit is contained in:
doitux
2007-02-14 23:24:17 +00:00
parent 3292a61f31
commit d0cc7b114b
3 changed files with 32 additions and 16 deletions
+18 -9
View File
@@ -224,19 +224,22 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
} }
void Log::logPlayerWinsMsg(int playerID, int pot, int cardsValueInt) { void Log::logPlayerWinsMsg(int playerID, int pot) {
int i; int i;
myW->textBrowser_Log->append(QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$ with "+translateCardsValueCode(cardsValueInt).at(0)+"!!! ");
myLogFile->open( QIODevice::ReadWrite ); myLogFile->open( QIODevice::ReadWrite );
QTextStream stream( myLogFile ); QTextStream stream( myLogFile );
for(i=0; i<=linesInFile; i++) { stream.readLine(); } for(i=0; i<=linesInFile; i++) { stream.readLine(); }
QString msg("</br><i>"+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n"); // if (cardsValueInt != -1) {
stream << msg; // myW->textBrowser_Log->append(QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$ with "+translateCardsValueCode(cardsValueInt).at(0)+"!!! ");
// stream << "</br><i>"+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
// }
// else {
myW->textBrowser_Log->append(QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!! ");
stream << "</br><i>"+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
// }
myLogFile->close(); myLogFile->close();
linesInFile++; linesInFile++;
@@ -273,7 +276,7 @@ void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int
} }
void Log::logFlipHoleCardsMsg(std::string playerName, int card1, int card2) { void Log::logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt) {
int i; int i;
@@ -281,9 +284,15 @@ void Log::logFlipHoleCardsMsg(std::string playerName, int card1, int card2) {
QTextStream stream( myLogFile ); QTextStream stream( myLogFile );
for(i=0; i<=linesInFile; i++) { stream.readLine(); } 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)+"]"); if (cardsValueInt != -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"; myW->textBrowser_Log->append(QString::fromStdString(playerName)+" shows \""+translateCardsValueCode(cardsValueInt).at(0)+"\"");
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)+"] - "+translateCardsValueCode(cardsValueInt).at(0)+"</br>\n";
}
else {
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(); myLogFile->close();
linesInFile++; linesInFile++;
} }
+2 -2
View File
@@ -40,9 +40,9 @@ public:
void logPlayerActionMsg(std::string playerName, int action, int setValue); void logPlayerActionMsg(std::string playerName, int action, int setValue);
void logNewGameHandMsg(int gameID, int handID); void logNewGameHandMsg(int gameID, int handID);
void logPlayerWinsMsg(int playerID, int pot, int cardsValueInt); void logPlayerWinsMsg(int playerID, int pot);
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1); 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 logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1);
QStringList translateCardsValueCode(int cardsValueCode); QStringList translateCardsValueCode(int cardsValueCode);
QStringList translateCardCode(int cardCode); QStringList translateCardCode(int cardCode);
+12 -5
View File
@@ -1387,13 +1387,13 @@ void mainWindowImpl::postRiverRunAnimation2() {
} }
//Karten umdrehen Loggen //Karten umdrehen Loggen
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[i]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1]); myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[i]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1], actualHand->getPlayerArray()[i]->getMyCardsValueInt());
} }
} }
//Karten umdrehen für Human PlayerLoggen //Karten umdrehen für Human PlayerLoggen
actualHand->getPlayerArray()[0]->getMyCards(tempCardsIntArray); actualHand->getPlayerArray()[0]->getMyCards(tempCardsIntArray);
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[0]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1]); myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[0]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1], actualHand->getPlayerArray()[0]->getMyCardsValueInt());
} }
else { else {
//Ohne Eye-Candy //Ohne Eye-Candy
@@ -1415,12 +1415,12 @@ void mainWindowImpl::postRiverRunAnimation2() {
} }
//Karten umdrehen Loggen //Karten umdrehen Loggen
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[i]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1] ); myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[i]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1], actualHand->getPlayerArray()[i]->getMyCardsValueInt() );
} }
} }
//Karten umdrehen für Human PlayerLoggen //Karten umdrehen für Human PlayerLoggen
actualHand->getPlayerArray()[0]->getMyCards(tempCardsIntArray); actualHand->getPlayerArray()[0]->getMyCards(tempCardsIntArray);
myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[0]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1]); myLog->logFlipHoleCardsMsg(actualHand->getPlayerArray()[0]->getMyName(), tempCardsIntArray[0], tempCardsIntArray[1], actualHand->getPlayerArray()[0]->getMyCardsValueInt());
} }
@@ -1503,7 +1503,14 @@ void mainWindowImpl::postRiverRunAnimation3() {
//Pro Spieler den Cash aus dem Player und dem Label auslesen. Player_cash - Label_cash = Gewinnsumme //Pro Spieler den Cash aus dem Player und dem Label auslesen. Player_cash - Label_cash = Gewinnsumme
bool toIntBool = TRUE; bool toIntBool = TRUE;
int pot = actualHand->getPlayerArray()[i]->getMyCash() - cashLabelArray[i]->text().remove(" $").toInt(&toIntBool,10) ; int pot = actualHand->getPlayerArray()[i]->getMyCash() - cashLabelArray[i]->text().remove(" $").toInt(&toIntBool,10) ;
myLog->logPlayerWinsMsg(i, pot, actualHand->getPlayerArray()[i]->getMyCardsValueInt()); //Wenn River dann auch das Blatt loggen!
// if (textLabel_handLabel->text() == "River") {
myLog->logPlayerWinsMsg(i, pot);
// }
// else {
// myLog->logPlayerWinsMsg(i, pot);
// }
//
} }
else { else {