Running astyle.
This commit is contained in:
@@ -3452,7 +3452,7 @@ int LocalPlayer::flopCardsValue(int* cards)
|
|||||||
return (71000 + temp*100 + array[j1][1]);
|
return (71000 + temp*100 + array[j1][1]);
|
||||||
} else {
|
} else {
|
||||||
// Test auf Straight-Flush-Ausnahme 5-4-3-2-A
|
// Test auf Straight-Flush-Ausnahme 5-4-3-2-A
|
||||||
if(array[j1][1] == 12 && (array[j1+1][1]<=3 || (j1==0 && array[j1+2][1]<=3 && array[j1][0]==array[j1+4][0]))) {
|
if(array[j1][1] == 12 && (array[j1+1][1]<=3 || (j1==0 && array[j1+2][1]<=3 && array[j1][0]==array[j1+4][0]))) {
|
||||||
// cout << "Straight-Flush-Draw Ass unten";
|
// cout << "Straight-Flush-Draw Ass unten";
|
||||||
for(j2=0; j2<4; j2++) {
|
for(j2=0; j2<4; j2++) {
|
||||||
if(array[j1+j2][2] <= 1) temp++;
|
if(array[j1+j2][2] <= 1) temp++;
|
||||||
|
|||||||
@@ -34,10 +34,10 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifndef ANDROID_TEST
|
#ifndef ANDROID_TEST
|
||||||
#include "QtGui/5.1.1/QtGui/qpa/qplatformnativeinterface.h"
|
#include "QtGui/5.1.1/QtGui/qpa/qplatformnativeinterface.h"
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
|
aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
|
||||||
@@ -71,19 +71,19 @@ aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
|
|||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
int api = -2;
|
int api = -2;
|
||||||
#ifndef ANDROID_TEST
|
#ifndef ANDROID_TEST
|
||||||
JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForIntegration("JavaVM");
|
JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForIntegration("JavaVM");
|
||||||
JNIEnv* env;
|
JNIEnv* env;
|
||||||
if (currVM->AttachCurrentThread(&env, NULL)<0) {
|
if (currVM->AttachCurrentThread(&env, NULL)<0) {
|
||||||
qCritical()<<"AttachCurrentThread failed";
|
qCritical()<<"AttachCurrentThread failed";
|
||||||
} else {
|
} else {
|
||||||
jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION");
|
jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION");
|
||||||
if (jclassApplicationClass) {
|
if (jclassApplicationClass) {
|
||||||
api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I"));
|
api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I"));
|
||||||
}
|
|
||||||
currVM->DetachCurrentThread();
|
|
||||||
}
|
}
|
||||||
#endif
|
currVM->DetachCurrentThread();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
label_pokerthVersion->setText(QString(tr("PokerTH %1 for Android (API%2)").arg(POKERTH_BETA_RELEASE_STRING).arg(api)));
|
label_pokerthVersion->setText(QString(tr("PokerTH %1 for Android (API%2)").arg(POKERTH_BETA_RELEASE_STRING).arg(api)));
|
||||||
#else
|
#else
|
||||||
label_pokerthVersion->setText(QString(tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
|
label_pokerthVersion->setText(QString(tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
|
||||||
|
|||||||
@@ -1041,7 +1041,8 @@ void gameLobbyDialogImpl::addConnectedPlayer(unsigned playerId, QString playerNa
|
|||||||
refreshConnectedPlayerAvatars();
|
refreshConnectedPlayerAvatars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameLobbyDialogImpl::addConnectedSpectator(unsigned spectatorId, QString spectatorName) {
|
void gameLobbyDialogImpl::addConnectedSpectator(unsigned spectatorId, QString spectatorName)
|
||||||
|
{
|
||||||
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_connectedSpectators, 0);
|
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_connectedSpectators, 0);
|
||||||
item->setData(0, Qt::UserRole, spectatorId);
|
item->setData(0, Qt::UserRole, spectatorId);
|
||||||
@@ -1672,8 +1673,11 @@ void gameLobbyDialogImpl::showNickListContextMenu(QPoint p)
|
|||||||
nickListPlayerInGameInfo->setText(playerInGameInfoString);
|
nickListPlayerInGameInfo->setText(playerInGameInfoString);
|
||||||
|
|
||||||
//prevent admin to total kickban himself
|
//prevent admin to total kickban himself
|
||||||
if(playerUid == mySession->getClientUniquePlayerId()) { nickListAdminTotalKickBan->setDisabled(true); }
|
if(playerUid == mySession->getClientUniquePlayerId()) {
|
||||||
else { nickListAdminTotalKickBan->setEnabled(true); }
|
nickListAdminTotalKickBan->setDisabled(true);
|
||||||
|
} else {
|
||||||
|
nickListAdminTotalKickBan->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
// check for admin and remove admin actions for non-admins
|
// check for admin and remove admin actions for non-admins
|
||||||
if(!mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId()).isAdmin) {
|
if(!mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId()).isAdmin) {
|
||||||
@@ -1693,8 +1697,11 @@ void gameLobbyDialogImpl::showGameListContextMenu(QPoint p)
|
|||||||
|
|
||||||
assert(mySession);
|
assert(mySession);
|
||||||
unsigned selectedGameId = myGameListSelectionModel->selectedRows().first().data(Qt::UserRole).toUInt();
|
unsigned selectedGameId = myGameListSelectionModel->selectedRows().first().data(Qt::UserRole).toUInt();
|
||||||
if(selectedGameId == mySession->getClientCurrentGameId()) { gameListAdminCloseGame->setDisabled(true); }
|
if(selectedGameId == mySession->getClientCurrentGameId()) {
|
||||||
else { gameListAdminCloseGame->setEnabled(true); }
|
gameListAdminCloseGame->setDisabled(true);
|
||||||
|
} else {
|
||||||
|
gameListAdminCloseGame->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
// check for admin and remove admin actions for non-admins
|
// check for admin and remove admin actions for non-admins
|
||||||
if(!mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId()).isAdmin) {
|
if(!mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId()).isAdmin) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MyGameListTreeWidget : public QTreeWidget
|
class MyGameListTreeWidget : public QTreeWidget
|
||||||
|
|||||||
@@ -4482,8 +4482,7 @@ void gameTableImpl::refreshSpectatorsDisplay()
|
|||||||
}
|
}
|
||||||
spectatorList.remove(spectatorList.size()-4,4);
|
spectatorList.remove(spectatorList.size()-4,4);
|
||||||
spectatorIcon->setToolTip(spectatorList);
|
spectatorIcon->setToolTip(spectatorList);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
spectatorIcon->setToolTip("");
|
spectatorIcon->setToolTip("");
|
||||||
spectatorIcon->clear();
|
spectatorIcon->clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class guiLog;
|
class guiLog;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtSql>
|
#include <QtSql>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct result_struct {
|
struct result_struct {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class GameTableStyleReader;
|
class GameTableStyleReader;
|
||||||
|
|||||||
@@ -397,10 +397,9 @@ void MyAvatarLabel::paintEvent(QPaintEvent*)
|
|||||||
//hide avatar if player is on ignore list
|
//hide avatar if player is on ignore list
|
||||||
boost::shared_ptr<Session> mySession = myW->myStartWindow->getSession();
|
boost::shared_ptr<Session> mySession = myW->myStartWindow->getSession();
|
||||||
if(!playerIsOnIgnoreList(QString::fromUtf8(mySession->getClientPlayerInfo(myUniqueId).playerName.c_str()))) {
|
if(!playerIsOnIgnoreList(QString::fromUtf8(mySession->getClientPlayerInfo(myUniqueId).playerName.c_str()))) {
|
||||||
painter.drawPixmap(0,0,myPixmap);
|
painter.drawPixmap(0,0,myPixmap);
|
||||||
return;
|
return;
|
||||||
}
|
} else if(myW->getMyConfig()->readConfigInt("DontHideAvatarsOfIgnored")) {
|
||||||
else if(myW->getMyConfig()->readConfigInt("DontHideAvatarsOfIgnored")) {
|
|
||||||
painter.drawPixmap(0,0,myPixmap);
|
painter.drawPixmap(0,0,myPixmap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MyLeftTabWidget : public QTabWidget
|
class MyLeftTabWidget : public QTabWidget
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MyMenuBar : public QMenuBar
|
class MyMenuBar : public QMenuBar
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MyRightTabWidget : public QTabWidget
|
class MyRightTabWidget : public QTabWidget
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include <third_party/boost/timers.hpp>
|
#include <third_party/boost/timers.hpp>
|
||||||
#endif
|
#endif
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -287,31 +287,30 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage)
|
|||||||
if (retStr == LOG_UPLOAD_ERROR_STR) {
|
if (retStr == LOG_UPLOAD_ERROR_STR) {
|
||||||
QString errorId(returnMessage.mid(retStr.size()).trimmed());
|
QString errorId(returnMessage.mid(retStr.size()).trimmed());
|
||||||
serverMsg += "\n" + tr("Failure reason: ");
|
serverMsg += "\n" + tr("Failure reason: ");
|
||||||
switch (errorId.toInt())
|
switch (errorId.toInt()) {
|
||||||
{
|
case LOG_UPLOAD_ERROR_NO_FILE :
|
||||||
case LOG_UPLOAD_ERROR_NO_FILE :
|
serverMsg += tr("No file received.");
|
||||||
serverMsg += tr("No file received.");
|
break;
|
||||||
break;
|
case LOG_UPLOAD_ERROR_MAX_NUM_TOTAL :
|
||||||
case LOG_UPLOAD_ERROR_MAX_NUM_TOTAL :
|
serverMsg += tr("File rejected because of too many uploads.");
|
||||||
serverMsg += tr("File rejected because of too many uploads.");
|
break;
|
||||||
break;
|
case LOG_UPLOAD_ERROR_MAX_NUM_IP :
|
||||||
case LOG_UPLOAD_ERROR_MAX_NUM_IP :
|
serverMsg += tr("File rejected because of too many recent uploads. Please try again later.");
|
||||||
serverMsg += tr("File rejected because of too many recent uploads. Please try again later.");
|
break;
|
||||||
break;
|
case LOG_UPLOAD_ERROR_FILE_SIZE :
|
||||||
case LOG_UPLOAD_ERROR_FILE_SIZE :
|
serverMsg += tr("The file is too large.");
|
||||||
serverMsg += tr("The file is too large.");
|
break;
|
||||||
break;
|
case LOG_UPLOAD_ERROR_FILE_EXT :
|
||||||
case LOG_UPLOAD_ERROR_FILE_EXT :
|
case LOG_UPLOAD_ERROR_FILE_HEAD :
|
||||||
case LOG_UPLOAD_ERROR_FILE_HEAD :
|
serverMsg += tr("This file is not a valid and current PokerTH log file.");
|
||||||
serverMsg += tr("This file is not a valid and current PokerTH log file.");
|
break;
|
||||||
break;
|
case LOG_UPLOAD_ERROR_OPEN_DB :
|
||||||
case LOG_UPLOAD_ERROR_OPEN_DB :
|
case LOG_UPLOAD_ERROR_ID :
|
||||||
case LOG_UPLOAD_ERROR_ID :
|
case LOG_UPLOAD_ERROR_FILE_MOVE :
|
||||||
case LOG_UPLOAD_ERROR_FILE_MOVE :
|
case LOG_UPLOAD_ERROR_INSERT_DB :
|
||||||
case LOG_UPLOAD_ERROR_INSERT_DB :
|
default :
|
||||||
default :
|
serverMsg += tr("Internal error. Please try again later. ID: ") + returnMessage;
|
||||||
serverMsg += tr("Internal error. Please try again later. ID: ") + returnMessage;
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MyMessageBox::warning(
|
MyMessageBox::warning(
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MyAvatarButton : public QPushButton
|
class MyAvatarButton : public QPushButton
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MyHPAvatarButton : public QPushButton
|
class MyHPAvatarButton : public QPushButton
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MyStyleListItem : public QTreeWidgetItem
|
class MyStyleListItem : public QTreeWidgetItem
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MyAvatarListItem : public QListWidgetItem
|
class MyAvatarListItem : public QListWidgetItem
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "ui_selectavatardialog.h"
|
#include "ui_selectavatardialog.h"
|
||||||
#endif
|
#endif
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|||||||
@@ -31,13 +31,13 @@
|
|||||||
#include "soundevents.h"
|
#include "soundevents.h"
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifdef ANDROID_API8
|
#ifdef ANDROID_API8
|
||||||
#include "androidapi8dummy.h"
|
#include "androidapi8dummy.h"
|
||||||
#else
|
|
||||||
#include "androidaudio.h"
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#include "sdlplayer.h"
|
#include "androidaudio.h"
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include "sdlplayer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -52,11 +52,11 @@ SoundEvents::SoundEvents(ConfigFile *c): myConfig(c), lastSBValue(0), lastSBLeve
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifdef ANDROID_API8
|
#ifdef ANDROID_API8
|
||||||
myPlayer = new AndroidApi8Dummy(myConfig);
|
myPlayer = new AndroidApi8Dummy(myConfig);
|
||||||
#else
|
#else
|
||||||
myPlayer = new AndroidAudio(myConfig);
|
myPlayer = new AndroidAudio(myConfig);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
myPlayer = new SDLPlayer(myConfig);
|
myPlayer = new SDLPlayer(myConfig);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,13 +34,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifdef ANDROID_API8
|
#ifdef ANDROID_API8
|
||||||
class AndroidApi8Dummy;
|
class AndroidApi8Dummy;
|
||||||
#else
|
|
||||||
class AndroidAudio;
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
class SDLPlayer;
|
class AndroidAudio;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
class SDLPlayer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -64,11 +64,11 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifdef ANDROID_API8
|
#ifdef ANDROID_API8
|
||||||
AndroidApi8Dummy *myPlayer;
|
AndroidApi8Dummy *myPlayer;
|
||||||
#else
|
#else
|
||||||
AndroidAudio *myPlayer;
|
AndroidAudio *myPlayer;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
SDLPlayer *myPlayer;
|
SDLPlayer *myPlayer;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -60,10 +60,10 @@
|
|||||||
#include "guilog.h"
|
#include "guilog.h"
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#ifndef ANDROID_TEST
|
#ifndef ANDROID_TEST
|
||||||
#include "QtGui/5.1.1/QtGui/qpa/qplatformnativeinterface.h"
|
#include "QtGui/5.1.1/QtGui/qpa/qplatformnativeinterface.h"
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -96,25 +96,25 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
|
|||||||
this->setStatusBar(0);
|
this->setStatusBar(0);
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
this->menubar->hide();
|
this->menubar->hide();
|
||||||
|
|
||||||
//check if custom background picture for the resolution is there. Otherwise create it!
|
//check if custom background picture for the resolution is there. Otherwise create it!
|
||||||
QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str());
|
QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str());
|
||||||
QDesktopWidget dw;
|
QDesktopWidget dw;
|
||||||
int screenWidth = dw.screenGeometry().width();
|
int screenWidth = dw.screenGeometry().width();
|
||||||
int screenHeight = dw.screenGeometry().height();
|
int screenHeight = dw.screenGeometry().height();
|
||||||
QString customStartWindowBgFileString(UserDataDir+"/startwindowbg10_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
|
QString customStartWindowBgFileString(UserDataDir+"/startwindowbg10_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
|
||||||
QFile customStartWindowBgFile(customStartWindowBgFileString);
|
QFile customStartWindowBgFile(customStartWindowBgFileString);
|
||||||
if(customStartWindowBgFile.exists()) {
|
if(customStartWindowBgFile.exists()) {
|
||||||
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: top center; background-origin: content; background-repeat: no-repeat;}");
|
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: top center; background-origin: content; background-repeat: no-repeat;}");
|
||||||
} else {
|
} else {
|
||||||
//if custom bg file could not be found load the big origin file
|
//if custom bg file could not be found load the big origin file
|
||||||
centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg10_mobile.png); background-position: top center; background-origin: content; background-repeat: no-repeat;}");
|
centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg10_mobile.png); background-position: top center; background-origin: content; background-repeat: no-repeat;}");
|
||||||
}
|
}
|
||||||
this->showFullScreen();
|
this->showFullScreen();
|
||||||
|
|
||||||
//TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(true)
|
//TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(true)
|
||||||
// #ifndef ANDROID_TEST
|
// #ifndef ANDROID_TEST
|
||||||
// JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
|
// JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
|
||||||
// JNIEnv* env;
|
// JNIEnv* env;
|
||||||
@@ -128,11 +128,11 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
|
|||||||
// currVM->DetachCurrentThread();
|
// currVM->DetachCurrentThread();
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
#else
|
#else
|
||||||
// Maemo
|
// Maemo
|
||||||
this->menubar->hide();
|
this->menubar->hide();
|
||||||
centralwidget->setStyleSheet(".QWidget { background-image: url(\""+myAppDataPath+"gfx/gui/misc/startwindowbg10_desktop.png\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
|
centralwidget->setStyleSheet(".QWidget { background-image: url(\""+myAppDataPath+"gfx/gui/misc/startwindowbg10_desktop.png\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
|
||||||
#endif
|
#endif
|
||||||
// All mobile GUI's
|
// All mobile GUI's
|
||||||
pushButtonStart_Local_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #505050; color: #FDC942; font-size:22px; border-width: 0px;}");
|
pushButtonStart_Local_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #505050; color: #FDC942; font-size:22px; border-width: 0px;}");
|
||||||
pushButtonInternet_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #505050; color: #FDC942; font-size:22px; border-width: 0px;}");
|
pushButtonInternet_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #505050; color: #FDC942; font-size:22px; border-width: 0px;}");
|
||||||
@@ -1186,8 +1186,9 @@ void startWindowImpl::networkMessage(unsigned msgId)
|
|||||||
msgText = tr("The player could not be found.");
|
msgText = tr("The player could not be found.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: showMsgBox = false;
|
default:
|
||||||
break;
|
showMsgBox = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(showMsgBox) {
|
if(showMsgBox) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
#ifndef Q_MOC_RUN
|
#ifndef Q_MOC_RUN
|
||||||
#include <third_party/boost/timers.hpp>
|
#include <third_party/boost/timers.hpp>
|
||||||
|
|||||||
@@ -158,11 +158,11 @@ NetPacketValidator::ValidateAnnounceMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_announcemessage()) {
|
if (packet.GetMsg()->has_announcemessage()) {
|
||||||
const AnnounceMessage &msg = packet.GetMsg()->announcemessage();
|
const AnnounceMessage &msg = packet.GetMsg()->announcemessage();
|
||||||
if (VALIDATE_IS_UINT16(msg.protocolversion().majorversion())
|
if (VALIDATE_IS_UINT16(msg.protocolversion().majorversion())
|
||||||
&& VALIDATE_IS_UINT16(msg.protocolversion().minorversion())
|
&& VALIDATE_IS_UINT16(msg.protocolversion().minorversion())
|
||||||
&& VALIDATE_IS_UINT16(msg.latestgameversion().majorversion())
|
&& VALIDATE_IS_UINT16(msg.latestgameversion().majorversion())
|
||||||
&& VALIDATE_IS_UINT16(msg.latestgameversion().minorversion())
|
&& VALIDATE_IS_UINT16(msg.latestgameversion().minorversion())
|
||||||
&& VALIDATE_IS_UINT16(msg.latestbetarevision())
|
&& VALIDATE_IS_UINT16(msg.latestbetarevision())
|
||||||
&& VALIDATE_IS_UINT16(msg.numplayersonserver())) {
|
&& VALIDATE_IS_UINT16(msg.numplayersonserver())) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -177,12 +177,12 @@ NetPacketValidator::ValidateInitMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_initmessage()) {
|
if (packet.GetMsg()->has_initmessage()) {
|
||||||
const InitMessage &msg = packet.GetMsg()->initmessage();
|
const InitMessage &msg = packet.GetMsg()->initmessage();
|
||||||
if (VALIDATE_IS_UINT16(msg.requestedversion().majorversion())
|
if (VALIDATE_IS_UINT16(msg.requestedversion().majorversion())
|
||||||
&& VALIDATE_IS_UINT16(msg.requestedversion().minorversion())
|
&& VALIDATE_IS_UINT16(msg.requestedversion().minorversion())
|
||||||
&& (!msg.has_mylastsessionid() || msg.mylastsessionid().size() == 16)
|
&& (!msg.has_mylastsessionid() || msg.mylastsessionid().size() == 16)
|
||||||
&& (!msg.has_authserverpassword() || VALIDATE_STRING_SIZE(msg.authserverpassword(), 1, 64))
|
&& (!msg.has_authserverpassword() || VALIDATE_STRING_SIZE(msg.authserverpassword(), 1, 64))
|
||||||
&& (!msg.has_nickname() || VALIDATE_STRING_SIZE(msg.nickname(), 1, 64))
|
&& (!msg.has_nickname() || VALIDATE_STRING_SIZE(msg.nickname(), 1, 64))
|
||||||
&& (!msg.has_clientuserdata() || VALIDATE_STRING_SIZE(msg.clientuserdata(), 1, 256))
|
&& (!msg.has_clientuserdata() || VALIDATE_STRING_SIZE(msg.clientuserdata(), 1, 256))
|
||||||
&& (!msg.has_avatarhash() || msg.avatarhash().size() == 16)) {
|
&& (!msg.has_avatarhash() || msg.avatarhash().size() == 16)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -236,9 +236,9 @@ NetPacketValidator::ValidateInitAckMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_initackmessage()) {
|
if (packet.GetMsg()->has_initackmessage()) {
|
||||||
const InitAckMessage &msg = packet.GetMsg()->initackmessage();
|
const InitAckMessage &msg = packet.GetMsg()->initackmessage();
|
||||||
if (msg.yoursessionid().size() == 16
|
if (msg.yoursessionid().size() == 16
|
||||||
&& msg.yourplayerid() != 0
|
&& msg.yourplayerid() != 0
|
||||||
&& (!msg.has_youravatarhash() || msg.youravatarhash().size() == 16)
|
&& (!msg.has_youravatarhash() || msg.youravatarhash().size() == 16)
|
||||||
&& (!msg.has_rejoingameid() || msg.rejoingameid() != 0)) {
|
&& (!msg.has_rejoingameid() || msg.rejoingameid() != 0)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ NetPacketValidator::ValidateAvatarRequestMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_avatarrequestmessage()) {
|
if (packet.GetMsg()->has_avatarrequestmessage()) {
|
||||||
const AvatarRequestMessage &msg = packet.GetMsg()->avatarrequestmessage();
|
const AvatarRequestMessage &msg = packet.GetMsg()->avatarrequestmessage();
|
||||||
if (msg.requestid() != 0
|
if (msg.requestid() != 0
|
||||||
&& msg.avatarhash().size() == 16) {
|
&& msg.avatarhash().size() == 16) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ NetPacketValidator::ValidateAvatarHeaderMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_avatarheadermessage()) {
|
if (packet.GetMsg()->has_avatarheadermessage()) {
|
||||||
const AvatarHeaderMessage &msg = packet.GetMsg()->avatarheadermessage();
|
const AvatarHeaderMessage &msg = packet.GetMsg()->avatarheadermessage();
|
||||||
if (msg.requestid() != 0
|
if (msg.requestid() != 0
|
||||||
&& VALIDATE_UINT_RANGE(msg.avatarsize(), 32, 30720)) {
|
&& VALIDATE_UINT_RANGE(msg.avatarsize(), 32, 30720)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ NetPacketValidator::ValidateAvatarDataMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_avatardatamessage()) {
|
if (packet.GetMsg()->has_avatardatamessage()) {
|
||||||
const AvatarDataMessage &msg = packet.GetMsg()->avatardatamessage();
|
const AvatarDataMessage &msg = packet.GetMsg()->avatardatamessage();
|
||||||
if (msg.requestid() != 0
|
if (msg.requestid() != 0
|
||||||
&& VALIDATE_STRING_SIZE(msg.avatarblock(), 1, 256)) {
|
&& VALIDATE_STRING_SIZE(msg.avatarblock(), 1, 256)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -337,9 +337,9 @@ NetPacketValidator::ValidateGameListNewMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_gamelistnewmessage()) {
|
if (packet.GetMsg()->has_gamelistnewmessage()) {
|
||||||
const GameListNewMessage &msg = packet.GetMsg()->gamelistnewmessage();
|
const GameListNewMessage &msg = packet.GetMsg()->gamelistnewmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& VALIDATE_LIST_SIZE(msg.playerids(), 0, 10)
|
&& VALIDATE_LIST_SIZE(msg.playerids(), 0, 10)
|
||||||
&& msg.adminplayerid() != 0
|
&& msg.adminplayerid() != 0
|
||||||
&& ValidateGameInfo(msg.gameinfo())) {
|
&& ValidateGameInfo(msg.gameinfo())) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -444,7 +444,7 @@ NetPacketValidator::ValidateJoinExistingGameMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_joinexistinggamemessage()) {
|
if (packet.GetMsg()->has_joinexistinggamemessage()) {
|
||||||
const JoinExistingGameMessage &msg = packet.GetMsg()->joinexistinggamemessage();
|
const JoinExistingGameMessage &msg = packet.GetMsg()->joinexistinggamemessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& (!msg.has_password() || VALIDATE_STRING_SIZE(msg.password(), 1, 64))) {
|
&& (!msg.has_password() || VALIDATE_STRING_SIZE(msg.password(), 1, 64))) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -459,7 +459,7 @@ NetPacketValidator::ValidateJoinNewGameMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_joinnewgamemessage()) {
|
if (packet.GetMsg()->has_joinnewgamemessage()) {
|
||||||
const JoinNewGameMessage &msg = packet.GetMsg()->joinnewgamemessage();
|
const JoinNewGameMessage &msg = packet.GetMsg()->joinnewgamemessage();
|
||||||
if (ValidateGameInfo(msg.gameinfo())
|
if (ValidateGameInfo(msg.gameinfo())
|
||||||
&& (!msg.has_password() || VALIDATE_STRING_SIZE(msg.password(), 1, 64))) {
|
&& (!msg.has_password() || VALIDATE_STRING_SIZE(msg.password(), 1, 64))) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -669,8 +669,8 @@ NetPacketValidator::ValidateGameStartInitialMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_gamestartinitialmessage()) {
|
if (packet.GetMsg()->has_gamestartinitialmessage()) {
|
||||||
const GameStartInitialMessage &msg = packet.GetMsg()->gamestartinitialmessage();
|
const GameStartInitialMessage &msg = packet.GetMsg()->gamestartinitialmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& msg.startdealerplayerid() != 0
|
&& msg.startdealerplayerid() != 0
|
||||||
&& VALIDATE_LIST_SIZE(msg.playerseats(), 2, 10)) {
|
&& VALIDATE_LIST_SIZE(msg.playerseats(), 2, 10)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -685,9 +685,9 @@ NetPacketValidator::ValidateGameStartRejoinMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_gamestartrejoinmessage()) {
|
if (packet.GetMsg()->has_gamestartrejoinmessage()) {
|
||||||
const GameStartRejoinMessage &msg = packet.GetMsg()->gamestartrejoinmessage();
|
const GameStartRejoinMessage &msg = packet.GetMsg()->gamestartrejoinmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& msg.startdealerplayerid() != 0
|
&& msg.startdealerplayerid() != 0
|
||||||
&& msg.handnum() != 0
|
&& msg.handnum() != 0
|
||||||
&& VALIDATE_LIST_SIZE(msg.rejoinplayerdata(), 2, 10)) {
|
&& VALIDATE_LIST_SIZE(msg.rejoinplayerdata(), 2, 10)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -702,8 +702,8 @@ NetPacketValidator::ValidateHandStartMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_handstartmessage()) {
|
if (packet.GetMsg()->has_handstartmessage()) {
|
||||||
const HandStartMessage &msg = packet.GetMsg()->handstartmessage();
|
const HandStartMessage &msg = packet.GetMsg()->handstartmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& VALIDATE_UINT_RANGE(msg.smallblind(), 1, 100000000)
|
&& VALIDATE_UINT_RANGE(msg.smallblind(), 1, 100000000)
|
||||||
&& VALIDATE_LIST_SIZE(msg.seatstates(), 2, 10)) {
|
&& VALIDATE_LIST_SIZE(msg.seatstates(), 2, 10)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -731,8 +731,8 @@ NetPacketValidator::ValidateMyActionRequestMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_myactionrequestmessage()) {
|
if (packet.GetMsg()->has_myactionrequestmessage()) {
|
||||||
const MyActionRequestMessage &msg = packet.GetMsg()->myactionrequestmessage();
|
const MyActionRequestMessage &msg = packet.GetMsg()->myactionrequestmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& msg.handnum() != 0
|
&& msg.handnum() != 0
|
||||||
&& VALIDATE_UINT_UPPER(msg.myrelativebet(), 10000000)) {
|
&& VALIDATE_UINT_UPPER(msg.myrelativebet(), 10000000)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -773,9 +773,9 @@ NetPacketValidator::ValidateDealFlopCardsMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_dealflopcardsmessage()) {
|
if (packet.GetMsg()->has_dealflopcardsmessage()) {
|
||||||
const DealFlopCardsMessage &msg = packet.GetMsg()->dealflopcardsmessage();
|
const DealFlopCardsMessage &msg = packet.GetMsg()->dealflopcardsmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& VALIDATE_UINT_UPPER(msg.flopcard1(), 51)
|
&& VALIDATE_UINT_UPPER(msg.flopcard1(), 51)
|
||||||
&& VALIDATE_UINT_UPPER(msg.flopcard2(), 51)
|
&& VALIDATE_UINT_UPPER(msg.flopcard2(), 51)
|
||||||
&& VALIDATE_UINT_UPPER(msg.flopcard3(), 51)) {
|
&& VALIDATE_UINT_UPPER(msg.flopcard3(), 51)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -790,7 +790,7 @@ NetPacketValidator::ValidateDealTurnCardMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_dealturncardmessage()) {
|
if (packet.GetMsg()->has_dealturncardmessage()) {
|
||||||
const DealTurnCardMessage &msg = packet.GetMsg()->dealturncardmessage();
|
const DealTurnCardMessage &msg = packet.GetMsg()->dealturncardmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& VALIDATE_UINT_UPPER(msg.turncard(), 51)) {
|
&& VALIDATE_UINT_UPPER(msg.turncard(), 51)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -805,7 +805,7 @@ NetPacketValidator::ValidateDealRiverCardMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_dealrivercardmessage()) {
|
if (packet.GetMsg()->has_dealrivercardmessage()) {
|
||||||
const DealRiverCardMessage &msg = packet.GetMsg()->dealrivercardmessage();
|
const DealRiverCardMessage &msg = packet.GetMsg()->dealrivercardmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& VALIDATE_UINT_UPPER(msg.rivercard(), 51)) {
|
&& VALIDATE_UINT_UPPER(msg.rivercard(), 51)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -820,7 +820,7 @@ NetPacketValidator::ValidateAllInShowCardsMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_allinshowcardsmessage()) {
|
if (packet.GetMsg()->has_allinshowcardsmessage()) {
|
||||||
const AllInShowCardsMessage &msg = packet.GetMsg()->allinshowcardsmessage();
|
const AllInShowCardsMessage &msg = packet.GetMsg()->allinshowcardsmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& VALIDATE_LIST_SIZE(msg.playersallin(), 1, 10)) {
|
&& VALIDATE_LIST_SIZE(msg.playersallin(), 1, 10)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -835,7 +835,7 @@ NetPacketValidator::ValidateEndOfHandShowCardsMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_endofhandshowcardsmessage()) {
|
if (packet.GetMsg()->has_endofhandshowcardsmessage()) {
|
||||||
const EndOfHandShowCardsMessage &msg = packet.GetMsg()->endofhandshowcardsmessage();
|
const EndOfHandShowCardsMessage &msg = packet.GetMsg()->endofhandshowcardsmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& VALIDATE_LIST_SIZE(msg.playerresults(), 1, 10)) {
|
&& VALIDATE_LIST_SIZE(msg.playerresults(), 1, 10)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -938,11 +938,11 @@ NetPacketValidator::ValidateStartKickPetitionMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_startkickpetitionmessage()) {
|
if (packet.GetMsg()->has_startkickpetitionmessage()) {
|
||||||
const StartKickPetitionMessage &msg = packet.GetMsg()->startkickpetitionmessage();
|
const StartKickPetitionMessage &msg = packet.GetMsg()->startkickpetitionmessage();
|
||||||
if (msg.gameid() != 0
|
if (msg.gameid() != 0
|
||||||
&& msg.petitionid() != 0
|
&& msg.petitionid() != 0
|
||||||
&& msg.proposingplayerid() != 0
|
&& msg.proposingplayerid() != 0
|
||||||
&& msg.kickplayerid() != 0
|
&& msg.kickplayerid() != 0
|
||||||
&& msg.kicktimeoutsec() > 0
|
&& msg.kicktimeoutsec() > 0
|
||||||
&& msg.numvotesneededtokick() > 0) {
|
&& msg.numvotesneededtokick() > 0) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -1095,7 +1095,7 @@ NetPacketValidator::ValidateReportAvatarMessage(const NetPacket &packet)
|
|||||||
if (packet.GetMsg()->has_reportavatarmessage()) {
|
if (packet.GetMsg()->has_reportavatarmessage()) {
|
||||||
const ReportAvatarMessage &msg = packet.GetMsg()->reportavatarmessage();
|
const ReportAvatarMessage &msg = packet.GetMsg()->reportavatarmessage();
|
||||||
if (msg.reportedplayerid() != 0
|
if (msg.reportedplayerid() != 0
|
||||||
&& msg.reportedavatarhash().size() == 16) {
|
&& msg.reportedavatarhash().size() == 16) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
@@ -1210,17 +1210,17 @@ NetPacketValidator::ValidateGameInfo(const NetGameInfo &gameInfo)
|
|||||||
{
|
{
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
if (VALIDATE_STRING_SIZE(gameInfo.gamename(), 1, 64)
|
if (VALIDATE_STRING_SIZE(gameInfo.gamename(), 1, 64)
|
||||||
&& VALIDATE_UINT_RANGE(gameInfo.maxnumplayers(), 2, 10)
|
&& VALIDATE_UINT_RANGE(gameInfo.maxnumplayers(), 2, 10)
|
||||||
&& (!gameInfo.has_raiseeveryhands() || VALIDATE_UINT_RANGE(gameInfo.raiseeveryhands(), 1, 1000))
|
&& (!gameInfo.has_raiseeveryhands() || VALIDATE_UINT_RANGE(gameInfo.raiseeveryhands(), 1, 1000))
|
||||||
&& (!gameInfo.has_raiseeveryminutes() || VALIDATE_UINT_RANGE(gameInfo.raiseeveryminutes(), 1, 1000))
|
&& (!gameInfo.has_raiseeveryminutes() || VALIDATE_UINT_RANGE(gameInfo.raiseeveryminutes(), 1, 1000))
|
||||||
&& (!gameInfo.has_endraisesmallblindvalue() || VALIDATE_UINT_UPPER(gameInfo.endraisesmallblindvalue(), 1000000))
|
&& (!gameInfo.has_endraisesmallblindvalue() || VALIDATE_UINT_UPPER(gameInfo.endraisesmallblindvalue(), 1000000))
|
||||||
&& VALIDATE_UINT_RANGE(gameInfo.proposedguispeed(), 1, 11)
|
&& VALIDATE_UINT_RANGE(gameInfo.proposedguispeed(), 1, 11)
|
||||||
&& VALIDATE_UINT_RANGE(gameInfo.delaybetweenhands(), 5, 20)
|
&& VALIDATE_UINT_RANGE(gameInfo.delaybetweenhands(), 5, 20)
|
||||||
&& VALIDATE_UINT_UPPER(gameInfo.playeractiontimeout(), 60)
|
&& VALIDATE_UINT_UPPER(gameInfo.playeractiontimeout(), 60)
|
||||||
&& VALIDATE_UINT_RANGE(gameInfo.firstsmallblind(), 1, 20000)
|
&& VALIDATE_UINT_RANGE(gameInfo.firstsmallblind(), 1, 20000)
|
||||||
&& VALIDATE_UINT_RANGE(gameInfo.startmoney(), 1, 1000000)
|
&& VALIDATE_UINT_RANGE(gameInfo.startmoney(), 1, 1000000)
|
||||||
&& VALIDATE_LIST_SIZE(gameInfo.manualblinds(), 0, 30)
|
&& VALIDATE_LIST_SIZE(gameInfo.manualblinds(), 0, 30)
|
||||||
&& ValidateListIntRange(gameInfo.manualblinds(), 1, 1000000)) {
|
&& ValidateListIntRange(gameInfo.manualblinds(), 1, 1000000)) {
|
||||||
|
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ServerAcceptWebHelper::ServerAcceptWebHelper(ServerCallback &serverCallback, boost::shared_ptr<boost::asio::io_service> ioService,
|
ServerAcceptWebHelper::ServerAcceptWebHelper(ServerCallback &serverCallback, boost::shared_ptr<boost::asio::io_service> ioService,
|
||||||
const string &webSocketResource, const string &webSocketOrigin)
|
const string &webSocketResource, const string &webSocketOrigin)
|
||||||
: m_ioService(ioService), m_serverCallback(serverCallback),
|
: m_ioService(ioService), m_serverCallback(serverCallback),
|
||||||
m_webSocketResource(webSocketResource), m_webSocketOrigin(webSocketOrigin)
|
m_webSocketResource(webSocketResource), m_webSocketOrigin(webSocketOrigin)
|
||||||
{
|
{
|
||||||
@@ -78,7 +78,7 @@ ServerAcceptWebHelper::validate(websocketpp::connection_hdl hdl)
|
|||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
server::connection_ptr con = m_webSocketServer->get_con_from_hdl(hdl);
|
server::connection_ptr con = m_webSocketServer->get_con_from_hdl(hdl);
|
||||||
if ((m_webSocketResource.empty() || con->get_resource() == m_webSocketResource)
|
if ((m_webSocketResource.empty() || con->get_resource() == m_webSocketResource)
|
||||||
&& (m_webSocketOrigin.empty() || (con->get_origin() != "null" && con->get_origin() == m_webSocketOrigin))) {
|
&& (m_webSocketOrigin.empty() || (con->get_origin() != "null" && con->get_origin() == m_webSocketOrigin))) {
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|||||||
@@ -1372,7 +1372,7 @@ ServerLobbyThread::HandleNetPacketJoinGame(boost::shared_ptr<SessionData> sessio
|
|||||||
const GameData &tmpData = game->GetGameData();
|
const GameData &tmpData = game->GetGameData();
|
||||||
// As guest, you are only allowed to join normal games or to join as spectator.
|
// As guest, you are only allowed to join normal games or to join as spectator.
|
||||||
if (session->GetPlayerData()->GetRights() == PLAYER_RIGHTS_GUEST
|
if (session->GetPlayerData()->GetRights() == PLAYER_RIGHTS_GUEST
|
||||||
&& tmpData.gameType != GAME_TYPE_NORMAL && !joinGame.spectateonly()) {
|
&& tmpData.gameType != GAME_TYPE_NORMAL && !joinGame.spectateonly()) {
|
||||||
SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_GUEST_FORBIDDEN);
|
SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_GUEST_FORBIDDEN);
|
||||||
} else if (tmpData.gameType == GAME_TYPE_INVITE_ONLY
|
} else if (tmpData.gameType == GAME_TYPE_INVITE_ONLY
|
||||||
&& !game->IsPlayerInvited(session->GetPlayerData()->GetUniqueId())) {
|
&& !game->IsPlayerInvited(session->GetPlayerData()->GetUniqueId())) {
|
||||||
@@ -1584,8 +1584,8 @@ ServerLobbyThread::HandleNetPacketAdminBanPlayer(boost::shared_ptr<SessionData>
|
|||||||
// Permanently ban the player in the database.
|
// Permanently ban the player in the database.
|
||||||
if (tmpPlayer->GetDBId() != DB_ID_INVALID) {
|
if (tmpPlayer->GetDBId() != DB_ID_INVALID) {
|
||||||
LOG_ERROR("Player " << session->GetPlayerData()->GetName() << "(" << session->GetPlayerData()->GetDBId()
|
LOG_ERROR("Player " << session->GetPlayerData()->GetName() << "(" << session->GetPlayerData()->GetDBId()
|
||||||
<< ") bans player " << tmpPlayer->GetName() << "(" << tmpPlayer->GetDBId()
|
<< ") bans player " << tmpPlayer->GetName() << "(" << tmpPlayer->GetDBId()
|
||||||
<< ") who has IP " << tmpSession->GetClientAddr());
|
<< ") who has IP " << tmpSession->GetClientAddr());
|
||||||
GetDatabase()->AsyncBlockPlayer(session->GetPlayerData()->GetUniqueId(), tmpPlayer->GetUniqueId(), tmpPlayer->GetDBId(), 0, 4);
|
GetDatabase()->AsyncBlockPlayer(session->GetPlayerData()->GetUniqueId(), tmpPlayer->GetUniqueId(), tmpPlayer->GetDBId(), 0, 4);
|
||||||
netBanAck->set_banplayerresult(AdminBanPlayerAckMessage::banPlayerPending);
|
netBanAck->set_banplayerresult(AdminBanPlayerAckMessage::banPlayerPending);
|
||||||
} else {
|
} else {
|
||||||
@@ -1837,8 +1837,7 @@ ServerLobbyThread::TimerRemoveGame(const boost::system::error_code &ec)
|
|||||||
GameMap::iterator next = i;
|
GameMap::iterator next = i;
|
||||||
++next;
|
++next;
|
||||||
boost::shared_ptr<ServerGame> tmpGame = i->second;
|
boost::shared_ptr<ServerGame> tmpGame = i->second;
|
||||||
if (!tmpGame->GetSessionManager().HasSessionWithState(SessionData::Game))
|
if (!tmpGame->GetSessionManager().HasSessionWithState(SessionData::Game)) {
|
||||||
{
|
|
||||||
tmpGame->MoveSpectatorsToLobby();
|
tmpGame->MoveSpectatorsToLobby();
|
||||||
InternalRemoveGame(tmpGame); // This will delete the game.
|
InternalRemoveGame(tmpGame); // This will delete the game.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ ServerManager::Init(unsigned serverPort, unsigned websocketPort, bool ipv6, int
|
|||||||
sctpAcceptHelper->Listen(serverPort, ipv6, logDir, m_lobbyThread);
|
sctpAcceptHelper->Listen(serverPort, ipv6, logDir, m_lobbyThread);
|
||||||
m_acceptHelperPool.push_back(sctpAcceptHelper);
|
m_acceptHelperPool.push_back(sctpAcceptHelper);
|
||||||
}*/
|
}*/
|
||||||
if (proto & TRANSPORT_PROTOCOL_WEBSOCKET)
|
if (proto & TRANSPORT_PROTOCOL_WEBSOCKET) {
|
||||||
{
|
|
||||||
boost::shared_ptr<ServerAcceptInterface> webAcceptHelper(
|
boost::shared_ptr<ServerAcceptInterface> webAcceptHelper(
|
||||||
new ServerAcceptWebHelper(GetGui(), m_ioService, webSocketResource, webSocketOrigin));
|
new ServerAcceptWebHelper(GetGui(), m_ioService, webSocketResource, webSocketOrigin));
|
||||||
webAcceptHelper->Listen(websocketPort, ipv6, logDir, m_lobbyThread);
|
webAcceptHelper->Listen(websocketPort, ipv6, logDir, m_lobbyThread);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
// Set the parameters.
|
// Set the parameters.
|
||||||
virtual void Init(unsigned serverPort, unsigned websocketPort, bool ipv6, int proto, const std::string &logDir,
|
virtual void Init(unsigned serverPort, unsigned websocketPort, bool ipv6, int proto, const std::string &logDir,
|
||||||
const std::string &webSocketResource, const std::string &webSocketOrigin);
|
const std::string &webSocketResource, const std::string &webSocketOrigin);
|
||||||
|
|
||||||
// Main start function.
|
// Main start function.
|
||||||
virtual void RunAll();
|
virtual void RunAll();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
// Set the parameters.
|
// Set the parameters.
|
||||||
virtual void Init(unsigned serverPort, unsigned websocketPort, bool ipv6, int proto, const std::string &logDir,
|
virtual void Init(unsigned serverPort, unsigned websocketPort, bool ipv6, int proto, const std::string &logDir,
|
||||||
const std::string &webSocketResource, const std::string &webSocketOrigin);
|
const std::string &webSocketResource, const std::string &webSocketOrigin);
|
||||||
|
|
||||||
// Main start function.
|
// Main start function.
|
||||||
virtual void RunAll();
|
virtual void RunAll();
|
||||||
|
|||||||
@@ -36,8 +36,7 @@
|
|||||||
#include <net/websocket_defs.h>
|
#include <net/websocket_defs.h>
|
||||||
|
|
||||||
|
|
||||||
struct WebSocketData
|
struct WebSocketData {
|
||||||
{
|
|
||||||
boost::shared_ptr<server> webSocketServer;
|
boost::shared_ptr<server> webSocketServer;
|
||||||
websocketpp::connection_hdl webHandle;
|
websocketpp::connection_hdl webHandle;
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-2
@@ -211,8 +211,7 @@ int main( int argc, char **argv )
|
|||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
if(customWelcomePokerTHFile.exists()) {
|
if(customWelcomePokerTHFile.exists()) {
|
||||||
pixmap.load(QFileInfo(customWelcomePokerTHFile).absoluteFilePath());
|
pixmap.load(QFileInfo(customWelcomePokerTHFile).absoluteFilePath());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
//if custom welcome pic could not be saved locally we need to scale it on the fly
|
//if custom welcome pic could not be saved locally we need to scale it on the fly
|
||||||
pixmap.load(":/android/android-data/gfx/gui/misc/welcomepokerth10_mobile.png");
|
pixmap.load(":/android/android-data/gfx/gui/misc/welcomepokerth10_mobile.png");
|
||||||
pixmap = pixmap.scaled(screenWidth, screenHeight, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
pixmap = pixmap.scaled(screenWidth, screenHeight, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||||
|
|||||||
Reference in New Issue
Block a user