Compare commits
192
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffdcd9af61 | ||
|
|
1449e370d5 | ||
|
|
31f7b845ff | ||
|
|
60d96d4d75 | ||
|
|
8ebc7509e9 | ||
|
|
95fac5a4f5 | ||
|
|
0341c26559 | ||
|
|
1e985d9069 | ||
|
|
a54de1f063 | ||
|
|
0622ed28a1 | ||
|
|
f901d63298 | ||
|
|
ea596f286b | ||
|
|
6a5554ca6f | ||
|
|
b44e7aef7d | ||
|
|
3fcb4bdf04 | ||
|
|
add1a616b2 | ||
|
|
1e7799ca79 | ||
|
|
836986c70b | ||
|
|
ebf6108e53 | ||
|
|
363c5f13e0 | ||
|
|
0e0a8fddd8 | ||
|
|
9e359ae749 | ||
|
|
5b369cfaf7 | ||
|
|
5c4983fb1e | ||
|
|
f9b9b91df7 | ||
|
|
d707d3d653 | ||
|
|
fb9a1a8781 | ||
|
|
926924a7f6 | ||
|
|
c2aba0782c | ||
|
|
b3117f3046 | ||
|
|
bbd05513fd | ||
|
|
78d150867f | ||
|
|
289adcd743 | ||
|
|
b628df6868 | ||
|
|
8120e1772f | ||
|
|
9062317a38 | ||
|
|
7303d235a0 | ||
|
|
f44711082b | ||
|
|
3f1f946653 | ||
|
|
df81e925dc | ||
|
|
213d110bc6 | ||
|
|
a93bb49485 | ||
|
|
16282c5096 | ||
|
|
749c0bb633 | ||
|
|
8290930393 | ||
|
|
5bd3d84bc2 | ||
|
|
66169137a5 | ||
|
|
0bba55d3c4 | ||
|
|
9042442d33 | ||
|
|
8c7d409a8d | ||
|
|
e5a975dd8c | ||
|
|
6681fe2102 | ||
|
|
1f6758f3dc | ||
|
|
b8d84e32b9 | ||
|
|
24b9a4eb4d | ||
|
|
6146a71ddd | ||
|
|
3606875b3d | ||
|
|
eedd9c0526 | ||
|
|
cfced4e480 | ||
|
|
33c3cc2dc4 | ||
|
|
f610568532 | ||
|
|
36389ba750 | ||
|
|
fdc37cfb65 | ||
|
|
d0332aab7c | ||
|
|
4c30f251f0 | ||
|
|
2f4492a4af | ||
|
|
a1f9278b4f | ||
|
|
9931e499bc | ||
|
|
5fa4dee864 | ||
|
|
c5bd29f4fe | ||
|
|
0598470942 | ||
|
|
834449af57 | ||
|
|
63cf638805 | ||
|
|
e1bceec4b1 | ||
|
|
e272ff0eed | ||
|
|
5f69d6e9f0 | ||
|
|
a28d67ac97 | ||
|
|
8ad3f8de69 | ||
|
|
9e547bcb98 | ||
|
|
2dbc570f15 | ||
|
|
ab595e8bea | ||
|
|
dbcb482cb9 | ||
|
|
2a43df54e0 | ||
|
|
57a17d7955 | ||
|
|
97cac10b9a | ||
|
|
c3ecf794d8 | ||
|
|
cab243d978 | ||
|
|
2b15e8536c | ||
|
|
40a25f4a1e | ||
|
|
ec1c39040d | ||
|
|
dd585173c3 | ||
|
|
eab4ddde55 | ||
|
|
600f95bdd0 | ||
|
|
e6413d143e | ||
|
|
06f9fb7fff | ||
|
|
f35ce20ff9 | ||
|
|
e4f27684c9 | ||
|
|
36ac47e1af | ||
|
|
c3a5c8ec85 | ||
|
|
ff4c2c5302 | ||
|
|
7cda99e881 | ||
|
|
f4b1d7a5f3 | ||
|
|
b2fbe16387 | ||
|
|
c83be07cd0 | ||
|
|
ac44fcf8c6 | ||
|
|
197d11b787 | ||
|
|
f4f0c4ec71 | ||
|
|
7d37c2f3fc | ||
|
|
0e90d0ab52 | ||
|
|
c97fd1daa1 | ||
|
|
4fa8364571 | ||
|
|
1325690e8e | ||
|
|
32063dbf16 | ||
|
|
02b5fd9675 | ||
|
|
aa4a71fb10 | ||
|
|
e17cb27a8b | ||
|
|
9d8d10d123 | ||
|
|
be3f7c93c8 | ||
|
|
04b4cb211c | ||
|
|
5c945df87e | ||
|
|
9c5a47a5bf | ||
|
|
98ce3c6f95 | ||
|
|
ff56a0629b | ||
|
|
8b223f6796 | ||
|
|
86e348ed94 | ||
|
|
1c71253efe | ||
|
|
9b3fffc003 | ||
|
|
1c1195fa43 | ||
|
|
afcec9d39a | ||
|
|
ecf5996135 | ||
|
|
4e695d88af | ||
|
|
a153d458dc | ||
|
|
da00a9a20e | ||
|
|
64e543fc16 | ||
|
|
ca8e11b18c | ||
|
|
9ea49b6d1c | ||
|
|
106a37330a | ||
|
|
1a5cd36dcf | ||
|
|
df460313ab | ||
|
|
cbb35b4aa3 | ||
|
|
fc614ca5ec | ||
|
|
69189291af | ||
|
|
cee8977958 | ||
|
|
2b17095641 | ||
|
|
8f61128714 | ||
|
|
373052a8c7 | ||
|
|
9d31fc3b5e | ||
|
|
1eb486660e | ||
|
|
ce5b242ac3 | ||
|
|
93534a5154 | ||
|
|
d246fbcb64 | ||
|
|
5cf037c43f | ||
|
|
09c4e09946 | ||
|
|
a667b65a22 | ||
|
|
e1260038ea | ||
|
|
06e3c0e3c3 | ||
|
|
aa93874a45 | ||
|
|
709e898c51 | ||
|
|
34f17f24dc | ||
|
|
830145ff3a | ||
|
|
c80724c58a | ||
|
|
2f595bb8c7 | ||
|
|
f35495c05f | ||
|
|
b29a8cc0e7 | ||
|
|
b3674f2ea5 | ||
|
|
d488619ce3 | ||
|
|
289282dc7a | ||
|
|
5fe59ac751 | ||
|
|
7cc45e85d3 | ||
|
|
2effd5219a | ||
|
|
cb51ee79f2 | ||
|
|
4f91bf60dc | ||
|
|
7dc83ce49f | ||
|
|
d882d4f675 | ||
|
|
f6c47c053b | ||
|
|
8765379a2e | ||
|
|
df8f38b8a8 | ||
|
|
53602107d9 | ||
|
|
02e8c81974 | ||
|
|
ee6c80406a | ||
|
|
17036816af | ||
|
|
8964467ef9 | ||
|
|
9285fa1e32 | ||
|
|
ad5735b9fd | ||
|
|
24c05f6d74 | ||
|
|
a3337dd869 | ||
|
|
16cff5612e | ||
|
|
835a0f6df8 | ||
|
|
962eb48148 | ||
|
|
13ebae6618 | ||
|
|
ada2365a73 | ||
|
|
e18e459434 |
+3
-4
@@ -8,15 +8,14 @@ Makefile.pokerth_protocol
|
||||
Makefile.pokerth_server
|
||||
Makefile.pokerth_dbofficial
|
||||
bin/
|
||||
/chatcleaner
|
||||
chatcleaner
|
||||
lib/
|
||||
mocs/
|
||||
obj/
|
||||
/pokerth
|
||||
pokerth
|
||||
qrc_pokerth.cpp
|
||||
uics/
|
||||
make.sh
|
||||
gitpush_serverstuff_stable
|
||||
pokerth_server
|
||||
.vscode/
|
||||
.project
|
||||
.classpath
|
||||
|
||||
@@ -112,11 +112,6 @@ message NetGameInfo {
|
||||
required uint32 startMoney = 13;
|
||||
repeated uint32 manualBlinds = 14 [packed = true];
|
||||
optional bool allowSpectators = 15 [default = true];
|
||||
//new data
|
||||
optional bool allowLateReg = 16 [default = false];
|
||||
optional bool allowReentries = 17 [default = false];
|
||||
optional uint32 numReentries = 18 [default = 0];
|
||||
optional uint32 maxTimeLateReg = 19 [default = 0];
|
||||
}
|
||||
|
||||
// Message Part containing player result.
|
||||
@@ -424,7 +419,6 @@ message StartEventMessage {
|
||||
enum StartEventType {
|
||||
startEvent = 0;
|
||||
rejoinEvent = 1;
|
||||
reentryEvent = 2;
|
||||
}
|
||||
required StartEventType startEventType = 2;
|
||||
optional bool fillWithComputerPlayers = 3;
|
||||
@@ -451,17 +445,6 @@ message GameStartRejoinMessage {
|
||||
repeated RejoinPlayerData rejoinPlayerData = 4;
|
||||
}
|
||||
|
||||
message GameStartReentryMessage {
|
||||
required uint32 gameId = 1;
|
||||
required uint32 startDealerPlayerId = 2;
|
||||
required uint32 handNum = 3;
|
||||
message ReentryPlayerData {
|
||||
required uint32 playerId = 1;
|
||||
required uint32 playerMoney = 2;
|
||||
}
|
||||
repeated ReentryPlayerData reentryPlayerData = 4;
|
||||
}
|
||||
|
||||
message HandStartMessage {
|
||||
required uint32 gameId = 1;
|
||||
message PlainCards {
|
||||
@@ -852,7 +835,6 @@ message PokerTHMessage {
|
||||
Type_GameListSpectatorLeftMessage = 79;
|
||||
Type_GameSpectatorJoinedMessage = 80;
|
||||
Type_GameSpectatorLeftMessage = 81;
|
||||
Type_GameStartReentryMessage = 82;
|
||||
}
|
||||
required PokerTHMessageType messageType = 1;
|
||||
|
||||
@@ -937,5 +919,4 @@ message PokerTHMessage {
|
||||
optional GameListSpectatorLeftMessage gameListSpectatorLeftMessage = 80;
|
||||
optional GameSpectatorJoinedMessage gameSpectatorJoinedMessage = 81;
|
||||
optional GameSpectatorLeftMessage gameSpectatorLeftMessage = 82;
|
||||
optional GameStartReentryMessage gameStartReentryMessage = 83;
|
||||
}
|
||||
|
||||
@@ -35,11 +35,10 @@
|
||||
|
||||
#include <core/loghelper.h>
|
||||
#include <iostream>
|
||||
#include <boost/date_time.hpp>
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace boost::posix_time;
|
||||
|
||||
|
||||
static int g_logLevel = 1;
|
||||
|
||||
@@ -53,20 +52,20 @@ loghelper_init(const std::string & /*logDir*/, int logLevel)
|
||||
void
|
||||
internal_log_err(const string &msg)
|
||||
{
|
||||
cerr << second_clock::local_time() << " " << msg;
|
||||
cerr << msg;
|
||||
}
|
||||
|
||||
void
|
||||
internal_log_msg(const std::string &msg)
|
||||
{
|
||||
if (g_logLevel)
|
||||
cout << second_clock::local_time() << " " << msg;
|
||||
cout << msg;
|
||||
}
|
||||
|
||||
void
|
||||
internal_log_level(const std::string &msg, int logLevel)
|
||||
{
|
||||
if (g_logLevel >= logLevel)
|
||||
cout << second_clock::local_time() << " " << msg;
|
||||
cout << msg;
|
||||
}
|
||||
|
||||
|
||||
+1
-21
@@ -33,7 +33,6 @@
|
||||
|
||||
#include <enginefactory.h>
|
||||
#include <guiinterface.h>
|
||||
#include <core/loghelper.h>
|
||||
#include "log.h"
|
||||
|
||||
#include "localexception.h"
|
||||
@@ -88,9 +87,6 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
// create player
|
||||
player_i = playerDataList.begin();
|
||||
player_end = playerDataList.end();
|
||||
|
||||
LOG_MSG("Starting game... PLAYERS:");
|
||||
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
string myName;
|
||||
@@ -124,6 +120,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
activePlayerList->push_back(tmpPlayer);
|
||||
}
|
||||
(*runningPlayerList) = (*activePlayerList);
|
||||
|
||||
}
|
||||
|
||||
currentBoard->setPlayerLists(seatsList, activePlayerList, runningPlayerList);
|
||||
@@ -315,20 +312,3 @@ void Game::raiseBlinds()
|
||||
currentSmallBlind = min(currentSmallBlind,startQuantityPlayers*startCash/2);
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<PlayerInterface>
|
||||
Game::addNewPlayer(boost::shared_ptr<PlayerData> player)
|
||||
{
|
||||
|
||||
// TODO (albmed): We must think how:
|
||||
// also add to seatList (or replace a free slot if 10 players tops)
|
||||
|
||||
int i = 0; // ERROR. Thik about approppiate value (probably this should be set after a seat is found)
|
||||
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, player->GetUniqueId(), player->GetType(), player->GetName(), player->GetAvatarFile(), player->GetStartCash(), startQuantityPlayers > i, PLAYER_TYPE_HUMAN, 0);
|
||||
tmpPlayer->setIsSessionActive(true); // ??? Really ???
|
||||
tmpPlayer->setMyGuid(player->GetGuid());
|
||||
|
||||
|
||||
return tmpPlayer;
|
||||
}
|
||||
|
||||
@@ -142,8 +142,6 @@ public:
|
||||
boost::shared_ptr<PlayerInterface> getPlayerByName(const std::string &name);
|
||||
boost::shared_ptr<PlayerInterface> getCurrentPlayer();
|
||||
|
||||
boost::shared_ptr<PlayerInterface> addNewPlayer(boost::shared_ptr<PlayerData> player);
|
||||
|
||||
void raiseBlinds();
|
||||
|
||||
private:
|
||||
|
||||
@@ -66,12 +66,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||
50, 51
|
||||
};
|
||||
|
||||
// Shuffle three times
|
||||
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
||||
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
||||
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
||||
|
||||
int tempBoardArray[5];
|
||||
int tempPlayerArray[2];
|
||||
int tempPlayerAndBoardArray[7];
|
||||
|
||||
@@ -93,12 +93,6 @@ struct GameData {
|
||||
int guiSpeed;
|
||||
int delayBetweenHandsSec;
|
||||
int playerActionTimeoutSec;
|
||||
|
||||
// new data
|
||||
bool allowLateReg;
|
||||
bool allowReentries;
|
||||
int numReentries;
|
||||
int maxTimeLateReg;
|
||||
};
|
||||
|
||||
struct GameInfo {
|
||||
|
||||
@@ -6,256 +6,246 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>395</width>
|
||||
<height>573</height>
|
||||
<width>293</width>
|
||||
<height>410</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create Internet Game</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>388</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Internet Game Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>Default game name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_gameName">
|
||||
<property name="maxLength">
|
||||
<number>48</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Game type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_gameType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Internet Game Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/player_play.png</normaloff>:/gfx/player_play.png</iconset>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>Default game name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Registered players only</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/registered.png</normaloff>:/gfx/registered.png</iconset>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="lineEdit_gameName">
|
||||
<property name="maxLength">
|
||||
<number>48</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Game type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Invited players only</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/list_add_user.png</normaloff>:/gfx/list_add_user.png</iconset>
|
||||
</property>
|
||||
<widget class="QComboBox" name="comboBox_gameType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/player_play.png</normaloff>:/gfx/player_play.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Registered players only</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/registered.png</normaloff>:/gfx/registered.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Invited players only</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/list_add_user.png</normaloff>:/gfx/list_add_user.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ranking game</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/cup.png</normaloff>:/gfx/cup.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_Password">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/lock.png</normaloff>:/gfx/lock.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ranking game</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/cup.png</normaloff>:/gfx/cup.png</iconset>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="lineEdit_Password">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_Password">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/lock.png</normaloff>:/gfx/lock.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Password">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkBox_allowSpectators">
|
||||
<property name="text">
|
||||
<string>Allow spectators to watch the game</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_allowLateReg">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow late registration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_reentries">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow re-entries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_numReentries">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Maximum number of re-entries:</string>
|
||||
<string>Maximum number of players:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_quantityPlayers</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_numReentries">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_quantityPlayers">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_timeLateReg">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Maximum time for late registration/re-entry:</string>
|
||||
<string>Start Cash:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_quantityPlayers</cstring>
|
||||
<cstring>spinBox_startCash</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>13</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_timeLateReg">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_startCash">
|
||||
<property name="suffix">
|
||||
<string>min</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>$</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_blinds">
|
||||
<property name="title">
|
||||
<string>Blinds</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_useSavedBlindsSettings">
|
||||
<property name="text">
|
||||
<string>Use saved blinds settings</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_changeBlindsSettings">
|
||||
<property name="text">
|
||||
<string>Change blinds settings ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Timeout for player action:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_netTimeOutPlayerAction</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_netTimeOutPlayerAction">
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>5</number>
|
||||
@@ -264,208 +254,99 @@
|
||||
<number>60</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>15</number>
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Delay between hands:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_netDelayBetweenHands</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_netDelayBetweenHands">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkBox_allowSpectators">
|
||||
<property name="text">
|
||||
<string>Allow spectators to watch the game</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Maximum number of players:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_quantityPlayers</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_quantityPlayers">
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Start Cash:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_startCash</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_startCash">
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>€</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_blinds">
|
||||
<property name="title">
|
||||
<string>Blinds</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_useSavedBlindsSettings">
|
||||
<property name="text">
|
||||
<string>Use saved blinds settings</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_changeBlindsSettings">
|
||||
<property name="text">
|
||||
<string>Change blinds settings ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Timeout for player action:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_netTimeOutPlayerAction</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_netTimeOutPlayerAction">
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Delay between hands:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_netDelayBetweenHands</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_netDelayBetweenHands">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>540</y>
|
||||
<width>381</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="_2">
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>115</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_createGame">
|
||||
<property name="text">
|
||||
<string>Create Game</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>181</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_createGame">
|
||||
<property name="text">
|
||||
<string>Create Game</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEdit_gameName</tabstop>
|
||||
|
||||
@@ -68,11 +68,6 @@ createInternetGameDialogImpl::createInternetGameDialogImpl(QWidget *parent, Conf
|
||||
connect( pushButton_createGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
||||
connect( checkBox_Password, SIGNAL( toggled(bool) ), this, SLOT( clearGamePassword(bool)) );
|
||||
connect( comboBox_gameType, SIGNAL(currentIndexChanged(int)), this, SLOT( gameTypeChanged() ) );
|
||||
|
||||
// new connections
|
||||
connect(checkBox_allowLateReg, SIGNAL(toggled(bool)), this, SLOT(switchAllowReg(bool)));
|
||||
connect(checkBox_reentries, SIGNAL(toggled(bool)), this, SLOT(switchReentries(bool)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +165,6 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
||||
raiseMode->hide();
|
||||
checkBox_allowSpectators->setEnabled(true);
|
||||
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
||||
switchLateReg(true); // allow late reg & reentries
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -186,7 +180,6 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
||||
raiseMode->hide();
|
||||
checkBox_allowSpectators->setEnabled(true);
|
||||
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
||||
switchLateReg(true); // allow late reg & reentries
|
||||
}
|
||||
break;
|
||||
case GAME_TYPE_INVITE_ONLY-1: {
|
||||
@@ -202,7 +195,6 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
||||
raiseMode->hide();
|
||||
checkBox_allowSpectators->setEnabled(true);
|
||||
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
||||
switchLateReg(false); // don't allow late reg & reentries
|
||||
}
|
||||
break;
|
||||
case GAME_TYPE_RANKING-1: {
|
||||
@@ -219,7 +211,6 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
||||
raiseMode->show();
|
||||
checkBox_allowSpectators->setDisabled(true);
|
||||
checkBox_allowSpectators->setChecked(true);
|
||||
switchLateReg(false); // don't allow late reg & reentries
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -261,51 +252,6 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void createInternetGameDialogImpl::switchLateReg(bool enable) {
|
||||
if (enable) {
|
||||
checkBox_allowLateReg->setDisabled(false);
|
||||
checkBox_allowLateReg->setChecked(true);
|
||||
checkBox_reentries->setDisabled(false);
|
||||
checkBox_reentries->setChecked(true);
|
||||
}
|
||||
else {
|
||||
checkBox_allowLateReg->setDisabled(true);
|
||||
checkBox_allowLateReg->setChecked(false);
|
||||
checkBox_reentries->setDisabled(true);
|
||||
checkBox_reentries->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void createInternetGameDialogImpl::switchReentries(bool enable) {
|
||||
if (enable) {
|
||||
label_numReentries->setDisabled(false);
|
||||
spinBox_numReentries->setDisabled(false);
|
||||
label_timeLateReg->setDisabled(false);
|
||||
spinBox_timeLateReg->setDisabled(false);
|
||||
}
|
||||
else {
|
||||
label_numReentries->setDisabled(true);
|
||||
spinBox_numReentries->setDisabled(true);
|
||||
if (!(checkBox_allowLateReg->isEnabled() && checkBox_allowLateReg->isChecked())) {
|
||||
label_timeLateReg->setDisabled(true);
|
||||
spinBox_timeLateReg->setDisabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void createInternetGameDialogImpl::switchAllowReg(bool enable) {
|
||||
if (enable) {
|
||||
label_timeLateReg->setDisabled(false);
|
||||
spinBox_timeLateReg->setDisabled(false);
|
||||
}
|
||||
else {
|
||||
if (!(checkBox_reentries->isEnabled() && checkBox_reentries->isChecked())) {
|
||||
label_timeLateReg->setDisabled(true);
|
||||
spinBox_timeLateReg->setDisabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool createInternetGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
#ifdef ANDROID
|
||||
|
||||
@@ -67,13 +67,8 @@ public slots:
|
||||
void gameTypeChanged();
|
||||
|
||||
void callChangeBlindsDialog(bool);
|
||||
|
||||
void switchAllowReg(bool);
|
||||
void switchReentries(bool);
|
||||
private:
|
||||
|
||||
void switchLateReg(bool);
|
||||
|
||||
ConfigFile *myConfig;
|
||||
changeCompleteBlindsDialogImpl *myChangeCompleteBlindsDialog;
|
||||
bool currentGuestMode;
|
||||
|
||||
@@ -352,17 +352,6 @@ void gameLobbyDialogImpl::createGame()
|
||||
}
|
||||
}
|
||||
|
||||
if (myCreateInternetGameDialog->checkBox_allowLateReg->isEnabled() && myCreateInternetGameDialog->checkBox_allowLateReg->isChecked()) {
|
||||
gameData.allowLateReg = true;
|
||||
gameData.maxTimeLateReg = myCreateInternetGameDialog->spinBox_timeLateReg->value();
|
||||
}
|
||||
if (myCreateInternetGameDialog->checkBox_reentries->isEnabled() && myCreateInternetGameDialog->checkBox_reentries->isChecked()) {
|
||||
gameData.allowReentries = true;
|
||||
gameData.numReentries = myCreateInternetGameDialog->spinBox_numReentries->value();
|
||||
gameData.maxTimeLateReg = myCreateInternetGameDialog->spinBox_timeLateReg->value();
|
||||
}
|
||||
|
||||
|
||||
gameData.guiSpeed = myConfig->readConfigInt("GameSpeed");
|
||||
gameData.delayBetweenHandsSec = myCreateInternetGameDialog->spinBox_netDelayBetweenHands->value();
|
||||
gameData.playerActionTimeoutSec = myCreateInternetGameDialog->spinBox_netTimeOutPlayerAction->value();
|
||||
|
||||
@@ -2222,13 +2222,13 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>114</height>
|
||||
<height>94</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>114</height>
|
||||
<height>94</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
@@ -2631,13 +2631,6 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="5">
|
||||
<widget class="QLabel" name="label_WinningCombination">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#include "carddeckstylereader.h"
|
||||
#include <gamedata.h>
|
||||
#include <generic/serverguiwrapper.h>
|
||||
#include <core/loghelper.h>
|
||||
|
||||
#include <net/socket_msg.h>
|
||||
|
||||
#include <cmath>
|
||||
@@ -81,8 +81,6 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
{
|
||||
int i;
|
||||
|
||||
LOG_MSG("starting gameTableImpl");
|
||||
|
||||
// this->setStyle(new QPlastiqueStyle);
|
||||
|
||||
//for statistic development
|
||||
@@ -872,8 +870,6 @@ void gameTableImpl::initGui(int speed)
|
||||
//kill running Singleshots!!!
|
||||
stopTimer();
|
||||
|
||||
LOG_MSG("starting gameTableImpl::initGui");
|
||||
|
||||
label_handNumber->setText(HandString+":");
|
||||
label_gameNumber->setText(GameString+":");
|
||||
|
||||
@@ -938,7 +934,6 @@ void gameTableImpl::initGui(int speed)
|
||||
|
||||
#endif
|
||||
|
||||
LOG_MSG("ending gameTableImpl::initGui");
|
||||
}
|
||||
|
||||
boost::shared_ptr<Session> gameTableImpl::getSession()
|
||||
@@ -2535,7 +2530,6 @@ void gameTableImpl::postRiverRunAnimation2()
|
||||
|
||||
if(nonfoldPlayersCounter!=1) {
|
||||
|
||||
label_WinningCombination->setText(CardsValue::determineHandName(currentGame->getCurrentHand()->getCurrentBeRo()->getHighestCardsValue(), activePlayerList).c_str());
|
||||
if(!flipHolecardsAllInAlreadyDone) {
|
||||
|
||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
||||
@@ -3023,8 +3017,6 @@ void gameTableImpl::nextRoundCleanGui()
|
||||
resetMyButtonsCheckStateMemory();
|
||||
clearMyButtons();
|
||||
pushButton_showMyCards->hide();
|
||||
label_WinningCombination->clear();
|
||||
update();
|
||||
}
|
||||
|
||||
void gameTableImpl::stopTimer()
|
||||
@@ -4125,7 +4117,6 @@ void gameTableImpl::refreshGameTableStyle()
|
||||
myGameTableStyle->setBigFontBoardStyle(textLabel_handLabel);
|
||||
myGameTableStyle->setBigFontBoardStyle(label_Pot);
|
||||
#endif
|
||||
myGameTableStyle->setBigFontBoardStyle(label_WinningCombination);
|
||||
myGameTableStyle->setCardHolderStyle(label_CardHolder0,0);
|
||||
myGameTableStyle->setCardHolderStyle(label_CardHolder1,0);
|
||||
myGameTableStyle->setCardHolderStyle(label_CardHolder2,0);
|
||||
|
||||
@@ -2745,13 +2745,13 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>390</width>
|
||||
<height>102</height>
|
||||
<height>82</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>390</width>
|
||||
<height>102</height>
|
||||
<height>82</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
@@ -3039,13 +3039,6 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_WinningCombination">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "configfile.h"
|
||||
#include "soundevents.h"
|
||||
#include <net/socket_msg.h>
|
||||
#include <core/loghelper.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -47,7 +46,6 @@ using namespace std;
|
||||
GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myGuiLog(NULL), myW(NULL), myConfig(c), myStartWindow(s)
|
||||
{
|
||||
|
||||
LOG_MSG("starting GuiWrapper");
|
||||
|
||||
myW = new gameTableImpl(myConfig);
|
||||
myGuiLog = new guiLog(myW, myConfig);
|
||||
@@ -65,7 +63,6 @@ GuiWrapper::~GuiWrapper()
|
||||
|
||||
void GuiWrapper::initGui(int speed)
|
||||
{
|
||||
LOG_MSG("starting GuiWrapper::initGui");
|
||||
myW->signalInitGui(speed);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <gamedata.h>
|
||||
#include <generic/serverguiwrapper.h>
|
||||
#include <net/socket_msg.h>
|
||||
#include <core/loghelper.h>
|
||||
#include "tools.h"
|
||||
#include "session.h"
|
||||
#include "game.h"
|
||||
@@ -73,8 +72,6 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
|
||||
: myConfig(c), myLog(l), msgBoxOutdatedVersionActive(false)
|
||||
{
|
||||
|
||||
LOG_MSG("starting startWindowImpl");
|
||||
|
||||
myGuiInterface.reset(new GuiWrapper(myConfig, this));
|
||||
{
|
||||
mySession.reset(new Session(myGuiInterface.get(), myConfig, myLog));
|
||||
|
||||
@@ -105,7 +105,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
|
||||
size_t packetSize = ntohl(nativeVal);
|
||||
if (packetSize > MAX_PACKET_SIZE) {
|
||||
recvBufUsed = 0;
|
||||
LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - Invalid packet size: " << packetSize);
|
||||
LOG_ERROR("Session " << session->GetId() << " - Invalid packet size: " << packetSize);
|
||||
} else if (recvBufUsed >= packetSize + NET_HEADER_SIZE) {
|
||||
try {
|
||||
tmpPacket = NetPacket::Create(&recvBuf[NET_HEADER_SIZE], packetSize);
|
||||
@@ -118,7 +118,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
|
||||
} catch (const exception &e) {
|
||||
// Reset buffer on error.
|
||||
recvBufUsed = 0;
|
||||
LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - " << e.what());
|
||||
LOG_ERROR("Session " << session->GetId() << " - " << e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
|
||||
if (validator.IsValidPacket(*tmpPacket)) {
|
||||
receivedPackets.push_back(tmpPacket);
|
||||
} else {
|
||||
LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - Invalid packet: " << tmpPacket->GetMsg()->messagetype());
|
||||
LOG_ERROR("Session " << session->GetId() << " - Invalid packet: " << tmpPacket->GetMsg()->messagetype());
|
||||
}
|
||||
} else {
|
||||
dataAvailable = false;
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
#include <core/crypthelper.h>
|
||||
#include <qttoolsinterface.h>
|
||||
|
||||
#include <core/loghelper.h>
|
||||
|
||||
#include <game.h>
|
||||
#include <playerinterface.h>
|
||||
|
||||
@@ -1520,14 +1518,6 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
|
||||
if (!tmpPlayer)
|
||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||
tmpPlayer->SetNumber(i);
|
||||
|
||||
LOG_MSG("PlayerData: {playerId, name, GUID, seat, number} -> {" <<
|
||||
playerId << "," <<
|
||||
tmpPlayer->GetName() << "," <<
|
||||
tmpPlayer->GetGuid() << "," <<
|
||||
i << "," <<
|
||||
tmpPlayer->GetNumber()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0);
|
||||
@@ -1562,54 +1552,6 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
|
||||
throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0);
|
||||
}
|
||||
client->InitGame();
|
||||
|
||||
|
||||
LOG_MSG("Game created. Let's LOG:");
|
||||
// LOG seats
|
||||
{
|
||||
boost::shared_ptr<Game> tmpGame = client->GetGame();
|
||||
PlayerListConstIterator it_c;
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer;
|
||||
PlayerList seatsList = tmpGame->getSeatsList();
|
||||
PlayerList activePlayerList = tmpGame->getActivePlayerList();
|
||||
PlayerList runningPlayerList = tmpGame->getRunningPlayerList();
|
||||
|
||||
LOG_MSG("\t === Player seats === ");
|
||||
for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||
tmpPlayer = *it_c;
|
||||
|
||||
LOG_MSG("\t\t {ID, name, GUID; UID} => " <<
|
||||
tmpPlayer->getMyID() << ", " <<
|
||||
tmpPlayer->getMyName() << ", " <<
|
||||
tmpPlayer->getMyUniqueID() << ", " <<
|
||||
tmpPlayer->getMyGuid());
|
||||
}
|
||||
|
||||
|
||||
LOG_MSG("\t === Player active List === ");
|
||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
||||
tmpPlayer = *it_c;
|
||||
|
||||
LOG_MSG("\t\t {ID, name, GUID; UID} => " <<
|
||||
tmpPlayer->getMyID() << ", " <<
|
||||
tmpPlayer->getMyName() << ", " <<
|
||||
tmpPlayer->getMyUniqueID() << ", " <<
|
||||
tmpPlayer->getMyGuid());
|
||||
}
|
||||
|
||||
LOG_MSG("\t === Player running List === ");
|
||||
for (it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); ++it_c) {
|
||||
tmpPlayer = *it_c;
|
||||
|
||||
LOG_MSG("\t\t {ID, name, GUID; UID} => " <<
|
||||
tmpPlayer->getMyID() << ", " <<
|
||||
tmpPlayer->getMyName() << ", " <<
|
||||
tmpPlayer->getMyUniqueID() << ", " <<
|
||||
tmpPlayer->getMyGuid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
client->GetGame()->setCurrentHandID(tmpHandId);
|
||||
// We need to remove the temporary player data objects after creating the game.
|
||||
BOOST_FOREACH(unsigned tmpPlayerId, tmpPlayerList) {
|
||||
@@ -1763,8 +1705,6 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
||||
client->GetCallback().SignalNetClientPostRiverShowCards(r.playerid());
|
||||
client->GetClientLog()->logHoleCardsHandName(client->GetGame()->getActivePlayerList(), tmpPlayer, true);
|
||||
} else if (tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_PlayerIdChangedMessage) {
|
||||
|
||||
LOG_MSG("performing rejoin");
|
||||
boost::shared_ptr<Game> curGame = client->GetGame();
|
||||
if (curGame) {
|
||||
// Perform Id change.
|
||||
@@ -1772,9 +1712,6 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(idChanged.oldplayerid());
|
||||
if (!tmpPlayer)
|
||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||
|
||||
LOG_MSG("Player rejoins with " << tmpPlayer->getMyCash());
|
||||
|
||||
tmpPlayer->setMyUniqueID(idChanged.newplayerid());
|
||||
// This player is now active again.
|
||||
tmpPlayer->setMyStayOnTableStatus(true);
|
||||
|
||||
@@ -113,10 +113,6 @@ NetPacket::SetGameData(const GameData &inData, NetGameInfo &outData)
|
||||
outData.set_endraisesmallblindvalue(inData.afterMBAlwaysRaiseValue);
|
||||
outData.set_firstsmallblind(inData.firstSmallBlind);
|
||||
outData.set_startmoney(inData.startMoney);
|
||||
outData.set_allowlatereg(inData.allowLateReg);
|
||||
outData.set_allowreentries(inData.allowReentries);
|
||||
outData.set_maxtimelatereg(inData.maxTimeLateReg);
|
||||
outData.set_numreentries(inData.numReentries);
|
||||
|
||||
BOOST_FOREACH(int manualBlind, inData.manualBlindsList) {
|
||||
outData.add_manualblinds(manualBlind);
|
||||
@@ -145,10 +141,6 @@ NetPacket::GetGameData(const NetGameInfo &inData, GameData &outData)
|
||||
outData.firstSmallBlind = inData.firstsmallblind();
|
||||
outData.afterMBAlwaysRaiseValue = inData.endraisesmallblindvalue();
|
||||
outData.startMoney = inData.startmoney();
|
||||
outData.allowLateReg = inData.allowlatereg();
|
||||
outData.allowReentries = inData.allowreentries();
|
||||
outData.numReentries = inData.numreentries();
|
||||
outData.maxTimeLateReg = inData.maxtimelatereg();
|
||||
|
||||
for (int i = 0; i < numManualBlinds; i++) {
|
||||
outData.manualBlindsList.push_back(static_cast<int>(inData.manualblinds(i)));
|
||||
|
||||
@@ -94,7 +94,6 @@ NetPacketValidator::NetPacketValidator()
|
||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_StartEventAckMessage, ValidateStartEventAckMessage));
|
||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_GameStartInitialMessage, ValidateGameStartInitialMessage));
|
||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_GameStartRejoinMessage, ValidateGameStartRejoinMessage));
|
||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_GameStartReentryMessage, ValidateGameStartReentryMessage));
|
||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_HandStartMessage, ValidateHandStartMessage));
|
||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_PlayersTurnMessage, ValidatePlayersTurnMessage));
|
||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_MyActionRequestMessage, ValidateMyActionRequestMessage));
|
||||
@@ -696,22 +695,6 @@ NetPacketValidator::ValidateGameStartRejoinMessage(const NetPacket &packet)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool
|
||||
NetPacketValidator::ValidateGameStartReentryMessage(const NetPacket &packet)
|
||||
{
|
||||
bool retVal = false;
|
||||
if (packet.GetMsg()->has_gamestartreentrymessage()) {
|
||||
const GameStartReentryMessage &msg = packet.GetMsg()->gamestartreentrymessage();
|
||||
if (msg.gameid() != 0
|
||||
&& msg.startdealerplayerid() != 0
|
||||
&& msg.handnum() != 0
|
||||
&& VALIDATE_LIST_SIZE(msg.reentryplayerdata(), 2, 10)) {
|
||||
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
bool
|
||||
NetPacketValidator::ValidateHandStartMessage(const NetPacket &packet)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <net/serveracceptwebhelper.h>
|
||||
#include <net/sessiondata.h>
|
||||
#include <net/webreceivebuffer.h>
|
||||
@@ -59,10 +58,10 @@ ServerAcceptWebHelper::Listen(unsigned serverPort, bool /*ipv6*/, const std::str
|
||||
|
||||
m_webSocketServer->init_asio(m_ioService.get());
|
||||
|
||||
m_webSocketServer->set_validate_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::validate), this, boost::placeholders::_1));
|
||||
m_webSocketServer->set_open_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_open), this, boost::placeholders::_1));
|
||||
m_webSocketServer->set_close_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_close), this, boost::placeholders::_1));
|
||||
m_webSocketServer->set_message_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_message), this, boost::placeholders::_1,boost::placeholders:: _2));
|
||||
m_webSocketServer->set_validate_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::validate), this, _1));
|
||||
m_webSocketServer->set_open_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_open), this, _1));
|
||||
m_webSocketServer->set_close_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_close), this, _1));
|
||||
m_webSocketServer->set_message_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_message), this, _1, _2));
|
||||
|
||||
m_webSocketServer->listen(serverPort);
|
||||
m_webSocketServer->start_accept();
|
||||
|
||||
@@ -66,28 +66,15 @@ static bool LessThanPlayerHandStartMoney(const boost::shared_ptr<PlayerInterface
|
||||
|
||||
|
||||
ServerGame::ServerGame(boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32_t id, const string &name, const string &pwd, const GameData &gameData,
|
||||
unsigned adminPlayerId, unsigned creatorPlayerDBId, GuiInterface &gui, ConfigFile &playerConfig)
|
||||
unsigned adminPlayerId, unsigned creatorPlayerDBId, GuiInterface &gui, ConfigFile &playerConfig)
|
||||
: m_adminPlayerId(adminPlayerId), m_lobbyThread(lobbyThread), m_gui(gui),
|
||||
m_gameData(gameData), m_curState(NULL), m_id(id), m_name(name),
|
||||
m_password(pwd), m_creatorPlayerDBId(creatorPlayerDBId), m_playerConfig(playerConfig),
|
||||
m_gameNum(1), m_curPetitionId(1), m_voteKickTimer(lobbyThread->GetIOService()),
|
||||
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService()), m_allowEntryTimer(lobbyThread->GetIOService()),
|
||||
m_isNameReported(false), m_isLateRegAllowed(false)
|
||||
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService()),
|
||||
m_isNameReported(false)
|
||||
{
|
||||
LOG_VERBOSE("Game object " << GetId() << " created.");
|
||||
|
||||
// TODO (albmed): Next is wrong!!
|
||||
// If game is restarted without being created, m_isLateRegAllowed probably will be always false because its timer would already be cancelled in previous game and object is not created again.
|
||||
// So, constructor is not called again.
|
||||
// m_isLateRegAllowed should probably be set on Init() function or in ServerGameStateInit::Enter. To be checked!!
|
||||
|
||||
|
||||
// set late reg allowed
|
||||
if ((m_gameData.gameType == GAME_TYPE_NORMAL || m_gameData.gameType == GAME_TYPE_REGISTERED_ONLY) &&
|
||||
(m_gameData.allowLateReg || m_gameData.allowReentries) &&
|
||||
m_gameData.maxTimeLateReg > 0) m_isLateRegAllowed = true;
|
||||
|
||||
LOG_MSG("m_isLateRegAllowed: " << std::boolalpha << m_isLateRegAllowed);
|
||||
}
|
||||
|
||||
ServerGame::~ServerGame()
|
||||
@@ -105,7 +92,6 @@ void
|
||||
ServerGame::Exit()
|
||||
{
|
||||
m_voteKickTimer.cancel();
|
||||
m_allowEntryTimer.cancel();
|
||||
SetState(ServerGameStateFinal::Instance());
|
||||
}
|
||||
|
||||
@@ -367,8 +353,6 @@ ServerGame::InternalStartGame()
|
||||
|
||||
if (GetGameData().gameType == GAME_TYPE_RANKING)
|
||||
StoreLastGames(playerData);
|
||||
|
||||
setEntries(playerData);
|
||||
|
||||
}
|
||||
return playerData;
|
||||
@@ -508,7 +492,6 @@ ServerGame::InternalEndGame()
|
||||
StoreAndResetRanking();
|
||||
m_game.reset();
|
||||
m_numJoinsPerPlayer.clear();
|
||||
m_numEntriesPlayer.clear();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -795,13 +778,6 @@ ServerGame::AddRejoinPlayer(unsigned playerId)
|
||||
m_rejoinPlayerList.push_back(playerId);
|
||||
}
|
||||
|
||||
void
|
||||
ServerGame::AddReentryPlayer(unsigned playerId)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_reentryPlayerListMutex);
|
||||
m_reentryPlayerList.push_back(playerId);
|
||||
}
|
||||
|
||||
PlayerIdList
|
||||
ServerGame::GetAndResetRejoinPlayers()
|
||||
{
|
||||
@@ -811,22 +787,6 @@ ServerGame::GetAndResetRejoinPlayers()
|
||||
return tmpList;
|
||||
}
|
||||
|
||||
unsigned
|
||||
ServerGame::GetNumberPlayersReentry()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_rejoinPlayerListMutex);
|
||||
return static_cast<unsigned>(m_rejoinPlayerList.size());
|
||||
}
|
||||
|
||||
PlayerIdList
|
||||
ServerGame::GetAndResetReentryPlayers()
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_reentryPlayerListMutex);
|
||||
PlayerIdList tmpList(m_reentryPlayerList);
|
||||
m_reentryPlayerList.clear();
|
||||
return tmpList;
|
||||
}
|
||||
|
||||
void
|
||||
ServerGame::AddReactivatePlayer(unsigned playerId)
|
||||
{
|
||||
@@ -1159,12 +1119,6 @@ ServerGame::GetStateTimer2()
|
||||
return m_stateTimer2;
|
||||
}
|
||||
|
||||
boost::asio::steady_timer &
|
||||
ServerGame::GetAllowEntryTimer()
|
||||
{
|
||||
return m_allowEntryTimer;
|
||||
}
|
||||
|
||||
Game &
|
||||
ServerGame::GetGame()
|
||||
{
|
||||
@@ -1230,17 +1184,6 @@ ServerGame::CheckSettings(const GameData &data, const string &password, ServerMo
|
||||
retVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.gameType == GAME_TYPE_NORMAL || data.gameType == GAME_TYPE_REGISTERED_ONLY) { // allow late reg and reentries
|
||||
if (data.allowLateReg || data.allowReentries) {
|
||||
if (data.maxTimeLateReg < 1 || data.maxTimeLateReg > 60) retVal = false;
|
||||
if (data.allowReentries && (data.numReentries < 0 || data.numReentries > 10)) retVal = false;
|
||||
}
|
||||
}
|
||||
else { // does not allow
|
||||
if (data.allowLateReg || data.allowReentries) retVal = false;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -1277,88 +1220,3 @@ ServerGame::GetNumJoinsPerPlayer(const std::string &playerName)
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
void
|
||||
ServerGame::setEntries(const PlayerDataList &playerDataList) {
|
||||
|
||||
PlayerDataList::const_iterator i = playerDataList.begin();
|
||||
PlayerDataList::const_iterator end = playerDataList.end();
|
||||
|
||||
while (i != end) {
|
||||
boost::shared_ptr<PlayerData> tmpPlayer(*i);
|
||||
m_numEntriesPlayer[tmpPlayer->GetName()] = 0;
|
||||
++i;
|
||||
}
|
||||
|
||||
{
|
||||
LOG_MSG("Printting set entries:");
|
||||
|
||||
NumJoinsPerPlayerMap::const_iterator i = m_numEntriesPlayer.begin();
|
||||
NumJoinsPerPlayerMap::const_iterator end = m_numEntriesPlayer.end();
|
||||
|
||||
while (i != end) {
|
||||
LOG_MSG("\t{player, entries}: {" << (*i).first << ", " << (*i).second << "}");
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ServerGame::admitReentries(boost::shared_ptr<PlayerData> player) { // FIXME: maybe set a reason, to return appropiate message. eg: uint32 &reason
|
||||
|
||||
bool retVal = false;
|
||||
const GameData &tmpGameData = GetGameData();
|
||||
|
||||
// uncomment to remove logs
|
||||
/*if (!m_isLateRegAllowed) return retVal;
|
||||
NumJoinsPerPlayerMap::iterator pos = m_numEntriesPlayer.find(player->GetName());
|
||||
if (pos != m_numEntriesPlayer.end()) { // is reentry
|
||||
if (!tmpGameData.allowReentries || pos->second++ >= tmpGameData.numReentries ) return retVal; // number of entries exceeded
|
||||
}
|
||||
else { // is late reg
|
||||
if (!tmpGameData.allowLateReg) return false; // does not allow late reg
|
||||
m_numEntriesPlayer[player->GetName()] = 0; // add player as new entry. Perhaps this should be set otherplace
|
||||
}*/
|
||||
|
||||
// comment or delete to remove logs -- begin
|
||||
if (!m_isLateRegAllowed) {
|
||||
LOG_MSG("Late reg was not allowed or is no longer available");
|
||||
return retVal;
|
||||
}
|
||||
NumJoinsPerPlayerMap::iterator pos = m_numEntriesPlayer.find(player->GetName());
|
||||
if (pos != m_numEntriesPlayer.end()) { // is reentry
|
||||
LOG_MSG("Player " << player->GetName() << " is trying to re-entry. Previous entries: " << pos->second);
|
||||
if (!tmpGameData.allowReentries || pos->second++ >= tmpGameData.numReentries ) {
|
||||
LOG_MSG("Number of reentries exceeded");
|
||||
return retVal; // number of entries exceeded
|
||||
}
|
||||
else {
|
||||
LOG_MSG("Allowed to re-entry");
|
||||
}
|
||||
}
|
||||
else { // is late reg
|
||||
LOG_MSG("Player " << player->GetName() << " is trying a late reg");
|
||||
if (!tmpGameData.allowLateReg) {
|
||||
LOG_MSG("Game does not allow late reg");
|
||||
return false; // does not allow late reg
|
||||
}
|
||||
m_numEntriesPlayer[player->GetName()] = 0; // add player as new entry. Perhaps this should be set otherplace
|
||||
}
|
||||
|
||||
LOG_MSG("Late reg allowed!! ");
|
||||
// comment or delete to remove logs -- end
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ServerGame::CancelLateReg() {
|
||||
m_isLateRegAllowed = false;
|
||||
|
||||
LOG_MSG("Called CancelLateReg");
|
||||
}
|
||||
|
||||
bool
|
||||
ServerGame::IsLateReg() {
|
||||
return m_isLateRegAllowed;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,6 @@ using namespace boost::chrono;
|
||||
|
||||
#define GAME_MAX_NUM_JOINS_PER_PLAYER 6
|
||||
|
||||
#define TESTS_LATE_REG // (albmed) To develop set this define, to compile comment until reentry is implemented
|
||||
|
||||
// Helper functions
|
||||
|
||||
static void SendPlayerAction(ServerGame &server, boost::shared_ptr<PlayerInterface> player)
|
||||
@@ -157,7 +155,7 @@ static void SendNewRoundCards(ServerGame &server, Game &curGame, int state)
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
break;
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,35 +227,6 @@ SetPlayerResult(PlayerResult &playerResult, boost::shared_ptr<PlayerInterface> t
|
||||
playerResult.set_playermoney(tmpPlayer->getMyCash());
|
||||
}
|
||||
|
||||
static int
|
||||
GetRandomFreeSeat(PlayerList playerList) {
|
||||
|
||||
// seek for a free seat
|
||||
PlayerListConstIterator player_i = playerList->begin();
|
||||
PlayerListConstIterator player_end = playerList->end();
|
||||
|
||||
std::vector<int> v(10, 0);
|
||||
while (player_i != player_end) {
|
||||
v[(*player_i)->getMyID()] = 1; // mark seats with player
|
||||
++player_i;
|
||||
}
|
||||
|
||||
// random seats
|
||||
random_shuffle(v.begin(), v.end());
|
||||
|
||||
int seat = -1;
|
||||
// seeks first free seat
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
if (v[i] == 0) {
|
||||
seat = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return seat;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ServerGameState::~ServerGameState()
|
||||
@@ -856,14 +825,6 @@ ServerGameStateStartGame::TimerTimeout(const boost::system::error_code &ec, boos
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerGameStateStartGame::TimerAllowLateRegTimeout(const boost::system::error_code &ec, boost::shared_ptr<ServerGame> server)
|
||||
{
|
||||
if (!ec && &server->GetState() != &ServerGameStateFinal::Instance()) {
|
||||
server->CancelLateReg();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerGameStateStartGame::DoStart(boost::shared_ptr<ServerGame> server)
|
||||
{
|
||||
@@ -891,39 +852,8 @@ ServerGameStateStartGame::DoStart(boost::shared_ptr<ServerGame> server)
|
||||
++player_i;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
LOG_MSG(" === SENDING DO START ====");
|
||||
LOG_MSG("\tPlayers: ");
|
||||
player_i = tmpPlayerList.begin();
|
||||
player_end = tmpPlayerList.end();
|
||||
|
||||
while (player_i != player_end) {
|
||||
boost::shared_ptr<PlayerData> tmpPlayer = (*player_i);
|
||||
LOG_MSG("\t\t {UID, name, GUID, seat}: -> {" <<
|
||||
tmpPlayer->GetUniqueId() << ", " <<
|
||||
tmpPlayer->GetName() << ", " <<
|
||||
tmpPlayer->GetGuid() << ", " <<
|
||||
tmpPlayer->GetNumber() << "}"
|
||||
);
|
||||
++player_i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server->SendToAllPlayers(packet, SessionData::Game | SessionData::Spectating);
|
||||
|
||||
LOG_MSG("Starting timer for LateReg");
|
||||
|
||||
// set late reg timer (if allowed)
|
||||
if (server->IsLateReg()) {
|
||||
server->GetAllowEntryTimer().expires_from_now(
|
||||
minutes(server->GetGameData().maxTimeLateReg));
|
||||
server->GetAllowEntryTimer().async_wait(
|
||||
boost::bind(
|
||||
&ServerGameStateStartGame::TimerAllowLateRegTimeout, this, boost::asio::placeholders::error, server));
|
||||
}
|
||||
|
||||
// Start the first hand.
|
||||
ServerGameStateHand::StartNewHand(server);
|
||||
server->SetState(ServerGameStateHand::Instance());
|
||||
@@ -958,55 +888,7 @@ AbstractServerGameStateRunning::HandleNewPlayer(boost::shared_ptr<ServerGame> se
|
||||
|
||||
// Wait for rejoining player to confirm start of game.
|
||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
||||
}
|
||||
else if (session && session->GetPlayerData() && server->admitReentries(session->GetPlayerData())) {
|
||||
const GameData tmpGameData = server->GetGameData();
|
||||
|
||||
if (server->GetCurNumberOfPlayers() + static_cast<int>(server->GetNumberPlayersReentry()) < tmpGameData.maxNumberOfPlayers) { // there is a seat available
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef TESTS_LATE_REG
|
||||
server->MoveSessionToLobby(session, NTF_NET_REMOVED_GAME_FULL);
|
||||
#else
|
||||
// Uncomment next line when implemented
|
||||
AcceptNewSession(server, session, false); // player wants to join
|
||||
server->AddReentryPlayer(session->GetPlayerData()->GetUniqueId()); // add to list of players to reentry
|
||||
|
||||
LOG_MSG("Late reg is allowed and there is a seat available... unfortunatelly not implemented, yet ;)");
|
||||
|
||||
// Send start event right away.
|
||||
boost::shared_ptr<NetPacket> packet(new NetPacket);
|
||||
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_StartEventMessage);
|
||||
StartEventMessage *netStartEvent = packet->GetMsg()->mutable_starteventmessage();
|
||||
netStartEvent->set_starteventtype(StartEventMessage::reentryEvent); // <-- set reentry event!! TODO (albmed): Fist we have to check proto NET versions. Both NET_VERSION_MAJOR & NET_VERSION_MINOR
|
||||
netStartEvent->set_gameid(server->GetId());
|
||||
|
||||
// Wait for rejoining player to confirm start of game.
|
||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
||||
|
||||
|
||||
// TODO (albmed):
|
||||
// - locate seat ---> this should be done in ServerGameStateHand::StartNewHand
|
||||
// - notify players and users
|
||||
// - move session to server
|
||||
// - set cash
|
||||
// - wait for button to pass (if necessary)
|
||||
// - let player play
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
server->MoveSessionToLobby(session, NTF_NET_REMOVED_GAME_FULL);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
// Do not accept "new" sessions in this state, only rejoin is allowed.
|
||||
server->MoveSessionToLobby(session, NTF_NET_REMOVED_ALREADY_RUNNING);
|
||||
}
|
||||
@@ -1369,81 +1251,8 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
|
||||
curGame.getCurrentHand()->getRiver()->skipFirstRunGui();
|
||||
|
||||
// Consider all players, even inactive.
|
||||
PlayerListIterator i;
|
||||
PlayerListIterator end;
|
||||
|
||||
{
|
||||
LOG_MSG("Starting new hand. Lets LOG: ");
|
||||
LOG_MSG("\tPlayer seats");
|
||||
|
||||
i = curGame.getSeatsList()->begin();
|
||||
end = curGame.getSeatsList()->end();
|
||||
while (i != end) {
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = (*i);
|
||||
|
||||
LOG_MSG("\t\t {ID, name, UID} -> {" <<
|
||||
tmpPlayer->getMyID() << ", " <<
|
||||
tmpPlayer->getMyName() << ", " <<
|
||||
tmpPlayer->getMyUniqueID() << "}"
|
||||
);
|
||||
++i;
|
||||
}
|
||||
|
||||
i = curGame.getActivePlayerList()->begin();
|
||||
end = curGame.getActivePlayerList()->end();
|
||||
|
||||
LOG_MSG("\tActive players");
|
||||
while (i != end) {
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = (*i);
|
||||
|
||||
LOG_MSG("\t\t {ID, name, UID} -> {" <<
|
||||
tmpPlayer->getMyID() << ", " <<
|
||||
tmpPlayer->getMyName() << ", " <<
|
||||
tmpPlayer->getMyUniqueID() << "}"
|
||||
);
|
||||
++i;
|
||||
}
|
||||
|
||||
i = curGame.getRunningPlayerList()->begin();
|
||||
end = curGame.getRunningPlayerList()->end();
|
||||
|
||||
LOG_MSG("\tRunning players");
|
||||
while (i != end) {
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = (*i);
|
||||
|
||||
LOG_MSG("\t\t {ID, name, UID} -> {" <<
|
||||
tmpPlayer->getMyID() << ", " <<
|
||||
tmpPlayer->getMyName() << ", " <<
|
||||
tmpPlayer->getMyUniqueID() << "}"
|
||||
);
|
||||
++i;
|
||||
}
|
||||
|
||||
PlayerDataList tmpPlayerList(server->GetFullPlayerDataList());
|
||||
|
||||
LOG_MSG("\tAll Data players");
|
||||
|
||||
PlayerDataList::iterator player_i = tmpPlayerList.begin();
|
||||
PlayerDataList::iterator player_end = tmpPlayerList.end();
|
||||
while (player_i != player_end) {
|
||||
boost::shared_ptr<PlayerData> tmpPlayer = (*player_i);
|
||||
|
||||
LOG_MSG("\t\tPlayerData: {playerId, name, number} -> {" <<
|
||||
tmpPlayer->GetUniqueId() << "," <<
|
||||
tmpPlayer->GetName() << "," <<
|
||||
//tmpPlayer->GetGuid() << "," <<
|
||||
tmpPlayer->GetNumber() << "}"
|
||||
);
|
||||
|
||||
++player_i;
|
||||
}
|
||||
}
|
||||
|
||||
// Consider all players, even inactive.
|
||||
i = curGame.getSeatsList()->begin();
|
||||
end = curGame.getSeatsList()->end();
|
||||
|
||||
|
||||
PlayerListIterator i = curGame.getSeatsList()->begin();
|
||||
PlayerListIterator end = curGame.getSeatsList()->end();
|
||||
|
||||
// Send cards to all players.
|
||||
while (i != end) {
|
||||
@@ -1608,21 +1417,6 @@ ServerGameStateHand::InitRejoiningPlayers(boost::shared_ptr<ServerGame> server)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerGameStateHand::InitReetryPlayers(boost::shared_ptr<ServerGame> server)
|
||||
{
|
||||
PlayerIdList reentryIdList(server->GetAndResetReentryPlayers());
|
||||
PlayerIdList::iterator i = reentryIdList.begin();
|
||||
PlayerIdList::iterator end = reentryIdList.end();
|
||||
while (i != end) {
|
||||
boost::shared_ptr<SessionData> session(server->GetSessionManager().GetSessionByUniquePlayerId(*i));
|
||||
if (session && session->GetPlayerData()) {
|
||||
PerformReentry(server, session);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerGameStateHand::InitNewSpectators(boost::shared_ptr<ServerGame> server)
|
||||
{
|
||||
@@ -1669,102 +1463,6 @@ ServerGameStateHand::PerformRejoin(boost::shared_ptr<ServerGame> server, boost::
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerGameStateHand::PerformReentry(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session)
|
||||
{
|
||||
Game &curGame = server->GetGame();
|
||||
|
||||
// TODO (albmed):
|
||||
// Create player interface
|
||||
if (session) {
|
||||
// check if player already played this game
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame.getPlayerByName(session->GetPlayerData()->GetName());
|
||||
if (!tmpPlayer) {
|
||||
|
||||
// TODO: Late registration implementation is postponed
|
||||
|
||||
throw ServerException(__FILE__, __LINE__, ERR_NET_INTERNAL_GAME_ERROR, 0);
|
||||
// tmpPlayer = curGame.addNewPlayer(session->GetPlayerData()); // TODO (albmed): Create addNewPlayer method
|
||||
}
|
||||
else {
|
||||
// This means this is a reentry, because player already played this game
|
||||
|
||||
// check for id change
|
||||
if (session->GetPlayerData()->GetUniqueId() != tmpPlayer->getMyUniqueID()) {
|
||||
// Notify other clients about id change.
|
||||
boost::shared_ptr<NetPacket> packet(new NetPacket);
|
||||
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_PlayerIdChangedMessage);
|
||||
PlayerIdChangedMessage *netIdChanged = packet->GetMsg()->mutable_playeridchangedmessage();
|
||||
netIdChanged->set_oldplayerid(tmpPlayer->getMyUniqueID());
|
||||
netIdChanged->set_newplayerid(session->GetPlayerData()->GetUniqueId());
|
||||
server->SendToAllButOnePlayers(packet, session->GetId(), SessionData::Game | SessionData::Spectating | SessionData::SpectatorWaiting);
|
||||
|
||||
// Update the dealer, if necessary.
|
||||
curGame.replaceDealer(tmpPlayer->getMyUniqueID(), session->GetPlayerData()->GetUniqueId());
|
||||
|
||||
// Update the ranking map.
|
||||
server->ReplaceRankingPlayer(tmpPlayer->getMyUniqueID(), session->GetPlayerData()->GetUniqueId());
|
||||
// Change the Id in the poker engine.
|
||||
tmpPlayer->setMyUniqueID(session->GetPlayerData()->GetUniqueId());
|
||||
tmpPlayer->setMyGuid(session->GetPlayerData()->GetGuid());
|
||||
}
|
||||
|
||||
tmpPlayer->markRemoteAction();
|
||||
tmpPlayer->setIsSessionActive(true);
|
||||
SendGameDataReentry(server, session); // TODO (albmed): This method should be duplicated
|
||||
// - to send starting game cash: server->GetGameData().startMoney
|
||||
// - to make a new reentry message
|
||||
|
||||
}
|
||||
|
||||
/* int seat = GetRandomFreeSeat(curGame.getActivePlayerList()); // (albmed): if reentry, assign same seat or find a new one?
|
||||
if (seat >= 0) { // ok
|
||||
// seat found....
|
||||
|
||||
// is between dealer? TODO (albmed)
|
||||
unsigned dealerPosition = curGame.getDealerPosition();
|
||||
|
||||
|
||||
}
|
||||
else throw ServerException(__FILE__, __LINE__, ERR_NET_INTERNAL_GAME_ERROR, 0); */
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
ServerGameStateHand::GetRandomFreeSeat(const PlayerList playerList) {
|
||||
|
||||
// seek for a free seat
|
||||
PlayerListConstIterator player_i = playerList->begin();
|
||||
PlayerListConstIterator player_end = playerList->end();
|
||||
|
||||
std::vector<int> v(10, 0);
|
||||
while (player_i != player_end) {
|
||||
v[(*player_i)->getMyID()] = 1; // mark seats with player
|
||||
++player_i;
|
||||
}
|
||||
|
||||
// random seats
|
||||
random_shuffle(v.begin(), v.end());
|
||||
|
||||
int seat = -1;
|
||||
// seeks first free seat
|
||||
for(std::vector<int>::size_type i = 0; i != v.size(); i++) {
|
||||
if (v[i] == 0) {
|
||||
seat = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return seat;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ServerGameStateHand::SendGameData(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session)
|
||||
{
|
||||
@@ -1791,33 +1489,6 @@ ServerGameStateHand::SendGameData(boost::shared_ptr<ServerGame> server, boost::s
|
||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
||||
}
|
||||
|
||||
void
|
||||
ServerGameStateHand::SendGameDataReentry(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session)
|
||||
{
|
||||
Game &curGame = server->GetGame();
|
||||
// Send game start notification to reentry client.
|
||||
boost::shared_ptr<NetPacket> packet(new NetPacket);
|
||||
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_GameStartReentryMessage);
|
||||
GameStartReentryMessage *netGameStart = packet->GetMsg()->mutable_gamestartreentrymessage();
|
||||
netGameStart->set_gameid(server->GetId());
|
||||
netGameStart->set_startdealerplayerid(curGame.getDealerPosition());
|
||||
netGameStart->set_handnum(curGame.getCurrentHandID());
|
||||
PlayerListIterator player_i = curGame.getSeatsList()->begin();
|
||||
PlayerListIterator player_end = curGame.getSeatsList()->end();
|
||||
int player_count = 0;
|
||||
while (player_i != player_end && player_count < server->GetStartData().numberOfPlayers) {
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = *player_i;
|
||||
GameStartReentryMessage::ReentryPlayerData *playerSlot = netGameStart->add_reentryplayerdata();
|
||||
playerSlot->set_playerid(tmpPlayer->getMyUniqueID());
|
||||
playerSlot->set_playermoney(server->GetGameData().startMoney);
|
||||
++player_i;
|
||||
++player_count;
|
||||
}
|
||||
|
||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -63,9 +63,8 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <gsasl.h>
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
|
||||
#define SERVER_MAX_NUM_LOBBY_SESSIONS 1536 // Maximum number of idle users in lobby.
|
||||
#define SERVER_MAX_NUM_LOBBY_SESSIONS 512 // Maximum number of idle users in lobby.
|
||||
#define SERVER_MAX_NUM_TOTAL_SESSIONS 2000 // Total maximum of sessions, fitting a 2048 handle limit
|
||||
|
||||
#define SERVER_SAVE_STATISTICS_INTERVAL_SEC 60
|
||||
@@ -305,8 +304,8 @@ ServerLobbyThread::AddConnection(boost::shared_ptr<SessionData> sessionData)
|
||||
// Create a new session.
|
||||
m_sessionManager.AddSession(sessionData);
|
||||
|
||||
LOG_VERBOSE(sessionData->GetRemoteIPAddressFromSocket() << " Accepted connection - session #" << sessionData->GetId() << ".");
|
||||
LOG_ERROR(sessionData->GetRemoteIPAddressFromSocket() << " Accepted connection - session #" << sessionData->GetId() << ".");
|
||||
LOG_VERBOSE("Accepted connection - session #" << sessionData->GetId() << ".");
|
||||
LOG_ERROR("Accepted connection - session #" << sessionData->GetId() << ".");
|
||||
|
||||
sessionData->StartTimerInitTimeout(SERVER_INIT_SESSION_TIMEOUT_SEC);
|
||||
sessionData->StartTimerGlobalTimeout(SERVER_SESSION_FORCED_TIMEOUT_SEC);
|
||||
@@ -1369,13 +1368,6 @@ ServerLobbyThread::HandleNetPacketCreateGame(boost::shared_ptr<SessionData> sess
|
||||
boost::replace_all(gameName, "\f", " ");
|
||||
unsigned gameId = GetNextGameId();
|
||||
|
||||
LOG_MSG ("Creating game with new params: {allowLate, allowReentries, numReentries, maxTimeLateReg} -> {" <<
|
||||
std::boolalpha <<
|
||||
tmpData.allowLateReg << ", " <<
|
||||
tmpData.allowReentries << ", " <<
|
||||
tmpData.numReentries << ", " <<
|
||||
tmpData.maxTimeLateReg << "}");
|
||||
|
||||
if (gameName.empty() || !isprint(gameName[0])) {
|
||||
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_GAME_BAD_NAME);
|
||||
} else if (IsGameNameInUse(gameName)) {
|
||||
|
||||
@@ -85,7 +85,6 @@ protected:
|
||||
static bool ValidateStartEventAckMessage(const NetPacket &packet);
|
||||
static bool ValidateGameStartInitialMessage(const NetPacket &packet);
|
||||
static bool ValidateGameStartRejoinMessage(const NetPacket &packet);
|
||||
static bool ValidateGameStartReentryMessage(const NetPacket &packet);
|
||||
static bool ValidateHandStartMessage(const NetPacket &packet);
|
||||
static bool ValidatePlayersTurnMessage(const NetPacket &packet);
|
||||
static bool ValidateMyActionRequestMessage(const NetPacket &packet);
|
||||
|
||||
@@ -111,10 +111,6 @@ public:
|
||||
void AddRejoinPlayer(unsigned playerId);
|
||||
PlayerIdList GetAndResetRejoinPlayers();
|
||||
|
||||
void AddReentryPlayer(unsigned playerId);
|
||||
PlayerIdList GetAndResetReentryPlayers();
|
||||
unsigned GetNumberPlayersReentry();
|
||||
|
||||
void AddReactivatePlayer(unsigned playerId);
|
||||
PlayerIdList GetAndResetReactivatePlayers();
|
||||
|
||||
@@ -132,10 +128,6 @@ public:
|
||||
|
||||
void AddPlayerToNumJoinsPerPlayer(const std::string &playerName);
|
||||
int GetNumJoinsPerPlayer(const std::string &playerName);
|
||||
bool admitReentries(boost::shared_ptr<PlayerData> player);
|
||||
|
||||
void CancelLateReg();
|
||||
bool IsLateReg();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -192,7 +184,6 @@ protected:
|
||||
|
||||
boost::asio::steady_timer &GetStateTimer1();
|
||||
boost::asio::steady_timer &GetStateTimer2();
|
||||
boost::asio::steady_timer &GetAllowEntryTimer();
|
||||
|
||||
const StartData &GetStartData() const;
|
||||
void SetStartData(const StartData &startData);
|
||||
@@ -205,8 +196,6 @@ protected:
|
||||
SessionManager &GetSessionManager();
|
||||
ServerDBInterface &GetDatabase();
|
||||
|
||||
void setEntries(const PlayerDataList &playerData);
|
||||
|
||||
typedef std::map<std::string, int> NumJoinsPerPlayerMap;
|
||||
|
||||
private:
|
||||
@@ -225,9 +214,6 @@ private:
|
||||
PlayerIdList m_rejoinPlayerList;
|
||||
mutable boost::mutex m_rejoinPlayerListMutex;
|
||||
|
||||
PlayerIdList m_reentryPlayerList;
|
||||
mutable boost::mutex m_reentryPlayerListMutex;
|
||||
|
||||
PlayerIdList m_reactivatePlayerList;
|
||||
mutable boost::mutex m_reactivatePlayerListMutex;
|
||||
|
||||
@@ -261,9 +247,7 @@ private:
|
||||
boost::asio::steady_timer m_voteKickTimer;
|
||||
boost::asio::steady_timer m_stateTimer1;
|
||||
boost::asio::steady_timer m_stateTimer2;
|
||||
boost::asio::steady_timer m_allowEntryTimer;
|
||||
bool m_isNameReported;
|
||||
bool m_isLateRegAllowed;
|
||||
|
||||
friend class ServerLobbyThread;
|
||||
friend class AbstractServerGameStateReceiving;
|
||||
@@ -276,7 +260,6 @@ private:
|
||||
friend class ServerGameStateWaitNextHand;
|
||||
|
||||
NumJoinsPerPlayerMap m_numJoinsPerPlayer;
|
||||
NumJoinsPerPlayerMap m_numEntriesPlayer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <playerdata.h>
|
||||
#include <net/sessionmanager.h>
|
||||
#include <engine/engine_defs.h>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@@ -146,7 +145,6 @@ protected:
|
||||
|
||||
virtual void InternalProcessPacket(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet);
|
||||
void TimerTimeout(const boost::system::error_code &ec, boost::shared_ptr<ServerGame> server);
|
||||
void TimerAllowLateRegTimeout(const boost::system::error_code &ec, boost::shared_ptr<ServerGame> server);
|
||||
void DoStart(boost::shared_ptr<ServerGame> server);
|
||||
|
||||
private:
|
||||
@@ -193,13 +191,9 @@ protected:
|
||||
static void CheckPlayerTimeouts(boost::shared_ptr<ServerGame> server);
|
||||
static void ReactivatePlayers(boost::shared_ptr<ServerGame> server);
|
||||
static void InitRejoiningPlayers(boost::shared_ptr<ServerGame> server);
|
||||
static void InitReetryPlayers(boost::shared_ptr<ServerGame> server);
|
||||
static void InitNewSpectators(boost::shared_ptr<ServerGame> server);
|
||||
static void PerformRejoin(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session);
|
||||
static void PerformReentry(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session);
|
||||
static void SendGameData(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session);
|
||||
static void SendGameDataReentry(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session);
|
||||
static int GetRandomFreeSeat(const PlayerList playerList);
|
||||
|
||||
private:
|
||||
static ServerGameStateHand s_state;
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <net/clientthread.h>
|
||||
#include <core/avatarmanager.h>
|
||||
#include <net/servermanagerfactory.h>
|
||||
#include <core/loghelper.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@@ -282,14 +281,6 @@ void Session::clientCreateGame(const GameData &gameData, const string &name, con
|
||||
{
|
||||
if (!myNetClient)
|
||||
return; // only act if client is running.
|
||||
|
||||
std::cout << "Creating game with new params: {allowLate, allowReentries, numReentries, maxTimeLateReg} -> {" <<
|
||||
std::boolalpha <<
|
||||
gameData.allowLateReg << ", " <<
|
||||
gameData.allowReentries << "," <<
|
||||
gameData.numReentries << ", " <<
|
||||
gameData.maxTimeLateReg << "}" << std::endl;
|
||||
|
||||
myNetClient->SendCreateGame(
|
||||
gameData,
|
||||
name,
|
||||
|
||||
+1297
-1606
File diff suppressed because it is too large
Load Diff
+1023
-1699
File diff suppressed because it is too large
Load Diff
+27789
-32628
File diff suppressed because it is too large
Load Diff
+13985
-27370
File diff suppressed because it is too large
Load Diff
@@ -311,10 +311,9 @@ public:
|
||||
* needed.
|
||||
*/
|
||||
timer_ptr set_timer(long duration, timer_handler callback) {
|
||||
timer_ptr new_timer(
|
||||
new lib::asio::steady_timer(
|
||||
*m_io_service,
|
||||
lib::asio::milliseconds(duration))
|
||||
timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>(
|
||||
lib::ref(*m_io_service),
|
||||
lib::asio::milliseconds(duration)
|
||||
);
|
||||
|
||||
if (config::enable_multithreading) {
|
||||
@@ -462,7 +461,8 @@ protected:
|
||||
m_io_service = io_service;
|
||||
|
||||
if (config::enable_multithreading) {
|
||||
m_strand.reset(new lib::asio::io_service::strand(*io_service));
|
||||
m_strand = lib::make_shared<lib::asio::io_service::strand>(
|
||||
lib::ref(*io_service));
|
||||
}
|
||||
|
||||
lib::error_code ec = socket_con_type::init_asio(io_service, m_strand,
|
||||
|
||||
@@ -191,7 +191,8 @@ public:
|
||||
|
||||
m_io_service = ptr;
|
||||
m_external_io_service = true;
|
||||
m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service));
|
||||
m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>(
|
||||
lib::ref(*m_io_service));
|
||||
|
||||
m_state = READY;
|
||||
ec = lib::error_code();
|
||||
@@ -659,7 +660,9 @@ public:
|
||||
* @since 0.3.0
|
||||
*/
|
||||
void start_perpetual() {
|
||||
m_work.reset(new lib::asio::io_service::work(*m_io_service));
|
||||
m_work = lib::make_shared<lib::asio::io_service::work>(
|
||||
lib::ref(*m_io_service)
|
||||
);
|
||||
}
|
||||
|
||||
/// Clears the endpoint's perpetual flag, allowing it to exit when empty
|
||||
@@ -823,7 +826,8 @@ protected:
|
||||
|
||||
// Create a resolver
|
||||
if (!m_resolver) {
|
||||
m_resolver.reset(new lib::asio::ip::tcp::resolver(*m_io_service));
|
||||
m_resolver = lib::make_shared<lib::asio::ip::tcp::resolver>(
|
||||
lib::ref(*m_io_service));
|
||||
}
|
||||
|
||||
tcon->set_uri(u);
|
||||
|
||||
@@ -168,7 +168,8 @@ protected:
|
||||
return socket::make_error_code(socket::error::invalid_state);
|
||||
}
|
||||
|
||||
m_socket.reset(new lib::asio::ip::tcp::socket(*service));
|
||||
m_socket = lib::make_shared<lib::asio::ip::tcp::socket>(
|
||||
lib::ref(*service));
|
||||
|
||||
m_state = READY;
|
||||
|
||||
|
||||
@@ -193,7 +193,8 @@ protected:
|
||||
if (!m_context) {
|
||||
return socket::make_error_code(socket::error::invalid_tls_context);
|
||||
}
|
||||
m_socket.reset(new socket_type(*service, *m_context));
|
||||
m_socket = lib::make_shared<socket_type>(
|
||||
_WEBSOCKETPP_REF(*service),lib::ref(*m_context));
|
||||
|
||||
m_io_service = service;
|
||||
m_strand = strand;
|
||||
|
||||
+13718
-46635
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user