sqlite-log: transmitting some functions to cardsValue for logging hole cards
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -21,18 +21,18 @@
|
||||
#define CARDSVALUE_H
|
||||
|
||||
#include "game_defs.h"
|
||||
#include "arraydata.h"
|
||||
#include "tools.h"
|
||||
|
||||
#include<vector>
|
||||
|
||||
#include "engine_defs.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
class CardsValue
|
||||
{
|
||||
public:
|
||||
static int holeCardsClass(int, int);
|
||||
static int cardsValue(int*, int*);
|
||||
static std::string determineHandName(int myCardsValueInt, PlayerList activePlayerList);
|
||||
static std::list<std::string> translateCardsValueCode(int cardsValueCode);
|
||||
|
||||
static int holeCardsToIntCode(int*);
|
||||
static int* intCodeToHoleCards(int);
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include "localexception.h"
|
||||
#include "engine_msg.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalBoard::LocalBoard(unsigned dp) : BoardInterface(), pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayer(0)
|
||||
{
|
||||
myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
|
||||
@@ -78,7 +76,7 @@ void LocalBoard::distributePot()
|
||||
PlayerListConstIterator it_c;
|
||||
|
||||
// filling player sets vector
|
||||
vector<unsigned> playerSets;
|
||||
std::vector<unsigned> playerSets;
|
||||
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||
if((*it)->getMyActiveStatus()) {
|
||||
playerSets.push_back( ( ((*it)->getMyRoundStartCash()) - ((*it)->getMyCash()) ) );
|
||||
@@ -89,11 +87,11 @@ void LocalBoard::distributePot()
|
||||
}
|
||||
|
||||
// sort player sets asc
|
||||
vector<unsigned> playerSetsSort = playerSets;
|
||||
std::vector<unsigned> playerSetsSort = playerSets;
|
||||
sort(playerSetsSort.begin(), playerSetsSort.end());
|
||||
|
||||
// potLevel[0] = amount, potLevel[1] = sum, potLevel[2..n] = winner
|
||||
vector<unsigned> potLevel;
|
||||
std::vector<unsigned> potLevel;
|
||||
|
||||
// temp var
|
||||
int highestCardsValue;
|
||||
|
||||
+46
-6
@@ -18,10 +18,12 @@
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "configfile.h"
|
||||
#include "game_defs.h"
|
||||
#include "log.h"
|
||||
|
||||
#include "configfile.h"
|
||||
#include "playerinterface.h"
|
||||
#include "cardsvalue.h"
|
||||
|
||||
#include <sqlite3.h>
|
||||
#include <iostream>
|
||||
#include <dirent.h>
|
||||
@@ -244,11 +246,11 @@ void Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, uns
|
||||
sql += ") VALUES (";
|
||||
sql += boost::lexical_cast<string>(curHandID);
|
||||
sql += "," + boost::lexical_cast<string>(curGameID);
|
||||
sql += "," + boost::lexical_cast<string>(dealerPosition+1);
|
||||
sql += "," + boost::lexical_cast<string>(dealerPosition);
|
||||
sql += "," + boost::lexical_cast<string>(smallBlind);
|
||||
sql += "," + boost::lexical_cast<string>(smallBlindPosition+1);
|
||||
sql += "," + boost::lexical_cast<string>(smallBlindPosition);
|
||||
sql += "," + boost::lexical_cast<string>(bigBlind);
|
||||
sql += "," + boost::lexical_cast<string>(bigBlindPosition+1);
|
||||
sql += "," + boost::lexical_cast<string>(bigBlindPosition);
|
||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
sql += "," + boost::lexical_cast<string>((*it_c)->getMyCash());
|
||||
@@ -261,7 +263,7 @@ void Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, uns
|
||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||
}
|
||||
|
||||
logPlayerAction(0,dealerPosition+1,LOG_ACTION_DEALER);
|
||||
logPlayerAction(0,dealerPosition,LOG_ACTION_DEALER);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -396,6 +398,44 @@ void Log::logBoardCards(int bero, int boardCards[5])
|
||||
}
|
||||
}
|
||||
|
||||
//void Log::logFlipHoleCards(int bero, int seat, PlayerActionLog action, int cards[2], int cardsValueInt)
|
||||
//{
|
||||
// if(SQLITE_LOG) {
|
||||
|
||||
// if(logOnOff) {
|
||||
// //if write logfiles is enabled
|
||||
|
||||
// string sql;
|
||||
// char *errmsg;
|
||||
|
||||
// if( mySqliteLogDb != 0 ) {
|
||||
// // sqlite-db is open
|
||||
|
||||
// sql = "UPDATE Hand SET ";
|
||||
// sql += "Seat_" + boost::lexical_cast<string>(seat) +"_Card_1=" + boost::lexical_cast<string>(cards[0]) + ",";
|
||||
// sql += "Seat_" + boost::lexical_cast<string>(seat) +"_Card_1=" + boost::lexical_cast<string>(cards[0]);
|
||||
// if(cardsVauleInt > 0) {
|
||||
// sql += "Seat_" + boost::lexical_cast<string>(seat) +"_Hand_int=" + boost::lexical_cast<string>(cardsValueInt);
|
||||
// sql += "Seat_" + boost::lexical_cast<string>(seat) +"_Hand_text=" + boost::lexical_cast<string>(CardsValue::determineHandname(cardsValueInt));
|
||||
// }
|
||||
// sql += " WHERE ";
|
||||
// sql += "GameID=" + boost::lexical_cast<string>(curGameID) + " AND ";
|
||||
// sql += "HandID=" + boost::lexical_cast<string>(curHandID);
|
||||
// if(sqlite3_exec(mySqliteLogDb, sql.data(), 0, 0, &errmsg) != SQLITE_OK) {
|
||||
// cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// logPlayerAction(bero, seat, action);
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//void
|
||||
//Log::closeLogDbAtExit()
|
||||
//{
|
||||
|
||||
+4
-1
@@ -20,7 +20,8 @@
|
||||
#ifndef LOG_H
|
||||
#define LOG_H
|
||||
|
||||
#include <engine_defs.h>
|
||||
#include "engine_defs.h"
|
||||
#include "game_defs.h"
|
||||
|
||||
struct sqlite3;
|
||||
|
||||
@@ -36,6 +37,8 @@ public:
|
||||
void logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned smallBlindPosition, int bigBlind, unsigned bigBlindPosition, PlayerList seatsList);
|
||||
void logPlayerAction(int bero, int seat, PlayerActionLog action, int amount = 0);
|
||||
void logBoardCards(int bero, int boardCards[5]);
|
||||
void logHoleCards(int bero, int seat, PlayerActionLog action, int cards[2], int cardsValueInt = 0);
|
||||
// void Log::logFlipHoleCards(int bero, int seat, PlayerActionLog action, int cards[2], int cardsValueInt)
|
||||
// void closeLogDbAtExit();
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,9 +59,7 @@ public slots:
|
||||
|
||||
|
||||
public:
|
||||
QStringList translateCardsValueCode(int cardsValueCode);
|
||||
QStringList translateCardCode(int cardCode);
|
||||
QString determineHandName(int cardsValueInt);
|
||||
|
||||
void writeLogFileStream(QString string);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user