logging missing network actions in sqlite; run astyle.
This commit is contained in:
+21
-2
@@ -266,15 +266,18 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
|||||||
|
|
||||||
// log blinds
|
// log blinds
|
||||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND && (*it_c)->getMySet()>0) {
|
||||||
logPlayerAction(GAME_STATE_PREFLOP,smallBlindPosition,LOG_ACTION_SMALL_BLIND,(*it_c)->getMySet());
|
logPlayerAction(GAME_STATE_PREFLOP,smallBlindPosition,LOG_ACTION_SMALL_BLIND,(*it_c)->getMySet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
if((*it_c)->getMyButton() == BUTTON_BIG_BLIND) {
|
if((*it_c)->getMyButton() == BUTTON_BIG_BLIND && (*it_c)->getMySet()>0) {
|
||||||
logPlayerAction(GAME_STATE_PREFLOP,bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
|
logPlayerAction(GAME_STATE_PREFLOP,bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// (*it_c)->getMySet() ist ein Hack, da es im Internetspiel vorkam, dass ein Spieler zweimal geloggt wurde mit Blind - einmal jedoch mit $0
|
||||||
|
|
||||||
// !! TODO !! Hack
|
// !! TODO !! Hack
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -364,6 +367,22 @@ Log::logPlayerAction(GameState bero, int seat, PlayerActionLog action, int amoun
|
|||||||
sql += ",'wins game'";
|
sql += ",'wins game'";
|
||||||
sql += ",NULL";
|
sql += ",NULL";
|
||||||
break;
|
break;
|
||||||
|
case LOG_ACTION_LEFT:
|
||||||
|
sql += ",'has left the game'";
|
||||||
|
sql += ",NULL";
|
||||||
|
break;
|
||||||
|
case LOG_ACTION_KICKED:
|
||||||
|
sql += ",'was kicked from the game'";
|
||||||
|
sql += ",NULL";
|
||||||
|
break;
|
||||||
|
case LOG_ACTION_ADMIN:
|
||||||
|
sql += ",'is game admin now'";
|
||||||
|
sql += ",NULL";
|
||||||
|
break;
|
||||||
|
case LOG_ACTION_JOIN:
|
||||||
|
sql += ",'has joined the game'";
|
||||||
|
sql += ",NULL";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,9 @@ public:
|
|||||||
bool checkIfINeedToShowCards();
|
bool checkIfINeedToShowCards();
|
||||||
|
|
||||||
void markRemoteAction() {}
|
void markRemoteAction() {}
|
||||||
unsigned getTimeSecSinceLastRemoteAction() const {return 0;}
|
unsigned getTimeSecSinceLastRemoteAction() const {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable boost::recursive_mutex m_syncMutex;
|
mutable boost::recursive_mutex m_syncMutex;
|
||||||
|
|||||||
+5
-1
@@ -94,7 +94,11 @@ enum PlayerActionLog {
|
|||||||
LOG_ACTION_WIN, // wins
|
LOG_ACTION_WIN, // wins
|
||||||
LOG_ACTION_WIN_SIDE_POT,// wins (side pot)
|
LOG_ACTION_WIN_SIDE_POT,// wins (side pot)
|
||||||
LOG_ACTION_SIT_OUT, // sits out
|
LOG_ACTION_SIT_OUT, // sits out
|
||||||
LOG_ACTION_WIN_GAME // wins game
|
LOG_ACTION_WIN_GAME, // wins game
|
||||||
|
LOG_ACTION_LEFT, // left the game
|
||||||
|
LOG_ACTION_KICKED, // was kicked from
|
||||||
|
LOG_ACTION_ADMIN, // is game admin now
|
||||||
|
LOG_ACTION_JOIN // has joined the game
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DenyKickPlayerReason {
|
enum DenyKickPlayerReason {
|
||||||
|
|||||||
@@ -403,14 +403,14 @@ void gameLobbyDialogImpl::refresh(int actionID)
|
|||||||
waitStartGameMsgBoxTimer->start(2000);
|
waitStartGameMsgBoxTimer->start(2000);
|
||||||
} else if(actionID == MSG_NET_GAME_CLIENT_SYNCREJOIN) {
|
} else if(actionID == MSG_NET_GAME_CLIENT_SYNCREJOIN) {
|
||||||
// if(this->isVisible()) { //TODO <-- does it work without isVisible???
|
// if(this->isVisible()) { //TODO <-- does it work without isVisible???
|
||||||
//break the autoStartTimer animation
|
//break the autoStartTimer animation
|
||||||
autoStartTimer->stop();
|
autoStartTimer->stop();
|
||||||
autoStartTimerOverlay->hide();
|
autoStartTimerOverlay->hide();
|
||||||
//show msg dialog
|
//show msg dialog
|
||||||
waitRejoinStartGameMsgBox->show();
|
waitRejoinStartGameMsgBox->show();
|
||||||
waitRejoinStartGameMsgBox->raise();
|
waitRejoinStartGameMsgBox->raise();
|
||||||
waitRejoinStartGameMsgBox->activateWindow();
|
waitRejoinStartGameMsgBox->activateWindow();
|
||||||
pushButton_Leave->setDisabled(true);
|
pushButton_Leave->setDisabled(true);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -907,19 +907,19 @@ void gameTableImpl::refreshPlayerName()
|
|||||||
case SEAT_ACTIVE: {
|
case SEAT_ACTIVE: {
|
||||||
playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, FALSE, guest, computerPlayer );
|
playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, FALSE, guest, computerPlayer );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_AUTOFOLD: {
|
case SEAT_AUTOFOLD: {
|
||||||
playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, TRUE, guest, computerPlayer );
|
playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, TRUE, guest, computerPlayer );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_STAYONTABLE: {
|
case SEAT_STAYONTABLE: {
|
||||||
playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, TRUE, guest, computerPlayer );
|
playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, TRUE, guest, computerPlayer );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_CLEAR: {
|
case SEAT_CLEAR: {
|
||||||
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
|
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
|
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
|
||||||
}
|
}
|
||||||
@@ -952,8 +952,7 @@ void gameTableImpl::refreshPlayerAvatar()
|
|||||||
QPixmap avatarPic;
|
QPixmap avatarPic;
|
||||||
if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) {
|
if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) {
|
||||||
avatarPic = QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar()));
|
avatarPic = QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar()));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
avatarPic = QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str())));
|
avatarPic = QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,21 +963,21 @@ void gameTableImpl::refreshPlayerAvatar()
|
|||||||
// qDebug() << seatPlace << "AVATAR ACTIVE";
|
// qDebug() << seatPlace << "AVATAR ACTIVE";
|
||||||
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace);
|
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_AUTOFOLD: {
|
case SEAT_AUTOFOLD: {
|
||||||
// qDebug() << seatPlace << "AVATAR AUTOFOLD";
|
// qDebug() << seatPlace << "AVATAR AUTOFOLD";
|
||||||
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE);
|
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_STAYONTABLE: {
|
case SEAT_STAYONTABLE: {
|
||||||
// qDebug() << seatPlace << "AVATAR STAYONTABLE";
|
// qDebug() << seatPlace << "AVATAR STAYONTABLE";
|
||||||
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE);
|
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_CLEAR: {
|
case SEAT_CLEAR: {
|
||||||
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
|
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
|
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
|
||||||
}
|
}
|
||||||
@@ -1084,20 +1083,20 @@ void gameTableImpl::refreshCash()
|
|||||||
// qDebug() << (*it_c)->getMyID() << "CASH ACTIVE";
|
// qDebug() << (*it_c)->getMyID() << "CASH ACTIVE";
|
||||||
cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash()));
|
cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_AUTOFOLD: {
|
case SEAT_AUTOFOLD: {
|
||||||
// qDebug() << (*it_c)->getMyID() << "CASH AUTOFOLD"; //TODO transparent
|
// qDebug() << (*it_c)->getMyID() << "CASH AUTOFOLD"; //TODO transparent
|
||||||
cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash()), transparent);
|
cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash()), transparent);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_STAYONTABLE: {
|
case SEAT_STAYONTABLE: {
|
||||||
cashLabelArray[(*it_c)->getMyID()]->setText("");
|
cashLabelArray[(*it_c)->getMyID()]->setText("");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEAT_CLEAR: {
|
case SEAT_CLEAR: {
|
||||||
cashLabelArray[(*it_c)->getMyID()]->setText("");
|
cashLabelArray[(*it_c)->getMyID()]->setText("");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
cashLabelArray[(*it_c)->getMyID()]->setText("");
|
cashLabelArray[(*it_c)->getMyID()]->setText("");
|
||||||
}
|
}
|
||||||
@@ -3830,21 +3829,19 @@ void gameTableImpl::hide()
|
|||||||
QWidget::hide();
|
QWidget::hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
SeatState gameTableImpl::getCurrentSeatState(boost::shared_ptr<PlayerInterface> player) {
|
SeatState gameTableImpl::getCurrentSeatState(boost::shared_ptr<PlayerInterface> player)
|
||||||
|
{
|
||||||
|
|
||||||
if(player->getMyActiveStatus()) {
|
if(player->getMyActiveStatus()) {
|
||||||
if(player->isSessionActive()) {
|
if(player->isSessionActive()) {
|
||||||
return SEAT_ACTIVE;
|
return SEAT_ACTIVE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return SEAT_AUTOFOLD;
|
return SEAT_AUTOFOLD;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if(player->getMyStayOnTableStatus() && (myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK)) {
|
if(player->getMyStayOnTableStatus() && (myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK)) {
|
||||||
return SEAT_STAYONTABLE;
|
return SEAT_STAYONTABLE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return SEAT_CLEAR;
|
return SEAT_CLEAR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
SDLPlayer* getMySDLPlayer() const {
|
SDLPlayer* getMySDLPlayer() const {
|
||||||
return mySDLPlayer;
|
return mySDLPlayer;
|
||||||
}
|
}
|
||||||
SoundEvents* getMySoundEventHandler() const{
|
SoundEvents* getMySoundEventHandler() const {
|
||||||
return mySoundEventHandler;
|
return mySoundEventHandler;
|
||||||
}
|
}
|
||||||
ChatTools* getMyChat() const {
|
ChatTools* getMyChat() const {
|
||||||
|
|||||||
+150
-125
@@ -684,18 +684,25 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
{
|
{
|
||||||
bool neu = false;
|
bool neu = false;
|
||||||
|
|
||||||
|
result_struct results;
|
||||||
|
results.result_Session = 0;
|
||||||
|
results.result_Game = 0;
|
||||||
|
results.result_Hand = 0;
|
||||||
|
results.result_Hand_ID = 0;
|
||||||
|
results.result_Action = 0;
|
||||||
|
|
||||||
string sql = "";
|
string sql = "";
|
||||||
string log_string = "";
|
string log_string = "";
|
||||||
string round_string = "";
|
string round_string = "";
|
||||||
string action_string = "";
|
string action_string = "";
|
||||||
bool data_found = false;
|
bool data_found = false;
|
||||||
char **result_Session = 0, **result_Game = 0, **result_Hand = 0, **result_Hand_ID = 0, **result_Action = 0;
|
|
||||||
int nRow_Session=0, nRow_Game=0, nRow_Hand=0, nRow_Hand_ID=0, nRow_Action=0;
|
int nRow_Session=0, nRow_Game=0, nRow_Hand=0, nRow_Hand_ID=0, nRow_Action=0;
|
||||||
int nCol_Session=0, nCol_Game=0, nCol_Hand=0, nCol_Action=0;
|
int nCol_Session=0, nCol_Game=0, nCol_Hand=0, nCol_Action=0;
|
||||||
char *errmsg = 0;
|
char *errmsg = 0;
|
||||||
int game_ctr = 0, hand_ctr = 0, round_ctr = 0, action_ctr = 0;
|
int game_ctr = 0, hand_ctr = 0, round_ctr = 0, action_ctr = 0;
|
||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
int gameID = 0; int uniqueGameID = 0;
|
int gameID = 0;
|
||||||
|
int uniqueGameID = 0;
|
||||||
string cmpString = "", string_tmp = "";
|
string cmpString = "", string_tmp = "";
|
||||||
string player[MAX_NUMBER_OF_PLAYERS];
|
string player[MAX_NUMBER_OF_PLAYERS];
|
||||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
@@ -709,14 +716,14 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
|
|
||||||
// read session
|
// read session
|
||||||
sql = "SELECT * FROM Session";
|
sql = "SELECT * FROM Session";
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Session,&nRow_Session,&nCol_Session,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Session,&nRow_Session,&nCol_Session,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(nRow_Session<1 || nRow_Session>1) {
|
if(nRow_Session<1 || nRow_Session>1) {
|
||||||
cout << "Number of Sessions implausible!" << endl;
|
cout << "Number of Sessions implausible!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,14 +732,14 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
// pokerth version
|
// pokerth version
|
||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Session; i++) {
|
for(i=0; i<nCol_Session; i++) {
|
||||||
if(boost::lexical_cast<std::string>(result_Session[i]) == "PokerTH_Version") {
|
if(boost::lexical_cast<std::string>(results.result_Session[i]) == "PokerTH_Version") {
|
||||||
log_string += boost::lexical_cast<std::string>(result_Session[i+nCol_Session]);
|
log_string += boost::lexical_cast<std::string>(results.result_Session[i+nCol_Session]);
|
||||||
data_found = true;
|
data_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing PokerTH version information!" << endl;
|
cout << "Missing PokerTH version information!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,14 +748,14 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
// logging date
|
// logging date
|
||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Session; i++) {
|
for(i=0; i<nCol_Session; i++) {
|
||||||
if(boost::lexical_cast<std::string>(result_Session[i]) == "Date") {
|
if(boost::lexical_cast<std::string>(results.result_Session[i]) == "Date") {
|
||||||
log_string += boost::lexical_cast<std::string>(result_Session[i+nCol_Session]);
|
log_string += boost::lexical_cast<std::string>(results.result_Session[i+nCol_Session]);
|
||||||
data_found = true;
|
data_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing date information!" << endl;
|
cout << "Missing date information!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -757,18 +764,18 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
// logging time
|
// logging time
|
||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Session; i++) {
|
for(i=0; i<nCol_Session; i++) {
|
||||||
if(boost::lexical_cast<std::string>(result_Session[i]) == "Time") {
|
if(boost::lexical_cast<std::string>(results.result_Session[i]) == "Time") {
|
||||||
log_string += boost::lexical_cast<std::string>(result_Session[i+nCol_Session]);
|
log_string += boost::lexical_cast<std::string>(results.result_Session[i+nCol_Session]);
|
||||||
data_found = true;
|
data_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing time information!" << endl;
|
cout << "Missing time information!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_free_table(result_Session);
|
// sqlite3_free_table(results.result_Session);
|
||||||
|
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -789,9 +796,9 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
|
|
||||||
// read game
|
// read game
|
||||||
sql = "SELECT * FROM Game";
|
sql = "SELECT * FROM Game";
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Game,&nRow_Game,&nCol_Game,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Game,&nRow_Game,&nCol_Game,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,28 +808,28 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
// unique game id
|
// unique game id
|
||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Game; i++) {
|
for(i=0; i<nCol_Game; i++) {
|
||||||
if(boost::lexical_cast<std::string>(result_Game[i]) == "UniqueGameID") {
|
if(boost::lexical_cast<std::string>(results.result_Game[i]) == "UniqueGameID") {
|
||||||
uniqueGameID = boost::lexical_cast<int>(result_Game[i+nCol_Game*game_ctr]);
|
uniqueGameID = boost::lexical_cast<int>(results.result_Game[i+nCol_Game*game_ctr]);
|
||||||
data_found = true;
|
data_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// game id
|
// game id
|
||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Game; i++) {
|
for(i=0; i<nCol_Game; i++) {
|
||||||
if(boost::lexical_cast<std::string>(result_Game[i]) == "GameID") {
|
if(boost::lexical_cast<std::string>(results.result_Game[i]) == "GameID") {
|
||||||
gameID = boost::lexical_cast<int>(result_Game[i+nCol_Game*game_ctr]);
|
gameID = boost::lexical_cast<int>(results.result_Game[i+nCol_Game*game_ctr]);
|
||||||
data_found = true;
|
data_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -832,11 +839,11 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
for(j=0; j<nCol_Game; j++) {
|
for(j=0; j<nCol_Game; j++) {
|
||||||
cmpString = "Seat_";
|
cmpString = "Seat_";
|
||||||
cmpString+= boost::lexical_cast<std::string>(i);
|
cmpString+= boost::lexical_cast<std::string>(i);
|
||||||
if(boost::lexical_cast<std::string>(result_Game[j]) == cmpString) {
|
if(boost::lexical_cast<std::string>(results.result_Game[j]) == cmpString) {
|
||||||
// Seat found
|
// Seat found
|
||||||
if(result_Game[j+nCol_Game*game_ctr]) {
|
if(results.result_Game[j+nCol_Game*game_ctr]) {
|
||||||
// the Seat is not empty
|
// the Seat is not empty
|
||||||
player[i-1] = boost::lexical_cast<std::string>(result_Game[j+nCol_Game*game_ctr]);
|
player[i-1] = boost::lexical_cast<std::string>(results.result_Game[j+nCol_Game*game_ctr]);
|
||||||
} else {
|
} else {
|
||||||
player[i-1] = "";
|
player[i-1] = "";
|
||||||
}
|
}
|
||||||
@@ -845,7 +852,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing some seats!" << endl;
|
cout << "Missing some seats!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -853,9 +860,9 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
// read all hand id
|
// read all hand id
|
||||||
sql = "SELECT HandID FROM Hand WHERE UniqueGameID=";
|
sql = "SELECT HandID FROM Hand WHERE UniqueGameID=";
|
||||||
sql+= boost::lexical_cast<std::string>(uniqueGameID);
|
sql+= boost::lexical_cast<std::string>(uniqueGameID);
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Hand_ID,&nRow_Hand_ID,&nCol_Hand,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Hand_ID,&nRow_Hand_ID,&nCol_Hand,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -866,7 +873,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
log_string += "Game: ";
|
log_string += "Game: ";
|
||||||
log_string += boost::lexical_cast<std::string>(gameID);
|
log_string += boost::lexical_cast<std::string>(gameID);
|
||||||
log_string += " | Hand: ";
|
log_string += " | Hand: ";
|
||||||
log_string += boost::lexical_cast<std::string>(result_Hand_ID[hand_ctr]);
|
log_string += boost::lexical_cast<std::string>(results.result_Hand_ID[hand_ctr]);
|
||||||
|
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -890,10 +897,10 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
sql = "SELECT * FROM Hand WHERE UniqueGameID=";
|
sql = "SELECT * FROM Hand WHERE UniqueGameID=";
|
||||||
sql+= boost::lexical_cast<std::string>(uniqueGameID);
|
sql+= boost::lexical_cast<std::string>(uniqueGameID);
|
||||||
sql+= " AND HandID=";
|
sql+= " AND HandID=";
|
||||||
sql+= boost::lexical_cast<std::string>(result_Hand_ID[hand_ctr]);
|
sql+= boost::lexical_cast<std::string>(results.result_Hand_ID[hand_ctr]);
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Hand,&nRow_Hand,&nCol_Hand,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Hand,&nRow_Hand,&nCol_Hand,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -904,14 +911,14 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
// read small blind amount
|
// read small blind amount
|
||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Hand; i++) {
|
for(i=0; i<nCol_Hand; i++) {
|
||||||
if(boost::lexical_cast<std::string>(result_Hand[i]) == "Sb_Amount") {
|
if(boost::lexical_cast<std::string>(results.result_Hand[i]) == "Sb_Amount") {
|
||||||
log_string += boost::lexical_cast<std::string>(result_Hand[i+nCol_Hand]);
|
log_string += boost::lexical_cast<std::string>(results.result_Hand[i+nCol_Hand]);
|
||||||
data_found = true;
|
data_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing small blind information!" << endl;
|
cout << "Missing small blind information!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,14 +927,14 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
// read big blind amount
|
// read big blind amount
|
||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Hand; i++) {
|
for(i=0; i<nCol_Hand; i++) {
|
||||||
if(boost::lexical_cast<std::string>(result_Hand[i]) == "Bb_Amount") {
|
if(boost::lexical_cast<std::string>(results.result_Hand[i]) == "Bb_Amount") {
|
||||||
log_string += boost::lexical_cast<std::string>(result_Hand[i+nCol_Hand]);
|
log_string += boost::lexical_cast<std::string>(results.result_Hand[i+nCol_Hand]);
|
||||||
data_found = true;
|
data_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing big blind information!" << endl;
|
cout << "Missing big blind information!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -954,8 +961,8 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
cmpString = "Seat_";
|
cmpString = "Seat_";
|
||||||
cmpString+= boost::lexical_cast<std::string>(i);
|
cmpString+= boost::lexical_cast<std::string>(i);
|
||||||
cmpString+= "_Cash";
|
cmpString+= "_Cash";
|
||||||
if(boost::lexical_cast<std::string>(result_Hand[j]) == cmpString) { // seat found
|
if(boost::lexical_cast<std::string>(results.result_Hand[j]) == cmpString) { // seat found
|
||||||
if(result_Hand[j+nCol_Hand]) { // player has cash > 0
|
if(results.result_Hand[j+nCol_Hand]) { // player has cash > 0
|
||||||
log_string += "Seat ";
|
log_string += "Seat ";
|
||||||
log_string += boost::lexical_cast<std::string>(i);
|
log_string += boost::lexical_cast<std::string>(i);
|
||||||
log_string += ": ";
|
log_string += ": ";
|
||||||
@@ -967,7 +974,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
log_string += "</b>";
|
log_string += "</b>";
|
||||||
}
|
}
|
||||||
log_string += " ($";
|
log_string += " ($";
|
||||||
log_string += boost::lexical_cast<std::string>(result_Hand[j+nCol_Hand]);
|
log_string += boost::lexical_cast<std::string>(results.result_Hand[j+nCol_Hand]);
|
||||||
log_string += ")";
|
log_string += ")";
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -988,8 +995,8 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing seat information in uniqueGame " << uniqueGameID << " and hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Missing seat information in uniqueGame " << uniqueGameID << " and hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1002,28 +1009,30 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
sql = "SELECT Player,Action,Amount FROM Action WHERE UniqueGameID=";
|
sql = "SELECT Player,Action,Amount FROM Action WHERE UniqueGameID=";
|
||||||
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
||||||
sql += " AND HandID=";
|
sql += " AND HandID=";
|
||||||
sql += boost::lexical_cast<std::string>(result_Hand_ID[hand_ctr]);
|
sql += boost::lexical_cast<std::string>(results.result_Hand_ID[hand_ctr]);
|
||||||
sql += " AND BeRo=0";
|
sql += " AND BeRo=";
|
||||||
|
sql += boost::lexical_cast<std::string>(GAME_STATE_PREFLOP);
|
||||||
|
sql += " AND (Action='posts small blind' OR Action='posts big blind' OR Action='starts as dealer')";
|
||||||
|
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(nRow_Action<1) {
|
if(nRow_Action<1) {
|
||||||
cout << "Missing information about dealer and blinds in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Missing information about dealer and blinds in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// log dealer and blind setting
|
// log dealer and blind setting
|
||||||
for(i=1; i<=nRow_Action; i++) {
|
for(i=1; i<=nRow_Action; i++) {
|
||||||
log_string += player[boost::lexical_cast<int>(result_Action[3*i])-1];
|
log_string += player[boost::lexical_cast<int>(results.result_Action[3*i])-1];
|
||||||
log_string += " ";
|
log_string += " ";
|
||||||
log_string += boost::lexical_cast<std::string>(result_Action[3*i+1]);
|
log_string += boost::lexical_cast<std::string>(results.result_Action[3*i+1]);
|
||||||
if(result_Action[3*i+2]) {
|
if(results.result_Action[3*i+2]) {
|
||||||
// with amount
|
// with amount
|
||||||
log_string += " $";
|
log_string += " $";
|
||||||
log_string += boost::lexical_cast<std::string>(result_Action[3*i+2]);
|
log_string += boost::lexical_cast<std::string>(results.result_Action[3*i+2]);
|
||||||
}
|
}
|
||||||
log_string += ".";
|
log_string += ".";
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
@@ -1033,12 +1042,15 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
case 2:
|
case 2:
|
||||||
log_string += "\n";
|
log_string += "\n";
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
log_string += "<br />";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_free_table(result_Action);
|
// sqlite3_free_table(results.result_Action);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -1048,69 +1060,69 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
sql = "SELECT Player,Amount FROM Action WHERE UniqueGameID=";
|
sql = "SELECT Player,Amount FROM Action WHERE UniqueGameID=";
|
||||||
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
||||||
sql += " AND HandID=";
|
sql += " AND HandID=";
|
||||||
sql += boost::lexical_cast<std::string>(result_Hand_ID[hand_ctr]);
|
sql += boost::lexical_cast<std::string>(results.result_Hand_ID[hand_ctr]);
|
||||||
sql += " AND BeRo=0 AND Action='posts small blind'";
|
sql += " AND BeRo=0 AND Action='posts small blind'";
|
||||||
|
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(nRow_Action<1 || nRow_Action>1) {
|
if(nRow_Action<1 || nRow_Action>1) {
|
||||||
cout << "Missing information about small blinds in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Wrong information about small blind in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// log small blind
|
// log small blind
|
||||||
log_string += player[boost::lexical_cast<int>(result_Action[2])-1];
|
log_string += player[boost::lexical_cast<int>(results.result_Action[2])-1];
|
||||||
log_string += " ($";
|
log_string += " ($";
|
||||||
log_string += boost::lexical_cast<std::string>(result_Action[3]);
|
log_string += boost::lexical_cast<std::string>(results.result_Action[3]);
|
||||||
log_string += "), ";
|
log_string += "), ";
|
||||||
|
|
||||||
sqlite3_free_table(result_Action);
|
// sqlite3_free_table(results.result_Action);
|
||||||
|
|
||||||
// read big blind
|
// read big blind
|
||||||
sql = "SELECT Player,Amount FROM Action WHERE UniqueGameID=";
|
sql = "SELECT Player,Amount FROM Action WHERE UniqueGameID=";
|
||||||
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
||||||
sql += " AND HandID=";
|
sql += " AND HandID=";
|
||||||
sql += boost::lexical_cast<std::string>(result_Hand_ID[hand_ctr]);
|
sql += boost::lexical_cast<std::string>(results.result_Hand_ID[hand_ctr]);
|
||||||
sql += " AND BeRo=0 AND Action='posts big blind'";
|
sql += " AND BeRo=0 AND Action='posts big blind'";
|
||||||
|
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(nRow_Action<1 || nRow_Action>1) {
|
if(nRow_Action<1 || nRow_Action>1) {
|
||||||
cout << "Missing information about small blinds in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Wrong information about big blind in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// log big blind
|
// log big blind
|
||||||
log_string += player[boost::lexical_cast<int>(result_Action[2])-1];
|
log_string += player[boost::lexical_cast<int>(results.result_Action[2])-1];
|
||||||
log_string += " ($";
|
log_string += " ($";
|
||||||
log_string += boost::lexical_cast<std::string>(result_Action[3]);
|
log_string += boost::lexical_cast<std::string>(results.result_Action[3]);
|
||||||
log_string += ")";
|
log_string += ")";
|
||||||
|
|
||||||
sqlite3_free_table(result_Action);
|
// sqlite3_free_table(results.result_Action);
|
||||||
|
|
||||||
// read dealer
|
// read dealer
|
||||||
sql = "SELECT Player,Amount FROM Action WHERE UniqueGameID=";
|
sql = "SELECT Player,Amount FROM Action WHERE UniqueGameID=";
|
||||||
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
||||||
sql += " AND HandID=";
|
sql += " AND HandID=";
|
||||||
sql += boost::lexical_cast<std::string>(result_Hand_ID[hand_ctr]);
|
sql += boost::lexical_cast<std::string>(results.result_Hand_ID[hand_ctr]);
|
||||||
sql += " AND BeRo=0 AND Action='starts as dealer'";
|
sql += " AND BeRo=0 AND Action='starts as dealer'";
|
||||||
|
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(nRow_Action>1) {
|
if(nRow_Action>1) {
|
||||||
cout << "Implausible information about dealer in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Implausible information about dealer in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1129,11 +1141,11 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
log_string += player[boost::lexical_cast<int>(result_Action[2])-1];
|
log_string += player[boost::lexical_cast<int>(results.result_Action[2])-1];
|
||||||
log_string += " starts as dealer.";
|
log_string += " starts as dealer.";
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_free_table(result_Action);
|
// sqlite3_free_table(results.result_Action);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1189,13 +1201,13 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
for(i=1; i<=round_ctr+2; i++) {
|
for(i=1; i<=round_ctr+2; i++) {
|
||||||
data_found = false;
|
data_found = false;
|
||||||
for(j=0; j<nCol_Hand; j++) {
|
for(j=0; j<nCol_Hand; j++) {
|
||||||
if(boost::lexical_cast<std::string>(result_Hand[j]) == "BoardCard_"+boost::lexical_cast<std::string>(i)) {
|
if(boost::lexical_cast<std::string>(results.result_Hand[j]) == "BoardCard_"+boost::lexical_cast<std::string>(i)) {
|
||||||
if(result_Hand[j+nCol_Hand]) {
|
if(results.result_Hand[j+nCol_Hand]) {
|
||||||
if(modus == 1 || modus == 3) round_string += "<b>";
|
if(modus == 1 || modus == 3) round_string += "<b>";
|
||||||
string_tmp = convertCardIntToString(boost::lexical_cast<int>(result_Hand[j+nCol_Hand]));
|
string_tmp = convertCardIntToString(boost::lexical_cast<int>(results.result_Hand[j+nCol_Hand]));
|
||||||
if(string_tmp == "") {
|
if(string_tmp == "") {
|
||||||
cout << "Implausible board card in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Implausible board card in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
round_string += boost::lexical_cast<std::string>(string_tmp.at(0));
|
round_string += boost::lexical_cast<std::string>(string_tmp.at(0));
|
||||||
@@ -1221,14 +1233,14 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
sql = "SELECT Player,Action,Amount FROM Action WHERE UniqueGameID=";
|
sql = "SELECT Player,Action,Amount FROM Action WHERE UniqueGameID=";
|
||||||
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
sql += boost::lexical_cast<std::string>(uniqueGameID);
|
||||||
sql += " AND HandID=";
|
sql += " AND HandID=";
|
||||||
sql += boost::lexical_cast<std::string>(result_Hand_ID[hand_ctr]);
|
sql += boost::lexical_cast<std::string>(results.result_Hand_ID[hand_ctr]);
|
||||||
sql += " AND BeRo=";
|
sql += " AND BeRo=";
|
||||||
sql += boost::lexical_cast<std::string>(round_ctr);
|
sql += boost::lexical_cast<std::string>(round_ctr);
|
||||||
sql += " AND Action<>'starts as dealer' AND Action<>'posts big blind' AND Action<>'posts small blind'";
|
sql += " AND Action<>'starts as dealer' AND Action<>'posts big blind' AND Action<>'posts small blind'";
|
||||||
|
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
if(sqlite3_get_table(mySqliteLogDb,sql.data(),&results.result_Action,&nRow_Action,&nCol_Action,&errmsg) != SQLITE_OK) {
|
||||||
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1236,7 +1248,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) {
|
if(!neu) {
|
||||||
if(action_ctr>1 && (boost::lexical_cast<std::string>(result_Action[3*(action_ctr-1)+1]) == "wins" || boost::lexical_cast<std::string>(result_Action[3*(action_ctr-1)+1]) == "sits out" || boost::lexical_cast<std::string>(result_Action[3*(action_ctr-1)+1]) == "wins (side pot)"))
|
if(action_ctr>1 && (boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "sits out" || boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "wins (side pot)"))
|
||||||
log_string += "\n";
|
log_string += "\n";
|
||||||
else
|
else
|
||||||
log_string += "</br>\n";
|
log_string += "</br>\n";
|
||||||
@@ -1253,24 +1265,24 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
if(!neu && boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
if(!neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
||||||
action_string += player[boost::lexical_cast<int>(result_Action[3*action_ctr])-1];
|
action_string += player[boost::lexical_cast<int>(results.result_Action[3*action_ctr])-1];
|
||||||
action_string += " wins $";
|
action_string += " wins $";
|
||||||
action_string += boost::lexical_cast<std::string>(result_Action[3*action_ctr+2]);
|
action_string += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+2]);
|
||||||
action_string += " (side pot)";
|
action_string += " (side pot)";
|
||||||
} else {
|
} else {
|
||||||
action_string += player[boost::lexical_cast<int>(result_Action[3*action_ctr])-1];
|
action_string += player[boost::lexical_cast<int>(results.result_Action[3*action_ctr])-1];
|
||||||
action_string += " ";
|
action_string += " ";
|
||||||
action_string += boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]);
|
action_string += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]);
|
||||||
if(result_Action[3*action_ctr+2]) {
|
if(results.result_Action[3*action_ctr+2]) {
|
||||||
// with amount
|
// with amount
|
||||||
action_string += " $";
|
action_string += " $";
|
||||||
action_string += boost::lexical_cast<std::string>(result_Action[3*action_ctr+2]);
|
action_string += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// wins game
|
// wins game
|
||||||
if(boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) == "wins game") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins game") {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) action_string = "</br></br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</i></b></br>";
|
if(!neu) action_string = "</br></br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</i></b></br>";
|
||||||
@@ -1288,7 +1300,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// wins
|
// wins
|
||||||
if(boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) == "wins" || boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has left the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "was kicked from the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "is game admin now" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has joined the game") {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) action_string = "</br><i>" + action_string + "</i>";
|
if(!neu) action_string = "</br><i>" + action_string + "</i>";
|
||||||
@@ -1303,7 +1315,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sits out
|
// sits out
|
||||||
if(boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) == "sits out") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "sits out") {
|
||||||
switch(modus) {
|
switch(modus) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!neu) action_string = "</br><i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
if(!neu) action_string = "</br><i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
||||||
@@ -1321,7 +1333,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
action_string = "";
|
action_string = "";
|
||||||
|
|
||||||
// show cards
|
// show cards
|
||||||
if(boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) == "shows" || boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) == "has") {
|
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "shows" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has") {
|
||||||
// log cards
|
// log cards
|
||||||
if(!neu && round_ctr == GAME_STATE_POST_RIVER) log_string += " [ ";
|
if(!neu && round_ctr == GAME_STATE_POST_RIVER) log_string += " [ ";
|
||||||
else log_string += " [";
|
else log_string += " [";
|
||||||
@@ -1331,13 +1343,13 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Hand; i++) {
|
for(i=0; i<nCol_Hand; i++) {
|
||||||
cmpString = "Seat_";
|
cmpString = "Seat_";
|
||||||
cmpString += boost::lexical_cast<std::string>(result_Action[3*action_ctr]);
|
cmpString += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr]);
|
||||||
cmpString += "_Card_1";
|
cmpString += "_Card_1";
|
||||||
if(boost::lexical_cast<std::string>(result_Hand[i]) == cmpString) {
|
if(boost::lexical_cast<std::string>(results.result_Hand[i]) == cmpString) {
|
||||||
string_tmp = convertCardIntToString(boost::lexical_cast<int>(result_Hand[i+nCol_Hand]));
|
string_tmp = convertCardIntToString(boost::lexical_cast<int>(results.result_Hand[i+nCol_Hand]));
|
||||||
if(string_tmp == "") {
|
if(string_tmp == "") {
|
||||||
cout << "Hole card information implausible in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Hole card information implausible in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
log_string += boost::lexical_cast<std::string>(string_tmp.at(0));
|
log_string += boost::lexical_cast<std::string>(string_tmp.at(0));
|
||||||
@@ -1349,8 +1361,8 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing hole card information in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Missing hole card information in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1358,13 +1370,13 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
data_found = false;
|
data_found = false;
|
||||||
for(i=0; i<nCol_Hand; i++) {
|
for(i=0; i<nCol_Hand; i++) {
|
||||||
cmpString = "Seat_";
|
cmpString = "Seat_";
|
||||||
cmpString += boost::lexical_cast<std::string>(result_Action[3*action_ctr]);
|
cmpString += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr]);
|
||||||
cmpString += "_Card_2";
|
cmpString += "_Card_2";
|
||||||
if(boost::lexical_cast<std::string>(result_Hand[i]) == cmpString) {
|
if(boost::lexical_cast<std::string>(results.result_Hand[i]) == cmpString) {
|
||||||
string_tmp = convertCardIntToString(boost::lexical_cast<int>(result_Hand[i+nCol_Hand]));
|
string_tmp = convertCardIntToString(boost::lexical_cast<int>(results.result_Hand[i+nCol_Hand]));
|
||||||
if(string_tmp == "") {
|
if(string_tmp == "") {
|
||||||
cout << "Hole card information implausible in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Hole card information implausible in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
log_string += boost::lexical_cast<std::string>(string_tmp.at(0));
|
log_string += boost::lexical_cast<std::string>(string_tmp.at(0));
|
||||||
@@ -1375,40 +1387,40 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
if(!data_found) {
|
||||||
cout << "Missing hole card information in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
cout << "Missing hole card information in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
cleanUp(results, mySqliteLogDb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(round_ctr == GAME_STATE_POST_RIVER) {
|
if(round_ctr == GAME_STATE_POST_RIVER) {
|
||||||
// find hand name
|
// find hand name
|
||||||
data_found = false;
|
// data_found = false;
|
||||||
for(i=0; i<nCol_Hand; i++) {
|
for(i=0; i<nCol_Hand; i++) {
|
||||||
cmpString = "Seat_";
|
cmpString = "Seat_";
|
||||||
cmpString += boost::lexical_cast<std::string>(result_Action[3*action_ctr]);
|
cmpString += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr]);
|
||||||
cmpString += "_Hand_text";
|
cmpString += "_Hand_text";
|
||||||
if(boost::lexical_cast<std::string>(result_Hand[i]) == cmpString) {
|
if(boost::lexical_cast<std::string>(results.result_Hand[i]) == cmpString && results.result_Hand[i+nCol_Hand]) {
|
||||||
log_string += " - " + boost::lexical_cast<std::string>(result_Hand[i+nCol_Hand]);
|
log_string += " - " + boost::lexical_cast<std::string>(results.result_Hand[i+nCol_Hand]);
|
||||||
data_found = true;
|
// data_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!data_found) {
|
// if(!data_found) {
|
||||||
cout << "Missing hand name information in uniqueGame " << uniqueGameID << " hand " << result_Hand_ID[hand_ctr] << "!" << endl;
|
// cout << "Missing hand name information in uniqueGame " << uniqueGameID << " hand " << results.result_Hand_ID[hand_ctr] << "!" << endl;
|
||||||
sqlite3_close(mySqliteLogDb);
|
// sqlite3_close(mySqliteLogDb);
|
||||||
return 1;
|
// return 1;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!neu && boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) != "wins game") {
|
if(!neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game") {
|
||||||
log_string += ".";
|
log_string += ".";
|
||||||
}
|
}
|
||||||
if(neu && boost::lexical_cast<std::string>(result_Action[3*action_ctr+1]) != "wins game") log_string += ".";
|
if(neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game") log_string += ".";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_free_table(result_Action);
|
// sqlite3_free_table(results.result_Action);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1424,10 +1436,23 @@ int guiLog::exportLog(QString fileStringPdb,int modus)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanUp(results, mySqliteLogDb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void guiLog::cleanUp(result_struct &results, sqlite3 *mySqliteLogDb)
|
||||||
|
{
|
||||||
|
|
||||||
|
sqlite3_free_table(results.result_Session);
|
||||||
|
sqlite3_free_table(results.result_Game);
|
||||||
|
sqlite3_free_table(results.result_Hand);
|
||||||
|
sqlite3_free_table(results.result_Hand_ID);
|
||||||
|
sqlite3_free_table(results.result_Action);
|
||||||
|
sqlite3_close(mySqliteLogDb);
|
||||||
|
}
|
||||||
|
|
||||||
int guiLog::convertCardStringToInt(string val, string col)
|
int guiLog::convertCardStringToInt(string val, string col)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,14 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtSql>
|
#include <QtSql>
|
||||||
|
|
||||||
|
struct result_struct {
|
||||||
|
char **result_Session;
|
||||||
|
char **result_Game;
|
||||||
|
char **result_Hand;
|
||||||
|
char **result_Hand_ID;
|
||||||
|
char **result_Action;
|
||||||
|
};
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
class GameTableStyleReader;
|
class GameTableStyleReader;
|
||||||
|
|
||||||
@@ -87,6 +95,7 @@ private:
|
|||||||
|
|
||||||
void writeLogFileStream(std::string log_string, QFile *LogFile);
|
void writeLogFileStream(std::string log_string, QFile *LogFile);
|
||||||
void writeLog(std::string log_string, int modus);
|
void writeLog(std::string log_string, int modus);
|
||||||
|
void cleanUp(result_struct &results, sqlite3 *mySqliteLogDb);
|
||||||
int convertCardStringToInt(std::string val, std::string col);
|
int convertCardStringToInt(std::string val, std::string col);
|
||||||
std::string convertCardIntToString(int code);
|
std::string convertCardIntToString(int code);
|
||||||
|
|
||||||
|
|||||||
@@ -172,11 +172,11 @@ void MyAvatarLabel::refreshStars()
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
fontSize = "10";
|
fontSize = "10";
|
||||||
#else
|
#else
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
fontSize = "7";
|
fontSize = "7";
|
||||||
#else
|
#else
|
||||||
fontSize = "12";
|
fontSize = "12";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::shared_ptr<Game> curGame = myW->myStartWindow->getSession()->getCurrentGame();
|
boost::shared_ptr<Game> curGame = myW->myStartWindow->getSession()->getCurrentGame();
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ void MyNameLabel::setText ( const QString &t, bool trans, bool guest, bool compu
|
|||||||
}
|
}
|
||||||
|
|
||||||
linkString = QString("http://pokerth.net/redirect_user_profile.php?tableview=1"+nickList+"&table="+QUrl::toPercentEncoding(QString::fromUtf8(info.name.c_str())));
|
linkString = QString("http://pokerth.net/redirect_user_profile.php?tableview=1"+nickList+"&table="+QUrl::toPercentEncoding(QString::fromUtf8(info.name.c_str())));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
linkString = QString("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(t));
|
linkString = QString("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,14 +17,16 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#include "guiwrapper.h"
|
#include "guiwrapper.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
#include "game.h"
|
||||||
|
#include "playerinterface.h"
|
||||||
#include "guilog.h"
|
#include "guilog.h"
|
||||||
|
#include "log.h"
|
||||||
#include "gametableimpl.h"
|
#include "gametableimpl.h"
|
||||||
#include "startwindowimpl.h"
|
#include "startwindowimpl.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "soundevents.h"
|
#include "soundevents.h"
|
||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
@@ -364,7 +366,6 @@ void GuiWrapper::SignalNetClientNewGameAdmin(unsigned playerId, const string &pl
|
|||||||
myStartWindow->signalNetClientNewGameAdmin(playerId, QString::fromUtf8(playerName.c_str()));
|
myStartWindow->signalNetClientNewGameAdmin(playerId, QString::fromUtf8(playerName.c_str()));
|
||||||
if (!playerName.empty() && playerName[0] != '#' && myW->isVisible())
|
if (!playerName.empty() && playerName[0] != '#' && myW->isVisible())
|
||||||
myGuiLog->signalLogNewGameAdminMsg(QString::fromUtf8(playerName.c_str()));
|
myGuiLog->signalLogNewGameAdminMsg(QString::fromUtf8(playerName.c_str()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiWrapper::SignalNetClientGameListNew(unsigned gameId)
|
void GuiWrapper::SignalNetClientGameListNew(unsigned gameId)
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ SoundEvents::~SoundEvents()
|
|||||||
|
|
||||||
void SoundEvents::blindsWereSet(int sB)
|
void SoundEvents::blindsWereSet(int sB)
|
||||||
{
|
{
|
||||||
if(newGameNow)
|
if(newGameNow) {
|
||||||
{
|
|
||||||
lastSBLevel = 0;
|
lastSBLevel = 0;
|
||||||
lastSBValue = sB;
|
lastSBValue = sB;
|
||||||
newGameNow = false;
|
newGameNow = false;
|
||||||
@@ -28,16 +27,13 @@ void SoundEvents::blindsWereSet(int sB)
|
|||||||
lastSBValue = sB;
|
lastSBValue = sB;
|
||||||
++lastSBLevel;
|
++lastSBLevel;
|
||||||
|
|
||||||
if(lastSBLevel == 1 || lastSBLevel == 2)
|
if(lastSBLevel == 1 || lastSBLevel == 2) {
|
||||||
{
|
|
||||||
mySDLPlayer->playSound("blinds_raises_level1", 0);
|
mySDLPlayer->playSound("blinds_raises_level1", 0);
|
||||||
}
|
}
|
||||||
if(lastSBLevel == 3 || lastSBLevel == 4)
|
if(lastSBLevel == 3 || lastSBLevel == 4) {
|
||||||
{
|
|
||||||
mySDLPlayer->playSound("blinds_raises_level2", 0);
|
mySDLPlayer->playSound("blinds_raises_level2", 0);
|
||||||
}
|
}
|
||||||
if(lastSBLevel >= 5)
|
if(lastSBLevel >= 5) {
|
||||||
{
|
|
||||||
mySDLPlayer->playSound("blinds_raises_level3", 0);
|
mySDLPlayer->playSound("blinds_raises_level3", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1642,17 +1642,16 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
|||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = client->GetGame()->getPlayerByNumber((i + numberDiff) % client->GetStartData().numberOfPlayers);
|
boost::shared_ptr<PlayerInterface> tmpPlayer = client->GetGame()->getPlayerByNumber((i + numberDiff) % client->GetStartData().numberOfPlayers);
|
||||||
if (!tmpPlayer)
|
if (!tmpPlayer)
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||||
switch (*seatState)
|
switch (*seatState) {
|
||||||
{
|
case NetPlayerState_playerStateNormal :
|
||||||
case NetPlayerState_playerStateNormal :
|
tmpPlayer->setIsSessionActive(true);
|
||||||
tmpPlayer->setIsSessionActive(true);
|
break;
|
||||||
break;
|
case NetPlayerState_playerStateSessionInactive :
|
||||||
case NetPlayerState_playerStateSessionInactive :
|
tmpPlayer->setIsSessionActive(false);
|
||||||
tmpPlayer->setIsSessionActive(false);
|
break;
|
||||||
break;
|
case NetPlayerState_playerStateNoMoney :
|
||||||
case NetPlayerState_playerStateNoMoney :
|
tmpPlayer->setMyCash(0);
|
||||||
tmpPlayer->setMyCash(0);
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -752,6 +752,11 @@ ClientThread::SetNewGameAdmin(unsigned id)
|
|||||||
if (playerData.get()) {
|
if (playerData.get()) {
|
||||||
playerData->SetGameAdmin(true);
|
playerData->SetGameAdmin(true);
|
||||||
GetCallback().SignalNetClientNewGameAdmin(id, playerData->GetName());
|
GetCallback().SignalNetClientNewGameAdmin(id, playerData->GetName());
|
||||||
|
m_clientLog->logPlayerAction(
|
||||||
|
m_game->getCurrentHand()->getCurrentRound(),
|
||||||
|
m_game->getPlayerByUniqueId(id)->getMyID()+1,
|
||||||
|
LOG_ACTION_ADMIN
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1058,7 +1063,7 @@ ClientThread::CreatePlayerData(unsigned playerId, bool isGameAdmin)
|
|||||||
if (GetCachedPlayerInfo(playerId, info)) {
|
if (GetCachedPlayerInfo(playerId, info)) {
|
||||||
playerData.reset(
|
playerData.reset(
|
||||||
new PlayerData(playerId, 0, info.ptype,
|
new PlayerData(playerId, 0, info.ptype,
|
||||||
info.isGuest ? PLAYER_RIGHTS_GUEST : PLAYER_RIGHTS_NORMAL, isGameAdmin));
|
info.isGuest ? PLAYER_RIGHTS_GUEST : PLAYER_RIGHTS_NORMAL, isGameAdmin));
|
||||||
playerData->SetName(info.playerName);
|
playerData->SetName(info.playerName);
|
||||||
if (info.hasAvatar) {
|
if (info.hasAvatar) {
|
||||||
string avatarFile;
|
string avatarFile;
|
||||||
@@ -1118,6 +1123,21 @@ ClientThread::RemovePlayerData(unsigned playerId, int removeReason)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetCallback().SignalNetClientPlayerLeft(tmpData->GetUniqueId(), tmpData->GetName(), removeReason);
|
GetCallback().SignalNetClientPlayerLeft(tmpData->GetUniqueId(), tmpData->GetName(), removeReason);
|
||||||
|
|
||||||
|
if(removeReason == NTF_NET_REMOVED_KICKED) {
|
||||||
|
m_clientLog->logPlayerAction(
|
||||||
|
m_game->getCurrentHand()->getCurrentRound(),
|
||||||
|
m_game->getPlayerByUniqueId(tmpData->GetUniqueId())->getMyID()+1,
|
||||||
|
LOG_ACTION_KICKED
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
m_clientLog->logPlayerAction(
|
||||||
|
m_game->getCurrentHand()->getCurrentRound(),
|
||||||
|
m_game->getPlayerByUniqueId(tmpData->GetUniqueId())->getMyID()+1,
|
||||||
|
LOG_ACTION_LEFT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -949,11 +949,10 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerComputerAction, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerComputerAction, this, boost::asio::placeholders::error, server));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// If the player we are waiting for left, continue without him.
|
// If the player we are waiting for left, continue without him.
|
||||||
if (!server->GetSessionManager().IsPlayerConnected(curPlayer->getMyUniqueID())
|
if (!server->GetSessionManager().IsPlayerConnected(curPlayer->getMyUniqueID())
|
||||||
|| !curPlayer->isSessionActive()) {
|
|| !curPlayer->isSessionActive()) {
|
||||||
PerformPlayerAction(*server, curPlayer, PLAYER_ACTION_FOLD, 0);
|
PerformPlayerAction(*server, curPlayer, PLAYER_ACTION_FOLD, 0);
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
@@ -1290,7 +1289,7 @@ ServerGameStateHand::CheckPlayerTimeouts(boost::shared_ptr<ServerGame> server)
|
|||||||
while (i != end) {
|
while (i != end) {
|
||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = *i;
|
boost::shared_ptr<PlayerInterface> tmpPlayer = *i;
|
||||||
if (tmpPlayer->getMyType() == PLAYER_TYPE_HUMAN
|
if (tmpPlayer->getMyType() == PLAYER_TYPE_HUMAN
|
||||||
&& (int)tmpPlayer->getTimeSecSinceLastRemoteAction() >= actionTimeout * SERVER_GAME_AUTOFOLD_TIMEOUT_FACTOR) {
|
&& (int)tmpPlayer->getTimeSecSinceLastRemoteAction() >= actionTimeout * SERVER_GAME_AUTOFOLD_TIMEOUT_FACTOR) {
|
||||||
if (tmpPlayer->isSessionActive()) {
|
if (tmpPlayer->isSessionActive()) {
|
||||||
tmpPlayer->setIsSessionActive(false);
|
tmpPlayer->setIsSessionActive(false);
|
||||||
boost::shared_ptr<SessionData> session = server->GetSessionManager().GetSessionByUniquePlayerId(tmpPlayer->getMyUniqueID());
|
boost::shared_ptr<SessionData> session = server->GetSessionManager().GetSessionByUniquePlayerId(tmpPlayer->getMyUniqueID());
|
||||||
|
|||||||
@@ -881,7 +881,7 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr<SessionData> session, boost::s
|
|||||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_avatarRequestMessage)
|
else if (packet->GetMsg()->present == PokerTHMessage_PR_avatarRequestMessage)
|
||||||
HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->choice.avatarRequestMessage);
|
HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->choice.avatarRequestMessage);
|
||||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
|
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
|
||||||
{}
|
{}
|
||||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_subscriptionRequestMessage) {
|
else if (packet->GetMsg()->present == PokerTHMessage_PR_subscriptionRequestMessage) {
|
||||||
SubscriptionRequestMessage_t *subscriptionRequest = &packet->GetMsg()->choice.subscriptionRequestMessage;
|
SubscriptionRequestMessage_t *subscriptionRequest = &packet->GetMsg()->choice.subscriptionRequestMessage;
|
||||||
if (subscriptionRequest->subscriptionAction == subscriptionAction_resubscribeGameList)
|
if (subscriptionRequest->subscriptionAction == subscriptionAction_resubscribeGameList)
|
||||||
|
|||||||
Reference in New Issue
Block a user