Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -11,7 +11,7 @@ Linux:
|
|||||||
- libgsasl version >= 1.4 --> http://www.gnu.org/software/gsasl/
|
- libgsasl version >= 1.4 --> http://www.gnu.org/software/gsasl/
|
||||||
- libboost_thread, libboost_filesystem, libboost_datetime, libboost_program_options,
|
- libboost_thread, libboost_filesystem, libboost_datetime, libboost_program_options,
|
||||||
libboost_iostreams, libboost_asio, libboost_regex, libboost_random, libboost_uuid
|
libboost_iostreams, libboost_asio, libboost_regex, libboost_random, libboost_uuid
|
||||||
(version >= 1.44, latest always recommended) --> http://www.boost.org/
|
(version >= 1.49, latest always recommended) --> http://www.boost.org/
|
||||||
- libSDL_mixer, libSDL --> http://www.libsdl.org/
|
- libSDL_mixer, libSDL --> http://www.libsdl.org/
|
||||||
- libSQLite3 --> http://sqlite.org/
|
- libSQLite3 --> http://sqlite.org/
|
||||||
- libtinyxml > 2.0 --> http://www.sourceforge.net/projects/tinyxml
|
- libtinyxml > 2.0 --> http://www.sourceforge.net/projects/tinyxml
|
||||||
|
|||||||
+14
-1
@@ -422,6 +422,8 @@ unix:!mac {
|
|||||||
boost_iostreams-mt
|
boost_iostreams-mt
|
||||||
BOOST_REGEX = boost_regex \
|
BOOST_REGEX = boost_regex \
|
||||||
boost_regex-mt
|
boost_regex-mt
|
||||||
|
BOOST_CHRONO = boost_chrono \
|
||||||
|
boost_chrono-mt
|
||||||
BOOST_SYS = boost_system \
|
BOOST_SYS = boost_system \
|
||||||
boost_system-mt
|
boost_system-mt
|
||||||
BOOST_RANDOM = boost_random \
|
BOOST_RANDOM = boost_random \
|
||||||
@@ -463,6 +465,14 @@ unix:!mac {
|
|||||||
message("Found $$lib")
|
message("Found $$lib")
|
||||||
BOOST_REGEX = -l$$lib
|
BOOST_REGEX = -l$$lib
|
||||||
}
|
}
|
||||||
|
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.so*) {
|
||||||
|
message("Found $$lib")
|
||||||
|
BOOST_CHRONO = -l$$lib
|
||||||
|
}
|
||||||
|
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.a) {
|
||||||
|
message("Found $$lib")
|
||||||
|
BOOST_CHRONO = -l$$lib
|
||||||
|
}
|
||||||
!android{
|
!android{
|
||||||
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
||||||
message("Found $$lib")
|
message("Found $$lib")
|
||||||
@@ -487,9 +497,10 @@ unix:!mac {
|
|||||||
$$BOOST_FS \
|
$$BOOST_FS \
|
||||||
$$BOOST_IOSTREAMS \
|
$$BOOST_IOSTREAMS \
|
||||||
$$BOOST_REGEX \
|
$$BOOST_REGEX \
|
||||||
|
$$BOOST_CHRONO \
|
||||||
$$BOOST_RANDOM \
|
$$BOOST_RANDOM \
|
||||||
$$BOOST_SYS
|
$$BOOST_SYS
|
||||||
!count(BOOST_LIBS, 6):error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
!count(BOOST_LIBS, 7):error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
||||||
if($$system(sdl-config --version)):error("sdl-config not found in PATH - libSDL_mixer, libSDL are required!")
|
if($$system(sdl-config --version)):error("sdl-config not found in PATH - libSDL_mixer, libSDL are required!")
|
||||||
UNAME = $$system(uname -s)
|
UNAME = $$system(uname -s)
|
||||||
BSD = $$find(UNAME, "BSD")
|
BSD = $$find(UNAME, "BSD")
|
||||||
@@ -509,6 +520,7 @@ unix:!mac {
|
|||||||
$$BOOST_FS \
|
$$BOOST_FS \
|
||||||
$$BOOST_IOSTREAMS \
|
$$BOOST_IOSTREAMS \
|
||||||
$$BOOST_REGEX \
|
$$BOOST_REGEX \
|
||||||
|
$$BOOST_CHRONO \
|
||||||
$$BOOST_SYS
|
$$BOOST_SYS
|
||||||
!count(BOOST_LIBS, 5):error("Unable to find boost libraries in PREFIX=$${PREFIX}/armv5")
|
!count(BOOST_LIBS, 5):error("Unable to find boost libraries in PREFIX=$${PREFIX}/armv5")
|
||||||
LIBS += -ltinyxml
|
LIBS += -ltinyxml
|
||||||
@@ -575,6 +587,7 @@ mac {
|
|||||||
LIBS += /usr/local/lib/libboost_thread.a
|
LIBS += /usr/local/lib/libboost_thread.a
|
||||||
LIBS += /usr/local/lib/libboost_filesystem.a
|
LIBS += /usr/local/lib/libboost_filesystem.a
|
||||||
LIBS += /usr/local/lib/libboost_regex.a
|
LIBS += /usr/local/lib/libboost_regex.a
|
||||||
|
LIBS += /usr/local/lib/libboost_chrono.a
|
||||||
LIBS += /usr/local/lib/libboost_random.a
|
LIBS += /usr/local/lib/libboost_random.a
|
||||||
LIBS += /usr/local/lib/libboost_system.a
|
LIBS += /usr/local/lib/libboost_system.a
|
||||||
LIBS += /usr/local/lib/libboost_iostreams.a
|
LIBS += /usr/local/lib/libboost_iostreams.a
|
||||||
|
|||||||
+12
-2
@@ -180,6 +180,7 @@ unix : !mac {
|
|||||||
BOOST_THREAD = boost_thread boost_thread-mt
|
BOOST_THREAD = boost_thread boost_thread-mt
|
||||||
BOOST_PROGRAM_OPTIONS = boost_program_options boost_program_options-mt
|
BOOST_PROGRAM_OPTIONS = boost_program_options boost_program_options-mt
|
||||||
BOOST_IOSTREAMS = boost_iostreams boost_iostreams-mt
|
BOOST_IOSTREAMS = boost_iostreams boost_iostreams-mt
|
||||||
|
BOOST_CHRONO = boost_chrono boost_chrono-mt
|
||||||
BOOST_SYS = boost_system boost_system-mt
|
BOOST_SYS = boost_system boost_system-mt
|
||||||
BOOST_REGEX = boost_regex boost_regex-mt
|
BOOST_REGEX = boost_regex boost_regex-mt
|
||||||
BOOST_RANDOM = boost_random boost_random-mt
|
BOOST_RANDOM = boost_random boost_random-mt
|
||||||
@@ -231,6 +232,14 @@ unix : !mac {
|
|||||||
message("Found $$lib")
|
message("Found $$lib")
|
||||||
BOOST_REGEX = -l$$lib
|
BOOST_REGEX = -l$$lib
|
||||||
}
|
}
|
||||||
|
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.so*) {
|
||||||
|
message("Found $$lib")
|
||||||
|
BOOST_CHRONO = -l$$lib
|
||||||
|
}
|
||||||
|
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.a) {
|
||||||
|
message("Found $$lib")
|
||||||
|
BOOST_CHRONO = -l$$lib
|
||||||
|
}
|
||||||
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
||||||
message("Found $$lib")
|
message("Found $$lib")
|
||||||
BOOST_RANDOM = -l$$lib
|
BOOST_RANDOM = -l$$lib
|
||||||
@@ -249,8 +258,8 @@ unix : !mac {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOOST_LIBS = $$BOOST_THREAD $$BOOST_FS $$BOOST_PROGRAM_OPTIONS $$BOOST_IOSTREAMS $$BOOST_REGEX $$BOOST_RANDOM $$BOOST_SYS
|
BOOST_LIBS = $$BOOST_THREAD $$BOOST_FS $$BOOST_PROGRAM_OPTIONS $$BOOST_IOSTREAMS $$BOOST_REGEX $$BOOST_CHRONO $$BOOST_RANDOM $$BOOST_SYS
|
||||||
!count(BOOST_LIBS, 7){
|
!count(BOOST_LIBS, 8){
|
||||||
error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,6 +310,7 @@ mac {
|
|||||||
LIBS += /usr/local/lib/libboost_thread.a
|
LIBS += /usr/local/lib/libboost_thread.a
|
||||||
LIBS += /usr/local/lib/libboost_filesystem.a
|
LIBS += /usr/local/lib/libboost_filesystem.a
|
||||||
LIBS += /usr/local/lib/libboost_regex.a
|
LIBS += /usr/local/lib/libboost_regex.a
|
||||||
|
LIBS += /usr/local/lib/libboost_chrono.a
|
||||||
LIBS += /usr/local/lib/libboost_random.a
|
LIBS += /usr/local/lib/libboost_random.a
|
||||||
LIBS += /usr/local/lib/libboost_system.a
|
LIBS += /usr/local/lib/libboost_system.a
|
||||||
LIBS += /usr/local/lib/libboost_iostreams.a
|
LIBS += /usr/local/lib/libboost_iostreams.a
|
||||||
|
|||||||
+5
-6
@@ -57,10 +57,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
dealerPosition = startData.startDealerPlayerId;
|
dealerPosition = startData.startDealerPlayerId;
|
||||||
|
|
||||||
// debug mode
|
// debug mode
|
||||||
if(myLog) {
|
if(myLog) {
|
||||||
myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind);
|
myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind);
|
||||||
myLog->debugMode_getStartDealerPosition(&dealerPosition);
|
myLog->debugMode_getStartDealerPosition(&dealerPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// debug mode
|
// debug mode
|
||||||
if(myLog) myLog->debugMode_getPlayerStartCash(&myStartCash, i);
|
if(myLog) myLog->debugMode_getPlayerStartCash(&myStartCash, i);
|
||||||
|
|
||||||
// create player objects
|
// create player objects
|
||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, myStartCash, startQuantityPlayers > i, myStayOnTableStatus, 0);
|
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, myStartCash, startQuantityPlayers > i, myStayOnTableStatus, 0);
|
||||||
@@ -215,7 +215,6 @@ void Game::startHand()
|
|||||||
|
|
||||||
// log new hand
|
// log new hand
|
||||||
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
||||||
myGui->flushLogAtGame(myGameID);
|
|
||||||
|
|
||||||
currentHand->start();
|
currentHand->start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1054,17 +1054,9 @@ vector< vector<int> > ArrayData::getHandChancePreflop(int handCode)
|
|||||||
|
|
||||||
int check = -1;
|
int check = -1;
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
vector< vector<int> > chance(2);
|
vector< vector<int> > chance(2);
|
||||||
|
chance[0].assign(10,0);
|
||||||
chance[0].resize(10);
|
chance[1].assign(10,0);
|
||||||
chance[1].resize(10);
|
|
||||||
|
|
||||||
for(i=0; i<10; i++) {
|
|
||||||
chance[0][i] = 0;
|
|
||||||
chance[1][i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned val = 0; val < NUM_HAND_CHANCE_PREFLOP; val++) {
|
for (unsigned val = 0; val < NUM_HAND_CHANCE_PREFLOP; val++) {
|
||||||
if(handCode == handChancePreflop[val].hand) {
|
if(handCode == handChancePreflop[val].hand) {
|
||||||
|
|||||||
@@ -221,52 +221,304 @@ int CardsValue::holeCardsClass(int one, int two)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CardsValue::holeCardsToIntCode(int* cards)
|
int CardsValue::holeCardsToIntCode(int holeCards[2])
|
||||||
{
|
{
|
||||||
|
|
||||||
// Code der HoleCards ermitteln
|
// Code der HoleCards ermitteln
|
||||||
if(cards[0]%13 == cards[1]%13) {
|
if(holeCards[0]%13 == holeCards[1]%13) {
|
||||||
return ((cards[0]%13)*1000 + (cards[0]%13)*10);
|
return ((holeCards[0]%13)*1000 + (holeCards[0]%13)*10);
|
||||||
} else {
|
} else {
|
||||||
if(cards[0]%13 < cards[1]%13) {
|
if(holeCards[0]%13 < holeCards[1]%13) {
|
||||||
if(cards[0]/13 == cards[1]/13) {
|
if(holeCards[0]/13 == holeCards[1]/13) {
|
||||||
return ((cards[0]%13)*1000 + (cards[1]%13)*10 + 1);
|
return ((holeCards[0]%13)*1000 + (holeCards[1]%13)*10 + 1);
|
||||||
} else {
|
} else {
|
||||||
return ((cards[0]%13)*1000 + (cards[1]%13)*10);
|
return ((holeCards[0]%13)*1000 + (holeCards[1]%13)*10);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(cards[0]/13 == cards[1]/13) {
|
if(holeCards[0]/13 == holeCards[1]/13) {
|
||||||
return ((cards[1]%13)*1000 + (cards[0]%13)*10 + 1);
|
return ((holeCards[1]%13)*1000 + (holeCards[0]%13)*10 + 1);
|
||||||
} else {
|
} else {
|
||||||
return ((cards[1]%13)*1000 + (cards[0]%13)*10);
|
return ((holeCards[1]%13)*1000 + (holeCards[0]%13)*10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DO NOT USE, THIS MAY LEAK MEMORY
|
static const int straight[10] = { 7936, 3968, 1984, 992, 496, 248, 124, 62, 31, 4111 };
|
||||||
int* CardsValue::intCodeToHoleCards(int code)
|
|
||||||
|
int CardsValue::cardsValueShort(int cards[4])
|
||||||
{
|
{
|
||||||
|
|
||||||
// one possibility !!!
|
int color_idx;
|
||||||
|
int card_idx;
|
||||||
|
|
||||||
int* cards = new int[2];
|
// Royal Flush, Straight Flush, Flush
|
||||||
|
for(color_idx=0; color_idx<4; color_idx++) { // check all colors
|
||||||
cards[0] = code/1000;
|
if(Tools::bitcount(cards[color_idx])>=5) { // check if at least 5 cards of one color
|
||||||
cards[1] = (code-cards[0]*1000)/10;
|
if((cards[color_idx] & straight[0]) == straight[0]) // check for Royal Flush
|
||||||
|
return 9;
|
||||||
if(cards[0]==cards[1]) {
|
else { // check for Straight Flush
|
||||||
cards[1] +=13;
|
for(card_idx=1; card_idx<10; card_idx++) {
|
||||||
} else {
|
if((cards[color_idx] & straight[card_idx]) == straight[card_idx]) {
|
||||||
if(code%10 == 0) cards[1] +=13;
|
return 8; // Straight Flush
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 5; // Flush
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cards;
|
int AND = cards[0] & cards[1] & cards[2] & cards[3];
|
||||||
|
|
||||||
}*/
|
// Four of a Kind
|
||||||
|
if(AND) {
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
|
||||||
int CardsValue::cardsValue(int* cards, int* position)
|
int OR = cards[0] | cards[1] | cards[2] | cards[3];
|
||||||
|
|
||||||
|
// Straight
|
||||||
|
for(card_idx=0; card_idx<10; card_idx++) {
|
||||||
|
if((OR & straight[card_idx]) == straight[card_idx]) {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int color_1_idx, color_2_idx, color_3_idx, color_4_idx, color_5_idx;
|
||||||
|
int temp;
|
||||||
|
|
||||||
|
// Full House, Three of a Kind
|
||||||
|
for(color_1_idx=0; color_1_idx<2; color_1_idx++) {
|
||||||
|
for(color_2_idx=color_1_idx+1; color_2_idx<3; color_2_idx++) {
|
||||||
|
for(color_3_idx=color_2_idx+1; color_3_idx<4; color_3_idx++) {
|
||||||
|
temp = cards[color_1_idx] & cards[color_2_idx] & cards[color_3_idx];
|
||||||
|
if(Tools::bitcount(temp) == 2) { // two times Three of a Kind
|
||||||
|
return 6; // Full House
|
||||||
|
} else {
|
||||||
|
if(temp) {
|
||||||
|
for(color_4_idx=0; color_4_idx<3; color_4_idx++) {
|
||||||
|
for(color_5_idx=color_4_idx+1; color_5_idx<4; color_5_idx++) {
|
||||||
|
if(~temp & cards[color_4_idx] & cards[color_5_idx]) { // search for additional pair
|
||||||
|
return 6; // Full House
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 3; // Three of a Kind
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Two Pairs, Two of a Kind
|
||||||
|
for(color_1_idx=0; color_1_idx<3; color_1_idx++) {
|
||||||
|
for(color_2_idx=color_1_idx+1; color_2_idx<4; color_2_idx++) {
|
||||||
|
temp = cards[color_1_idx] & cards[color_2_idx];
|
||||||
|
if(Tools::bitcount(temp) >= 2) { // at least two times Two of a Kind
|
||||||
|
return 2; // Two Pairs
|
||||||
|
} else {
|
||||||
|
if(temp) { // search for second pair
|
||||||
|
for(color_3_idx=0; color_3_idx<3; color_3_idx++) {
|
||||||
|
for(color_4_idx=color_3_idx+1; color_4_idx<4; color_4_idx++) {
|
||||||
|
if(~temp & cards[color_3_idx] & cards[color_4_idx]) {
|
||||||
|
return 2; // Two Pairs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1; // Two of a Kind
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; // High Card
|
||||||
|
}
|
||||||
|
|
||||||
|
int CardsValue::cardsValue(int cards[4], int bestHand[4])
|
||||||
|
{
|
||||||
|
int color_1_idx;
|
||||||
|
int card_idx;
|
||||||
|
KickerValue kickerValue1;
|
||||||
|
|
||||||
|
// Royal Flush, Straight Flush, Flush
|
||||||
|
for(color_1_idx=0; color_1_idx<4; color_1_idx++) { // check all colors
|
||||||
|
if(Tools::bitcount(cards[color_1_idx])>=5) { // check if at least 5 cards of one color
|
||||||
|
if((cards[color_1_idx] & straight[0]) == straight[0]) { // check for Royal Flush
|
||||||
|
if(bestHand) bestHand[color_1_idx] = straight[0];
|
||||||
|
return 900000000; // Royal Flush
|
||||||
|
} else {
|
||||||
|
for(card_idx=1; card_idx<10; card_idx++) {
|
||||||
|
if((cards[color_1_idx] & straight[card_idx]) == straight[card_idx]) { // check for Straight Flush
|
||||||
|
if(bestHand) bestHand[color_1_idx] = straight[card_idx];
|
||||||
|
return (800000000+(12-card_idx)*1000000); // Straight Flush
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Flush
|
||||||
|
kickerValue1 = determineKickerValue(cards[color_1_idx],0,4);
|
||||||
|
if(bestHand) bestHand[color_1_idx] = kickerValue1.select;
|
||||||
|
return 500000000 + kickerValue1.factorValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int AND = cards[0] & cards[1] & cards[2] & cards[3];
|
||||||
|
int OR = cards[0] | cards[1] | cards[2] | cards[3];
|
||||||
|
int temp1;
|
||||||
|
KickerValue kickerValue2;
|
||||||
|
|
||||||
|
// Four of a Kind
|
||||||
|
if(AND) {
|
||||||
|
kickerValue1 = determineKickerValue(AND,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(OR & ~AND,1,1);
|
||||||
|
if(bestHand) {
|
||||||
|
temp1 = kickerValue2.select;
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] = (cards[color_1_idx] & (kickerValue1.select | temp1));
|
||||||
|
if(bestHand[color_1_idx] & temp1) temp1 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 700000000 + kickerValue1.factorValue + kickerValue2.factorValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Straight
|
||||||
|
for(card_idx=0; card_idx<10; card_idx++) {
|
||||||
|
if((OR & straight[card_idx]) == straight[card_idx]) {
|
||||||
|
if(bestHand) {
|
||||||
|
temp1 = straight[card_idx];
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] += (temp1 & cards[color_1_idx]);
|
||||||
|
temp1 &= ~bestHand[color_1_idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 400000000 + (12-card_idx)*1000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int color_2_idx, color_3_idx;
|
||||||
|
int temp2;
|
||||||
|
|
||||||
|
// Full House, Three of a Kind
|
||||||
|
temp1 = 0;
|
||||||
|
for(color_1_idx=0; color_1_idx<2; color_1_idx++) {
|
||||||
|
for(color_2_idx=color_1_idx+1; color_2_idx<3; color_2_idx++) {
|
||||||
|
for(color_3_idx=color_2_idx+1; color_3_idx<4; color_3_idx++) {
|
||||||
|
temp1 |= cards[color_1_idx] & cards[color_2_idx] & cards[color_3_idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(temp1) {
|
||||||
|
if(Tools::bitcount(temp1) == 2) {
|
||||||
|
// two times Three of a Kind
|
||||||
|
if(bestHand) {
|
||||||
|
kickerValue1 = determineKickerValue(temp1,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(kickerValue1.remain,1,1);
|
||||||
|
temp2 = 0;
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
if(temp2<2) bestHand[color_1_idx] += (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||||
|
else bestHand[color_1_idx] += (cards[color_1_idx] & kickerValue1.select);
|
||||||
|
if(cards[color_1_idx] & kickerValue2.select) temp2++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 600000000 + determineKickerValue(temp1,0,1).factorValue;
|
||||||
|
} else {
|
||||||
|
// one times Three of a Kind
|
||||||
|
temp2 = temp1;
|
||||||
|
temp1 = 0;
|
||||||
|
// check for additional pair
|
||||||
|
for(color_1_idx=0; color_1_idx<3; color_1_idx++) {
|
||||||
|
for(color_2_idx=color_1_idx+1; color_2_idx<4; color_2_idx++) {
|
||||||
|
temp1 |= cards[color_1_idx] & cards[color_2_idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
temp1 &= ~temp2; // remove Three of a Kind from found pairs
|
||||||
|
if(temp1) {
|
||||||
|
// with additional pair
|
||||||
|
kickerValue1 = determineKickerValue(temp2,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(temp1,1,1);
|
||||||
|
if(bestHand) {
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) bestHand[color_1_idx] = (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||||
|
}
|
||||||
|
return 600000000 + kickerValue1.factorValue + kickerValue2.factorValue; // Full House
|
||||||
|
} else {
|
||||||
|
// without addition pair
|
||||||
|
kickerValue1 = determineKickerValue(temp2,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(OR & ~temp2,1,2);
|
||||||
|
if(bestHand) {
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) bestHand[color_1_idx] = (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||||
|
}
|
||||||
|
return 300000000 + kickerValue1.factorValue + kickerValue2.factorValue; // Three of a Kind
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Two Pairs, Two of a Kind
|
||||||
|
temp1 = 0;
|
||||||
|
for(color_1_idx=0; color_1_idx<3; color_1_idx++) {
|
||||||
|
for(color_2_idx=color_1_idx+1; color_2_idx<4; color_2_idx++) {
|
||||||
|
temp1 |= (cards[color_1_idx] & cards[color_2_idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(temp1) {
|
||||||
|
if(Tools::bitcount(temp1) >= 2) { // at least two times Two of a Kind
|
||||||
|
kickerValue1 = determineKickerValue(temp1,0,1);
|
||||||
|
kickerValue2 = determineKickerValue(OR & ~kickerValue1.select,2,2);
|
||||||
|
if(bestHand) {
|
||||||
|
temp1 = (kickerValue1.select | kickerValue2.select);
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] += (cards[color_1_idx] & temp1);
|
||||||
|
if(bestHand[color_1_idx] & kickerValue2.select) temp1 &= ~kickerValue2.select;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 200000000 + kickerValue1.factorValue + kickerValue2.factorValue; // Two Pairs
|
||||||
|
} else {
|
||||||
|
kickerValue1 = determineKickerValue(temp1,0,0);
|
||||||
|
kickerValue2 = determineKickerValue(OR & ~temp1,1,3);
|
||||||
|
if(bestHand) {
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] += (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 100000000 + kickerValue1.factorValue + kickerValue2.factorValue; // Two of a Kind
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// High Card
|
||||||
|
kickerValue1 = determineKickerValue(OR,0,4);
|
||||||
|
if(bestHand) {
|
||||||
|
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||||
|
bestHand[color_1_idx] += (cards[color_1_idx] & kickerValue1.select);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return kickerValue1.factorValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int factor_kicker_short[4] = {1000000,10000,100,1};
|
||||||
|
static const int factor_kicker_long[5] = {1000000,10000,100,10,1};
|
||||||
|
|
||||||
|
KickerValue CardsValue::determineKickerValue(int testValue, int factorPointerStart, int factorPointerEnd)
|
||||||
|
{
|
||||||
|
KickerValue kickerValue;
|
||||||
|
kickerValue.factorValue = 0;
|
||||||
|
kickerValue.remain = testValue;
|
||||||
|
kickerValue.select = 0;
|
||||||
|
int compareValue = 4096;
|
||||||
|
int factorPointer = factorPointerStart;
|
||||||
|
for(int card_idx=0; (factorPointer<=factorPointerEnd) & (card_idx<13); card_idx++) {
|
||||||
|
if(kickerValue.remain >= compareValue) {
|
||||||
|
if(factorPointerEnd - factorPointerStart==4) kickerValue.factorValue += (12-card_idx)*factor_kicker_long[factorPointer];
|
||||||
|
else kickerValue.factorValue += (12-card_idx)*factor_kicker_short[factorPointer];
|
||||||
|
kickerValue.remain &= ~compareValue;
|
||||||
|
factorPointer++;
|
||||||
|
}
|
||||||
|
compareValue >>= 1;
|
||||||
|
}
|
||||||
|
kickerValue.select = testValue & ~kickerValue.remain;
|
||||||
|
return kickerValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CardsValue::cardsValueOld(int cards[7], int position[5])
|
||||||
{
|
{
|
||||||
|
|
||||||
int array[7][3];
|
int array[7][3];
|
||||||
@@ -645,26 +897,18 @@ int CardsValue::cardsValue(int* cards, int* position)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards)
|
std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, int playerCards[2], int boardCards[5])
|
||||||
{
|
{
|
||||||
int i,j;
|
int card_idx_1, card_idx_2;
|
||||||
|
|
||||||
std::vector< std::vector<int> > chance(2);
|
std::vector< std::vector<int> > chance(2);
|
||||||
|
chance[0].assign(10,0);
|
||||||
|
chance[1].assign(10,0);
|
||||||
|
|
||||||
chance[0].resize(10);
|
int cards[4] = { 0,0,0,0 };
|
||||||
chance[1].resize(10);
|
|
||||||
|
|
||||||
for(i=0; i<10; i++) {
|
|
||||||
chance[0][i] = 0;
|
|
||||||
chance[1][i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cards[7];
|
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
|
|
||||||
cards[0] = playerCards[0];
|
for(card_idx_1=0; card_idx_1<2; card_idx_1++) cards[playerCards[card_idx_1]/13] |= (1 << (playerCards[card_idx_1]%13));
|
||||||
cards[1] = playerCards[1];
|
|
||||||
for(i=0; i<5; i++) cards[i+2] = boardCards[i];
|
|
||||||
|
|
||||||
switch(beRoID) {
|
switch(beRoID) {
|
||||||
case GAME_STATE_PREFLOP: {
|
case GAME_STATE_PREFLOP: {
|
||||||
@@ -675,50 +919,60 @@ std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, in
|
|||||||
break;
|
break;
|
||||||
case GAME_STATE_FLOP: {
|
case GAME_STATE_FLOP: {
|
||||||
|
|
||||||
for(i=0; i<51; i++) {
|
for(card_idx_1=0; card_idx_1<3; card_idx_1++) cards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13));
|
||||||
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4]) {
|
|
||||||
for(j=i+1; j<52; j++) {
|
for(card_idx_1=0; card_idx_1<51; card_idx_1++) {
|
||||||
if(j!=cards[0] && j!=cards[1] && j!=cards[2] && j!=cards[3] && j!=cards[4]) {
|
if((cards[card_idx_1/13] & (1 << (card_idx_1%13))) == 0) {
|
||||||
cards[5] = i;
|
cards[card_idx_1/13] |= (1 << (card_idx_1%13));
|
||||||
cards[6] = j;
|
for(card_idx_2=card_idx_1+1; card_idx_2<52; card_idx_2++) {
|
||||||
(chance[0][cardsValue(cards,0)/100000000])++;
|
if((cards[card_idx_2/13] & (1 << (card_idx_2%13))) == 0) {
|
||||||
|
cards[card_idx_2/13] |= (1 << (card_idx_2%13));
|
||||||
|
(chance[0][cardsValueShort(cards)])++;
|
||||||
sum++;
|
sum++;
|
||||||
|
cards[card_idx_2/13] &= ~(1 << (card_idx_2%13));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cards[card_idx_1/13] &= ~(1 << (card_idx_1%13));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0; i<10; i++) {
|
|
||||||
if(chance[0][i] > 0) chance[1][i] = 1;
|
|
||||||
chance[0][i] = (int)(((double)chance[0][i]/(double)sum)*100.0+0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_TURN: {
|
case GAME_STATE_TURN: {
|
||||||
|
|
||||||
for(i=0; i<52; i++) {
|
for(card_idx_1=0; card_idx_1<4; card_idx_1++) cards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13));
|
||||||
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4] && i!=cards[5]) {
|
|
||||||
cards[6] = i;
|
for(card_idx_1=0; card_idx_1<52; card_idx_1++) {
|
||||||
(chance[0][cardsValue(cards,0)/100000000])++;
|
if((cards[card_idx_1/13] & (1 << (card_idx_1%13))) == 0) {
|
||||||
|
cards[card_idx_1/13] |= (1 << (card_idx_1%13));
|
||||||
|
(chance[0][cardsValueShort(cards)])++;
|
||||||
sum++;
|
sum++;
|
||||||
|
cards[card_idx_1/13] &= ~(1 << (card_idx_1%13));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0; i<10; i++) {
|
|
||||||
if(chance[0][i] > 0) chance[1][i] = 1;
|
|
||||||
chance[0][i] = (int)(((double)chance[0][i]/(double)sum)*100.0+0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_RIVER: {
|
case GAME_STATE_RIVER: {
|
||||||
chance[0][cardsValue(cards,0)/100000000] = 100;
|
|
||||||
chance[1][cardsValue(cards,0)/100000000] = 1;
|
for(card_idx_1=0; card_idx_1<5; card_idx_1++) cards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13));
|
||||||
|
|
||||||
|
chance[0][cardsValueShort(cards)] = 1;
|
||||||
|
sum = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(beRoID>GAME_STATE_PREFLOP) {
|
||||||
|
for(int hand_idx=0; hand_idx<10; hand_idx++) {
|
||||||
|
if(chance[0][hand_idx] > 0) chance[1][hand_idx] = 1;
|
||||||
|
chance[0][hand_idx] = (int)(((double)chance[0][hand_idx]/(double)sum)*100.0+0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return chance;
|
return chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,18 +38,26 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
struct KickerValue {
|
||||||
|
int factorValue;
|
||||||
|
int select;
|
||||||
|
int remain;
|
||||||
|
};
|
||||||
|
|
||||||
class CardsValue
|
class CardsValue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static int holeCardsClass(int, int);
|
static int holeCardsClass(int, int);
|
||||||
static int cardsValue(int*, int*);
|
static int cardsValueShort(int[4]);
|
||||||
|
static int cardsValue(int[4], int[4]);
|
||||||
|
static KickerValue determineKickerValue(int, int, int);
|
||||||
|
static int cardsValueOld(int[7], int[5]);
|
||||||
static std::string determineHandName(int myCardsValueInt, PlayerList activePlayerList);
|
static std::string determineHandName(int myCardsValueInt, PlayerList activePlayerList);
|
||||||
static std::list<std::string> translateCardsValueCode(int cardsValueCode);
|
static std::list<std::string> translateCardsValueCode(int cardsValueCode);
|
||||||
|
|
||||||
static int holeCardsToIntCode(int*);
|
static int holeCardsToIntCode(int[2]);
|
||||||
static int* intCodeToHoleCards(int);
|
|
||||||
|
|
||||||
static std::vector< std::vector<int> > calcCardsChance(GameState, int*, int*);
|
static std::vector< std::vector<int> > calcCardsChance(GameState, int[2], int[5]);
|
||||||
//static int** showdown(GameState, int**, int);
|
//static int** showdown(GameState, int**, int);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
|||||||
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||||
(*it)->setHand(this);
|
(*it)->setHand(this);
|
||||||
// set myFlipCards 0
|
// set myFlipCards 0
|
||||||
(*it)->setMyCardsFlip(0, 0);
|
(*it)->setMyHoleCardsFlip(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate cards and assign to board and player
|
// generate cards and assign to board and player
|
||||||
@@ -77,7 +77,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
|||||||
for(i=0; i<5; i++) tempBoardArray[i] = cardsArray[i];
|
for(i=0; i<5; i++) tempBoardArray[i] = cardsArray[i];
|
||||||
|
|
||||||
// debug mode
|
// debug mode
|
||||||
if(myLog) myLog->debugMode_getBoardCards(tempBoardArray,myID);
|
if(myLog) myLog->debugMode_getBoardCards(tempBoardArray,myID);
|
||||||
|
|
||||||
// prepare whole player hand
|
// prepare whole player hand
|
||||||
for(i=0; i<5; i++) tempPlayerAndBoardArray[i+2] = tempBoardArray[i];
|
for(i=0; i<5; i++) tempPlayerAndBoardArray[i+2] = tempBoardArray[i];
|
||||||
@@ -92,13 +92,13 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
|||||||
for(j=0; j<2; j++) tempPlayerArray[j] = cardsArray[2*k+j+5];
|
for(j=0; j<2; j++) tempPlayerArray[j] = cardsArray[2*k+j+5];
|
||||||
|
|
||||||
// debug mode
|
// debug mode
|
||||||
if(myLog) myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k);
|
if(myLog) myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k);
|
||||||
|
|
||||||
// complete whole player hand
|
// complete whole player hand
|
||||||
for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j];
|
for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j];
|
||||||
|
|
||||||
(*it)->setMyCards(tempPlayerArray);
|
(*it)->setMyHoleCards(tempPlayerArray);
|
||||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(tempPlayerAndBoardArray, bestHandPos));
|
(*it)->setMyCardsValueInt(CardsValue::cardsValueOld(tempPlayerAndBoardArray, bestHandPos));
|
||||||
(*it)->setMyBestHandPosition(bestHandPos);
|
(*it)->setMyBestHandPosition(bestHandPos);
|
||||||
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
||||||
|
|
||||||
@@ -144,7 +144,6 @@ void LocalHand::start()
|
|||||||
} else {
|
} else {
|
||||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID");
|
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID");
|
||||||
}
|
}
|
||||||
myGui->flushLogAtHand();
|
|
||||||
|
|
||||||
// deal cards
|
// deal cards
|
||||||
myGui->dealHoleCards();
|
myGui->dealHoleCards();
|
||||||
|
|||||||
@@ -861,7 +861,7 @@ static const RoundData FlopValues[] = {
|
|||||||
LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB)
|
LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB)
|
||||||
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar),
|
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar),
|
||||||
myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(PLAYER_ACTION_NONE),
|
myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(PLAYER_ACTION_NONE),
|
||||||
myButton(mB), myActiveStatus(aS), myStayOnTableStatus(sotS), myTurn(0), myCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0),
|
myButton(mB), myActiveStatus(aS), myStayOnTableStatus(sotS), myTurn(0), myHoleCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0),
|
||||||
sBluff(0), sBluffStatus(false), m_actionTimeoutCounter(0), m_isSessionActive(false), m_isKicked(false), m_isMuted(false)
|
sBluff(0), sBluffStatus(false), m_actionTimeoutCounter(0), m_isSessionActive(false), m_isKicked(false), m_isMuted(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -870,7 +870,7 @@ LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType ty
|
|||||||
myNiveau[i] = 0;
|
myNiveau[i] = 0;
|
||||||
}
|
}
|
||||||
for(i=0; i<2; i++) {
|
for(i=0; i<2; i++) {
|
||||||
myCards[i] = -1;
|
myHoleCards[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// myBestHandPosition mit -1 initialisieren
|
// myBestHandPosition mit -1 initialisieren
|
||||||
@@ -905,18 +905,10 @@ LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType ty
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LocalPlayer::~LocalPlayer()
|
LocalPlayer::~LocalPlayer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalPlayer::setHand(HandInterface* br)
|
|
||||||
{
|
|
||||||
currentHand = br;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LocalPlayer::action()
|
void LocalPlayer::action()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1078,7 +1070,7 @@ void LocalPlayer::preflopEngine()
|
|||||||
myNiveau[2] += (21-myCash/individualHighestSet)/2;
|
myNiveau[2] += (21-myCash/individualHighestSet)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << myID << ": " << myHoleCardsValue << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << myCards[0] << " " << myCards[1] << endl;
|
// cout << myID << ": " << myHoleCardsValue << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << myHoleCards[0] << " " << myHoleCards[1] << endl;
|
||||||
|
|
||||||
// count number of active human players
|
// count number of active human players
|
||||||
size_t countHumanPlayers = 0;
|
size_t countHumanPlayers = 0;
|
||||||
@@ -1264,12 +1256,11 @@ void LocalPlayer::preflopEngine()
|
|||||||
// cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl;
|
// cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl;
|
||||||
|
|
||||||
// debug mode
|
// debug mode
|
||||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_PREFLOP, currentHand->getMyID(), myUniqueID, mySet);
|
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_PREFLOP, currentHand->getMyID(), myUniqueID, mySet);
|
||||||
|
|
||||||
evaluation(bet, raise);
|
evaluation(bet, raise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalPlayer::flopEngine()
|
void LocalPlayer::flopEngine()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1526,13 +1517,12 @@ void LocalPlayer::flopEngine()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// debug mode
|
// debug mode
|
||||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_FLOP, currentHand->getMyID(), myUniqueID, mySet);
|
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_FLOP, currentHand->getMyID(), myUniqueID, mySet);
|
||||||
|
|
||||||
evaluation(bet, raise);
|
evaluation(bet, raise);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalPlayer::turnEngine()
|
void LocalPlayer::turnEngine()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1540,7 +1530,7 @@ void LocalPlayer::turnEngine()
|
|||||||
// int boardCards[5];
|
// int boardCards[5];
|
||||||
// int i;
|
// int i;
|
||||||
|
|
||||||
// for(i=0; i<2; i++) tempArray[i] = myCards[i];
|
// for(i=0; i<2; i++) tempArray[i] = myHoleCards[i];
|
||||||
// currentBoard->getMyCards(boardCards);
|
// currentBoard->getMyCards(boardCards);
|
||||||
// for(i=0; i<4; i++) tempArray[2+i] = boardCards[i];
|
// for(i=0; i<4; i++) tempArray[2+i] = boardCards[i];
|
||||||
|
|
||||||
@@ -1801,13 +1791,12 @@ void LocalPlayer::turnEngine()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// debug mode
|
// debug mode
|
||||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_TURN, currentHand->getMyID(), myUniqueID, mySet);
|
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_TURN, currentHand->getMyID(), myUniqueID, mySet);
|
||||||
|
|
||||||
evaluation(bet, raise);
|
evaluation(bet, raise);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalPlayer::riverEngine()
|
void LocalPlayer::riverEngine()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1815,7 +1804,7 @@ void LocalPlayer::riverEngine()
|
|||||||
// int boardCards[5];
|
// int boardCards[5];
|
||||||
// int i;
|
// int i;
|
||||||
|
|
||||||
// for(i=0; i<2; i++) tempArray[i] = myCards[i];
|
// for(i=0; i<2; i++) tempArray[i] = myHoleCards[i];
|
||||||
// currentBoard->getMyCards(boardCards);
|
// currentBoard->getMyCards(boardCards);
|
||||||
// for(i=0; i<4; i++) tempArray[2+i] = boardCards[i];
|
// for(i=0; i<4; i++) tempArray[2+i] = boardCards[i];
|
||||||
|
|
||||||
@@ -2062,13 +2051,12 @@ void LocalPlayer::riverEngine()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// debug mode
|
// debug mode
|
||||||
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_RIVER, currentHand->getMyID(), myUniqueID, mySet);
|
if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_RIVER, currentHand->getMyID(), myUniqueID, mySet);
|
||||||
|
|
||||||
evaluation(bet, raise);
|
evaluation(bet, raise);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalPlayer::evaluation(int bet, int raise)
|
void LocalPlayer::evaluation(int bet, int raise)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2193,7 +2181,6 @@ void LocalPlayer::evaluation(int bet, int raise)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LocalPlayer::flopCardsValue(int* cards)
|
int LocalPlayer::flopCardsValue(int* cards)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2827,7 +2814,6 @@ int LocalPlayer::flopCardsValue(int* cards)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalPlayer::calcMyOdds()
|
void LocalPlayer::calcMyOdds()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2835,9 +2821,9 @@ void LocalPlayer::calcMyOdds()
|
|||||||
|
|
||||||
switch(currentHand->getCurrentRound()) {
|
switch(currentHand->getCurrentRound()) {
|
||||||
|
|
||||||
case 0: {
|
case GAME_STATE_PREFLOP: {
|
||||||
|
|
||||||
handCode = CardsValue::holeCardsToIntCode(myCards);
|
handCode = CardsValue::holeCardsToIntCode(myHoleCards);
|
||||||
|
|
||||||
// übergang solange preflopValue und flopValue noch nicht bereinigt
|
// übergang solange preflopValue und flopValue noch nicht bereinigt
|
||||||
int players = currentHand->getActivePlayerList()->size();
|
int players = currentHand->getActivePlayerList()->size();
|
||||||
@@ -2855,14 +2841,14 @@ void LocalPlayer::calcMyOdds()
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: {
|
case GAME_STATE_FLOP: {
|
||||||
|
|
||||||
int tempArray[5];
|
int tempArray[5];
|
||||||
int boardCards[5];
|
int boardCards[5];
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i<2; i++) tempArray[i] = myCards[i];
|
for(i=0; i<2; i++) tempArray[i] = myHoleCards[i];
|
||||||
currentHand->getBoard()->getMyCards(boardCards);
|
currentHand->getBoard()->getMyCards(boardCards);
|
||||||
for(i=0; i<3; i++) tempArray[2+i] = boardCards[i];
|
for(i=0; i<3; i++) tempArray[2+i] = boardCards[i];
|
||||||
|
|
||||||
@@ -2900,9 +2886,7 @@ void LocalPlayer::calcMyOdds()
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: {
|
case GAME_STATE_TURN: {
|
||||||
|
|
||||||
// Prozent ausrechnen
|
|
||||||
|
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
int tempBoardCardsArray[5];
|
int tempBoardCardsArray[5];
|
||||||
@@ -2910,8 +2894,8 @@ void LocalPlayer::calcMyOdds()
|
|||||||
int tempOpponentCardsArray[7];
|
int tempOpponentCardsArray[7];
|
||||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||||
|
|
||||||
tempMyCardsArray[0] = myCards[0];
|
tempMyCardsArray[0] = myHoleCards[0];
|
||||||
tempMyCardsArray[1] = myCards[1];
|
tempMyCardsArray[1] = myHoleCards[1];
|
||||||
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
||||||
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
||||||
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
||||||
@@ -2922,6 +2906,12 @@ void LocalPlayer::calcMyOdds()
|
|||||||
tempOpponentCardsArray[4] = tempBoardCardsArray[2];
|
tempOpponentCardsArray[4] = tempBoardCardsArray[2];
|
||||||
tempOpponentCardsArray[5] = tempBoardCardsArray[3];
|
tempOpponentCardsArray[5] = tempBoardCardsArray[3];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int myCards[4] = { 0,0,0,0 };
|
||||||
|
int opponentCards[4] = { 0,0,0,0 };
|
||||||
|
|
||||||
|
|
||||||
int tempMyCardsValue;
|
int tempMyCardsValue;
|
||||||
int tempOpponentCardsValue;
|
int tempOpponentCardsValue;
|
||||||
|
|
||||||
@@ -2929,11 +2919,11 @@ void LocalPlayer::calcMyOdds()
|
|||||||
int countMy = 0;
|
int countMy = 0;
|
||||||
|
|
||||||
for(i=0; i<49; i++) {
|
for(i=0; i<49; i++) {
|
||||||
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
||||||
for(j=i+1; j<50; j++) {
|
for(j=i+1; j<50; j++) {
|
||||||
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
||||||
for(k=j+1; k<51; k++) {
|
for(k=j+1; k<51; k++) {
|
||||||
if(k != myCards[0] && k != myCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
|
if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
|
||||||
|
|
||||||
countAll++;
|
countAll++;
|
||||||
|
|
||||||
@@ -2941,8 +2931,8 @@ void LocalPlayer::calcMyOdds()
|
|||||||
tempOpponentCardsArray[1] = j;
|
tempOpponentCardsArray[1] = j;
|
||||||
tempOpponentCardsArray[6] = k;
|
tempOpponentCardsArray[6] = k;
|
||||||
tempMyCardsArray[6] = k;
|
tempMyCardsArray[6] = k;
|
||||||
tempMyCardsValue = CardsValue::cardsValue(tempMyCardsArray,0);
|
tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0);
|
||||||
tempOpponentCardsValue = CardsValue::cardsValue(tempOpponentCardsArray,0);
|
tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0);
|
||||||
|
|
||||||
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
||||||
}
|
}
|
||||||
@@ -2956,7 +2946,7 @@ void LocalPlayer::calcMyOdds()
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: {
|
case GAME_STATE_RIVER: {
|
||||||
|
|
||||||
// Prozent ausrechnen
|
// Prozent ausrechnen
|
||||||
|
|
||||||
@@ -2966,8 +2956,8 @@ void LocalPlayer::calcMyOdds()
|
|||||||
int tempOpponentCardsArray[7];
|
int tempOpponentCardsArray[7];
|
||||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||||
|
|
||||||
tempMyCardsArray[0] = myCards[0];
|
tempMyCardsArray[0] = myHoleCards[0];
|
||||||
tempMyCardsArray[1] = myCards[1];
|
tempMyCardsArray[1] = myHoleCards[1];
|
||||||
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
||||||
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
||||||
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
||||||
@@ -2987,16 +2977,16 @@ void LocalPlayer::calcMyOdds()
|
|||||||
int countMy = 0;
|
int countMy = 0;
|
||||||
|
|
||||||
for(i=0; i<49; i++) {
|
for(i=0; i<49; i++) {
|
||||||
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
||||||
for(j=i+1; j<50; j++) {
|
for(j=i+1; j<50; j++) {
|
||||||
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
||||||
|
|
||||||
countAll++;
|
countAll++;
|
||||||
|
|
||||||
tempOpponentCardsArray[0] = i;
|
tempOpponentCardsArray[0] = i;
|
||||||
tempOpponentCardsArray[1] = j;
|
tempOpponentCardsArray[1] = j;
|
||||||
tempMyCardsValue = CardsValue::cardsValue(tempMyCardsArray,0);
|
tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0);
|
||||||
tempOpponentCardsValue = CardsValue::cardsValue(tempOpponentCardsArray,0);
|
tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0);
|
||||||
|
|
||||||
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
||||||
}
|
}
|
||||||
@@ -3291,7 +3281,7 @@ void LocalPlayer::preflopEngine3()
|
|||||||
// cout << "preflop-bluff " << bluff << endl;
|
// cout << "preflop-bluff " << bluff << endl;
|
||||||
|
|
||||||
// Potential
|
// Potential
|
||||||
int potential = 10*(4*(CardsValue::holeCardsClass(myCards[0], myCards[1]))+1*tempRand)/50-myDude;
|
int potential = 10*(4*(CardsValue::holeCardsClass(myHoleCards[0], myHoleCards[1]))+1*tempRand)/50-myDude;
|
||||||
|
|
||||||
int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet;
|
int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet;
|
||||||
|
|
||||||
@@ -3301,7 +3291,7 @@ void LocalPlayer::preflopEngine3()
|
|||||||
Tools::GetRand(2, 3, 1, &tempFold);
|
Tools::GetRand(2, 3, 1, &tempFold);
|
||||||
|
|
||||||
// FOLD --> wenn Potential negativ oder HighestSet zu hoch
|
// FOLD --> wenn Potential negativ oder HighestSet zu hoch
|
||||||
if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * currentHand->getSmallBlind() && potential<4)) && CardsValue::holeCardsClass(myCards[0], myCards[1]) < 9 && bluff > 15) {
|
if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * currentHand->getSmallBlind() && potential<4)) && CardsValue::holeCardsClass(myHoleCards[0], myHoleCards[1]) < 9 && bluff > 15) {
|
||||||
myAction = PLAYER_ACTION_FOLD;
|
myAction = PLAYER_ACTION_FOLD;
|
||||||
} else {
|
} else {
|
||||||
// RAISE --> wenn hohes Potential
|
// RAISE --> wenn hohes Potential
|
||||||
@@ -3457,8 +3447,8 @@ void LocalPlayer::flopEngine3()
|
|||||||
int tempOpponentCardsArray[7];
|
int tempOpponentCardsArray[7];
|
||||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||||
|
|
||||||
tempMyCardsArray[0] = myCards[0];
|
tempMyCardsArray[0] = myHoleCards[0];
|
||||||
tempMyCardsArray[1] = myCards[1];
|
tempMyCardsArray[1] = myHoleCards[1];
|
||||||
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
||||||
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
||||||
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
||||||
@@ -3474,13 +3464,13 @@ void LocalPlayer::flopEngine3()
|
|||||||
int countMy = 0;
|
int countMy = 0;
|
||||||
|
|
||||||
for(i=0; i<49; i++) {
|
for(i=0; i<49; i++) {
|
||||||
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
||||||
for(j=i+1; j<50; j++) {
|
for(j=i+1; j<50; j++) {
|
||||||
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
||||||
for(k=j+1; k<51; k++) {
|
for(k=j+1; k<51; k++) {
|
||||||
if(k != myCards[0] && k != myCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
|
if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
|
||||||
for(l=k+1; l<52; l++) {
|
for(l=k+1; l<52; l++) {
|
||||||
if(l != myCards[0] && l != myCards[1] && l != tempBoardCardsArray[0] && l != tempBoardCardsArray[1] && l != tempBoardCardsArray[2]) {
|
if(l != myHoleCards[0] && l != myHoleCards[1] && l != tempBoardCardsArray[0] && l != tempBoardCardsArray[1] && l != tempBoardCardsArray[2]) {
|
||||||
|
|
||||||
countAll++;
|
countAll++;
|
||||||
|
|
||||||
@@ -3490,8 +3480,8 @@ void LocalPlayer::flopEngine3()
|
|||||||
tempOpponentCardsArray[6] = l;
|
tempOpponentCardsArray[6] = l;
|
||||||
tempMyCardsArray[5] = k;
|
tempMyCardsArray[5] = k;
|
||||||
tempMyCardsArray[6] = l;
|
tempMyCardsArray[6] = l;
|
||||||
tempMyCardsValue = CardsValue::cardsValue(tempMyCardsArray,0);
|
tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0);
|
||||||
tempOpponentCardsValue = CardsValue::cardsValue(tempOpponentCardsArray,0);
|
tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0);
|
||||||
|
|
||||||
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
||||||
|
|
||||||
@@ -3628,8 +3618,8 @@ void LocalPlayer::turnEngine3()
|
|||||||
int tempOpponentCardsArray[7];
|
int tempOpponentCardsArray[7];
|
||||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||||
|
|
||||||
tempMyCardsArray[0] = myCards[0];
|
tempMyCardsArray[0] = myHoleCards[0];
|
||||||
tempMyCardsArray[1] = myCards[1];
|
tempMyCardsArray[1] = myHoleCards[1];
|
||||||
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
||||||
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
||||||
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
||||||
@@ -3647,11 +3637,11 @@ void LocalPlayer::turnEngine3()
|
|||||||
int countMy = 0;
|
int countMy = 0;
|
||||||
|
|
||||||
for(i=0; i<49; i++) {
|
for(i=0; i<49; i++) {
|
||||||
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
||||||
for(j=i+1; j<50; j++) {
|
for(j=i+1; j<50; j++) {
|
||||||
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
||||||
for(k=j+1; k<51; k++) {
|
for(k=j+1; k<51; k++) {
|
||||||
if(k != myCards[0] && k != myCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
|
if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) {
|
||||||
|
|
||||||
countAll++;
|
countAll++;
|
||||||
|
|
||||||
@@ -3659,8 +3649,8 @@ void LocalPlayer::turnEngine3()
|
|||||||
tempOpponentCardsArray[1] = j;
|
tempOpponentCardsArray[1] = j;
|
||||||
tempOpponentCardsArray[6] = k;
|
tempOpponentCardsArray[6] = k;
|
||||||
tempMyCardsArray[6] = k;
|
tempMyCardsArray[6] = k;
|
||||||
tempMyCardsValue = CardsValue::cardsValue(tempMyCardsArray,0);
|
tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0);
|
||||||
tempOpponentCardsValue = CardsValue::cardsValue(tempOpponentCardsArray,0);
|
tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0);
|
||||||
|
|
||||||
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
||||||
}
|
}
|
||||||
@@ -3794,8 +3784,8 @@ void LocalPlayer::riverEngine3()
|
|||||||
int tempOpponentCardsArray[7];
|
int tempOpponentCardsArray[7];
|
||||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||||
|
|
||||||
tempMyCardsArray[0] = myCards[0];
|
tempMyCardsArray[0] = myHoleCards[0];
|
||||||
tempMyCardsArray[1] = myCards[1];
|
tempMyCardsArray[1] = myHoleCards[1];
|
||||||
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
tempMyCardsArray[2] = tempBoardCardsArray[0];
|
||||||
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
tempMyCardsArray[3] = tempBoardCardsArray[1];
|
||||||
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
tempMyCardsArray[4] = tempBoardCardsArray[2];
|
||||||
@@ -3815,16 +3805,16 @@ void LocalPlayer::riverEngine3()
|
|||||||
int countMy = 0;
|
int countMy = 0;
|
||||||
|
|
||||||
for(i=0; i<49; i++) {
|
for(i=0; i<49; i++) {
|
||||||
if(i != myCards[0] && i != myCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) {
|
||||||
for(j=i+1; j<50; j++) {
|
for(j=i+1; j<50; j++) {
|
||||||
if(j != myCards[0] && j != myCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) {
|
||||||
|
|
||||||
countAll++;
|
countAll++;
|
||||||
|
|
||||||
tempOpponentCardsArray[0] = i;
|
tempOpponentCardsArray[0] = i;
|
||||||
tempOpponentCardsArray[1] = j;
|
tempOpponentCardsArray[1] = j;
|
||||||
tempMyCardsValue = CardsValue::cardsValue(tempMyCardsArray,0);
|
tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0);
|
||||||
tempOpponentCardsValue = CardsValue::cardsValue(tempOpponentCardsArray,0);
|
tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0);
|
||||||
|
|
||||||
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
if(tempMyCardsValue>=tempOpponentCardsValue) countMy++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,9 @@ public:
|
|||||||
|
|
||||||
~LocalPlayer();
|
~LocalPlayer();
|
||||||
|
|
||||||
void setHand(HandInterface *);
|
void setHand(HandInterface *theValue) {
|
||||||
|
currentHand = theValue;
|
||||||
|
}
|
||||||
int getMyID() const {
|
int getMyID() const {
|
||||||
return myID;
|
return myID;
|
||||||
}
|
}
|
||||||
@@ -156,13 +157,13 @@ public:
|
|||||||
return myStayOnTableStatus;
|
return myStayOnTableStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMyCards(int* theValue) {
|
void setMyHoleCards(int* theValue) {
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<2; i++) myCards[i] = theValue[i];
|
for(i=0; i<2; i++) myHoleCards[i] = theValue[i];
|
||||||
}
|
}
|
||||||
void getMyCards(int* theValue) const {
|
void getMyHoleCards(int* theValue) const {
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<2; i++) theValue[i] = myCards[i];
|
for(i=0; i<2; i++) theValue[i] = myHoleCards[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMyTurn(bool theValue) {
|
void setMyTurn(bool theValue) {
|
||||||
@@ -172,27 +173,27 @@ public:
|
|||||||
return myTurn;
|
return myTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMyCardsFlip(bool theValue, int state) {
|
void setMyHoleCardsFlip(bool theValue, int state) {
|
||||||
myCardsFlip = theValue;
|
myHoleCardsFlip = theValue;
|
||||||
// log flipping cards
|
// log flipping cards
|
||||||
if(myCardsFlip) {
|
if(myHoleCardsFlip) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case 1:
|
case 1:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt);
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]);
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has");
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt, "has");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool getMyCardsFlip() const {
|
bool getMyHoleCardsFlip() const {
|
||||||
return myCardsFlip;
|
return myHoleCardsFlip;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMyCardsValueInt(int theValue) {
|
void setMyCardsValueInt(int theValue) {
|
||||||
@@ -328,7 +329,7 @@ private:
|
|||||||
int myNiveau[3];
|
int myNiveau[3];
|
||||||
bool logHoleCardsDone;
|
bool logHoleCardsDone;
|
||||||
|
|
||||||
int myCards[2];
|
int myHoleCards[2];
|
||||||
int myCash;
|
int myCash;
|
||||||
int mySet;
|
int mySet;
|
||||||
int myLastRelativeSet;
|
int myLastRelativeSet;
|
||||||
@@ -337,7 +338,7 @@ private:
|
|||||||
bool myActiveStatus; // 0 = inactive, 1 = active
|
bool myActiveStatus; // 0 = inactive, 1 = active
|
||||||
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
||||||
bool myTurn; // 0 = no, 1 = yes
|
bool myTurn; // 0 = no, 1 = yes
|
||||||
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
bool myHoleCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
||||||
int myRoundStartCash;
|
int myRoundStartCash;
|
||||||
int lastMoneyWon;
|
int lastMoneyWon;
|
||||||
|
|
||||||
|
|||||||
@@ -83,3 +83,13 @@ void Tools::GetRand(int minValue, int maxValue, unsigned count, int *out)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Tools::bitcount(int in)
|
||||||
|
{
|
||||||
|
int count=0 ;
|
||||||
|
while (in) {
|
||||||
|
count++ ;
|
||||||
|
in &= (in - 1) ;
|
||||||
|
}
|
||||||
|
return count ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
static void ShuffleArrayNonDeterministic(int *inout, unsigned count);
|
static void ShuffleArrayNonDeterministic(int *inout, unsigned count);
|
||||||
static void GetRand(int minValue, int maxValue, unsigned count, int *out);
|
static void GetRand(int minValue, int maxValue, unsigned count, int *out);
|
||||||
|
static int bitcount(int in);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+375
-397
@@ -119,115 +119,112 @@ Log::Log(ConfigFile *c) : mySqliteLogDb(0), mySqliteLogFileName(""), myConfig(c)
|
|||||||
|
|
||||||
Log::~Log()
|
Log::~Log()
|
||||||
{
|
{
|
||||||
if(SQLITE_LOG) sqlite3_close(mySqliteLogDb);
|
sqlite3_close(mySqliteLogDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Log::init()
|
Log::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
// logging activated
|
||||||
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
|
||||||
// logging activated
|
DIR *logDir;
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
logDir = opendir((myConfig->readConfigString("LogDir")).c_str());
|
||||||
|
bool dirExists = logDir != NULL;
|
||||||
|
closedir(logDir);
|
||||||
|
|
||||||
DIR *logDir;
|
// check if logging path exist
|
||||||
logDir = opendir((myConfig->readConfigString("LogDir")).c_str());
|
if(myConfig->readConfigString("LogDir") != "" && dirExists) {
|
||||||
bool dirExists = logDir != NULL;
|
|
||||||
closedir(logDir);
|
|
||||||
|
|
||||||
// check if logging path exist
|
// detect current time
|
||||||
if(myConfig->readConfigString("LogDir") != "" && dirExists) {
|
char curDateTime[20];
|
||||||
|
char curDate[11];
|
||||||
|
char curTime[9];
|
||||||
|
time_t now = time(NULL);
|
||||||
|
tm *z = localtime(&now);
|
||||||
|
strftime(curDateTime,20,"%Y-%m-%d_%H%M%S",z);
|
||||||
|
strftime(curDate,11,"%Y-%m-%d",z);
|
||||||
|
strftime(curTime,9,"%H:%M:%S",z);
|
||||||
|
|
||||||
// detect current time
|
mySqliteLogFileName.clear();
|
||||||
char curDateTime[20];
|
mySqliteLogFileName /= myConfig->readConfigString("LogDir");
|
||||||
char curDate[11];
|
mySqliteLogFileName /= string("pokerth-log-") + curDateTime + ".pdb";
|
||||||
char curTime[9];
|
|
||||||
time_t now = time(NULL);
|
|
||||||
tm *z = localtime(&now);
|
|
||||||
strftime(curDateTime,20,"%Y-%m-%d_%H%M%S",z);
|
|
||||||
strftime(curDate,11,"%Y-%m-%d",z);
|
|
||||||
strftime(curTime,9,"%H:%M:%S",z);
|
|
||||||
|
|
||||||
mySqliteLogFileName.clear();
|
// open sqlite-db
|
||||||
mySqliteLogFileName /= myConfig->readConfigString("LogDir");
|
sqlite3_open(mySqliteLogFileName.directory_string().c_str(), &mySqliteLogDb);
|
||||||
mySqliteLogFileName /= string("pokerth-log-") + curDateTime + ".pdb";
|
if( mySqliteLogDb != 0 ) {
|
||||||
|
|
||||||
// open sqlite-db
|
int i;
|
||||||
sqlite3_open(mySqliteLogFileName.directory_string().c_str(), &mySqliteLogDb);
|
// create session table
|
||||||
if( mySqliteLogDb != 0 ) {
|
sql += "CREATE TABLE Session (";
|
||||||
|
sql += "PokerTH_Version TEXT NOT NULL";
|
||||||
|
sql += ",Date TEXT NOT NULL";
|
||||||
|
sql += ",Time TEXT NOT NULL";
|
||||||
|
sql += ",LogVersion INTEGER NOT NULL";
|
||||||
|
sql += ", PRIMARY KEY(Date,Time));";
|
||||||
|
|
||||||
int i;
|
sql += "INSERT INTO Session (";
|
||||||
// create session table
|
sql += "PokerTH_Version";
|
||||||
sql += "CREATE TABLE Session (";
|
sql += ",Date";
|
||||||
sql += "PokerTH_Version TEXT NOT NULL";
|
sql += ",Time";
|
||||||
sql += ",Date TEXT NOT NULL";
|
sql += ",LogVersion";
|
||||||
sql += ",Time TEXT NOT NULL";
|
sql += ") VALUES (";
|
||||||
sql += ",LogVersion INTEGER NOT NULL";
|
sql += "\"" + boost::lexical_cast<string>(POKERTH_BETA_RELEASE_STRING) + "\",";
|
||||||
sql += ", PRIMARY KEY(Date,Time));";
|
sql += "\"" + boost::lexical_cast<string>(curDate) + "\",";
|
||||||
|
sql += "\"" + boost::lexical_cast<string>(curTime) + "\",";
|
||||||
|
sql += boost::lexical_cast<string>(SQLITE_LOG_VERSION) + ");";
|
||||||
|
|
||||||
sql += "INSERT INTO Session (";
|
// create game table
|
||||||
sql += "PokerTH_Version";
|
sql += "CREATE TABLE Game (";
|
||||||
sql += ",Date";
|
sql += "UniqueGameID INTEGER PRIMARY KEY";
|
||||||
sql += ",Time";
|
sql += ",GameID INTEGER NOT NULL";
|
||||||
sql += ",LogVersion";
|
sql += ",Startmoney INTEGER NOT NULL";
|
||||||
sql += ") VALUES (";
|
sql += ",StartSb INTEGER NOT NULL";
|
||||||
sql += "\"" + boost::lexical_cast<string>(POKERTH_BETA_RELEASE_STRING) + "\",";
|
sql += ",DealerPos INTEGER NOT NULL";
|
||||||
sql += "\"" + boost::lexical_cast<string>(curDate) + "\",";
|
sql += ",Winner_Seat INTEGER";
|
||||||
sql += "\"" + boost::lexical_cast<string>(curTime) + "\",";
|
sql += ");";
|
||||||
sql += boost::lexical_cast<string>(SQLITE_LOG_VERSION) + ");";
|
|
||||||
|
|
||||||
// create game table
|
// create player table
|
||||||
sql += "CREATE TABLE Game (";
|
sql += "CREATE TABLE Player (";
|
||||||
sql += "UniqueGameID INTEGER PRIMARY KEY";
|
sql += "UniqueGameID INTEGER NOT NULL";
|
||||||
sql += ",GameID INTEGER NOT NULL";
|
sql += ",Seat INTEGER NOT NULL";
|
||||||
sql += ",Startmoney INTEGER NOT NULL";
|
sql += ",Player TEXT NOT NULL";
|
||||||
sql += ",StartSb INTEGER NOT NULL";
|
sql += ",PRIMARY KEY(UniqueGameID,Seat));";
|
||||||
sql += ",DealerPos INTEGER NOT NULL";
|
|
||||||
sql += ",Winner_Seat INTEGER";
|
|
||||||
sql += ");";
|
|
||||||
|
|
||||||
// create player table
|
// create hand table
|
||||||
sql += "CREATE TABLE Player (";
|
sql += "CREATE TABLE Hand (";
|
||||||
sql += "UniqueGameID INTEGER NOT NULL";
|
sql += "HandID INTEGER NOT NULL";
|
||||||
sql += ",Seat INTEGER NOT NULL";
|
sql += ",UniqueGameID INTEGER NOT NULL";
|
||||||
sql += ",Player TEXT NOT NULL";
|
sql += ",Dealer_Seat INTEGER";
|
||||||
sql += ",PRIMARY KEY(UniqueGameID,Seat));";
|
sql += ",Sb_Amount INTEGER NOT NULL";
|
||||||
|
sql += ",Sb_Seat INTEGER NOT NULL";
|
||||||
// create hand table
|
sql += ",Bb_Amount INTEGER NOT NULL";
|
||||||
sql += "CREATE TABLE Hand (";
|
sql += ",Bb_Seat INTEGER NOT NULL";
|
||||||
sql += "HandID INTEGER NOT NULL";
|
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
sql += ",UniqueGameID INTEGER NOT NULL";
|
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash INTEGER";
|
||||||
sql += ",Dealer_Seat INTEGER";
|
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Card_1 INTEGER";
|
||||||
sql += ",Sb_Amount INTEGER NOT NULL";
|
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Card_2 INTEGER";
|
||||||
sql += ",Sb_Seat INTEGER NOT NULL";
|
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Hand_text TEXT";
|
||||||
sql += ",Bb_Amount INTEGER NOT NULL";
|
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Hand_int INTEGER";
|
||||||
sql += ",Bb_Seat INTEGER NOT NULL";
|
|
||||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash INTEGER";
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Card_1 INTEGER";
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Card_2 INTEGER";
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Hand_text TEXT";
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Hand_int INTEGER";
|
|
||||||
}
|
|
||||||
for(i=1; i<=5; i++) {
|
|
||||||
sql += ",BoardCard_" + boost::lexical_cast<std::string>(i) + " INTEGER";
|
|
||||||
}
|
|
||||||
sql += ",PRIMARY KEY(HandID,UniqueGameID));";
|
|
||||||
|
|
||||||
// create action table
|
|
||||||
sql += "CREATE TABLE Action (";
|
|
||||||
sql += "ActionID INTEGER PRIMARY KEY AUTOINCREMENT";
|
|
||||||
sql += ",HandID INTEGER NOT NULL";
|
|
||||||
sql += ",UniqueGameID INTEGER NOT NULL";
|
|
||||||
sql += ",BeRo INTEGER NOT NULL";
|
|
||||||
sql += ",Player INTEGER NOT NULL";
|
|
||||||
sql += ",Action TEXT NOT NULL";
|
|
||||||
sql += ",Amount INTEGER";
|
|
||||||
sql += ");";
|
|
||||||
|
|
||||||
exec_transaction();
|
|
||||||
}
|
}
|
||||||
|
for(i=1; i<=5; i++) {
|
||||||
|
sql += ",BoardCard_" + boost::lexical_cast<std::string>(i) + " INTEGER";
|
||||||
|
}
|
||||||
|
sql += ",PRIMARY KEY(HandID,UniqueGameID));";
|
||||||
|
|
||||||
|
// create action table
|
||||||
|
sql += "CREATE TABLE Action (";
|
||||||
|
sql += "ActionID INTEGER PRIMARY KEY AUTOINCREMENT";
|
||||||
|
sql += ",HandID INTEGER NOT NULL";
|
||||||
|
sql += ",UniqueGameID INTEGER NOT NULL";
|
||||||
|
sql += ",BeRo INTEGER NOT NULL";
|
||||||
|
sql += ",Player INTEGER NOT NULL";
|
||||||
|
sql += ",Action TEXT NOT NULL";
|
||||||
|
sql += ",Amount INTEGER";
|
||||||
|
sql += ");";
|
||||||
|
|
||||||
|
exec_transaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,49 +235,46 @@ Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned deal
|
|||||||
{
|
{
|
||||||
uniqueGameID++;
|
uniqueGameID++;
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
PlayerListConstIterator it_c;
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
if( mySqliteLogDb != 0 ) {
|
||||||
|
// sqlite-db is open
|
||||||
|
int i;
|
||||||
|
|
||||||
if( mySqliteLogDb != 0 ) {
|
sql += "INSERT INTO Game (";
|
||||||
// sqlite-db is open
|
sql += "UniqueGameID";
|
||||||
int i;
|
sql += ",GameID";
|
||||||
|
sql += ",Startmoney";
|
||||||
|
sql += ",StartSb";
|
||||||
|
sql += ",DealerPos";
|
||||||
|
sql += ") VALUES (";
|
||||||
|
sql += boost::lexical_cast<string>(uniqueGameID);
|
||||||
|
sql += "," + boost::lexical_cast<string>(gameID);
|
||||||
|
sql += "," + boost::lexical_cast<string>(startCash);
|
||||||
|
sql += "," + boost::lexical_cast<string>(startSmallBlind);
|
||||||
|
sql += "," + boost::lexical_cast<string>(dealerPosition);
|
||||||
|
sql += ");";
|
||||||
|
|
||||||
sql += "INSERT INTO Game (";
|
i = 1;
|
||||||
sql += "UniqueGameID";
|
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
sql += ",GameID";
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
sql += ",Startmoney";
|
sql += "INSERT INTO Player (";
|
||||||
sql += ",StartSb";
|
sql += "UniqueGameID";
|
||||||
sql += ",DealerPos";
|
sql += ",Seat";
|
||||||
sql += ") VALUES (";
|
sql += ",Player";
|
||||||
sql += boost::lexical_cast<string>(uniqueGameID);
|
sql += ") VALUES (";
|
||||||
sql += "," + boost::lexical_cast<string>(gameID);
|
sql += boost::lexical_cast<string>(uniqueGameID);
|
||||||
sql += "," + boost::lexical_cast<string>(startCash);
|
sql += "," + boost::lexical_cast<string>(i);
|
||||||
sql += "," + boost::lexical_cast<string>(startSmallBlind);
|
sql += ",\"" + (*it_c)->getMyName() +"\"";
|
||||||
sql += "," + boost::lexical_cast<string>(dealerPosition);
|
sql += ");";
|
||||||
sql += ");";
|
|
||||||
|
|
||||||
i = 1;
|
|
||||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
|
||||||
sql += "INSERT INTO Player (";
|
|
||||||
sql += "UniqueGameID";
|
|
||||||
sql += ",Seat";
|
|
||||||
sql += ",Player";
|
|
||||||
sql += ") VALUES (";
|
|
||||||
sql += boost::lexical_cast<string>(uniqueGameID);
|
|
||||||
sql += "," + boost::lexical_cast<string>(i);
|
|
||||||
sql += ",\"" + (*it_c)->getMyName() +"\"";
|
|
||||||
sql += ");";
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
exec_transaction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exec_transaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,82 +290,79 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
|||||||
(*it_c)->setLogHoleCardsDone(false);
|
(*it_c)->setLogHoleCardsDone(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if( mySqliteLogDb != 0 ) {
|
||||||
//if write logfiles is enabled
|
// sqlite-db is open
|
||||||
|
int i;
|
||||||
if( mySqliteLogDb != 0 ) {
|
|
||||||
// sqlite-db is open
|
|
||||||
int i;
|
|
||||||
|
|
||||||
sql += "INSERT INTO Hand (";
|
|
||||||
sql += "HandID";
|
|
||||||
sql += ",UniqueGameID";
|
|
||||||
sql += ",Dealer_Seat";
|
|
||||||
sql += ",Sb_Amount";
|
|
||||||
sql += ",Sb_Seat";
|
|
||||||
sql += ",Bb_Amount";
|
|
||||||
sql += ",Bb_Seat";
|
|
||||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash";
|
|
||||||
}
|
|
||||||
sql += ") VALUES (";
|
|
||||||
sql += boost::lexical_cast<string>(currentHandID);
|
|
||||||
sql += "," + boost::lexical_cast<string>(uniqueGameID);
|
|
||||||
sql += "," + boost::lexical_cast<string>(dealerPosition);
|
|
||||||
sql += "," + boost::lexical_cast<string>(smallBlind);
|
|
||||||
sql += "," + boost::lexical_cast<string>(smallBlindPosition);
|
|
||||||
sql += "," + boost::lexical_cast<string>(bigBlind);
|
|
||||||
sql += "," + boost::lexical_cast<string>(bigBlindPosition);
|
|
||||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
|
||||||
sql += "," + boost::lexical_cast<string>((*it_c)->getMyRoundStartCash());
|
|
||||||
} else {
|
|
||||||
sql += ",NULL";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sql += ");";
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
exec_transaction();
|
|
||||||
}
|
|
||||||
|
|
||||||
// !! TODO !! Hack, weil Button-Regel noch falsch und dealerPosition noch teilweise falsche ID enthält (HeadsUp: dealerPosition=bigBlindPosition <-- falsch)
|
|
||||||
bool dealerButtonOnTable = false;
|
|
||||||
int countActivePlayer = 0;
|
|
||||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
|
||||||
countActivePlayer++;
|
|
||||||
if((*it_c)->getMyButton()==BUTTON_DEALER && (*it_c)->getMyActiveStatus()) {
|
|
||||||
dealerButtonOnTable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(countActivePlayer==2) {
|
|
||||||
logPlayerAction(smallBlindPosition,LOG_ACTION_DEALER);
|
|
||||||
} else {
|
|
||||||
if(dealerButtonOnTable) {
|
|
||||||
logPlayerAction(dealerPosition,LOG_ACTION_DEALER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// log blinds
|
|
||||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
|
||||||
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND && (*it_c)->getMySet()>0) {
|
|
||||||
logPlayerAction(smallBlindPosition,LOG_ACTION_SMALL_BLIND,(*it_c)->getMySet());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
|
||||||
if((*it_c)->getMyButton() == BUTTON_BIG_BLIND && (*it_c)->getMySet()>0) {
|
|
||||||
logPlayerAction(bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// (*it_c)->getMySet() ist ein Hack, da es im Internetspiel vorkam, dass ein Spieler zweimal geloggt wurde mit Blind - einmal jedoch mit $0
|
|
||||||
|
|
||||||
// !! TODO !! Hack
|
|
||||||
|
|
||||||
|
sql += "INSERT INTO Hand (";
|
||||||
|
sql += "HandID";
|
||||||
|
sql += ",UniqueGameID";
|
||||||
|
sql += ",Dealer_Seat";
|
||||||
|
sql += ",Sb_Amount";
|
||||||
|
sql += ",Sb_Seat";
|
||||||
|
sql += ",Bb_Amount";
|
||||||
|
sql += ",Bb_Seat";
|
||||||
|
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
|
sql += ",Seat_" + boost::lexical_cast<std::string>(i) + "_Cash";
|
||||||
}
|
}
|
||||||
|
sql += ") VALUES (";
|
||||||
|
sql += boost::lexical_cast<string>(currentHandID);
|
||||||
|
sql += "," + boost::lexical_cast<string>(uniqueGameID);
|
||||||
|
sql += "," + boost::lexical_cast<string>(dealerPosition);
|
||||||
|
sql += "," + boost::lexical_cast<string>(smallBlind);
|
||||||
|
sql += "," + boost::lexical_cast<string>(smallBlindPosition);
|
||||||
|
sql += "," + boost::lexical_cast<string>(bigBlind);
|
||||||
|
sql += "," + boost::lexical_cast<string>(bigBlindPosition);
|
||||||
|
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
|
sql += "," + boost::lexical_cast<string>((*it_c)->getMyRoundStartCash());
|
||||||
|
} else {
|
||||||
|
sql += ",NULL";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sql += ");";
|
||||||
|
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||||
|
exec_transaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
// !! TODO !! Hack, weil Button-Regel noch falsch und dealerPosition noch teilweise falsche ID enthält (HeadsUp: dealerPosition=bigBlindPosition <-- falsch)
|
||||||
|
bool dealerButtonOnTable = false;
|
||||||
|
int countActivePlayer = 0;
|
||||||
|
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
|
countActivePlayer++;
|
||||||
|
if((*it_c)->getMyButton()==BUTTON_DEALER && (*it_c)->getMyActiveStatus()) {
|
||||||
|
dealerButtonOnTable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(countActivePlayer==2) {
|
||||||
|
logPlayerAction(smallBlindPosition,LOG_ACTION_DEALER);
|
||||||
|
} else {
|
||||||
|
if(dealerButtonOnTable) {
|
||||||
|
logPlayerAction(dealerPosition,LOG_ACTION_DEALER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// log blinds
|
||||||
|
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
|
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND && (*it_c)->getMySet()>0) {
|
||||||
|
logPlayerAction(smallBlindPosition,LOG_ACTION_SMALL_BLIND,(*it_c)->getMySet());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(it_c = seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
|
if((*it_c)->getMyButton() == BUTTON_BIG_BLIND && (*it_c)->getMySet()>0) {
|
||||||
|
logPlayerAction(bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// (*it_c)->getMySet() ist ein Hack, da es im Internetspiel vorkam, dass ein Spieler zweimal geloggt wurde mit Blind - einmal jedoch mit $0
|
||||||
|
|
||||||
|
// !! TODO !! Hack
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,35 +371,32 @@ void
|
|||||||
Log::logPlayerAction(string playerName, PlayerActionLog action, int amount)
|
Log::logPlayerAction(string playerName, PlayerActionLog action, int amount)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if( mySqliteLogDb != 0 ) {
|
||||||
//if write logfiles is enabled
|
// sqlite-db is open
|
||||||
|
|
||||||
if( mySqliteLogDb != 0 ) {
|
char **result_Player=0;
|
||||||
// sqlite-db is open
|
int nRow_Player=0;
|
||||||
|
int nCol_Player=0;
|
||||||
|
char *errmsg = 0;
|
||||||
|
|
||||||
char **result_Player=0;
|
// read seat
|
||||||
int nRow_Player=0;
|
string sql_select = "SELECT Seat FROM Player WHERE UniqueGameID=" + boost::lexical_cast<std::string>(uniqueGameID);
|
||||||
int nCol_Player=0;
|
sql_select += " AND ";
|
||||||
char *errmsg = 0;
|
sql_select += "Player=\"" + playerName +"\"";
|
||||||
|
if(sqlite3_get_table(mySqliteLogDb,sql_select.c_str(),&result_Player,&nRow_Player,&nCol_Player,&errmsg) != SQLITE_OK) {
|
||||||
// read seat
|
cout << "Error in statement: " << sql_select.c_str() << "[" << errmsg << "]." << endl;
|
||||||
string sql_select = "SELECT Seat FROM Player WHERE UniqueGameID=" + boost::lexical_cast<std::string>(uniqueGameID);
|
} else {
|
||||||
sql_select += " AND ";
|
if(nRow_Player == 1) {
|
||||||
sql_select += "Player=\"" + playerName +"\"";
|
logPlayerAction(boost::lexical_cast<int>(result_Player[1]), action, amount);
|
||||||
if(sqlite3_get_table(mySqliteLogDb,sql_select.c_str(),&result_Player,&nRow_Player,&nCol_Player,&errmsg) != SQLITE_OK) {
|
|
||||||
cout << "Error in statement: " << sql_select.c_str() << "[" << errmsg << "]." << endl;
|
|
||||||
} else {
|
} else {
|
||||||
if(nRow_Player == 1) {
|
cout << "Implausible information about player " << playerName << " in log-db!" << endl;
|
||||||
logPlayerAction(boost::lexical_cast<int>(result_Player[1]), action, amount);
|
|
||||||
} else {
|
|
||||||
cout << "Implausible information about player " << playerName << " in log-db!" << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_free_table(result_Player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sqlite3_free_table(result_Player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -417,107 +405,104 @@ void
|
|||||||
Log::logPlayerAction(int seat, PlayerActionLog action, int amount)
|
Log::logPlayerAction(int seat, PlayerActionLog action, int amount)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if( mySqliteLogDb != 0 ) {
|
||||||
//if write logfiles is enabled
|
// sqlite-db is open
|
||||||
|
|
||||||
if( mySqliteLogDb != 0 ) {
|
if(action!=LOG_ACTION_NONE) {
|
||||||
// sqlite-db is open
|
sql += "INSERT INTO Action (";
|
||||||
|
sql += "HandID";
|
||||||
if(action!=LOG_ACTION_NONE) {
|
sql += ",UniqueGameID";
|
||||||
sql += "INSERT INTO Action (";
|
sql += ",BeRo";
|
||||||
sql += "HandID";
|
sql += ",Player";
|
||||||
sql += ",UniqueGameID";
|
sql += ",Action";
|
||||||
sql += ",BeRo";
|
sql += ",Amount";
|
||||||
sql += ",Player";
|
sql += ") VALUES (";
|
||||||
sql += ",Action";
|
sql += boost::lexical_cast<string>(currentHandID);
|
||||||
sql += ",Amount";
|
sql += "," + boost::lexical_cast<string>(uniqueGameID);
|
||||||
sql += ") VALUES (";
|
sql += "," + boost::lexical_cast<string>(currentRound);;
|
||||||
sql += boost::lexical_cast<string>(currentHandID);
|
sql += "," + boost::lexical_cast<string>(seat);
|
||||||
sql += "," + boost::lexical_cast<string>(uniqueGameID);
|
switch(action) {
|
||||||
sql += "," + boost::lexical_cast<string>(currentRound);;
|
case LOG_ACTION_DEALER:
|
||||||
sql += "," + boost::lexical_cast<string>(seat);
|
sql += ",'starts as dealer'";
|
||||||
switch(action) {
|
sql += ",NULL";
|
||||||
case LOG_ACTION_DEALER:
|
break;
|
||||||
sql += ",'starts as dealer'";
|
case LOG_ACTION_SMALL_BLIND:
|
||||||
sql += ",NULL";
|
sql += ",'posts small blind'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_SMALL_BLIND:
|
break;
|
||||||
sql += ",'posts small blind'";
|
case LOG_ACTION_BIG_BLIND:
|
||||||
sql += "," + boost::lexical_cast<string>(amount);
|
sql += ",'posts big blind'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_BIG_BLIND:
|
break;
|
||||||
sql += ",'posts big blind'";
|
case LOG_ACTION_FOLD:
|
||||||
sql += "," + boost::lexical_cast<string>(amount);
|
sql += ",'folds'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_FOLD:
|
break;
|
||||||
sql += ",'folds'";
|
case LOG_ACTION_CHECK:
|
||||||
sql += ",NULL";
|
sql += ",'checks'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_CHECK:
|
break;
|
||||||
sql += ",'checks'";
|
case LOG_ACTION_CALL:
|
||||||
sql += ",NULL";
|
sql += ",'calls'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_CALL:
|
break;
|
||||||
sql += ",'calls'";
|
case LOG_ACTION_BET:
|
||||||
sql += "," + boost::lexical_cast<string>(amount);
|
sql += ",'bets'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_BET:
|
break;
|
||||||
sql += ",'bets'";
|
case LOG_ACTION_ALL_IN:
|
||||||
sql += "," + boost::lexical_cast<string>(amount);
|
sql += ",'is all in with'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_ALL_IN:
|
break;
|
||||||
sql += ",'is all in with'";
|
case LOG_ACTION_SHOW:
|
||||||
sql += "," + boost::lexical_cast<string>(amount);
|
sql += ",'shows'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_SHOW:
|
break;
|
||||||
sql += ",'shows'";
|
case LOG_ACTION_HAS:
|
||||||
sql += ",NULL";
|
sql += ",'has'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_HAS:
|
break;
|
||||||
sql += ",'has'";
|
case LOG_ACTION_WIN:
|
||||||
sql += ",NULL";
|
sql += ",'wins'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_WIN:
|
break;
|
||||||
sql += ",'wins'";
|
case LOG_ACTION_WIN_SIDE_POT:
|
||||||
sql += "," + boost::lexical_cast<string>(amount);
|
sql += ",'wins (side pot)'";
|
||||||
break;
|
sql += "," + boost::lexical_cast<string>(amount);
|
||||||
case LOG_ACTION_WIN_SIDE_POT:
|
break;
|
||||||
sql += ",'wins (side pot)'";
|
case LOG_ACTION_SIT_OUT:
|
||||||
sql += "," + boost::lexical_cast<string>(amount);
|
sql += ",'sits out'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_SIT_OUT:
|
break;
|
||||||
sql += ",'sits out'";
|
case LOG_ACTION_WIN_GAME:
|
||||||
sql += ",NULL";
|
sql += ",'wins game'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_WIN_GAME:
|
break;
|
||||||
sql += ",'wins game'";
|
case LOG_ACTION_LEFT:
|
||||||
sql += ",NULL";
|
sql += ",'has left the game'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_LEFT:
|
break;
|
||||||
sql += ",'has left the game'";
|
case LOG_ACTION_KICKED:
|
||||||
sql += ",NULL";
|
sql += ",'was kicked from the game'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_KICKED:
|
break;
|
||||||
sql += ",'was kicked from the game'";
|
case LOG_ACTION_ADMIN:
|
||||||
sql += ",NULL";
|
sql += ",'is game admin now'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_ADMIN:
|
break;
|
||||||
sql += ",'is game admin now'";
|
case LOG_ACTION_JOIN:
|
||||||
sql += ",NULL";
|
sql += ",'has joined the game'";
|
||||||
break;
|
sql += ",NULL";
|
||||||
case LOG_ACTION_JOIN:
|
break;
|
||||||
sql += ",'has joined the game'";
|
default:
|
||||||
sql += ",NULL";
|
return;
|
||||||
break;
|
}
|
||||||
default:
|
sql += ");";
|
||||||
return;
|
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||||
}
|
exec_transaction();
|
||||||
sql += ");";
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
exec_transaction();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -552,42 +537,40 @@ Log::transformPlayerActionLog(PlayerAction action)
|
|||||||
void
|
void
|
||||||
Log::logBoardCards(int boardCards[5])
|
Log::logBoardCards(int boardCards[5])
|
||||||
{
|
{
|
||||||
if(SQLITE_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
//if write logfiles is enabled
|
//if write logfiles is enabled
|
||||||
|
|
||||||
if( mySqliteLogDb != 0 ) {
|
if( mySqliteLogDb != 0 ) {
|
||||||
// sqlite-db is open
|
// sqlite-db is open
|
||||||
|
|
||||||
switch(currentRound) {
|
switch(currentRound) {
|
||||||
case GAME_STATE_FLOP: {
|
case GAME_STATE_FLOP: {
|
||||||
sql += "UPDATE Hand SET ";
|
sql += "UPDATE Hand SET ";
|
||||||
sql += "BoardCard_1=" + boost::lexical_cast<string>(boardCards[0]) + ",";
|
sql += "BoardCard_1=" + boost::lexical_cast<string>(boardCards[0]) + ",";
|
||||||
sql += "BoardCard_2=" + boost::lexical_cast<string>(boardCards[1]) + ",";
|
sql += "BoardCard_2=" + boost::lexical_cast<string>(boardCards[1]) + ",";
|
||||||
sql += "BoardCard_3=" + boost::lexical_cast<string>(boardCards[2]);
|
sql += "BoardCard_3=" + boost::lexical_cast<string>(boardCards[2]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_TURN: {
|
case GAME_STATE_TURN: {
|
||||||
sql += "UPDATE Hand SET ";
|
sql += "UPDATE Hand SET ";
|
||||||
sql += "BoardCard_4=" + boost::lexical_cast<string>(boardCards[3]);
|
sql += "BoardCard_4=" + boost::lexical_cast<string>(boardCards[3]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAME_STATE_RIVER: {
|
case GAME_STATE_RIVER: {
|
||||||
sql += "UPDATE Hand SET ";
|
sql += "UPDATE Hand SET ";
|
||||||
sql += "BoardCard_5=" + boost::lexical_cast<string>(boardCards[4]);
|
sql += "BoardCard_5=" + boost::lexical_cast<string>(boardCards[4]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sql += " WHERE ";
|
sql += " WHERE ";
|
||||||
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
|
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
|
||||||
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
|
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
|
||||||
sql += ";";
|
sql += ";";
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||||
exec_transaction();
|
exec_transaction();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -612,44 +595,41 @@ void
|
|||||||
Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog)
|
Log::logHoleCardsHandName(PlayerList activePlayerList, boost::shared_ptr<PlayerInterface> player, bool forceExecLog)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if( mySqliteLogDb != 0) {
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
if( mySqliteLogDb != 0) {
|
|
||||||
|
|
||||||
int myCards[2];
|
|
||||||
player->getMyCards(myCards);
|
|
||||||
sql += "UPDATE Hand SET ";
|
|
||||||
if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0) {
|
|
||||||
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName(player->getMyCardsValueInt(),activePlayerList) + "\"";
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_int=" + boost::lexical_cast<string>(player->getMyCardsValueInt());
|
|
||||||
}
|
|
||||||
if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0 && !player->getLogHoleCardsDone()) {
|
|
||||||
sql+= ",";
|
|
||||||
}
|
|
||||||
if(!player->getLogHoleCardsDone()) {
|
|
||||||
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
|
|
||||||
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_2=" + boost::lexical_cast<string>(myCards[1]);
|
|
||||||
}
|
|
||||||
sql += " WHERE ";
|
|
||||||
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
|
|
||||||
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
|
|
||||||
sql += ";";
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0 || forceExecLog) {
|
|
||||||
exec_transaction();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!player->getLogHoleCardsDone()) {
|
|
||||||
logPlayerAction(player->getMyName(),LOG_ACTION_SHOW);
|
|
||||||
} else {
|
|
||||||
logPlayerAction(player->getMyName(),LOG_ACTION_HAS);
|
|
||||||
}
|
|
||||||
|
|
||||||
player->setLogHoleCardsDone(true);
|
|
||||||
|
|
||||||
|
int myCards[2];
|
||||||
|
player->getMyHoleCards(myCards);
|
||||||
|
sql += "UPDATE Hand SET ";
|
||||||
|
if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0) {
|
||||||
|
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName(player->getMyCardsValueInt(),activePlayerList) + "\"";
|
||||||
|
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_int=" + boost::lexical_cast<string>(player->getMyCardsValueInt());
|
||||||
}
|
}
|
||||||
|
if(currentRound==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0 && !player->getLogHoleCardsDone()) {
|
||||||
|
sql+= ",";
|
||||||
|
}
|
||||||
|
if(!player->getLogHoleCardsDone()) {
|
||||||
|
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
|
||||||
|
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_2=" + boost::lexical_cast<string>(myCards[1]);
|
||||||
|
}
|
||||||
|
sql += " WHERE ";
|
||||||
|
sql += "UniqueGameID=" + boost::lexical_cast<string>(uniqueGameID) + " AND ";
|
||||||
|
sql += "HandID=" + boost::lexical_cast<string>(currentHandID);
|
||||||
|
sql += ";";
|
||||||
|
if(myConfig->readConfigInt("LogInterval") == 0 || forceExecLog) {
|
||||||
|
exec_transaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!player->getLogHoleCardsDone()) {
|
||||||
|
logPlayerAction(player->getMyName(),LOG_ACTION_SHOW);
|
||||||
|
} else {
|
||||||
|
logPlayerAction(player->getMyName(),LOG_ACTION_HAS);
|
||||||
|
}
|
||||||
|
|
||||||
|
player->setLogHoleCardsDone(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -752,11 +732,9 @@ Log::exec_transaction()
|
|||||||
//void
|
//void
|
||||||
//Log::closeLogDbAtExit()
|
//Log::closeLogDbAtExit()
|
||||||
//{
|
//{
|
||||||
// if(SQLITE_LOG) {
|
// // close sqlite-db
|
||||||
// // close sqlite-db
|
// sqlite3_close(mySqliteLogDb);
|
||||||
// sqlite3_close(mySqliteLogDb);
|
// mySqliteLogDb = NULL;
|
||||||
// mySqliteLogDb = NULL;
|
|
||||||
// }
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boos
|
|||||||
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
for(it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||||
(*it)->setHand(this);
|
(*it)->setHand(this);
|
||||||
// myFlipCards auf 0 setzen
|
// myFlipCards auf 0 setzen
|
||||||
(*it)->setMyCardsFlip(0, 0);
|
(*it)->setMyHoleCardsFlip(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// roundStartCashArray fuellen
|
// roundStartCashArray fuellen
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ using namespace std;
|
|||||||
ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB)
|
ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB)
|
||||||
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type),
|
: PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type),
|
||||||
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0),
|
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0),
|
||||||
myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(sotS), myTurn(false), myCardsFlip(false), myRoundStartCash(0),
|
myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(sotS), myTurn(false), myHoleCardsFlip(false), myRoundStartCash(0),
|
||||||
lastMoneyWon(0), sBluff(0), sBluffStatus(false), m_isSessionActive(false), m_isKicked(false), m_isMuted(false)
|
lastMoneyWon(0), sBluff(0), sBluffStatus(false), m_isSessionActive(false), m_isKicked(false), m_isMuted(false)
|
||||||
{
|
{
|
||||||
myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0;
|
myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0;
|
||||||
myNiveau[0] = myNiveau[1] = myNiveau[2] = 0;
|
myNiveau[0] = myNiveau[1] = myNiveau[2] = 0;
|
||||||
myCards[0] = myCards[1] = 0;
|
myHoleCards[0] = myHoleCards[1] = 0;
|
||||||
myAverageSets[0] = myAverageSets[1] = myAverageSets[2] = myAverageSets[3] = 0;
|
myAverageSets[0] = myAverageSets[1] = myAverageSets[2] = myAverageSets[3] = 0;
|
||||||
myAggressive[0] = myAggressive[1] = myAggressive[2] = myAggressive[3] = myAggressive[4] = myAggressive[5] = myAggressive[6] = false;
|
myAggressive[0] = myAggressive[1] = myAggressive[2] = myAggressive[3] = myAggressive[4] = myAggressive[5] = myAggressive[6] = false;
|
||||||
}
|
}
|
||||||
@@ -264,19 +264,19 @@ ClientPlayer::getMyStayOnTableStatus() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientPlayer::setMyCards(int* theValue)
|
ClientPlayer::setMyHoleCards(int* theValue)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
myCards[i] = theValue[i];
|
myHoleCards[i] = theValue[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientPlayer::getMyCards(int* theValue) const
|
ClientPlayer::getMyHoleCards(int* theValue) const
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
theValue[i] = myCards[i];
|
theValue[i] = myHoleCards[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -294,21 +294,21 @@ ClientPlayer::getMyTurn() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientPlayer::setMyCardsFlip(bool theValue, int state)
|
ClientPlayer::setMyHoleCardsFlip(bool theValue, int state)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
myCardsFlip = theValue;
|
myHoleCardsFlip = theValue;
|
||||||
// log flipping cards
|
// log flipping cards
|
||||||
if (myCardsFlip) {
|
if (myHoleCardsFlip) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case 1:
|
case 1:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt);
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1]);
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myCards[0], myCards[1], myCardsValueInt, "has");
|
currentHand->getGuiInterface()->logFlipHoleCardsMsg(myName, myHoleCards[0], myHoleCards[1], myCardsValueInt, "has");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
@@ -317,10 +317,10 @@ ClientPlayer::setMyCardsFlip(bool theValue, int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ClientPlayer::getMyCardsFlip() const
|
ClientPlayer::getMyHoleCardsFlip() const
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
return myCardsFlip;
|
return myHoleCardsFlip;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -89,14 +89,14 @@ public:
|
|||||||
void setMyStayOnTableStatus(bool theValue);
|
void setMyStayOnTableStatus(bool theValue);
|
||||||
bool getMyStayOnTableStatus() const;
|
bool getMyStayOnTableStatus() const;
|
||||||
|
|
||||||
void setMyCards(int* theValue);
|
void setMyHoleCards(int* theValue);
|
||||||
void getMyCards(int* theValue) const;
|
void getMyHoleCards(int* theValue) const;
|
||||||
|
|
||||||
void setMyTurn(bool theValue);
|
void setMyTurn(bool theValue);
|
||||||
bool getMyTurn() const;
|
bool getMyTurn() const;
|
||||||
|
|
||||||
void setMyCardsFlip(bool theValue, int state);
|
void setMyHoleCardsFlip(bool theValue, int state);
|
||||||
bool getMyCardsFlip() const;
|
bool getMyHoleCardsFlip() const;
|
||||||
|
|
||||||
void setMyCardsValueInt(int theValue);
|
void setMyCardsValueInt(int theValue);
|
||||||
int getMyCardsValueInt() const;
|
int getMyCardsValueInt() const;
|
||||||
@@ -184,7 +184,7 @@ private:
|
|||||||
int myNiveau[3];
|
int myNiveau[3];
|
||||||
bool logHoleCardsDone;
|
bool logHoleCardsDone;
|
||||||
|
|
||||||
int myCards[2];
|
int myHoleCards[2];
|
||||||
int myCash;
|
int myCash;
|
||||||
int mySet;
|
int mySet;
|
||||||
int myLastRelativeSet;
|
int myLastRelativeSet;
|
||||||
@@ -193,7 +193,7 @@ private:
|
|||||||
bool myActiveStatus; // 0 = inactive, 1 = active
|
bool myActiveStatus; // 0 = inactive, 1 = active
|
||||||
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
bool myStayOnTableStatus; // 0 = left, 1 = stay
|
||||||
bool myTurn; // 0 = no, 1 = yes
|
bool myTurn; // 0 = no, 1 = yes
|
||||||
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
bool myHoleCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
||||||
int myRoundStartCash;
|
int myRoundStartCash;
|
||||||
int lastMoneyWon;
|
int lastMoneyWon;
|
||||||
|
|
||||||
|
|||||||
@@ -87,14 +87,14 @@ public:
|
|||||||
virtual void setMyStayOnTableStatus(bool theValue) =0;
|
virtual void setMyStayOnTableStatus(bool theValue) =0;
|
||||||
virtual bool getMyStayOnTableStatus() const =0;
|
virtual bool getMyStayOnTableStatus() const =0;
|
||||||
|
|
||||||
virtual void setMyCards(int* theValue) =0;
|
virtual void setMyHoleCards(int* theValue) =0;
|
||||||
virtual void getMyCards(int* theValue) const =0;
|
virtual void getMyHoleCards(int* theValue) const =0;
|
||||||
|
|
||||||
virtual void setMyTurn(bool theValue) =0;
|
virtual void setMyTurn(bool theValue) =0;
|
||||||
virtual bool getMyTurn() const =0;
|
virtual bool getMyTurn() const =0;
|
||||||
|
|
||||||
virtual void setMyCardsFlip(bool theValue, int state) =0;
|
virtual void setMyHoleCardsFlip(bool theValue, int state) =0;
|
||||||
virtual bool getMyCardsFlip() const =0;
|
virtual bool getMyHoleCardsFlip() const =0;
|
||||||
|
|
||||||
virtual void setMyCardsValueInt(int theValue) =0;
|
virtual void setMyCardsValueInt(int theValue) =0;
|
||||||
virtual int getMyCardsValueInt() const =0;
|
virtual int getMyCardsValueInt() const =0;
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#define MIN_GUI_SPEED 1
|
#define MIN_GUI_SPEED 1
|
||||||
#define MAX_GUI_SPEED 11
|
#define MAX_GUI_SPEED 11
|
||||||
|
|
||||||
#define SQLITE_LOG 1
|
|
||||||
#define HTML_LOG 0
|
|
||||||
|
|
||||||
#define POKERTH_VERSION_MAJOR 1
|
#define POKERTH_VERSION_MAJOR 1
|
||||||
#define POKERTH_VERSION_MINOR 11
|
#define POKERTH_VERSION_MINOR 11
|
||||||
#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR)
|
#define POKERTH_VERSION ((POKERTH_VERSION_MAJOR << 8) | POKERTH_VERSION_MINOR)
|
||||||
|
|||||||
@@ -105,8 +105,6 @@ void ServerGuiWrapper::logNewBlindsSetsMsg(int /*sbSet*/, int /*bbSet*/, std::st
|
|||||||
void ServerGuiWrapper::logDealBoardCardsMsg(int /*roundID*/, int /*card1*/, int /*card2*/, int /*card3*/, int /*card4*/, int /*card5*/) {}
|
void ServerGuiWrapper::logDealBoardCardsMsg(int /*roundID*/, int /*card1*/, int /*card2*/, int /*card3*/, int /*card4*/, int /*card5*/) {}
|
||||||
void ServerGuiWrapper::logFlipHoleCardsMsg(std::string /*playerName*/, int /*card1*/, int /*card2*/, int /*cardsValueInt*/, std::string /*showHas*/) {}
|
void ServerGuiWrapper::logFlipHoleCardsMsg(std::string /*playerName*/, int /*card1*/, int /*card2*/, int /*cardsValueInt*/, std::string /*showHas*/) {}
|
||||||
void ServerGuiWrapper::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {}
|
void ServerGuiWrapper::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {}
|
||||||
void ServerGuiWrapper::flushLogAtGame(int /*gameID*/) {}
|
|
||||||
void ServerGuiWrapper::flushLogAtHand() {}
|
|
||||||
|
|
||||||
void ServerGuiWrapper::SignalNetClientServerListAdd(unsigned serverId)
|
void ServerGuiWrapper::SignalNetClientServerListAdd(unsigned serverId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,8 +118,6 @@ public:
|
|||||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ;
|
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ;
|
||||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
||||||
void logPlayerWinGame(std::string playerName, int gameID);
|
void logPlayerWinGame(std::string playerName, int gameID);
|
||||||
void flushLogAtGame(int gameID);
|
|
||||||
void flushLogAtHand();
|
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientGameInfo(int actionID);
|
void SignalNetClientGameInfo(int actionID);
|
||||||
|
|||||||
@@ -119,8 +119,6 @@ public:
|
|||||||
virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 0;
|
virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 0;
|
||||||
virtual void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0;
|
virtual void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0;
|
||||||
virtual void logPlayerWinGame(std::string playerName, int gameID) =0;
|
virtual void logPlayerWinGame(std::string playerName, int gameID) =0;
|
||||||
virtual void flushLogAtGame(int gameID) =0;
|
|
||||||
virtual void flushLogAtHand() =0;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -834,7 +834,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
|
|||||||
QPixmap tempCardsPixmapArray[2];
|
QPixmap tempCardsPixmapArray[2];
|
||||||
int tempCardsIntArray[2];
|
int tempCardsIntArray[2];
|
||||||
|
|
||||||
humanPlayer->getMyCards(tempCardsIntArray);
|
humanPlayer->getMyHoleCards(tempCardsIntArray);
|
||||||
if(myConfig->readConfigInt("AntiPeekMode")) {
|
if(myConfig->readConfigInt("AntiPeekMode")) {
|
||||||
holeCardsArray[0][0]->setPixmap(flipside, true);
|
holeCardsArray[0][0]->setPixmap(flipside, true);
|
||||||
tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png"));
|
tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[0], 10)+".png"));
|
||||||
@@ -1440,7 +1440,7 @@ void gameTableImpl::dealHoleCards()
|
|||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
PlayerList seatsList = currentGame->getSeatsList();
|
PlayerList seatsList = currentGame->getSeatsList();
|
||||||
for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
|
||||||
(*it_c)->getMyCards(tempCardsIntArray);
|
(*it_c)->getMyHoleCards(tempCardsIntArray);
|
||||||
for(j=0; j<2; j++) {
|
for(j=0; j<2; j++) {
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
if (( (*it_c)->getMyID() == 0) || (currentGame->getCurrentHand()->getLog() && currentGame->getCurrentHand()->getLog()->getDebugMode()) ) {
|
if (( (*it_c)->getMyID() == 0) || (currentGame->getCurrentHand()->getLog() && currentGame->getCurrentHand()->getLog()->getDebugMode()) ) {
|
||||||
@@ -2550,7 +2550,7 @@ void gameTableImpl::postRiverRunAnimation2()
|
|||||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
||||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||||
//set Player value (logging) for all in already shown cards
|
//set Player value (logging) for all in already shown cards
|
||||||
(*it_c)->setMyCardsFlip(1,3);
|
(*it_c)->setMyHoleCardsFlip(1,3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2843,7 +2843,7 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
|
|||||||
|
|
||||||
if((*it_c)->getMyUniqueID() == playerId) {
|
if((*it_c)->getMyUniqueID() == playerId) {
|
||||||
|
|
||||||
(*it_c)->getMyCards(tempCardsIntArray);
|
(*it_c)->getMyHoleCards(tempCardsIntArray);
|
||||||
for(j=0; j<2; j++) {
|
for(j=0; j<2; j++) {
|
||||||
|
|
||||||
if(showFlipcardAnimation) { // with Eye-Candy
|
if(showFlipcardAnimation) { // with Eye-Candy
|
||||||
@@ -2855,9 +2855,9 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
|
|||||||
}
|
}
|
||||||
//set Player value (logging)
|
//set Player value (logging)
|
||||||
if(currentHand->getCurrentRound() < GAME_STATE_RIVER || allIn) {
|
if(currentHand->getCurrentRound() < GAME_STATE_RIVER || allIn) {
|
||||||
(*it_c)->setMyCardsFlip(1,2); //for bero before postriver or allin just log the hole cards
|
(*it_c)->setMyHoleCardsFlip(1,2); //for bero before postriver or allin just log the hole cards
|
||||||
} else {
|
} else {
|
||||||
(*it_c)->setMyCardsFlip(1,1); //for postriver log the value
|
(*it_c)->setMyHoleCardsFlip(1,1); //for postriver log the value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4013,7 +4013,7 @@ void gameTableImpl::refreshCardsChance(GameState bero)
|
|||||||
int boardCards[5];
|
int boardCards[5];
|
||||||
int holeCards[2];
|
int holeCards[2];
|
||||||
|
|
||||||
humanPlayer->getMyCards(holeCards);
|
humanPlayer->getMyHoleCards(holeCards);
|
||||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||||
|
|
||||||
if(humanPlayer->getMyAction() == PLAYER_ACTION_FOLD) {
|
if(humanPlayer->getMyAction() == PLAYER_ACTION_FOLD) {
|
||||||
|
|||||||
@@ -61,9 +61,6 @@ guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(
|
|||||||
connect(this, SIGNAL(signalLogSpectatorLeftMsg(QString, int)), this, SLOT(logSpectatorLeftMsg(QString, int)));
|
connect(this, SIGNAL(signalLogSpectatorLeftMsg(QString, int)), this, SLOT(logSpectatorLeftMsg(QString, int)));
|
||||||
connect(this, SIGNAL(signalLogSpectatorJoinedMsg(QString)), this, SLOT(logSpectatorJoinedMsg(QString)));
|
connect(this, SIGNAL(signalLogSpectatorJoinedMsg(QString)), this, SLOT(logSpectatorJoinedMsg(QString)));
|
||||||
connect(this, SIGNAL(signalLogPlayerWinGame(QString, int)), this, SLOT(logPlayerWinGame(QString, int)));
|
connect(this, SIGNAL(signalLogPlayerWinGame(QString, int)), this, SLOT(logPlayerWinGame(QString, int)));
|
||||||
connect(this, SIGNAL(signalFlushLogAtGame(int)), this, SLOT(flushLogAtGame(int)));
|
|
||||||
connect(this, SIGNAL(signalFlushLogAtHand()), this, SLOT(flushLogAtHand()));
|
|
||||||
|
|
||||||
|
|
||||||
logFileStreamString = "";
|
logFileStreamString = "";
|
||||||
lastGameID = 0;
|
lastGameID = 0;
|
||||||
@@ -79,40 +76,7 @@ guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(
|
|||||||
|
|
||||||
myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||||
|
|
||||||
if(HTML_LOG) {
|
// delete old log files - TODO: move to Log
|
||||||
|
|
||||||
QDateTime currentTime = QDateTime::currentDateTime();
|
|
||||||
if(SQLITE_LOG) {
|
|
||||||
myHtmlLogFile_old = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+"_old.html");
|
|
||||||
} else {
|
|
||||||
myHtmlLogFile_old = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".html");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Logo-Pixmap extrahieren
|
|
||||||
QPixmap logoChipPixmapFile(":/gfx/logoChip3D.png");
|
|
||||||
logoChipPixmapFile.save(myLogDir->absolutePath()+"/logo.png");
|
|
||||||
|
|
||||||
// myW->textBrowser_Log->append(myHtmlLogFile_old->fileName());
|
|
||||||
|
|
||||||
// erstelle html-Datei
|
|
||||||
myHtmlLogFile_old->open( QIODevice::WriteOnly );
|
|
||||||
QTextStream stream_old( myHtmlLogFile_old );
|
|
||||||
stream_old << "<html>\n";
|
|
||||||
stream_old << "<head>\n";
|
|
||||||
stream_old << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\">";
|
|
||||||
stream_old << "</head>\n";
|
|
||||||
#ifdef GUI_800x480
|
|
||||||
stream_old << "<body style=\"font-size:14px\">\n";
|
|
||||||
#else
|
|
||||||
stream_old << "<body>\n";
|
|
||||||
#endif
|
|
||||||
stream_old << "<img src='logo.png'>\n";
|
|
||||||
stream_old << QString("<h3><b>Log-File for PokerTH %1 Session started on ").arg(POKERTH_BETA_RELEASE_STRING)+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>\n";
|
|
||||||
myHtmlLogFile_old->close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete old log files
|
|
||||||
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
||||||
|
|
||||||
QStringList filters("pokerth-log*");
|
QStringList filters("pokerth-log*");
|
||||||
@@ -191,62 +155,19 @@ void guiLog::logPlayerActionMsg(QString msg, int action, int setValue)
|
|||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+msg+"</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+msg+"</span>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
logFileStreamString += msg+"</br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logNewGameHandMsg(int gameID, int handID)
|
void guiLog::logNewGameHandMsg(int gameID, int handID)
|
||||||
{
|
{
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
|
||||||
boost::shared_ptr<HandInterface> currentHand = myW->getSession()->getCurrentGame()->getCurrentHand();
|
|
||||||
|
|
||||||
PlayerList activePlayerList = currentHand->getActivePlayerList();
|
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
logFileStreamString += "<table><tr><td width=\"600\" align=\"center\"><hr noshade size=\"3\"><b>Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"</b></td><td></td></tr></table>";
|
|
||||||
logFileStreamString += "BLIND LEVEL: $"+QString::number(currentHand->getSmallBlind())+" / $"+QString::number(currentHand->getSmallBlind()*2)+"</br>";
|
|
||||||
|
|
||||||
//print cash only for active players
|
|
||||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
|
||||||
|
|
||||||
logFileStreamString += "Seat " + QString::number((*it_c)->getMyID()+1,10) + ": <b>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + "</b> ($" + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+")</br>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName)
|
void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName)
|
||||||
{
|
{
|
||||||
|
|
||||||
// log blinds
|
// log blinds
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
|
||||||
@@ -255,45 +176,6 @@ void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString b
|
|||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+sbName+" posts small blind ($"+QString::number(sbSet,10)+")</span>");
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+bbName+" posts big blind ($"+QString::number(bbSet,10)+")</span>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
logFileStreamString += "BLINDS: ";
|
|
||||||
|
|
||||||
logFileStreamString += sbName+" ($"+QString::number(sbSet,10)+"), ";
|
|
||||||
logFileStreamString += bbName+" ($"+QString::number(bbSet,10)+")";
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
|
||||||
boost::shared_ptr<Game> currentGame = myW->getSession()->getCurrentGame();
|
|
||||||
PlayerList activePlayerList = currentGame->getActivePlayerList();
|
|
||||||
|
|
||||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) {
|
|
||||||
|
|
||||||
if(activePlayerList->size() > 2) {
|
|
||||||
if((*it_c)->getMyButton() == BUTTON_DEALER) {
|
|
||||||
|
|
||||||
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
|
||||||
|
|
||||||
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logFileStreamString += "</br></br><b>PREFLOP</b>";
|
|
||||||
logFileStreamString += "</br>\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main)
|
void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main)
|
||||||
@@ -312,116 +194,43 @@ void guiLog::logPlayerWinsMsg(QString playerName, int pot, bool main)
|
|||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogWinnerSidePotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogWinnerSidePotColor()+";\">"+playerName+" wins $"+QString::number(pot,10)+" (side pot)</span>");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
logFileStreamString += "</br><i>"+playerName+" wins $"+QString::number(pot,10);
|
|
||||||
if(!main) {
|
|
||||||
logFileStreamString += " (side pot)";
|
|
||||||
}
|
|
||||||
logFileStreamString += "</i>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logPlayerSitsOut(QString playerName)
|
void guiLog::logPlayerSitsOut(QString playerName)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
myW->tabs.textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
myW->textBrowser_Log->append("<i><span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">"+playerName+" sits out</span></i>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
|
|
||||||
logFileStreamString += "</br><i><span style=\"font-size:smaller;\">"+playerName+" sits out</span></i>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5)
|
void guiLog::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5)
|
||||||
{
|
{
|
||||||
|
|
||||||
QString round;
|
|
||||||
|
|
||||||
switch (roundID) {
|
switch (roundID) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
round = "Flop";
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Flop --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Flop --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]</span>");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
round = "Turn";
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Turn --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- Turn --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]</span>");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
round = "River";
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
|
myW->tabs.textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- River --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getLogPlayerSitsOutColor()+";\">--- River --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]</span>");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
round = "ERROR";
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
switch (roundID) {
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
round = "Flop";
|
|
||||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+"]"+"</br>\n";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
round = "Turn";
|
|
||||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+"]"+"</br>\n";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
round = "River";
|
|
||||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+",<b>"+translateCardCode(card5).at(0)+"</b>"+translateCardCode(card5).at(1)+"]"+"</br>\n";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
round = "ERROR";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,40 +256,10 @@ void guiLog::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int c
|
|||||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]</span>");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
//if write logfiles is enabled
|
|
||||||
|
|
||||||
if (cardsValueInt != -1) {
|
|
||||||
|
|
||||||
tempHandName.fromStdString(CardsValue::determineHandName(cardsValueInt,myW->getSession()->getCurrentGame()->getActivePlayerList()));
|
|
||||||
|
|
||||||
logFileStreamString += playerName+" "+showHas+" [ <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"] - "+tempHandName+"</br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
logFileStreamString += playerName+" "+showHas+" [<b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"]"+"</br>\n";
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
|
void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
|
||||||
{
|
{
|
||||||
|
|
||||||
QString action;
|
QString action;
|
||||||
if(wasKicked) action = "was kicked from";
|
if(wasKicked) action = "was kicked from";
|
||||||
else action = "has left";
|
else action = "has left";
|
||||||
@@ -490,44 +269,15 @@ void guiLog::logPlayerLeftMsg(QString playerName, int wasKicked)
|
|||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append( "<span style=\"color:#"+myStyle->getChatLogTextColor()+";\"><i>"+playerName+" "+action+" the game!</i></span>");
|
myW->textBrowser_Log->append( "<span style=\"color:#"+myStyle->getChatLogTextColor()+";\"><i>"+playerName+" "+action+" the game!</i></span>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
|
|
||||||
logFileStreamString += "<i>"+playerName+" "+action+" the game!</i><br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logNewGameAdminMsg(QString playerName)
|
void guiLog::logNewGameAdminMsg(QString playerName)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
myW->tabs.textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
myW->textBrowser_Log->append( "<i><span style=\"color:#"+myStyle->getLogNewGameAdminColor()+";\">"+playerName+" is game admin now!</span></i>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
|
|
||||||
logFileStreamString += "<i>"+playerName+" is game admin now!</i><br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::logPlayerJoinedMsg(QString playerName)
|
void guiLog::logPlayerJoinedMsg(QString playerName)
|
||||||
@@ -551,27 +301,11 @@ void guiLog::logSpectatorJoinedMsg(QString playerName)
|
|||||||
|
|
||||||
void guiLog::logPlayerWinGame(QString playerName, int gameID)
|
void guiLog::logPlayerWinGame(QString playerName, int gameID)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GUI_800x480
|
#ifdef GUI_800x480
|
||||||
myW->tabs.textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
myW->tabs.textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
||||||
#else
|
#else
|
||||||
myW->textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
myW->textBrowser_Log->append( "<i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b><br>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
|
|
||||||
logFileStreamString += "</br></br><i><b>"+playerName+" wins game " + QString::number(gameID,10) +"!</i></b></br>\n";
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList guiLog::translateCardCode(int cardCode)
|
QStringList guiLog::translateCardCode(int cardCode)
|
||||||
@@ -693,39 +427,6 @@ void guiLog::writeLog(string log_string, int modus)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guiLog::flushLogAtHand()
|
|
||||||
{
|
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
if(myConfig->readConfigInt("LogInterval") < 2) {
|
|
||||||
// write for log after every action and after every hand
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void guiLog::flushLogAtGame(int gameID)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(HTML_LOG) {
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
// write for log after every game
|
|
||||||
if(gameID > lastGameID) {
|
|
||||||
writeLogFileStream(logFileStreamString);
|
|
||||||
logFileStreamString = "";
|
|
||||||
lastGameID = gameID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void guiLog::exportLogPdbToHtml(QString fileStringPdb, QString exportFileString)
|
void guiLog::exportLogPdbToHtml(QString fileStringPdb, QString exportFileString)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -769,7 +470,7 @@ void guiLog::showLog(QString fileStringPdb, QTextBrowser *tb_tmp, int uniqueGame
|
|||||||
|
|
||||||
int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||||
{
|
{
|
||||||
bool neu = false;
|
bool neu = true;
|
||||||
|
|
||||||
result_struct results;
|
result_struct results;
|
||||||
results.result_Session = 0;
|
results.result_Session = 0;
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ public slots:
|
|||||||
void logSpectatorLeftMsg(QString playerName, int wasKicked);
|
void logSpectatorLeftMsg(QString playerName, int wasKicked);
|
||||||
void logSpectatorJoinedMsg(QString playerName);
|
void logSpectatorJoinedMsg(QString playerName);
|
||||||
void logPlayerWinGame(QString playerName, int gameID);
|
void logPlayerWinGame(QString playerName, int gameID);
|
||||||
void flushLogAtGame(int gameID);
|
|
||||||
void flushLogAtHand();
|
|
||||||
void exportLogPdbToHtml(QString fileStringPdb, QString exportFileString);
|
void exportLogPdbToHtml(QString fileStringPdb, QString exportFileString);
|
||||||
void exportLogPdbToTxt(QString fileStringPdb, QString exportFileString);
|
void exportLogPdbToTxt(QString fileStringPdb, QString exportFileString);
|
||||||
void showLog(QString fileStringPdb, QTextBrowser *tb, int uniqueGameID = 0);
|
void showLog(QString fileStringPdb, QTextBrowser *tb, int uniqueGameID = 0);
|
||||||
@@ -115,8 +113,6 @@ signals:
|
|||||||
void signalLogSpectatorJoinedMsg(QString playerName);
|
void signalLogSpectatorJoinedMsg(QString playerName);
|
||||||
void signalLogNewGameAdminMsg(QString playerName);
|
void signalLogNewGameAdminMsg(QString playerName);
|
||||||
void signalLogPlayerWinGame(QString playerName, int gameID);
|
void signalLogPlayerWinGame(QString playerName, int gameID);
|
||||||
void signalFlushLogAtGame(int gameID);
|
|
||||||
void signalFlushLogAtHand();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -287,14 +287,6 @@ void GuiWrapper::logPlayerWinGame(std::string playerName, int gameID)
|
|||||||
{
|
{
|
||||||
myGuiLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID);
|
myGuiLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID);
|
||||||
}
|
}
|
||||||
void GuiWrapper::flushLogAtGame(int gameID)
|
|
||||||
{
|
|
||||||
myGuiLog->signalFlushLogAtGame(gameID);
|
|
||||||
}
|
|
||||||
void GuiWrapper::flushLogAtHand()
|
|
||||||
{
|
|
||||||
myGuiLog->signalFlushLogAtHand();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiWrapper::SignalNetClientConnect(int actionID)
|
void GuiWrapper::SignalNetClientConnect(int actionID)
|
||||||
|
|||||||
@@ -124,8 +124,6 @@ public:
|
|||||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
|
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
|
||||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
||||||
void logPlayerWinGame(std::string playerName, int gameID);
|
void logPlayerWinGame(std::string playerName, int gameID);
|
||||||
void flushLogAtGame(int gameID);
|
|
||||||
void flushLogAtHand();
|
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientServerListAdd(unsigned serverId);
|
void SignalNetClientServerListAdd(unsigned serverId);
|
||||||
|
|||||||
@@ -771,12 +771,24 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
|
|||||||
QMessageBox::Close);
|
QMessageBox::Close);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ERR_SOCK_CONNECT_IPV6_FAILED: {
|
||||||
|
MyMessageBox::warning(this, tr("Network Error"),
|
||||||
|
tr("Could not connect to the server.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
|
||||||
|
QMessageBox::Close);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ERR_SOCK_CONNECT_TIMEOUT: {
|
case ERR_SOCK_CONNECT_TIMEOUT: {
|
||||||
MyMessageBox::warning(this, tr("Network Error"),
|
MyMessageBox::warning(this, tr("Network Error"),
|
||||||
tr("Connection timed out.\nPlease check the server address.\n\nIf the server is behind a NAT-Router, make sure port forwarding has been set up on server side."),
|
tr("Connection timed out.\nPlease check the server address.\n\nIf the server is behind a NAT-Router, make sure port forwarding has been set up on server side."),
|
||||||
QMessageBox::Close);
|
QMessageBox::Close);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ERR_SOCK_CONNECT_IPV6_TIMEOUT: {
|
||||||
|
MyMessageBox::warning(this, tr("Network Error"),
|
||||||
|
tr("Connection timed out.\nPlease check the server address.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
|
||||||
|
QMessageBox::Close);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ERR_SOCK_SELECT_FAILED: {
|
case ERR_SOCK_SELECT_FAILED: {
|
||||||
MyMessageBox::warning(this, tr("Network Error"),
|
MyMessageBox::warning(this, tr("Network Error"),
|
||||||
tr("Internal network error: \"select\" failed."),
|
tr("Internal network error: \"select\" failed."),
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -218,7 +219,7 @@ protected:
|
|||||||
|
|
||||||
ClientState &GetState();
|
ClientState &GetState();
|
||||||
void SetState(ClientState &newState);
|
void SetState(ClientState &newState);
|
||||||
boost::asio::deadline_timer &GetStateTimer();
|
boost::asio::steady_timer &GetStateTimer();
|
||||||
|
|
||||||
SenderHelper &GetSender();
|
SenderHelper &GetSender();
|
||||||
|
|
||||||
@@ -341,8 +342,8 @@ private:
|
|||||||
mutable boost::mutex m_pingDataMutex;
|
mutable boost::mutex m_pingDataMutex;
|
||||||
PingData m_pingData;
|
PingData m_pingData;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_stateTimer;
|
boost::asio::steady_timer m_stateTimer;
|
||||||
boost::asio::deadline_timer m_avatarTimer;
|
boost::asio::steady_timer m_avatarTimer;
|
||||||
|
|
||||||
friend class AbstractClientStateReceiving;
|
friend class AbstractClientStateReceiving;
|
||||||
friend class ClientStateInit;
|
friend class ClientStateInit;
|
||||||
|
|||||||
@@ -60,6 +60,12 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CLIENT_WAIT_TIMEOUT_MSEC 50
|
#define CLIENT_WAIT_TIMEOUT_MSEC 50
|
||||||
#define CLIENT_CONNECT_TIMEOUT_SEC 10
|
#define CLIENT_CONNECT_TIMEOUT_SEC 10
|
||||||
|
|
||||||
@@ -238,7 +244,7 @@ void
|
|||||||
ClientStateDownloadingServerList::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateDownloadingServerList::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -265,7 +271,7 @@ ClientStateDownloadingServerList::TimerLoop(const boost::system::error_code& ec,
|
|||||||
client->SetState(ClientStateReadingServerList::Instance());
|
client->SetState(ClientStateReadingServerList::Instance());
|
||||||
} else {
|
} else {
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateDownloadingServerList::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -409,7 +415,7 @@ void
|
|||||||
ClientStateWaitChooseServer::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateWaitChooseServer::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -432,7 +438,7 @@ ClientStateWaitChooseServer::TimerLoop(const boost::system::error_code& ec, boos
|
|||||||
client->SetState(ClientStateStartResolve::Instance());
|
client->SetState(ClientStateStartResolve::Instance());
|
||||||
} else {
|
} else {
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateWaitChooseServer::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -461,7 +467,7 @@ void
|
|||||||
ClientStateStartConnect::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateStartConnect::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::seconds(CLIENT_CONNECT_TIMEOUT_SEC));
|
seconds(CLIENT_CONNECT_TIMEOUT_SEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateStartConnect::TimerTimeout, this, boost::asio::placeholders::error, client));
|
&ClientStateStartConnect::TimerTimeout, this, boost::asio::placeholders::error, client));
|
||||||
@@ -511,7 +517,11 @@ ClientStateStartConnect::HandleConnect(const boost::system::error_code& ec, boos
|
|||||||
client));
|
client));
|
||||||
} else {
|
} else {
|
||||||
if (ec != boost::asio::error::operation_aborted) {
|
if (ec != boost::asio::error::operation_aborted) {
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_FAILED, ec.value());
|
if (client->GetContext().GetAddrFamily() == AF_INET6) {
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_FAILED, ec.value());
|
||||||
|
} else {
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_FAILED, ec.value());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,7 +533,11 @@ ClientStateStartConnect::TimerTimeout(const boost::system::error_code& ec, boost
|
|||||||
if (!ec && &client->GetState() == this) {
|
if (!ec && &client->GetState() == this) {
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
|
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
|
if (client->GetContext().GetAddrFamily() == AF_INET6) {
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_TIMEOUT, 0);
|
||||||
|
} else {
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,7 +1000,7 @@ void
|
|||||||
ClientStateWaitEnterLogin::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateWaitEnterLogin::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -1065,7 +1079,7 @@ ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -1399,7 +1413,7 @@ void
|
|||||||
ClientStateSynchronizeStart::Enter(boost::shared_ptr<ClientThread> client)
|
ClientStateSynchronizeStart::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
{
|
{
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateSynchronizeStart::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateSynchronizeStart::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -1429,7 +1443,7 @@ ClientStateSynchronizeStart::TimerLoop(const boost::system::error_code& ec, boos
|
|||||||
client->SetState(ClientStateWaitStart::Instance());
|
client->SetState(ClientStateWaitStart::Instance());
|
||||||
} else {
|
} else {
|
||||||
client->GetStateTimer().expires_from_now(
|
client->GetStateTimer().expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
client->GetStateTimer().async_wait(
|
client->GetStateTimer().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientStateSynchronizeStart::TimerLoop, this, boost::asio::placeholders::error, client));
|
&ClientStateSynchronizeStart::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
@@ -1637,7 +1651,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
|||||||
// Basic synchronisation before a new hand is started.
|
// Basic synchronisation before a new hand is started.
|
||||||
client->GetGui().waitForGuiUpdateDone();
|
client->GetGui().waitForGuiUpdateDone();
|
||||||
// Start new hand.
|
// Start new hand.
|
||||||
client->GetGame()->getSeatsList()->front()->setMyCards(myCards);
|
client->GetGame()->getSeatsList()->front()->setMyHoleCards(myCards);
|
||||||
client->GetGame()->initHand();
|
client->GetGame()->initHand();
|
||||||
client->GetGame()->getCurrentHand()->setSmallBlind(netHandStart.smallblind());
|
client->GetGame()->getCurrentHand()->setSmallBlind(netHandStart.smallblind());
|
||||||
client->GetGame()->getCurrentHand()->getCurrentBeRo()->setMinimumRaise(2 * netHandStart.smallblind());
|
client->GetGame()->getCurrentHand()->getCurrentBeRo()->setMinimumRaise(2 * netHandStart.smallblind());
|
||||||
@@ -1677,7 +1691,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
|||||||
int bestHandPos[5];
|
int bestHandPos[5];
|
||||||
tmpCards[0] = static_cast<int>(r.resultcard1());
|
tmpCards[0] = static_cast<int>(r.resultcard1());
|
||||||
tmpCards[1] = static_cast<int>(r.resultcard2());
|
tmpCards[1] = static_cast<int>(r.resultcard2());
|
||||||
tmpPlayer->setMyCards(tmpCards);
|
tmpPlayer->setMyHoleCards(tmpCards);
|
||||||
for (int num = 0; num < 5; num++) {
|
for (int num = 0; num < 5; num++) {
|
||||||
bestHandPos[num] = r.besthandposition(num);
|
bestHandPos[num] = r.besthandposition(num);
|
||||||
}
|
}
|
||||||
@@ -1794,7 +1808,6 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMySet(),
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMySet(),
|
||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(),
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyName(),
|
||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getBigBlindPositionId())->getMyName());
|
||||||
client->GetGui().flushLogAtHand();
|
|
||||||
client->GetClientLog()->logNewHandMsg(
|
client->GetClientLog()->logNewHandMsg(
|
||||||
curGame->getCurrentHandID(),
|
curGame->getCurrentHandID(),
|
||||||
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1,
|
curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1,
|
||||||
@@ -1926,7 +1939,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
int tmpCards[2];
|
int tmpCards[2];
|
||||||
tmpCards[0] = static_cast<int>(p.allincard1());
|
tmpCards[0] = static_cast<int>(p.allincard1());
|
||||||
tmpCards[1] = static_cast<int>(p.allincard2());
|
tmpCards[1] = static_cast<int>(p.allincard2());
|
||||||
tmpPlayer->setMyCards(tmpCards);
|
tmpPlayer->setMyHoleCards(tmpCards);
|
||||||
}
|
}
|
||||||
client->GetGui().flipHolecardsAllIn();
|
client->GetGui().flipHolecardsAllIn();
|
||||||
if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) {
|
if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) {
|
||||||
@@ -1998,7 +2011,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
|
|||||||
int bestHandPos[5];
|
int bestHandPos[5];
|
||||||
tmpCards[0] = static_cast<int>(r.resultcard1());
|
tmpCards[0] = static_cast<int>(r.resultcard1());
|
||||||
tmpCards[1] = static_cast<int>(r.resultcard2());
|
tmpCards[1] = static_cast<int>(r.resultcard2());
|
||||||
tmpPlayer->setMyCards(tmpCards);
|
tmpPlayer->setMyHoleCards(tmpCards);
|
||||||
for (int num = 0; num < 5; num++) {
|
for (int num = 0; num < 5; num++) {
|
||||||
bestHandPos[num] = r.besthandposition(num);
|
bestHandPos[num] = r.besthandposition(num);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,12 @@ using namespace std;
|
|||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
ClientThread::ClientThread(GuiInterface &gui, AvatarManager &avatarManager, Log *myLog)
|
ClientThread::ClientThread(GuiInterface &gui, AvatarManager &avatarManager, Log *myLog)
|
||||||
: m_ioService(new boost::asio::io_service), m_clientLog(myLog), m_curState(NULL), m_gui(gui),
|
: m_ioService(new boost::asio::io_service), m_clientLog(myLog), m_curState(NULL), m_gui(gui),
|
||||||
m_avatarManager(avatarManager), m_isServerSelected(false),
|
m_avatarManager(avatarManager), m_isServerSelected(false),
|
||||||
@@ -586,7 +592,7 @@ void
|
|||||||
ClientThread::RegisterTimers()
|
ClientThread::RegisterTimers()
|
||||||
{
|
{
|
||||||
m_avatarTimer.expires_from_now(
|
m_avatarTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
||||||
m_avatarTimer.async_wait(
|
m_avatarTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -910,7 +916,7 @@ ClientThread::TimerCheckAvatarDownloads(const boost::system::error_code& ec)
|
|||||||
PassAvatarFileToManager(playerId, tmpAvatar);
|
PassAvatarFileToManager(playerId, tmpAvatar);
|
||||||
}
|
}
|
||||||
m_avatarTimer.expires_from_now(
|
m_avatarTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
milliseconds(CLIENT_AVATAR_LOOP_MSEC));
|
||||||
m_avatarTimer.async_wait(
|
m_avatarTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
&ClientThread::TimerCheckAvatarDownloads, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -1022,7 +1028,7 @@ ClientThread::SetState(ClientState &newState)
|
|||||||
m_curState->Enter(shared_from_this());
|
m_curState->Enter(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::deadline_timer &
|
boost::asio::steady_timer &
|
||||||
ClientThread::GetStateTimer()
|
ClientThread::GetStateTimer()
|
||||||
{
|
{
|
||||||
return m_stateTimer;
|
return m_stateTimer;
|
||||||
|
|||||||
@@ -49,6 +49,12 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
ServerAdminBot::ServerAdminBot(boost::shared_ptr<boost::asio::io_service> ioService)
|
ServerAdminBot::ServerAdminBot(boost::shared_ptr<boost::asio::io_service> ioService)
|
||||||
: m_notifyTimeoutMinutes(0), m_notifyIntervalMinutes(0), m_notifyCounter(0),
|
: m_notifyTimeoutMinutes(0), m_notifyIntervalMinutes(0), m_notifyCounter(0),
|
||||||
m_notifyTimer(boost::posix_time::time_duration(0, 0, 0), boost::timers::portable::second_timer::manual_start),
|
m_notifyTimer(boost::posix_time::time_duration(0, 0, 0), boost::timers::portable::second_timer::manual_start),
|
||||||
@@ -272,17 +278,17 @@ ServerAdminBot::Run()
|
|||||||
if (m_ircAdminThread) {
|
if (m_ircAdminThread) {
|
||||||
// Initialise the timers.
|
// Initialise the timers.
|
||||||
m_reconnectTimer.expires_from_now(
|
m_reconnectTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||||
m_reconnectTimer.async_wait(
|
m_reconnectTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||||
m_notifyLoopTimer.expires_from_now(
|
m_notifyLoopTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
||||||
m_notifyLoopTimer.async_wait(
|
m_notifyLoopTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
||||||
m_checkFileTimer.expires_from_now(
|
m_checkFileTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_CHECK_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_CHECK_IRC_BOT_INTERVAL_SEC));
|
||||||
m_checkFileTimer.async_wait(
|
m_checkFileTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -298,7 +304,7 @@ ServerAdminBot::ReconnectHandler(const boost::system::error_code& ec)
|
|||||||
Reconnect();
|
Reconnect();
|
||||||
|
|
||||||
m_reconnectTimer.expires_from_now(
|
m_reconnectTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||||
m_reconnectTimer.async_wait(
|
m_reconnectTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::ReconnectHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -330,7 +336,7 @@ ServerAdminBot::CheckFileHandler(const boost::system::error_code& ec)
|
|||||||
Reconnect();
|
Reconnect();
|
||||||
}
|
}
|
||||||
m_checkFileTimer.expires_from_now(
|
m_checkFileTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_CHECK_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_CHECK_IRC_BOT_INTERVAL_SEC));
|
||||||
m_checkFileTimer.async_wait(
|
m_checkFileTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::CheckFileHandler, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -386,7 +392,7 @@ ServerAdminBot::NotifyLoop(const boost::system::error_code& ec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_notifyLoopTimer.expires_from_now(
|
m_notifyLoopTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_NOTIFY_IRC_BOT_INTERVAL_SEC));
|
||||||
m_notifyLoopTimer.async_wait(
|
m_notifyLoopTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
&ServerAdminBot::NotifyLoop, shared_from_this(), boost::asio::placeholders::error));
|
||||||
|
|||||||
@@ -34,6 +34,11 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
ServerBanManager::ServerBanManager(boost::shared_ptr<boost::asio::io_service> ioService)
|
ServerBanManager::ServerBanManager(boost::shared_ptr<boost::asio::io_service> ioService)
|
||||||
: m_ioService(ioService), m_curBanId(0)
|
: m_ioService(ioService), m_curBanId(0)
|
||||||
@@ -126,7 +131,7 @@ ServerBanManager::GetBanList(list<string> &list) const
|
|||||||
banText << (*i_nick).first << ": (nickStr) - " << (*i_nick).second.nameStr;
|
banText << (*i_nick).first << ": (nickStr) - " << (*i_nick).second.nameStr;
|
||||||
|
|
||||||
if ((*i_nick).second.timer)
|
if ((*i_nick).second.timer)
|
||||||
banText << " duration: " << (*i_nick).second.timer->expires_from_now().hours() << "h";
|
banText << " duration: " << duration_cast<hours>((*i_nick).second.timer->expires_from_now()).count() << "h";
|
||||||
list.push_back(banText.str());
|
list.push_back(banText.str());
|
||||||
++i_nick;
|
++i_nick;
|
||||||
}
|
}
|
||||||
@@ -136,7 +141,7 @@ ServerBanManager::GetBanList(list<string> &list) const
|
|||||||
ostringstream banText;
|
ostringstream banText;
|
||||||
banText << (*i_ip).first << ": (IP) - " << (*i_ip).second.ipAddress;
|
banText << (*i_ip).first << ": (IP) - " << (*i_ip).second.ipAddress;
|
||||||
if ((*i_ip).second.timer)
|
if ((*i_ip).second.timer)
|
||||||
banText << " duration: " << (*i_ip).second.timer->expires_from_now().hours() << "h";
|
banText << " duration: " << duration_cast<hours>((*i_ip).second.timer->expires_from_now()).count() << "h";
|
||||||
list.push_back(banText.str());
|
list.push_back(banText.str());
|
||||||
++i_ip;
|
++i_ip;
|
||||||
}
|
}
|
||||||
@@ -235,14 +240,14 @@ ServerBanManager::IsBadGameName(const std::string &name) const
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<boost::asio::deadline_timer>
|
boost::shared_ptr<boost::asio::steady_timer>
|
||||||
ServerBanManager::InternalRegisterTimedBan(unsigned timerId, unsigned durationHours)
|
ServerBanManager::InternalRegisterTimedBan(unsigned timerId, unsigned durationHours)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> tmpTimer;
|
boost::shared_ptr<boost::asio::steady_timer> tmpTimer;
|
||||||
if (durationHours) {
|
if (durationHours) {
|
||||||
tmpTimer.reset(new boost::asio::deadline_timer(*m_ioService));
|
tmpTimer.reset(new boost::asio::steady_timer(*m_ioService));
|
||||||
tmpTimer->expires_from_now(
|
tmpTimer->expires_from_now(
|
||||||
boost::posix_time::hours(durationHours));
|
hours(durationHours));
|
||||||
tmpTimer->async_wait(
|
tmpTimer->async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerBanManager::TimerRemoveBan, shared_from_this(), boost::asio::placeholders::error, timerId, tmpTimer));
|
&ServerBanManager::TimerRemoveBan, shared_from_this(), boost::asio::placeholders::error, timerId, tmpTimer));
|
||||||
@@ -251,7 +256,7 @@ ServerBanManager::InternalRegisterTimedBan(unsigned timerId, unsigned durationHo
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerBanManager::TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::deadline_timer> timer)
|
ServerBanManager::TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::steady_timer> timer)
|
||||||
{
|
{
|
||||||
if (!ec && timer)
|
if (!ec && timer)
|
||||||
UnBan(banId);
|
UnBan(banId);
|
||||||
|
|||||||
@@ -53,6 +53,12 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool LessThanPlayerHandStartMoney(const boost::shared_ptr<PlayerInterface> p1, const boost::shared_ptr<PlayerInterface> p2)
|
static bool LessThanPlayerHandStartMoney(const boost::shared_ptr<PlayerInterface> p1, const boost::shared_ptr<PlayerInterface> p2)
|
||||||
{
|
{
|
||||||
return p1->getMyRoundStartCash() < p2->getMyRoundStartCash();
|
return p1->getMyRoundStartCash() < p2->getMyRoundStartCash();
|
||||||
@@ -276,7 +282,7 @@ ServerGame::TimerVoteKick(const boost::system::error_code &ec)
|
|||||||
m_voteKickData.reset();
|
m_voteKickData.reset();
|
||||||
}
|
}
|
||||||
m_voteKickTimer.expires_from_now(
|
m_voteKickTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
||||||
m_voteKickTimer.async_wait(
|
m_voteKickTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -514,7 +520,7 @@ ServerGame::InternalAskVoteKick(boost::shared_ptr<SessionData> byWhom, unsigned
|
|||||||
SendToAllPlayers(packet, SessionData::Game);
|
SendToAllPlayers(packet, SessionData::Game);
|
||||||
|
|
||||||
m_voteKickTimer.expires_from_now(
|
m_voteKickTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
||||||
m_voteKickTimer.async_wait(
|
m_voteKickTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
&ServerGame::TimerVoteKick, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -1072,13 +1078,13 @@ ServerGame::SetState(ServerGameState &newState)
|
|||||||
m_curState->Enter(shared_from_this());
|
m_curState->Enter(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::deadline_timer &
|
boost::asio::steady_timer &
|
||||||
ServerGame::GetStateTimer1()
|
ServerGame::GetStateTimer1()
|
||||||
{
|
{
|
||||||
return m_stateTimer1;
|
return m_stateTimer1;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::deadline_timer &
|
boost::asio::steady_timer &
|
||||||
ServerGame::GetStateTimer2()
|
ServerGame::GetStateTimer2()
|
||||||
{
|
{
|
||||||
return m_stateTimer2;
|
return m_stateTimer2;
|
||||||
|
|||||||
@@ -52,6 +52,12 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define POKERTH_SERVER_TEST
|
//#define POKERTH_SERVER_TEST
|
||||||
|
|
||||||
#ifdef POKERTH_SERVER_TEST
|
#ifdef POKERTH_SERVER_TEST
|
||||||
@@ -204,7 +210,7 @@ SetPlayerResult(PlayerResult &playerResult, boost::shared_ptr<PlayerInterface> t
|
|||||||
playerResult.set_playerid(tmpPlayer->getMyUniqueID());
|
playerResult.set_playerid(tmpPlayer->getMyUniqueID());
|
||||||
int tmpCards[2];
|
int tmpCards[2];
|
||||||
int bestHandPos[5];
|
int bestHandPos[5];
|
||||||
tmpPlayer->getMyCards(tmpCards);
|
tmpPlayer->getMyHoleCards(tmpCards);
|
||||||
playerResult.set_resultcard1(tmpCards[0]);
|
playerResult.set_resultcard1(tmpCards[0]);
|
||||||
playerResult.set_resultcard2(tmpCards[1]);
|
playerResult.set_resultcard2(tmpCards[1]);
|
||||||
tmpPlayer->getMyBestHandPosition(bestHandPos);
|
tmpPlayer->getMyBestHandPosition(bestHandPos);
|
||||||
@@ -570,7 +576,7 @@ ServerGameStateInit::RegisterAdminTimer(boost::shared_ptr<ServerGame> server)
|
|||||||
// No admin timeout in LAN or ranking games.
|
// No admin timeout in LAN or ranking games.
|
||||||
if (server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN && server->GetGameData().gameType != GAME_TYPE_RANKING) {
|
if (server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN && server->GetGameData().gameType != GAME_TYPE_RANKING) {
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_GAME_ADMIN_TIMEOUT_SEC - SERVER_GAME_ADMIN_WARNING_REMAINING_SEC));
|
seconds(SERVER_GAME_ADMIN_TIMEOUT_SEC - SERVER_GAME_ADMIN_WARNING_REMAINING_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateInit::TimerAdminWarning, this, boost::asio::placeholders::error, server));
|
&ServerGameStateInit::TimerAdminWarning, this, boost::asio::placeholders::error, server));
|
||||||
@@ -589,7 +595,7 @@ ServerGameStateInit::RegisterAutoStartTimer(boost::shared_ptr<ServerGame> server
|
|||||||
// No autostart in LAN games.
|
// No autostart in LAN games.
|
||||||
if (server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN) {
|
if (server->GetLobbyThread().GetServerMode() != SERVER_MODE_LAN) {
|
||||||
server->GetStateTimer2().expires_from_now(
|
server->GetStateTimer2().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_AUTOSTART_GAME_DELAY_SEC));
|
seconds(SERVER_AUTOSTART_GAME_DELAY_SEC));
|
||||||
server->GetStateTimer2().async_wait(
|
server->GetStateTimer2().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateInit::TimerAutoStart, this, boost::asio::placeholders::error, server));
|
&ServerGameStateInit::TimerAutoStart, this, boost::asio::placeholders::error, server));
|
||||||
@@ -627,7 +633,7 @@ ServerGameStateInit::TimerAdminWarning(const boost::system::error_code &ec, boos
|
|||||||
}
|
}
|
||||||
// Start timeout timer.
|
// Start timeout timer.
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_GAME_ADMIN_WARNING_REMAINING_SEC));
|
seconds(SERVER_GAME_ADMIN_WARNING_REMAINING_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateInit::TimerAdminTimeout, this, boost::asio::placeholders::error, server));
|
&ServerGameStateInit::TimerAdminTimeout, this, boost::asio::placeholders::error, server));
|
||||||
@@ -762,7 +768,7 @@ void
|
|||||||
ServerGameStateStartGame::Enter(boost::shared_ptr<ServerGame> server)
|
ServerGameStateStartGame::Enter(boost::shared_ptr<ServerGame> server)
|
||||||
{
|
{
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_START_GAME_TIMEOUT_SEC));
|
seconds(SERVER_START_GAME_TIMEOUT_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateStartGame::TimerTimeout, this, boost::asio::placeholders::error, server));
|
&ServerGameStateStartGame::TimerTimeout, this, boost::asio::placeholders::error, server));
|
||||||
@@ -925,7 +931,7 @@ void
|
|||||||
ServerGameStateHand::Enter(boost::shared_ptr<ServerGame> server)
|
ServerGameStateHand::Enter(boost::shared_ptr<ServerGame> server)
|
||||||
{
|
{
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_LOOP_DELAY_MSEC));
|
milliseconds(SERVER_LOOP_DELAY_MSEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||||
@@ -993,7 +999,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
AllInShowCardsMessage::PlayerAllIn *playerAllIn = netAllInShow->add_playersallin();
|
AllInShowCardsMessage::PlayerAllIn *playerAllIn = netAllInShow->add_playersallin();
|
||||||
playerAllIn->set_playerid((*i)->getMyUniqueID());
|
playerAllIn->set_playerid((*i)->getMyUniqueID());
|
||||||
int tmpCards[2];
|
int tmpCards[2];
|
||||||
(*i)->getMyCards(tmpCards);
|
(*i)->getMyHoleCards(tmpCards);
|
||||||
playerAllIn->set_allincard1(tmpCards[0]);
|
playerAllIn->set_allincard1(tmpCards[0]);
|
||||||
playerAllIn->set_allincard2(tmpCards[1]);
|
playerAllIn->set_allincard2(tmpCards[1]);
|
||||||
++i;
|
++i;
|
||||||
@@ -1002,7 +1008,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
curGame.getCurrentHand()->setCardsShown(true);
|
curGame.getCurrentHand()->setCardsShown(true);
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_SHOW_CARDS_DELAY_SEC));
|
seconds(SERVER_SHOW_CARDS_DELAY_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerShowCards, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerShowCards, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1010,7 +1016,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
SendNewRoundCards(*server, curGame, newRound);
|
SendNewRoundCards(*server, curGame, newRound);
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(GetDealCardsDelaySec(*server)));
|
seconds(GetDealCardsDelaySec(*server)));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1038,7 +1044,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
// If the player is computer controlled, let the engine act.
|
// If the player is computer controlled, let the engine act.
|
||||||
if (curPlayer->getMyType() == PLAYER_TYPE_COMPUTER) {
|
if (curPlayer->getMyType() == PLAYER_TYPE_COMPUTER) {
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_COMPUTER_ACTION_DELAY_SEC));
|
seconds(SERVER_COMPUTER_ACTION_DELAY_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerComputerAction, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerComputerAction, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1049,7 +1055,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
PerformPlayerAction(*server, curPlayer, PLAYER_ACTION_FOLD, 0);
|
PerformPlayerAction(*server, curPlayer, PLAYER_ACTION_FOLD, 0);
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_LOOP_DELAY_MSEC));
|
milliseconds(SERVER_LOOP_DELAY_MSEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1117,7 +1123,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
|
|||||||
|
|
||||||
// View a dialog for a new game - delayed.
|
// View a dialog for a new game - delayed.
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_DELAY_NEXT_GAME_SEC));
|
seconds(SERVER_DELAY_NEXT_GAME_SEC));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerNextGame, this, boost::asio::placeholders::error, server, winnerPlayer->getMyUniqueID()));
|
&ServerGameStateHand::TimerNextGame, this, boost::asio::placeholders::error, server, winnerPlayer->getMyUniqueID()));
|
||||||
@@ -1136,7 +1142,7 @@ ServerGameStateHand::TimerShowCards(const boost::system::error_code &ec, boost::
|
|||||||
SendNewRoundCards(*server, curGame, curGame.getCurrentHand()->getCurrentRound());
|
SendNewRoundCards(*server, curGame, curGame.getCurrentHand()->getCurrentRound());
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(GetDealCardsDelaySec(*server)));
|
seconds(GetDealCardsDelaySec(*server)));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
&ServerGameStateHand::TimerLoop, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1251,7 +1257,7 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
|
|||||||
if (tmpSession) {
|
if (tmpSession) {
|
||||||
int cards[2];
|
int cards[2];
|
||||||
bool errorFlag = false;
|
bool errorFlag = false;
|
||||||
tmpPlayer->getMyCards(cards);
|
tmpPlayer->getMyHoleCards(cards);
|
||||||
|
|
||||||
boost::shared_ptr<NetPacket> notifyCards = CreateNetPacketHandStart(*server);
|
boost::shared_ptr<NetPacket> notifyCards = CreateNetPacketHandStart(*server);
|
||||||
HandStartMessage *netHandStart = notifyCards->GetMsg()->mutable_handstartmessage();
|
HandStartMessage *netHandStart = notifyCards->GetMsg()->mutable_handstartmessage();
|
||||||
@@ -1507,7 +1513,7 @@ ServerGameStateWaitPlayerAction::Enter(boost::shared_ptr<ServerGame> server)
|
|||||||
int timeoutSec = server->GetGameData().playerActionTimeoutSec + SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
|
int timeoutSec = server->GetGameData().playerActionTimeoutSec + SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(boost::posix_time::seconds(timeoutSec));
|
server->GetStateTimer1().expires_from_now(seconds(timeoutSec));
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerGameStateWaitPlayerAction::TimerTimeout, this, boost::asio::placeholders::error, server));
|
&ServerGameStateWaitPlayerAction::TimerTimeout, this, boost::asio::placeholders::error, server));
|
||||||
@@ -1641,7 +1647,7 @@ ServerGameStateWaitNextHand::Enter(boost::shared_ptr<ServerGame> server)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
server->GetStateTimer1().expires_from_now(
|
server->GetStateTimer1().expires_from_now(
|
||||||
boost::posix_time::seconds(timeoutSec));
|
seconds(timeoutSec));
|
||||||
|
|
||||||
server->GetStateTimer1().async_wait(
|
server->GetStateTimer1().async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
|
|||||||
@@ -45,6 +45,12 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
ServerLobbyBot::ServerLobbyBot(boost::shared_ptr<boost::asio::io_service> ioService)
|
ServerLobbyBot::ServerLobbyBot(boost::shared_ptr<boost::asio::io_service> ioService)
|
||||||
: m_reconnectTimer(*ioService)
|
: m_reconnectTimer(*ioService)
|
||||||
{
|
{
|
||||||
@@ -110,7 +116,7 @@ ServerLobbyBot::Run()
|
|||||||
if (m_ircLobbyThread) {
|
if (m_ircLobbyThread) {
|
||||||
// Initialise the reconnect timer.
|
// Initialise the reconnect timer.
|
||||||
m_reconnectTimer.expires_from_now(
|
m_reconnectTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||||
m_reconnectTimer.async_wait(
|
m_reconnectTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -132,7 +138,7 @@ ServerLobbyBot::Reconnect(const boost::system::error_code& ec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_reconnectTimer.expires_from_now(
|
m_reconnectTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
seconds(SERVER_RESTART_IRC_BOT_INTERVAL_SEC));
|
||||||
m_reconnectTimer.async_wait(
|
m_reconnectTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyBot::Reconnect, shared_from_this(), boost::asio::placeholders::error));
|
||||||
|
|||||||
@@ -95,6 +95,11 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
class InternalServerCallback : public SessionDataCallback, public ChatCleanerCallback, public ServerDBCallback
|
class InternalServerCallback : public SessionDataCallback, public ChatCleanerCallback, public ServerDBCallback
|
||||||
{
|
{
|
||||||
@@ -859,19 +864,19 @@ ServerLobbyThread::RegisterTimers()
|
|||||||
{
|
{
|
||||||
// Remove closed games.
|
// Remove closed games.
|
||||||
m_removeGameTimer.expires_from_now(
|
m_removeGameTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
||||||
m_removeGameTimer.async_wait(
|
m_removeGameTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
||||||
// Update the statistics file.
|
// Update the statistics file.
|
||||||
m_saveStatisticsTimer.expires_from_now(
|
m_saveStatisticsTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
||||||
m_saveStatisticsTimer.async_wait(
|
m_saveStatisticsTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
||||||
// Update the avatar upload locks.
|
// Update the avatar upload locks.
|
||||||
m_loginLockTimer.expires_from_now(
|
m_loginLockTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_UPDATE_LOGIN_LOCK_INTERVAL_MSEC));
|
milliseconds(SERVER_UPDATE_LOGIN_LOCK_INTERVAL_MSEC));
|
||||||
m_loginLockTimer.async_wait(
|
m_loginLockTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -1859,7 +1864,7 @@ ServerLobbyThread::TimerRemoveGame(const boost::system::error_code &ec)
|
|||||||
}
|
}
|
||||||
// Restart timer
|
// Restart timer
|
||||||
m_removeGameTimer.expires_from_now(
|
m_removeGameTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
milliseconds(SERVER_REMOVE_GAME_INTERVAL_MSEC));
|
||||||
m_removeGameTimer.async_wait(
|
m_removeGameTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -1884,7 +1889,7 @@ ServerLobbyThread::TimerUpdateClientLoginLock(const boost::system::error_code &e
|
|||||||
}
|
}
|
||||||
// Restart timer
|
// Restart timer
|
||||||
m_loginLockTimer.expires_from_now(
|
m_loginLockTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(SERVER_UPDATE_LOGIN_LOCK_INTERVAL_MSEC));
|
milliseconds(SERVER_UPDATE_LOGIN_LOCK_INTERVAL_MSEC));
|
||||||
m_loginLockTimer.async_wait(
|
m_loginLockTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerUpdateClientLoginLock, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -2231,7 +2236,7 @@ ServerLobbyThread::TimerSaveStatisticsFile(const boost::system::error_code &ec)
|
|||||||
}
|
}
|
||||||
// Restart timer
|
// Restart timer
|
||||||
m_saveStatisticsTimer.expires_from_now(
|
m_saveStatisticsTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC));
|
||||||
m_saveStatisticsTimer.async_wait(
|
m_saveStatisticsTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
&ServerLobbyThread::TimerSaveStatisticsFile, shared_from_this(), boost::asio::placeholders::error));
|
||||||
|
|||||||
@@ -41,6 +41,12 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
|
#ifdef BOOST_ASIO_HAS_STD_CHRONO
|
||||||
|
using namespace std::chrono;
|
||||||
|
#else
|
||||||
|
using namespace boost::chrono;
|
||||||
|
#endif
|
||||||
|
|
||||||
SessionData::SessionData(boost::shared_ptr<boost::asio::ip::tcp::socket> sock, SessionId id, SessionDataCallback &cb, boost::asio::io_service &ioService)
|
SessionData::SessionData(boost::shared_ptr<boost::asio::ip::tcp::socket> sock, SessionId id, SessionDataCallback &cb, boost::asio::io_service &ioService)
|
||||||
: m_socket(sock), m_id(id), m_state(SessionData::Init), m_readyFlag(false), m_wantsLobbyMsg(true),
|
: m_socket(sock), m_id(id), m_state(SessionData::Init), m_readyFlag(false), m_wantsLobbyMsg(true),
|
||||||
m_activityTimeoutSec(0), m_activityWarningRemainingSec(0), m_initTimeoutTimer(ioService), m_globalTimeoutTimer(ioService),
|
m_activityTimeoutSec(0), m_activityWarningRemainingSec(0), m_initTimeoutTimer(ioService), m_globalTimeoutTimer(ioService),
|
||||||
@@ -236,7 +242,7 @@ SessionData::TimerActivityWarning(const boost::system::error_code &ec)
|
|||||||
m_callback.SessionTimeoutWarning(shared_from_this(), m_activityWarningRemainingSec);
|
m_callback.SessionTimeoutWarning(shared_from_this(), m_activityWarningRemainingSec);
|
||||||
|
|
||||||
m_activityTimeoutTimer.expires_from_now(
|
m_activityTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(m_activityWarningRemainingSec));
|
seconds(m_activityWarningRemainingSec));
|
||||||
m_activityTimeoutTimer.async_wait(
|
m_activityTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -322,7 +328,7 @@ SessionData::ResetActivityTimer()
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||||
m_activityTimeoutTimer.expires_from_now(
|
m_activityTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(m_activityTimeoutSec - m_activityWarningRemainingSec));
|
seconds(m_activityTimeoutSec - m_activityWarningRemainingSec));
|
||||||
m_activityTimeoutTimer.async_wait(
|
m_activityTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -333,7 +339,7 @@ SessionData::StartTimerInitTimeout(unsigned timeoutSec)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||||
m_initTimeoutTimer.expires_from_now(
|
m_initTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(timeoutSec));
|
seconds(timeoutSec));
|
||||||
m_initTimeoutTimer.async_wait(
|
m_initTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerInitTimeout, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerInitTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -344,7 +350,7 @@ SessionData::StartTimerGlobalTimeout(unsigned timeoutSec)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_dataMutex);
|
boost::mutex::scoped_lock lock(m_dataMutex);
|
||||||
m_globalTimeoutTimer.expires_from_now(
|
m_globalTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(timeoutSec));
|
seconds(timeoutSec));
|
||||||
m_globalTimeoutTimer.async_wait(
|
m_globalTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerSessionTimeout, shared_from_this(), boost::asio::placeholders::error));
|
||||||
@@ -358,7 +364,7 @@ SessionData::StartTimerActivityTimeout(unsigned timeoutSec, unsigned warningRema
|
|||||||
m_activityWarningRemainingSec = warningRemainingSec;
|
m_activityWarningRemainingSec = warningRemainingSec;
|
||||||
|
|
||||||
m_activityTimeoutTimer.expires_from_now(
|
m_activityTimeoutTimer.expires_from_now(
|
||||||
boost::posix_time::seconds(timeoutSec - warningRemainingSec));
|
seconds(timeoutSec - warningRemainingSec));
|
||||||
m_activityTimeoutTimer.async_wait(
|
m_activityTimeoutTimer.async_wait(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
&SessionData::TimerActivityWarning, shared_from_this(), boost::asio::placeholders::error));
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define _SERVERADMINBOT_H_
|
#define _SERVERADMINBOT_H_
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <third_party/boost/timers.hpp>
|
#include <third_party/boost/timers.hpp>
|
||||||
@@ -96,9 +97,9 @@ private:
|
|||||||
boost::shared_ptr<IrcThread> m_ircAdminThread;
|
boost::shared_ptr<IrcThread> m_ircAdminThread;
|
||||||
boost::timers::portable::second_timer m_notifyTimer;
|
boost::timers::portable::second_timer m_notifyTimer;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_reconnectTimer;
|
boost::asio::steady_timer m_reconnectTimer;
|
||||||
boost::asio::deadline_timer m_notifyLoopTimer;
|
boost::asio::steady_timer m_notifyLoopTimer;
|
||||||
boost::asio::deadline_timer m_checkFileTimer;
|
boost::asio::steady_timer m_checkFileTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <db/dbdefs.h>
|
#include <db/dbdefs.h>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
@@ -67,12 +68,12 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
struct TimedPlayerBan {
|
struct TimedPlayerBan {
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> timer;
|
boost::shared_ptr<boost::asio::steady_timer> timer;
|
||||||
std::string nameStr;
|
std::string nameStr;
|
||||||
boost::regex nameRegex;
|
boost::regex nameRegex;
|
||||||
};
|
};
|
||||||
struct TimedIPBan {
|
struct TimedIPBan {
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> timer;
|
boost::shared_ptr<boost::asio::steady_timer> timer;
|
||||||
std::string ipAddress;
|
std::string ipAddress;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,8 +82,8 @@ protected:
|
|||||||
typedef std::list<boost::regex> RegexList;
|
typedef std::list<boost::regex> RegexList;
|
||||||
typedef std::vector<DB_id> DBPlayerIdList;
|
typedef std::vector<DB_id> DBPlayerIdList;
|
||||||
|
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> InternalRegisterTimedBan(unsigned timerId, unsigned durationHours);
|
boost::shared_ptr<boost::asio::steady_timer> InternalRegisterTimedBan(unsigned timerId, unsigned durationHours);
|
||||||
void TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::deadline_timer> timer);
|
void TimerRemoveBan(const boost::system::error_code &ec, unsigned banId, boost::shared_ptr<boost::asio::steady_timer> timer);
|
||||||
|
|
||||||
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define _SERVERGAME_H_
|
#define _SERVERGAME_H_
|
||||||
|
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <third_party/boost/timers.hpp>
|
#include <third_party/boost/timers.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@@ -177,8 +178,8 @@ protected:
|
|||||||
ServerGameState &GetState();
|
ServerGameState &GetState();
|
||||||
void SetState(ServerGameState &newState);
|
void SetState(ServerGameState &newState);
|
||||||
|
|
||||||
boost::asio::deadline_timer &GetStateTimer1();
|
boost::asio::steady_timer &GetStateTimer1();
|
||||||
boost::asio::deadline_timer &GetStateTimer2();
|
boost::asio::steady_timer &GetStateTimer2();
|
||||||
|
|
||||||
const StartData &GetStartData() const;
|
const StartData &GetStartData() const;
|
||||||
void SetStartData(const StartData &startData);
|
void SetStartData(const StartData &startData);
|
||||||
@@ -237,9 +238,9 @@ private:
|
|||||||
ConfigFile &m_playerConfig;
|
ConfigFile &m_playerConfig;
|
||||||
unsigned m_gameNum;
|
unsigned m_gameNum;
|
||||||
unsigned m_curPetitionId;
|
unsigned m_curPetitionId;
|
||||||
boost::asio::deadline_timer m_voteKickTimer;
|
boost::asio::steady_timer m_voteKickTimer;
|
||||||
boost::asio::deadline_timer m_stateTimer1;
|
boost::asio::steady_timer m_stateTimer1;
|
||||||
boost::asio::deadline_timer m_stateTimer2;
|
boost::asio::steady_timer m_stateTimer2;
|
||||||
bool m_isNameReported;
|
bool m_isNameReported;
|
||||||
|
|
||||||
friend class ServerLobbyThread;
|
friend class ServerLobbyThread;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define _SERVERLOBBYBOT_H_
|
#define _SERVERLOBBYBOT_H_
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
@@ -86,7 +87,7 @@ private:
|
|||||||
boost::shared_ptr<ServerLobbyThread> m_lobbyThread;
|
boost::shared_ptr<ServerLobbyThread> m_lobbyThread;
|
||||||
boost::shared_ptr<IrcThread> m_ircLobbyThread;
|
boost::shared_ptr<IrcThread> m_ircLobbyThread;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_reconnectTimer;
|
boost::asio::steady_timer m_reconnectTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define _SERVERLOBBYTHREAD_H_
|
#define _SERVERLOBBYTHREAD_H_
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <boost/uuid/uuid_generators.hpp>
|
#include <boost/uuid/uuid_generators.hpp>
|
||||||
|
|
||||||
@@ -268,9 +269,9 @@ private:
|
|||||||
boost::shared_ptr<ChatCleanerManager> m_chatCleanerManager;
|
boost::shared_ptr<ChatCleanerManager> m_chatCleanerManager;
|
||||||
boost::shared_ptr<ServerDBInterface> m_database;
|
boost::shared_ptr<ServerDBInterface> m_database;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_removeGameTimer;
|
boost::asio::steady_timer m_removeGameTimer;
|
||||||
boost::asio::deadline_timer m_saveStatisticsTimer;
|
boost::asio::steady_timer m_saveStatisticsTimer;
|
||||||
boost::asio::deadline_timer m_loginLockTimer;
|
boost::asio::steady_timer m_loginLockTimer;
|
||||||
|
|
||||||
boost::uuids::random_generator m_sessionIdGenerator;
|
boost::uuids::random_generator m_sessionIdGenerator;
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
typedef unsigned SessionId;
|
typedef unsigned SessionId;
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -144,9 +145,9 @@ private:
|
|||||||
bool m_wantsLobbyMsg;
|
bool m_wantsLobbyMsg;
|
||||||
unsigned m_activityTimeoutSec;
|
unsigned m_activityTimeoutSec;
|
||||||
unsigned m_activityWarningRemainingSec;
|
unsigned m_activityWarningRemainingSec;
|
||||||
boost::asio::deadline_timer m_initTimeoutTimer;
|
boost::asio::steady_timer m_initTimeoutTimer;
|
||||||
boost::asio::deadline_timer m_globalTimeoutTimer;
|
boost::asio::steady_timer m_globalTimeoutTimer;
|
||||||
boost::asio::deadline_timer m_activityTimeoutTimer;
|
boost::asio::steady_timer m_activityTimeoutTimer;
|
||||||
SessionDataCallback &m_callback;
|
SessionDataCallback &m_callback;
|
||||||
Gsasl_session *m_authSession;
|
Gsasl_session *m_authSession;
|
||||||
int m_curAuthStep;
|
int m_curAuthStep;
|
||||||
|
|||||||
@@ -61,6 +61,8 @@
|
|||||||
#define ERR_SOCK_TRANSFER_INVALID_URL 26
|
#define ERR_SOCK_TRANSFER_INVALID_URL 26
|
||||||
#define ERR_SOCK_TRANSFER_SELECT_FAILED 27
|
#define ERR_SOCK_TRANSFER_SELECT_FAILED 27
|
||||||
#define ERR_SOCK_TRANSFER_FAILED 28
|
#define ERR_SOCK_TRANSFER_FAILED 28
|
||||||
|
#define ERR_SOCK_CONNECT_IPV6_FAILED 29
|
||||||
|
#define ERR_SOCK_CONNECT_IPV6_TIMEOUT 30
|
||||||
// The following errors are game errors.
|
// The following errors are game errors.
|
||||||
#define ERR_NET_VERSION_NOT_SUPPORTED 101
|
#define ERR_NET_VERSION_NOT_SUPPORTED 101
|
||||||
#define ERR_NET_SERVER_MAINTENANCE 102
|
#define ERR_NET_SERVER_MAINTENANCE 102
|
||||||
|
|||||||
Reference in New Issue
Block a user