Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d16705cfb | ||
|
|
44c9da90ab | ||
|
|
ecfc8693b2 | ||
|
|
df0a5625f9 | ||
|
|
a333185525 | ||
|
|
7d116d7294 | ||
|
|
0cd9ba6f99 | ||
|
|
99ad7ffd71 | ||
|
|
eccb3f404e | ||
|
|
63fb9bc287 | ||
|
|
1e3253a18d | ||
|
|
2827f7d36c | ||
|
|
9b36c9863c |
+4
-3
@@ -8,14 +8,15 @@ Makefile.pokerth_protocol
|
|||||||
Makefile.pokerth_server
|
Makefile.pokerth_server
|
||||||
Makefile.pokerth_dbofficial
|
Makefile.pokerth_dbofficial
|
||||||
bin/
|
bin/
|
||||||
chatcleaner
|
/chatcleaner
|
||||||
lib/
|
lib/
|
||||||
mocs/
|
mocs/
|
||||||
obj/
|
obj/
|
||||||
pokerth
|
/pokerth
|
||||||
qrc_pokerth.cpp
|
qrc_pokerth.cpp
|
||||||
uics/
|
uics/
|
||||||
make.sh
|
make.sh
|
||||||
gitpush_serverstuff_stable
|
gitpush_serverstuff_stable
|
||||||
pokerth_server
|
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
# QMake pro-file for the PokerTH dedicated server
|
|
||||||
|
|
||||||
isEmpty( PREFIX ){
|
|
||||||
PREFIX =/usr
|
|
||||||
}
|
|
||||||
|
|
||||||
TEMPLATE = app
|
|
||||||
CODECFORSRC = UTF-8
|
|
||||||
|
|
||||||
CONFIG += thread console embed_manifest_exe exceptions rtti stl warn_on
|
|
||||||
|
|
||||||
UI_DIR = uics
|
|
||||||
TARGET = bin/dealer_random_test
|
|
||||||
MOC_DIR = mocs
|
|
||||||
OBJECTS_DIR = obj
|
|
||||||
DEFINES += PREFIX=\"$${PREFIX}\"
|
|
||||||
QT -= core gui
|
|
||||||
#PRECOMPILED_HEADER = src/pch_lib.h
|
|
||||||
|
|
||||||
INCLUDEPATH += . \
|
|
||||||
src
|
|
||||||
DEPENDPATH += . \
|
|
||||||
src
|
|
||||||
|
|
||||||
# Input
|
|
||||||
SOURCES += \
|
|
||||||
src/dealer_random_test.cpp
|
|
||||||
|
|
||||||
unix : !mac {
|
|
||||||
|
|
||||||
##### My release static build options
|
|
||||||
#QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
|
|
||||||
#QMAKE_LFLAGS += -Wl,--gc-sections
|
|
||||||
|
|
||||||
QMAKE_LIBDIR += lib $${PREFIX}/lib /opt/gsasl/lib
|
|
||||||
INCLUDEPATH += $${PREFIX}/include
|
|
||||||
LIB_DIRS = $${PREFIX}/lib $${PREFIX}/lib64 $$system($$QMAKE_QMAKE -query QT_INSTALL_LIBS)
|
|
||||||
BOOST_PROGRAM_OPTIONS = boost_program_options boost_program_options-mt
|
|
||||||
BOOST_SYS = boost_system boost_system-mt
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# searching in $PREFIX/lib, $PREFIX/lib64 and $$system($$QMAKE_QMAKE -query QT_INSTALL_LIBS)
|
|
||||||
# to override the default '/usr' pass PREFIX
|
|
||||||
# variable to qmake.
|
|
||||||
#
|
|
||||||
for(dir, LIB_DIRS){
|
|
||||||
exists($$dir){
|
|
||||||
for(lib, BOOST_PROGRAM_OPTIONS):exists($${dir}/lib$${lib}.so*) {
|
|
||||||
message("Found $$lib")
|
|
||||||
BOOST_PROGRAM_OPTIONS = -l$$lib
|
|
||||||
}
|
|
||||||
for(lib, BOOST_PROGRAM_OPTIONS):exists($${dir}/lib$${lib}.a) {
|
|
||||||
message("Found $$lib")
|
|
||||||
BOOST_PROGRAM_OPTIONS = -l$$lib
|
|
||||||
}
|
|
||||||
for(lib, BOOST_SYS):exists($${dir}/lib$${lib}.so*) {
|
|
||||||
message("Found $$lib")
|
|
||||||
BOOST_SYS = -l$$lib
|
|
||||||
}
|
|
||||||
for(lib, BOOST_SYS):exists($${dir}/lib$${lib}.a) {
|
|
||||||
message("Found $$lib")
|
|
||||||
BOOST_SYS = -l$$lib
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BOOST_LIBS = $$BOOST_PROGRAM_OPTIONS $$BOOST_SYS
|
|
||||||
!count(BOOST_LIBS, 2){
|
|
||||||
error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
|
||||||
}
|
|
||||||
|
|
||||||
UNAME = $$system(uname -s)
|
|
||||||
BSD = $$find(UNAME, "BSD")
|
|
||||||
kFreeBSD = $$find(UNAME, "kFreeBSD")
|
|
||||||
|
|
||||||
LIBS += $$BOOST_LIBS
|
|
||||||
LIBS += -lprotobuf -lgsasl -lgcrypt -lidn -lboost_thread -lboost_system -lboost_random
|
|
||||||
|
|
||||||
#### INSTALL ####
|
|
||||||
|
|
||||||
binary.path += $${PREFIX}/bin/
|
|
||||||
binary.files += dealer_random_test
|
|
||||||
|
|
||||||
INSTALLS += binary
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -112,6 +112,11 @@ message NetGameInfo {
|
|||||||
required uint32 startMoney = 13;
|
required uint32 startMoney = 13;
|
||||||
repeated uint32 manualBlinds = 14 [packed = true];
|
repeated uint32 manualBlinds = 14 [packed = true];
|
||||||
optional bool allowSpectators = 15 [default = 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.
|
// Message Part containing player result.
|
||||||
@@ -419,6 +424,7 @@ message StartEventMessage {
|
|||||||
enum StartEventType {
|
enum StartEventType {
|
||||||
startEvent = 0;
|
startEvent = 0;
|
||||||
rejoinEvent = 1;
|
rejoinEvent = 1;
|
||||||
|
reentryEvent = 2;
|
||||||
}
|
}
|
||||||
required StartEventType startEventType = 2;
|
required StartEventType startEventType = 2;
|
||||||
optional bool fillWithComputerPlayers = 3;
|
optional bool fillWithComputerPlayers = 3;
|
||||||
@@ -445,6 +451,17 @@ message GameStartRejoinMessage {
|
|||||||
repeated RejoinPlayerData rejoinPlayerData = 4;
|
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 {
|
message HandStartMessage {
|
||||||
required uint32 gameId = 1;
|
required uint32 gameId = 1;
|
||||||
message PlainCards {
|
message PlainCards {
|
||||||
@@ -835,6 +852,7 @@ message PokerTHMessage {
|
|||||||
Type_GameListSpectatorLeftMessage = 79;
|
Type_GameListSpectatorLeftMessage = 79;
|
||||||
Type_GameSpectatorJoinedMessage = 80;
|
Type_GameSpectatorJoinedMessage = 80;
|
||||||
Type_GameSpectatorLeftMessage = 81;
|
Type_GameSpectatorLeftMessage = 81;
|
||||||
|
Type_GameStartReentryMessage = 82;
|
||||||
}
|
}
|
||||||
required PokerTHMessageType messageType = 1;
|
required PokerTHMessageType messageType = 1;
|
||||||
|
|
||||||
@@ -919,4 +937,5 @@ message PokerTHMessage {
|
|||||||
optional GameListSpectatorLeftMessage gameListSpectatorLeftMessage = 80;
|
optional GameListSpectatorLeftMessage gameListSpectatorLeftMessage = 80;
|
||||||
optional GameSpectatorJoinedMessage gameSpectatorJoinedMessage = 81;
|
optional GameSpectatorJoinedMessage gameSpectatorJoinedMessage = 81;
|
||||||
optional GameSpectatorLeftMessage gameSpectatorLeftMessage = 82;
|
optional GameSpectatorLeftMessage gameSpectatorLeftMessage = 82;
|
||||||
|
optional GameStartReentryMessage gameStartReentryMessage = 83;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,11 @@
|
|||||||
|
|
||||||
#include <core/loghelper.h>
|
#include <core/loghelper.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <boost/date_time.hpp>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
static int g_logLevel = 1;
|
static int g_logLevel = 1;
|
||||||
|
|
||||||
@@ -52,20 +53,20 @@ loghelper_init(const std::string & /*logDir*/, int logLevel)
|
|||||||
void
|
void
|
||||||
internal_log_err(const string &msg)
|
internal_log_err(const string &msg)
|
||||||
{
|
{
|
||||||
cerr << msg;
|
cerr << second_clock::local_time() << " " << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
internal_log_msg(const std::string &msg)
|
internal_log_msg(const std::string &msg)
|
||||||
{
|
{
|
||||||
if (g_logLevel)
|
if (g_logLevel)
|
||||||
cout << msg;
|
cout << second_clock::local_time() << " " << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
internal_log_level(const std::string &msg, int logLevel)
|
internal_log_level(const std::string &msg, int logLevel)
|
||||||
{
|
{
|
||||||
if (g_logLevel >= logLevel)
|
if (g_logLevel >= logLevel)
|
||||||
cout << msg;
|
cout << second_clock::local_time() << " " << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* PokerTH - The open source texas holdem engine *
|
|
||||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
|
||||||
* *
|
|
||||||
* This program is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU Affero General Public License as *
|
|
||||||
* published by the Free Software Foundation, either version 3 of the *
|
|
||||||
* License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This program is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU Affero General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU Affero General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
* *
|
|
||||||
* Additional permission under GNU AGPL version 3 section 7 *
|
|
||||||
* *
|
|
||||||
* If you modify this program, or any covered work, by linking or *
|
|
||||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
|
||||||
* modified version of that library), containing parts covered by the *
|
|
||||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
|
||||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
|
||||||
* permission to convey the resulting work. *
|
|
||||||
* Corresponding Source for a non-source form of such a combination *
|
|
||||||
* shall include the source code for the parts of OpenSSL used as well *
|
|
||||||
* as that of the covered work. *
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
// Connectivity test program for PokerTH
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <boost/program_options.hpp>
|
|
||||||
#include <boost/thread.hpp>
|
|
||||||
#include <boost/nondet_random.hpp>
|
|
||||||
#include <boost/random/uniform_int.hpp>
|
|
||||||
#include <boost/random/variate_generator.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
namespace po = boost::program_options;
|
|
||||||
boost::thread_specific_ptr<boost::random_device> g_rand_state;
|
|
||||||
|
|
||||||
struct nondet_rng : std::unary_function<unsigned, unsigned> {
|
|
||||||
boost::random_device &_state;
|
|
||||||
unsigned operator()(unsigned i)
|
|
||||||
{
|
|
||||||
boost::uniform_int<> rng(0, i - 1);
|
|
||||||
return rng(_state);
|
|
||||||
}
|
|
||||||
nondet_rng(boost::random_device &state) : _state(state) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
// Check command line options.
|
|
||||||
po::options_description desc("Allowed options");
|
|
||||||
desc.add_options()
|
|
||||||
("help,h", "produce help message")
|
|
||||||
("num,n", po::value<int>(), "set num of deals")
|
|
||||||
;
|
|
||||||
|
|
||||||
po::variables_map vm;
|
|
||||||
po::store(po::parse_command_line(argc, argv, desc), vm);
|
|
||||||
po::notify(vm);
|
|
||||||
|
|
||||||
if (vm.count("help")) {
|
|
||||||
cout << desc << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (!vm.count("num")) {
|
|
||||||
cout << "Missing option!" << endl << desc << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int num = vm["num"].as<int>();
|
|
||||||
const int NumCards = 52;
|
|
||||||
|
|
||||||
for(int i=0; i<num;i++){
|
|
||||||
// shuffle cards
|
|
||||||
int cardsArray[NumCards] = {
|
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
|
||||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
|
||||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
|
||||||
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
|
||||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
|
||||||
50, 51
|
|
||||||
};
|
|
||||||
if (!g_rand_state.get()) {
|
|
||||||
g_rand_state.reset(new boost::random_device);
|
|
||||||
}
|
|
||||||
nondet_rng rand(*g_rand_state);
|
|
||||||
random_shuffle(&cardsArray[0], &cardsArray[NumCards], rand);
|
|
||||||
|
|
||||||
ostringstream oss("");
|
|
||||||
for (int temp = 0; temp < NumCards; temp++){
|
|
||||||
if(temp > 0) cout << ",";
|
|
||||||
cout << cardsArray[temp];
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (...) {
|
|
||||||
cout << "Exception caught" << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+21
-1
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <enginefactory.h>
|
#include <enginefactory.h>
|
||||||
#include <guiinterface.h>
|
#include <guiinterface.h>
|
||||||
|
#include <core/loghelper.h>
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#include "localexception.h"
|
#include "localexception.h"
|
||||||
@@ -87,6 +88,9 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
// create player
|
// create player
|
||||||
player_i = playerDataList.begin();
|
player_i = playerDataList.begin();
|
||||||
player_end = playerDataList.end();
|
player_end = playerDataList.end();
|
||||||
|
|
||||||
|
LOG_MSG("Starting game... PLAYERS:");
|
||||||
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
|
|
||||||
string myName;
|
string myName;
|
||||||
@@ -120,7 +124,6 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
activePlayerList->push_back(tmpPlayer);
|
activePlayerList->push_back(tmpPlayer);
|
||||||
}
|
}
|
||||||
(*runningPlayerList) = (*activePlayerList);
|
(*runningPlayerList) = (*activePlayerList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBoard->setPlayerLists(seatsList, activePlayerList, runningPlayerList);
|
currentBoard->setPlayerLists(seatsList, activePlayerList, runningPlayerList);
|
||||||
@@ -312,3 +315,20 @@ void Game::raiseBlinds()
|
|||||||
currentSmallBlind = min(currentSmallBlind,startQuantityPlayers*startCash/2);
|
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,6 +142,8 @@ public:
|
|||||||
boost::shared_ptr<PlayerInterface> getPlayerByName(const std::string &name);
|
boost::shared_ptr<PlayerInterface> getPlayerByName(const std::string &name);
|
||||||
boost::shared_ptr<PlayerInterface> getCurrentPlayer();
|
boost::shared_ptr<PlayerInterface> getCurrentPlayer();
|
||||||
|
|
||||||
|
boost::shared_ptr<PlayerInterface> addNewPlayer(boost::shared_ptr<PlayerData> player);
|
||||||
|
|
||||||
void raiseBlinds();
|
void raiseBlinds();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -66,7 +66,12 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
|||||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||||
50, 51
|
50, 51
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Shuffle three times
|
||||||
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
||||||
|
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
||||||
|
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
||||||
|
|
||||||
int tempBoardArray[5];
|
int tempBoardArray[5];
|
||||||
int tempPlayerArray[2];
|
int tempPlayerArray[2];
|
||||||
int tempPlayerAndBoardArray[7];
|
int tempPlayerAndBoardArray[7];
|
||||||
|
|||||||
@@ -93,6 +93,12 @@ struct GameData {
|
|||||||
int guiSpeed;
|
int guiSpeed;
|
||||||
int delayBetweenHandsSec;
|
int delayBetweenHandsSec;
|
||||||
int playerActionTimeoutSec;
|
int playerActionTimeoutSec;
|
||||||
|
|
||||||
|
// new data
|
||||||
|
bool allowLateReg;
|
||||||
|
bool allowReentries;
|
||||||
|
int numReentries;
|
||||||
|
int maxTimeLateReg;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GameInfo {
|
struct GameInfo {
|
||||||
|
|||||||
@@ -6,16 +6,22 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>293</width>
|
<width>395</width>
|
||||||
<height>410</height>
|
<height>573</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Create Internet Game</string>
|
<string>Create Internet Game</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<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">
|
<property name="title">
|
||||||
<string>Internet Game Settings</string>
|
<string>Internet Game Settings</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -135,6 +141,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="Line" name="line">
|
<widget class="Line" name="line">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@@ -143,6 +156,128 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<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>
|
||||||
|
</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>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>2</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>
|
||||||
|
<property name="text">
|
||||||
|
<string>Maximum time for late registration/re-entry:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>spinBox_quantityPlayers</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>
|
||||||
|
<property name="suffix">
|
||||||
|
<string>min</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>60</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>15</number>
|
||||||
|
</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">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Maximum number of players:</string>
|
<string>Maximum number of players:</string>
|
||||||
@@ -152,7 +287,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="10" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_quantityPlayers">
|
<widget class="QSpinBox" name="spinBox_quantityPlayers">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
@@ -165,7 +300,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="11" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Start Cash:</string>
|
<string>Start Cash:</string>
|
||||||
@@ -175,29 +310,29 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="11" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_startCash">
|
<widget class="QSpinBox" name="spinBox_startCash">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="prefix">
|
<property name="prefix">
|
||||||
<string>$</string>
|
<string>€</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1000</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>1000000</number>
|
<number>1000000</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<number>50</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>2000</number>
|
<number>20</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="12" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="groupBox_blinds">
|
<widget class="QGroupBox" name="groupBox_blinds">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Blinds</string>
|
<string>Blinds</string>
|
||||||
@@ -226,7 +361,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="13" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
@@ -242,7 +377,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="13" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_netTimeOutPlayerAction">
|
<widget class="QSpinBox" name="spinBox_netTimeOutPlayerAction">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> s</string>
|
<string> s</string>
|
||||||
@@ -258,7 +393,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="14" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delay between hands:</string>
|
<string>Delay between hands:</string>
|
||||||
@@ -268,7 +403,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="14" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_netDelayBetweenHands">
|
<widget class="QSpinBox" name="spinBox_netDelayBetweenHands">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
@@ -290,33 +425,18 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
<widget class="QWidget" name="">
|
||||||
<item row="1" column="0">
|
<property name="geometry">
|
||||||
<layout class="QHBoxLayout">
|
<rect>
|
||||||
<property name="spacing">
|
<x>10</x>
|
||||||
<number>6</number>
|
<y>540</y>
|
||||||
</property>
|
<width>381</width>
|
||||||
<property name="leftMargin">
|
<height>25</height>
|
||||||
<number>0</number>
|
</rect>
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="_2">
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@@ -324,8 +444,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>181</width>
|
<width>115</width>
|
||||||
<height>20</height>
|
<height>17</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@@ -345,8 +465,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</widget>
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>lineEdit_gameName</tabstop>
|
<tabstop>lineEdit_gameName</tabstop>
|
||||||
|
|||||||
@@ -68,6 +68,11 @@ createInternetGameDialogImpl::createInternetGameDialogImpl(QWidget *parent, Conf
|
|||||||
connect( pushButton_createGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
connect( pushButton_createGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
||||||
connect( checkBox_Password, SIGNAL( toggled(bool) ), this, SLOT( clearGamePassword(bool)) );
|
connect( checkBox_Password, SIGNAL( toggled(bool) ), this, SLOT( clearGamePassword(bool)) );
|
||||||
connect( comboBox_gameType, SIGNAL(currentIndexChanged(int)), this, SLOT( gameTypeChanged() ) );
|
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)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -165,6 +170,7 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
|||||||
raiseMode->hide();
|
raiseMode->hide();
|
||||||
checkBox_allowSpectators->setEnabled(true);
|
checkBox_allowSpectators->setEnabled(true);
|
||||||
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
||||||
|
switchLateReg(true); // allow late reg & reentries
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -180,6 +186,7 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
|||||||
raiseMode->hide();
|
raiseMode->hide();
|
||||||
checkBox_allowSpectators->setEnabled(true);
|
checkBox_allowSpectators->setEnabled(true);
|
||||||
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
||||||
|
switchLateReg(true); // allow late reg & reentries
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAME_TYPE_INVITE_ONLY-1: {
|
case GAME_TYPE_INVITE_ONLY-1: {
|
||||||
@@ -195,6 +202,7 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
|||||||
raiseMode->hide();
|
raiseMode->hide();
|
||||||
checkBox_allowSpectators->setEnabled(true);
|
checkBox_allowSpectators->setEnabled(true);
|
||||||
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators"));
|
||||||
|
switchLateReg(false); // don't allow late reg & reentries
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAME_TYPE_RANKING-1: {
|
case GAME_TYPE_RANKING-1: {
|
||||||
@@ -211,6 +219,7 @@ void createInternetGameDialogImpl::gameTypeChanged()
|
|||||||
raiseMode->show();
|
raiseMode->show();
|
||||||
checkBox_allowSpectators->setDisabled(true);
|
checkBox_allowSpectators->setDisabled(true);
|
||||||
checkBox_allowSpectators->setChecked(true);
|
checkBox_allowSpectators->setChecked(true);
|
||||||
|
switchLateReg(false); // don't allow late reg & reentries
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -252,6 +261,51 @@ 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)
|
bool createInternetGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
|||||||
@@ -67,8 +67,13 @@ public slots:
|
|||||||
void gameTypeChanged();
|
void gameTypeChanged();
|
||||||
|
|
||||||
void callChangeBlindsDialog(bool);
|
void callChangeBlindsDialog(bool);
|
||||||
|
|
||||||
|
void switchAllowReg(bool);
|
||||||
|
void switchReentries(bool);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void switchLateReg(bool);
|
||||||
|
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
changeCompleteBlindsDialogImpl *myChangeCompleteBlindsDialog;
|
changeCompleteBlindsDialogImpl *myChangeCompleteBlindsDialog;
|
||||||
bool currentGuestMode;
|
bool currentGuestMode;
|
||||||
|
|||||||
@@ -352,6 +352,17 @@ 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.guiSpeed = myConfig->readConfigInt("GameSpeed");
|
||||||
gameData.delayBetweenHandsSec = myCreateInternetGameDialog->spinBox_netDelayBetweenHands->value();
|
gameData.delayBetweenHandsSec = myCreateInternetGameDialog->spinBox_netDelayBetweenHands->value();
|
||||||
gameData.playerActionTimeoutSec = myCreateInternetGameDialog->spinBox_netTimeOutPlayerAction->value();
|
gameData.playerActionTimeoutSec = myCreateInternetGameDialog->spinBox_netTimeOutPlayerAction->value();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
#include "carddeckstylereader.h"
|
#include "carddeckstylereader.h"
|
||||||
#include <gamedata.h>
|
#include <gamedata.h>
|
||||||
#include <generic/serverguiwrapper.h>
|
#include <generic/serverguiwrapper.h>
|
||||||
|
#include <core/loghelper.h>
|
||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -81,6 +81,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
LOG_MSG("starting gameTableImpl");
|
||||||
|
|
||||||
// this->setStyle(new QPlastiqueStyle);
|
// this->setStyle(new QPlastiqueStyle);
|
||||||
|
|
||||||
//for statistic development
|
//for statistic development
|
||||||
@@ -870,6 +872,8 @@ void gameTableImpl::initGui(int speed)
|
|||||||
//kill running Singleshots!!!
|
//kill running Singleshots!!!
|
||||||
stopTimer();
|
stopTimer();
|
||||||
|
|
||||||
|
LOG_MSG("starting gameTableImpl::initGui");
|
||||||
|
|
||||||
label_handNumber->setText(HandString+":");
|
label_handNumber->setText(HandString+":");
|
||||||
label_gameNumber->setText(GameString+":");
|
label_gameNumber->setText(GameString+":");
|
||||||
|
|
||||||
@@ -934,6 +938,7 @@ void gameTableImpl::initGui(int speed)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
LOG_MSG("ending gameTableImpl::initGui");
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<Session> gameTableImpl::getSession()
|
boost::shared_ptr<Session> gameTableImpl::getSession()
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "soundevents.h"
|
#include "soundevents.h"
|
||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
|
#include <core/loghelper.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ using namespace std;
|
|||||||
GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myGuiLog(NULL), myW(NULL), myConfig(c), myStartWindow(s)
|
GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myGuiLog(NULL), myW(NULL), myConfig(c), myStartWindow(s)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
LOG_MSG("starting GuiWrapper");
|
||||||
|
|
||||||
myW = new gameTableImpl(myConfig);
|
myW = new gameTableImpl(myConfig);
|
||||||
myGuiLog = new guiLog(myW, myConfig);
|
myGuiLog = new guiLog(myW, myConfig);
|
||||||
@@ -63,6 +65,7 @@ GuiWrapper::~GuiWrapper()
|
|||||||
|
|
||||||
void GuiWrapper::initGui(int speed)
|
void GuiWrapper::initGui(int speed)
|
||||||
{
|
{
|
||||||
|
LOG_MSG("starting GuiWrapper::initGui");
|
||||||
myW->signalInitGui(speed);
|
myW->signalInitGui(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <gamedata.h>
|
#include <gamedata.h>
|
||||||
#include <generic/serverguiwrapper.h>
|
#include <generic/serverguiwrapper.h>
|
||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
|
#include <core/loghelper.h>
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
@@ -72,6 +73,8 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
|
|||||||
: myConfig(c), myLog(l), msgBoxOutdatedVersionActive(false)
|
: myConfig(c), myLog(l), msgBoxOutdatedVersionActive(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
LOG_MSG("starting startWindowImpl");
|
||||||
|
|
||||||
myGuiInterface.reset(new GuiWrapper(myConfig, this));
|
myGuiInterface.reset(new GuiWrapper(myConfig, this));
|
||||||
{
|
{
|
||||||
mySession.reset(new Session(myGuiInterface.get(), myConfig, myLog));
|
mySession.reset(new Session(myGuiInterface.get(), myConfig, myLog));
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
|
|||||||
size_t packetSize = ntohl(nativeVal);
|
size_t packetSize = ntohl(nativeVal);
|
||||||
if (packetSize > MAX_PACKET_SIZE) {
|
if (packetSize > MAX_PACKET_SIZE) {
|
||||||
recvBufUsed = 0;
|
recvBufUsed = 0;
|
||||||
LOG_ERROR("Session " << session->GetId() << " - Invalid packet size: " << packetSize);
|
LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - Invalid packet size: " << packetSize);
|
||||||
} else if (recvBufUsed >= packetSize + NET_HEADER_SIZE) {
|
} else if (recvBufUsed >= packetSize + NET_HEADER_SIZE) {
|
||||||
try {
|
try {
|
||||||
tmpPacket = NetPacket::Create(&recvBuf[NET_HEADER_SIZE], packetSize);
|
tmpPacket = NetPacket::Create(&recvBuf[NET_HEADER_SIZE], packetSize);
|
||||||
@@ -118,7 +118,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
|
|||||||
} catch (const exception &e) {
|
} catch (const exception &e) {
|
||||||
// Reset buffer on error.
|
// Reset buffer on error.
|
||||||
recvBufUsed = 0;
|
recvBufUsed = 0;
|
||||||
LOG_ERROR("Session " << session->GetId() << " - " << e.what());
|
LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - " << e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
|
|||||||
if (validator.IsValidPacket(*tmpPacket)) {
|
if (validator.IsValidPacket(*tmpPacket)) {
|
||||||
receivedPackets.push_back(tmpPacket);
|
receivedPackets.push_back(tmpPacket);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("Session " << session->GetId() << " - Invalid packet: " << tmpPacket->GetMsg()->messagetype());
|
LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - Invalid packet: " << tmpPacket->GetMsg()->messagetype());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dataAvailable = false;
|
dataAvailable = false;
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
#include <core/crypthelper.h>
|
#include <core/crypthelper.h>
|
||||||
#include <qttoolsinterface.h>
|
#include <qttoolsinterface.h>
|
||||||
|
|
||||||
|
#include <core/loghelper.h>
|
||||||
|
|
||||||
#include <game.h>
|
#include <game.h>
|
||||||
#include <playerinterface.h>
|
#include <playerinterface.h>
|
||||||
|
|
||||||
@@ -1518,6 +1520,14 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
|
|||||||
if (!tmpPlayer)
|
if (!tmpPlayer)
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||||
tmpPlayer->SetNumber(i);
|
tmpPlayer->SetNumber(i);
|
||||||
|
|
||||||
|
LOG_MSG("PlayerData: {playerId, name, GUID, seat, number} -> {" <<
|
||||||
|
playerId << "," <<
|
||||||
|
tmpPlayer->GetName() << "," <<
|
||||||
|
tmpPlayer->GetGuid() << "," <<
|
||||||
|
i << "," <<
|
||||||
|
tmpPlayer->GetNumber()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0);
|
throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0);
|
||||||
@@ -1552,6 +1562,54 @@ ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> clien
|
|||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0);
|
throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0);
|
||||||
}
|
}
|
||||||
client->InitGame();
|
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);
|
client->GetGame()->setCurrentHandID(tmpHandId);
|
||||||
// We need to remove the temporary player data objects after creating the game.
|
// We need to remove the temporary player data objects after creating the game.
|
||||||
BOOST_FOREACH(unsigned tmpPlayerId, tmpPlayerList) {
|
BOOST_FOREACH(unsigned tmpPlayerId, tmpPlayerList) {
|
||||||
@@ -1705,6 +1763,8 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
|||||||
client->GetCallback().SignalNetClientPostRiverShowCards(r.playerid());
|
client->GetCallback().SignalNetClientPostRiverShowCards(r.playerid());
|
||||||
client->GetClientLog()->logHoleCardsHandName(client->GetGame()->getActivePlayerList(), tmpPlayer, true);
|
client->GetClientLog()->logHoleCardsHandName(client->GetGame()->getActivePlayerList(), tmpPlayer, true);
|
||||||
} else if (tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_PlayerIdChangedMessage) {
|
} else if (tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_PlayerIdChangedMessage) {
|
||||||
|
|
||||||
|
LOG_MSG("performing rejoin");
|
||||||
boost::shared_ptr<Game> curGame = client->GetGame();
|
boost::shared_ptr<Game> curGame = client->GetGame();
|
||||||
if (curGame) {
|
if (curGame) {
|
||||||
// Perform Id change.
|
// Perform Id change.
|
||||||
@@ -1712,6 +1772,9 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
|||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(idChanged.oldplayerid());
|
boost::shared_ptr<PlayerInterface> tmpPlayer = curGame->getPlayerByUniqueId(idChanged.oldplayerid());
|
||||||
if (!tmpPlayer)
|
if (!tmpPlayer)
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||||
|
|
||||||
|
LOG_MSG("Player rejoins with " << tmpPlayer->getMyCash());
|
||||||
|
|
||||||
tmpPlayer->setMyUniqueID(idChanged.newplayerid());
|
tmpPlayer->setMyUniqueID(idChanged.newplayerid());
|
||||||
// This player is now active again.
|
// This player is now active again.
|
||||||
tmpPlayer->setMyStayOnTableStatus(true);
|
tmpPlayer->setMyStayOnTableStatus(true);
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ NetPacket::SetGameData(const GameData &inData, NetGameInfo &outData)
|
|||||||
outData.set_endraisesmallblindvalue(inData.afterMBAlwaysRaiseValue);
|
outData.set_endraisesmallblindvalue(inData.afterMBAlwaysRaiseValue);
|
||||||
outData.set_firstsmallblind(inData.firstSmallBlind);
|
outData.set_firstsmallblind(inData.firstSmallBlind);
|
||||||
outData.set_startmoney(inData.startMoney);
|
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) {
|
BOOST_FOREACH(int manualBlind, inData.manualBlindsList) {
|
||||||
outData.add_manualblinds(manualBlind);
|
outData.add_manualblinds(manualBlind);
|
||||||
@@ -141,6 +145,10 @@ NetPacket::GetGameData(const NetGameInfo &inData, GameData &outData)
|
|||||||
outData.firstSmallBlind = inData.firstsmallblind();
|
outData.firstSmallBlind = inData.firstsmallblind();
|
||||||
outData.afterMBAlwaysRaiseValue = inData.endraisesmallblindvalue();
|
outData.afterMBAlwaysRaiseValue = inData.endraisesmallblindvalue();
|
||||||
outData.startMoney = inData.startmoney();
|
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++) {
|
for (int i = 0; i < numManualBlinds; i++) {
|
||||||
outData.manualBlindsList.push_back(static_cast<int>(inData.manualblinds(i)));
|
outData.manualBlindsList.push_back(static_cast<int>(inData.manualblinds(i)));
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ NetPacketValidator::NetPacketValidator()
|
|||||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_StartEventAckMessage, ValidateStartEventAckMessage));
|
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_GameStartInitialMessage, ValidateGameStartInitialMessage));
|
||||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_GameStartRejoinMessage, ValidateGameStartRejoinMessage));
|
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_HandStartMessage, ValidateHandStartMessage));
|
||||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_PlayersTurnMessage, ValidatePlayersTurnMessage));
|
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_PlayersTurnMessage, ValidatePlayersTurnMessage));
|
||||||
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_MyActionRequestMessage, ValidateMyActionRequestMessage));
|
m_validationMap.insert(make_pair(PokerTHMessage_PokerTHMessageType_Type_MyActionRequestMessage, ValidateMyActionRequestMessage));
|
||||||
@@ -695,6 +696,22 @@ NetPacketValidator::ValidateGameStartRejoinMessage(const NetPacket &packet)
|
|||||||
return retVal;
|
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
|
bool
|
||||||
NetPacketValidator::ValidateHandStartMessage(const NetPacket &packet)
|
NetPacketValidator::ValidateHandStartMessage(const NetPacket &packet)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
* as that of the covered work. *
|
* as that of the covered work. *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <boost/bind/bind.hpp>
|
||||||
#include <net/serveracceptwebhelper.h>
|
#include <net/serveracceptwebhelper.h>
|
||||||
#include <net/sessiondata.h>
|
#include <net/sessiondata.h>
|
||||||
#include <net/webreceivebuffer.h>
|
#include <net/webreceivebuffer.h>
|
||||||
@@ -58,10 +59,10 @@ ServerAcceptWebHelper::Listen(unsigned serverPort, bool /*ipv6*/, const std::str
|
|||||||
|
|
||||||
m_webSocketServer->init_asio(m_ioService.get());
|
m_webSocketServer->init_asio(m_ioService.get());
|
||||||
|
|
||||||
m_webSocketServer->set_validate_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::validate), this, _1));
|
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, _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, _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, _1, _2));
|
m_webSocketServer->set_message_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_message), this, boost::placeholders::_1,boost::placeholders:: _2));
|
||||||
|
|
||||||
m_webSocketServer->listen(serverPort);
|
m_webSocketServer->listen(serverPort);
|
||||||
m_webSocketServer->start_accept();
|
m_webSocketServer->start_accept();
|
||||||
|
|||||||
@@ -71,10 +71,23 @@ ServerGame::ServerGame(boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32
|
|||||||
m_gameData(gameData), m_curState(NULL), m_id(id), m_name(name),
|
m_gameData(gameData), m_curState(NULL), m_id(id), m_name(name),
|
||||||
m_password(pwd), m_creatorPlayerDBId(creatorPlayerDBId), m_playerConfig(playerConfig),
|
m_password(pwd), m_creatorPlayerDBId(creatorPlayerDBId), m_playerConfig(playerConfig),
|
||||||
m_gameNum(1), m_curPetitionId(1), m_voteKickTimer(lobbyThread->GetIOService()),
|
m_gameNum(1), m_curPetitionId(1), m_voteKickTimer(lobbyThread->GetIOService()),
|
||||||
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService()),
|
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService()), m_allowEntryTimer(lobbyThread->GetIOService()),
|
||||||
m_isNameReported(false)
|
m_isNameReported(false), m_isLateRegAllowed(false)
|
||||||
{
|
{
|
||||||
LOG_VERBOSE("Game object " << GetId() << " created.");
|
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()
|
ServerGame::~ServerGame()
|
||||||
@@ -92,6 +105,7 @@ void
|
|||||||
ServerGame::Exit()
|
ServerGame::Exit()
|
||||||
{
|
{
|
||||||
m_voteKickTimer.cancel();
|
m_voteKickTimer.cancel();
|
||||||
|
m_allowEntryTimer.cancel();
|
||||||
SetState(ServerGameStateFinal::Instance());
|
SetState(ServerGameStateFinal::Instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,6 +368,8 @@ ServerGame::InternalStartGame()
|
|||||||
if (GetGameData().gameType == GAME_TYPE_RANKING)
|
if (GetGameData().gameType == GAME_TYPE_RANKING)
|
||||||
StoreLastGames(playerData);
|
StoreLastGames(playerData);
|
||||||
|
|
||||||
|
setEntries(playerData);
|
||||||
|
|
||||||
}
|
}
|
||||||
return playerData;
|
return playerData;
|
||||||
}
|
}
|
||||||
@@ -492,6 +508,7 @@ ServerGame::InternalEndGame()
|
|||||||
StoreAndResetRanking();
|
StoreAndResetRanking();
|
||||||
m_game.reset();
|
m_game.reset();
|
||||||
m_numJoinsPerPlayer.clear();
|
m_numJoinsPerPlayer.clear();
|
||||||
|
m_numEntriesPlayer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -778,6 +795,13 @@ ServerGame::AddRejoinPlayer(unsigned playerId)
|
|||||||
m_rejoinPlayerList.push_back(playerId);
|
m_rejoinPlayerList.push_back(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerGame::AddReentryPlayer(unsigned playerId)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_reentryPlayerListMutex);
|
||||||
|
m_reentryPlayerList.push_back(playerId);
|
||||||
|
}
|
||||||
|
|
||||||
PlayerIdList
|
PlayerIdList
|
||||||
ServerGame::GetAndResetRejoinPlayers()
|
ServerGame::GetAndResetRejoinPlayers()
|
||||||
{
|
{
|
||||||
@@ -787,6 +811,22 @@ ServerGame::GetAndResetRejoinPlayers()
|
|||||||
return tmpList;
|
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
|
void
|
||||||
ServerGame::AddReactivatePlayer(unsigned playerId)
|
ServerGame::AddReactivatePlayer(unsigned playerId)
|
||||||
{
|
{
|
||||||
@@ -1119,6 +1159,12 @@ ServerGame::GetStateTimer2()
|
|||||||
return m_stateTimer2;
|
return m_stateTimer2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::asio::steady_timer &
|
||||||
|
ServerGame::GetAllowEntryTimer()
|
||||||
|
{
|
||||||
|
return m_allowEntryTimer;
|
||||||
|
}
|
||||||
|
|
||||||
Game &
|
Game &
|
||||||
ServerGame::GetGame()
|
ServerGame::GetGame()
|
||||||
{
|
{
|
||||||
@@ -1184,6 +1230,17 @@ ServerGame::CheckSettings(const GameData &data, const string &password, ServerMo
|
|||||||
retVal = false;
|
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;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1220,3 +1277,88 @@ ServerGame::GetNumJoinsPerPlayer(const std::string &playerName)
|
|||||||
}
|
}
|
||||||
return num;
|
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,6 +92,8 @@ using namespace boost::chrono;
|
|||||||
|
|
||||||
#define GAME_MAX_NUM_JOINS_PER_PLAYER 6
|
#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
|
// Helper functions
|
||||||
|
|
||||||
static void SendPlayerAction(ServerGame &server, boost::shared_ptr<PlayerInterface> player)
|
static void SendPlayerAction(ServerGame &server, boost::shared_ptr<PlayerInterface> player)
|
||||||
@@ -155,7 +157,7 @@ static void SendNewRoundCards(ServerGame &server, Game &curGame, int state)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
//
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,6 +229,35 @@ SetPlayerResult(PlayerResult &playerResult, boost::shared_ptr<PlayerInterface> t
|
|||||||
playerResult.set_playermoney(tmpPlayer->getMyCash());
|
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()
|
ServerGameState::~ServerGameState()
|
||||||
@@ -825,6 +856,14 @@ 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
|
void
|
||||||
ServerGameStateStartGame::DoStart(boost::shared_ptr<ServerGame> server)
|
ServerGameStateStartGame::DoStart(boost::shared_ptr<ServerGame> server)
|
||||||
{
|
{
|
||||||
@@ -852,8 +891,39 @@ ServerGameStateStartGame::DoStart(boost::shared_ptr<ServerGame> server)
|
|||||||
++player_i;
|
++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);
|
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.
|
// Start the first hand.
|
||||||
ServerGameStateHand::StartNewHand(server);
|
ServerGameStateHand::StartNewHand(server);
|
||||||
server->SetState(ServerGameStateHand::Instance());
|
server->SetState(ServerGameStateHand::Instance());
|
||||||
@@ -888,7 +958,55 @@ AbstractServerGameStateRunning::HandleNewPlayer(boost::shared_ptr<ServerGame> se
|
|||||||
|
|
||||||
// Wait for rejoining player to confirm start of game.
|
// Wait for rejoining player to confirm start of game.
|
||||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
server->GetLobbyThread().GetSender().Send(session, packet);
|
||||||
} else {
|
}
|
||||||
|
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 {
|
||||||
// Do not accept "new" sessions in this state, only rejoin is allowed.
|
// Do not accept "new" sessions in this state, only rejoin is allowed.
|
||||||
server->MoveSessionToLobby(session, NTF_NET_REMOVED_ALREADY_RUNNING);
|
server->MoveSessionToLobby(session, NTF_NET_REMOVED_ALREADY_RUNNING);
|
||||||
}
|
}
|
||||||
@@ -1251,8 +1369,81 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
|
|||||||
curGame.getCurrentHand()->getRiver()->skipFirstRunGui();
|
curGame.getCurrentHand()->getRiver()->skipFirstRunGui();
|
||||||
|
|
||||||
// Consider all players, even inactive.
|
// Consider all players, even inactive.
|
||||||
PlayerListIterator i = curGame.getSeatsList()->begin();
|
PlayerListIterator i;
|
||||||
PlayerListIterator end = curGame.getSeatsList()->end();
|
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();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Send cards to all players.
|
// Send cards to all players.
|
||||||
while (i != end) {
|
while (i != end) {
|
||||||
@@ -1417,6 +1608,21 @@ 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
|
void
|
||||||
ServerGameStateHand::InitNewSpectators(boost::shared_ptr<ServerGame> server)
|
ServerGameStateHand::InitNewSpectators(boost::shared_ptr<ServerGame> server)
|
||||||
{
|
{
|
||||||
@@ -1463,6 +1669,102 @@ 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
|
void
|
||||||
ServerGameStateHand::SendGameData(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session)
|
ServerGameStateHand::SendGameData(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session)
|
||||||
{
|
{
|
||||||
@@ -1489,6 +1791,33 @@ ServerGameStateHand::SendGameData(boost::shared_ptr<ServerGame> server, boost::s
|
|||||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
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,8 +63,9 @@
|
|||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <gsasl.h>
|
#include <gsasl.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#define SERVER_MAX_NUM_LOBBY_SESSIONS 512 // Maximum number of idle users in lobby.
|
#define SERVER_MAX_NUM_LOBBY_SESSIONS 1536 // 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_MAX_NUM_TOTAL_SESSIONS 2000 // Total maximum of sessions, fitting a 2048 handle limit
|
||||||
|
|
||||||
#define SERVER_SAVE_STATISTICS_INTERVAL_SEC 60
|
#define SERVER_SAVE_STATISTICS_INTERVAL_SEC 60
|
||||||
@@ -304,8 +305,8 @@ ServerLobbyThread::AddConnection(boost::shared_ptr<SessionData> sessionData)
|
|||||||
// Create a new session.
|
// Create a new session.
|
||||||
m_sessionManager.AddSession(sessionData);
|
m_sessionManager.AddSession(sessionData);
|
||||||
|
|
||||||
LOG_VERBOSE("Accepted connection - session #" << sessionData->GetId() << ".");
|
LOG_VERBOSE(sessionData->GetRemoteIPAddressFromSocket() << " Accepted connection - session #" << sessionData->GetId() << ".");
|
||||||
LOG_ERROR("Accepted connection - session #" << sessionData->GetId() << ".");
|
LOG_ERROR(sessionData->GetRemoteIPAddressFromSocket() << " Accepted connection - session #" << sessionData->GetId() << ".");
|
||||||
|
|
||||||
sessionData->StartTimerInitTimeout(SERVER_INIT_SESSION_TIMEOUT_SEC);
|
sessionData->StartTimerInitTimeout(SERVER_INIT_SESSION_TIMEOUT_SEC);
|
||||||
sessionData->StartTimerGlobalTimeout(SERVER_SESSION_FORCED_TIMEOUT_SEC);
|
sessionData->StartTimerGlobalTimeout(SERVER_SESSION_FORCED_TIMEOUT_SEC);
|
||||||
@@ -1368,6 +1369,13 @@ ServerLobbyThread::HandleNetPacketCreateGame(boost::shared_ptr<SessionData> sess
|
|||||||
boost::replace_all(gameName, "\f", " ");
|
boost::replace_all(gameName, "\f", " ");
|
||||||
unsigned gameId = GetNextGameId();
|
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])) {
|
if (gameName.empty() || !isprint(gameName[0])) {
|
||||||
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_GAME_BAD_NAME);
|
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_GAME_BAD_NAME);
|
||||||
} else if (IsGameNameInUse(gameName)) {
|
} else if (IsGameNameInUse(gameName)) {
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ protected:
|
|||||||
static bool ValidateStartEventAckMessage(const NetPacket &packet);
|
static bool ValidateStartEventAckMessage(const NetPacket &packet);
|
||||||
static bool ValidateGameStartInitialMessage(const NetPacket &packet);
|
static bool ValidateGameStartInitialMessage(const NetPacket &packet);
|
||||||
static bool ValidateGameStartRejoinMessage(const NetPacket &packet);
|
static bool ValidateGameStartRejoinMessage(const NetPacket &packet);
|
||||||
|
static bool ValidateGameStartReentryMessage(const NetPacket &packet);
|
||||||
static bool ValidateHandStartMessage(const NetPacket &packet);
|
static bool ValidateHandStartMessage(const NetPacket &packet);
|
||||||
static bool ValidatePlayersTurnMessage(const NetPacket &packet);
|
static bool ValidatePlayersTurnMessage(const NetPacket &packet);
|
||||||
static bool ValidateMyActionRequestMessage(const NetPacket &packet);
|
static bool ValidateMyActionRequestMessage(const NetPacket &packet);
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ public:
|
|||||||
void AddRejoinPlayer(unsigned playerId);
|
void AddRejoinPlayer(unsigned playerId);
|
||||||
PlayerIdList GetAndResetRejoinPlayers();
|
PlayerIdList GetAndResetRejoinPlayers();
|
||||||
|
|
||||||
|
void AddReentryPlayer(unsigned playerId);
|
||||||
|
PlayerIdList GetAndResetReentryPlayers();
|
||||||
|
unsigned GetNumberPlayersReentry();
|
||||||
|
|
||||||
void AddReactivatePlayer(unsigned playerId);
|
void AddReactivatePlayer(unsigned playerId);
|
||||||
PlayerIdList GetAndResetReactivatePlayers();
|
PlayerIdList GetAndResetReactivatePlayers();
|
||||||
|
|
||||||
@@ -128,6 +132,10 @@ public:
|
|||||||
|
|
||||||
void AddPlayerToNumJoinsPerPlayer(const std::string &playerName);
|
void AddPlayerToNumJoinsPerPlayer(const std::string &playerName);
|
||||||
int GetNumJoinsPerPlayer(const std::string &playerName);
|
int GetNumJoinsPerPlayer(const std::string &playerName);
|
||||||
|
bool admitReentries(boost::shared_ptr<PlayerData> player);
|
||||||
|
|
||||||
|
void CancelLateReg();
|
||||||
|
bool IsLateReg();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -184,6 +192,7 @@ protected:
|
|||||||
|
|
||||||
boost::asio::steady_timer &GetStateTimer1();
|
boost::asio::steady_timer &GetStateTimer1();
|
||||||
boost::asio::steady_timer &GetStateTimer2();
|
boost::asio::steady_timer &GetStateTimer2();
|
||||||
|
boost::asio::steady_timer &GetAllowEntryTimer();
|
||||||
|
|
||||||
const StartData &GetStartData() const;
|
const StartData &GetStartData() const;
|
||||||
void SetStartData(const StartData &startData);
|
void SetStartData(const StartData &startData);
|
||||||
@@ -196,6 +205,8 @@ protected:
|
|||||||
SessionManager &GetSessionManager();
|
SessionManager &GetSessionManager();
|
||||||
ServerDBInterface &GetDatabase();
|
ServerDBInterface &GetDatabase();
|
||||||
|
|
||||||
|
void setEntries(const PlayerDataList &playerData);
|
||||||
|
|
||||||
typedef std::map<std::string, int> NumJoinsPerPlayerMap;
|
typedef std::map<std::string, int> NumJoinsPerPlayerMap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -214,6 +225,9 @@ private:
|
|||||||
PlayerIdList m_rejoinPlayerList;
|
PlayerIdList m_rejoinPlayerList;
|
||||||
mutable boost::mutex m_rejoinPlayerListMutex;
|
mutable boost::mutex m_rejoinPlayerListMutex;
|
||||||
|
|
||||||
|
PlayerIdList m_reentryPlayerList;
|
||||||
|
mutable boost::mutex m_reentryPlayerListMutex;
|
||||||
|
|
||||||
PlayerIdList m_reactivatePlayerList;
|
PlayerIdList m_reactivatePlayerList;
|
||||||
mutable boost::mutex m_reactivatePlayerListMutex;
|
mutable boost::mutex m_reactivatePlayerListMutex;
|
||||||
|
|
||||||
@@ -247,7 +261,9 @@ private:
|
|||||||
boost::asio::steady_timer m_voteKickTimer;
|
boost::asio::steady_timer m_voteKickTimer;
|
||||||
boost::asio::steady_timer m_stateTimer1;
|
boost::asio::steady_timer m_stateTimer1;
|
||||||
boost::asio::steady_timer m_stateTimer2;
|
boost::asio::steady_timer m_stateTimer2;
|
||||||
|
boost::asio::steady_timer m_allowEntryTimer;
|
||||||
bool m_isNameReported;
|
bool m_isNameReported;
|
||||||
|
bool m_isLateRegAllowed;
|
||||||
|
|
||||||
friend class ServerLobbyThread;
|
friend class ServerLobbyThread;
|
||||||
friend class AbstractServerGameStateReceiving;
|
friend class AbstractServerGameStateReceiving;
|
||||||
@@ -260,6 +276,7 @@ private:
|
|||||||
friend class ServerGameStateWaitNextHand;
|
friend class ServerGameStateWaitNextHand;
|
||||||
|
|
||||||
NumJoinsPerPlayerMap m_numJoinsPerPlayer;
|
NumJoinsPerPlayerMap m_numJoinsPerPlayer;
|
||||||
|
NumJoinsPerPlayerMap m_numEntriesPlayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <playerdata.h>
|
#include <playerdata.h>
|
||||||
#include <net/sessionmanager.h>
|
#include <net/sessionmanager.h>
|
||||||
|
#include <engine/engine_defs.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -145,6 +146,7 @@ protected:
|
|||||||
|
|
||||||
virtual void InternalProcessPacket(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet);
|
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 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);
|
void DoStart(boost::shared_ptr<ServerGame> server);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -191,9 +193,13 @@ protected:
|
|||||||
static void CheckPlayerTimeouts(boost::shared_ptr<ServerGame> server);
|
static void CheckPlayerTimeouts(boost::shared_ptr<ServerGame> server);
|
||||||
static void ReactivatePlayers(boost::shared_ptr<ServerGame> server);
|
static void ReactivatePlayers(boost::shared_ptr<ServerGame> server);
|
||||||
static void InitRejoiningPlayers(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 InitNewSpectators(boost::shared_ptr<ServerGame> server);
|
||||||
static void PerformRejoin(boost::shared_ptr<ServerGame> server, boost::shared_ptr<SessionData> session);
|
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 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:
|
private:
|
||||||
static ServerGameStateHand s_state;
|
static ServerGameStateHand s_state;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <net/clientthread.h>
|
#include <net/clientthread.h>
|
||||||
#include <core/avatarmanager.h>
|
#include <core/avatarmanager.h>
|
||||||
#include <net/servermanagerfactory.h>
|
#include <net/servermanagerfactory.h>
|
||||||
|
#include <core/loghelper.h>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@@ -281,6 +282,14 @@ void Session::clientCreateGame(const GameData &gameData, const string &name, con
|
|||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
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(
|
myNetClient->SendCreateGame(
|
||||||
gameData,
|
gameData,
|
||||||
name,
|
name,
|
||||||
|
|||||||
+1903
-1594
File diff suppressed because it is too large
Load Diff
+1701
-1025
File diff suppressed because it is too large
Load Diff
+32439
-27600
File diff suppressed because it is too large
Load Diff
+27392
-14007
File diff suppressed because it is too large
Load Diff
@@ -311,9 +311,10 @@ public:
|
|||||||
* needed.
|
* needed.
|
||||||
*/
|
*/
|
||||||
timer_ptr set_timer(long duration, timer_handler callback) {
|
timer_ptr set_timer(long duration, timer_handler callback) {
|
||||||
timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>(
|
timer_ptr new_timer(
|
||||||
lib::ref(*m_io_service),
|
new lib::asio::steady_timer(
|
||||||
lib::asio::milliseconds(duration)
|
*m_io_service,
|
||||||
|
lib::asio::milliseconds(duration))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (config::enable_multithreading) {
|
if (config::enable_multithreading) {
|
||||||
@@ -461,8 +462,7 @@ protected:
|
|||||||
m_io_service = io_service;
|
m_io_service = io_service;
|
||||||
|
|
||||||
if (config::enable_multithreading) {
|
if (config::enable_multithreading) {
|
||||||
m_strand = lib::make_shared<lib::asio::io_service::strand>(
|
m_strand.reset(new lib::asio::io_service::strand(*io_service));
|
||||||
lib::ref(*io_service));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lib::error_code ec = socket_con_type::init_asio(io_service, m_strand,
|
lib::error_code ec = socket_con_type::init_asio(io_service, m_strand,
|
||||||
|
|||||||
@@ -191,8 +191,7 @@ public:
|
|||||||
|
|
||||||
m_io_service = ptr;
|
m_io_service = ptr;
|
||||||
m_external_io_service = true;
|
m_external_io_service = true;
|
||||||
m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>(
|
m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service));
|
||||||
lib::ref(*m_io_service));
|
|
||||||
|
|
||||||
m_state = READY;
|
m_state = READY;
|
||||||
ec = lib::error_code();
|
ec = lib::error_code();
|
||||||
@@ -660,9 +659,7 @@ public:
|
|||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
void start_perpetual() {
|
void start_perpetual() {
|
||||||
m_work = lib::make_shared<lib::asio::io_service::work>(
|
m_work.reset(new lib::asio::io_service::work(*m_io_service));
|
||||||
lib::ref(*m_io_service)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clears the endpoint's perpetual flag, allowing it to exit when empty
|
/// Clears the endpoint's perpetual flag, allowing it to exit when empty
|
||||||
@@ -826,8 +823,7 @@ protected:
|
|||||||
|
|
||||||
// Create a resolver
|
// Create a resolver
|
||||||
if (!m_resolver) {
|
if (!m_resolver) {
|
||||||
m_resolver = lib::make_shared<lib::asio::ip::tcp::resolver>(
|
m_resolver.reset(new lib::asio::ip::tcp::resolver(*m_io_service));
|
||||||
lib::ref(*m_io_service));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tcon->set_uri(u);
|
tcon->set_uri(u);
|
||||||
|
|||||||
@@ -168,8 +168,7 @@ protected:
|
|||||||
return socket::make_error_code(socket::error::invalid_state);
|
return socket::make_error_code(socket::error::invalid_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_socket = lib::make_shared<lib::asio::ip::tcp::socket>(
|
m_socket.reset(new lib::asio::ip::tcp::socket(*service));
|
||||||
lib::ref(*service));
|
|
||||||
|
|
||||||
m_state = READY;
|
m_state = READY;
|
||||||
|
|
||||||
|
|||||||
@@ -193,8 +193,7 @@ protected:
|
|||||||
if (!m_context) {
|
if (!m_context) {
|
||||||
return socket::make_error_code(socket::error::invalid_tls_context);
|
return socket::make_error_code(socket::error::invalid_tls_context);
|
||||||
}
|
}
|
||||||
m_socket = lib::make_shared<socket_type>(
|
m_socket.reset(new socket_type(*service, *m_context));
|
||||||
_WEBSOCKETPP_REF(*service),lib::ref(*m_context));
|
|
||||||
|
|
||||||
m_io_service = service;
|
m_io_service = service;
|
||||||
m_strand = strand;
|
m_strand = strand;
|
||||||
|
|||||||
+45685
-12768
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user