additional log in sqlite-db + preparation for replay mode

This commit is contained in:
floty
2010-05-29 14:05:41 +00:00
parent 4e3d885bc3
commit 4643e7ff89
19 changed files with 372 additions and 61 deletions
+19 -5
View File
@@ -98,6 +98,20 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
if(DEBUG_MODE) {
//QSqlDatabase *mySqliteLogDb;
// myGui->getMyW()->getSession();
//QSqlDatabase * test = myGui->getMyLog()->getMySqliteLogDb();
// if(!mySqliteLogDb->open()) {
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
// }
int temp5Array[5];
switch(myID) {
@@ -108,7 +122,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
tempBoardArray[1] = 21;
tempBoardArray[2] = 50;
tempBoardArray[3] = 15;
tempBoardArray[4] = 12;
tempBoardArray[4] = -1;
myBoard->setMyCards(tempBoardArray);
@@ -121,8 +135,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player0
it = seatsList->begin();
tempPlayerArray[0] = 13;
tempPlayerArray[1] = 22;
tempPlayerArray[0] = 0;
tempPlayerArray[1] = 1;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -174,7 +188,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
it++;
tempPlayerArray[0] = 48;
tempPlayerArray[1] = 7;
tempPlayerArray[1] = 2;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -347,7 +361,7 @@ void LocalHand::start() {
it_sB = getActivePlayerIt(getCurrentBeRo()->getSmallBlindPositionId());
it_bB = getActivePlayerIt(getCurrentBeRo()->getBigBlindPositionId());
if(it_sB != getActivePlayerList()->end() && it_bB != getActivePlayerList()->end()) {
myGui->logNewBlindsSetsMsg((*it_sB)->getMySet(), (*it_bB)->getMySet(), (*it_sB)->getMyName().c_str(), (*it_bB)->getMyName().c_str());
myGui->logNewBlindsSetsMsg((*it_sB)->getMySet(), (*it_bB)->getMySet(), (*it_sB)->getMyName().c_str(), (*it_bB)->getMyName().c_str());
}
else { LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID"); }
myGui->flushLogAtHand();
+7 -5
View File
@@ -856,6 +856,8 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
// !!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!
if(DEBUG_MODE) {
//cout << myConfig->readConfigString("LogDir").c_str() << endl;
switch(myUniqueID) {
case 0: {
@@ -874,19 +876,19 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
myCash=9395;
} break;
case 5: {
myCash=0;
myCash=100;
} break;
case 6: {
myCash=0;
} break;
case 7: {
myCash=0;
myCash=0;
} break;
case 8: {
myCash=0;
myCash=0;
} break;
case 9: {
myCash=0;
myCash=0;
} break;
default: {
@@ -1048,7 +1050,7 @@ void LocalPlayer::action() {
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(myID);
currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet);
currentHand->getGuiInterface()->logPlayerActionMsg(myName, myID, myAction, mySet);
currentHand->getGuiInterface()->nextPlayerAnimation();
// cout << "playerID in action(): " << (*(currentHand->getCurrentBeRo()->getCurrentPlayersTurnIt()))->getMyID() << endl;
+4 -4
View File
@@ -67,7 +67,7 @@ public:
void setMyAction(int theValue, bool blind = 0) {
myAction = theValue;
// logging for human player
if(myAction && !blind) currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet);
if(myAction && !blind) currentHand->getGuiInterface()->logPlayerActionMsg(myName, myID, myAction, mySet);
}
int getMyAction() const { return myAction; }
@@ -91,11 +91,11 @@ public:
// log flipping cards
if(myCardsFlip) {
switch(state) {
case 1: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt);
case 1: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1], myCardsValueInt);
break;
case 2: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]);
case 2: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1]);
break;
case 3: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has");
case 3: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1], myCardsValueInt, "has");
break;
default: ;
}
+39
View File
@@ -0,0 +1,39 @@
/***************************************************************************
* 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. *
***************************************************************************/
#include "replay.h"
Replay::Replay() : replaySqliteLogDb(0)
{
replaySqliteLogDb = new QSqlDatabase();
*replaySqliteLogDb = QSqlDatabase::addDatabase("QSQLITE");
//replaySqliteLogDb->setDatabaseName(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".db");
//if(!mySqliteLogDb->open()) {
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
//}
}
Replay::~Replay()
{
delete replaySqliteLogDb;
}
+36
View File
@@ -0,0 +1,36 @@
/***************************************************************************
* 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 REPLAY_H
#define REPLAY_H
#include <QtSql>
class Replay
{
public:
Replay();
~Replay();
private:
QSqlDatabase *replaySqliteLogDb;
};
#endif // REPLAY_H
+3 -3
View File
@@ -258,11 +258,11 @@ ClientPlayer::setMyCardsFlip(bool theValue, int state)
// log flipping cards
if (myCardsFlip) {
switch(state) {
case 1: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt);
case 1: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1], myCardsValueInt);
break;
case 2: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]);
case 2: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1]);
break;
case 3: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has");
case 3: currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myID, myCards[0], myCards[1], myCardsValueInt, "has");
break;
default: ;
}