2011-07-02 14:45:12 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
|
* PokerTH - The open source texas holdem engine *
|
2012-12-25 15:06:23 +01:00
|
|
|
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
2011-07-02 14:45:12 +00:00
|
|
|
* *
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU Affero General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
2012-12-25 15:06:23 +01:00
|
|
|
* *
|
|
|
|
|
* *
|
|
|
|
|
* Additional permission under GNU AGPL version 3 section 7 *
|
|
|
|
|
* *
|
|
|
|
|
* If you modify this program, or any covered work, by linking or *
|
|
|
|
|
* combining it with the OpenSSL project's OpenSSL library (or a *
|
|
|
|
|
* modified version of that library), containing parts covered by the *
|
|
|
|
|
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
|
|
|
|
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
|
|
|
|
* permission to convey the resulting work. *
|
|
|
|
|
* Corresponding Source for a non-source form of such a combination *
|
|
|
|
|
* shall include the source code for the parts of OpenSSL used as well *
|
|
|
|
|
* as that of the covered work. *
|
2011-07-02 14:45:12 +00:00
|
|
|
*****************************************************************************/
|
2007-11-16 15:24:25 +00:00
|
|
|
/* Game data. */
|
|
|
|
|
|
|
|
|
|
#ifndef _GAMEDATA_H_
|
|
|
|
|
#define _GAMEDATA_H_
|
|
|
|
|
|
2009-05-07 22:36:51 +00:00
|
|
|
#include <list>
|
|
|
|
|
#include <string>
|
2013-08-29 17:26:08 +02:00
|
|
|
#ifndef Q_MOC_RUN
|
2008-11-16 22:57:11 +00:00
|
|
|
#include <third_party/boost/timers.hpp>
|
2013-08-29 17:26:08 +02:00
|
|
|
#endif
|
2007-11-16 15:24:25 +00:00
|
|
|
|
2009-05-07 22:36:51 +00:00
|
|
|
typedef std::list<unsigned> PlayerIdList;
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
enum GameMode {
|
2007-11-16 15:24:25 +00:00
|
|
|
GAME_MODE_CREATED = 1,
|
|
|
|
|
GAME_MODE_STARTED,
|
|
|
|
|
GAME_MODE_CLOSED
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
enum GameType {
|
2010-03-26 22:15:27 +00:00
|
|
|
GAME_TYPE_NORMAL = 1,
|
|
|
|
|
GAME_TYPE_REGISTERED_ONLY,
|
|
|
|
|
GAME_TYPE_INVITE_ONLY,
|
|
|
|
|
GAME_TYPE_RANKING
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
enum RaiseIntervalMode {
|
2007-11-16 15:24:25 +00:00
|
|
|
RAISE_ON_HANDNUMBER = 1,
|
|
|
|
|
RAISE_ON_MINUTES
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
enum RaiseMode {
|
2007-11-16 15:24:25 +00:00
|
|
|
DOUBLE_BLINDS = 1,
|
|
|
|
|
MANUAL_BLINDS_ORDER
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
enum AfterManualBlindsMode {
|
2007-11-16 15:24:25 +00:00
|
|
|
AFTERMB_DOUBLE_BLINDS = 1,
|
|
|
|
|
AFTERMB_RAISE_ABOUT,
|
|
|
|
|
AFTERMB_STAY_AT_LAST_BLIND
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// For the sake of simplicity, this is a struct.
|
2011-02-11 20:02:08 +00:00
|
|
|
struct GameData {
|
2010-03-26 22:15:27 +00:00
|
|
|
GameData() : gameType(GAME_TYPE_NORMAL), maxNumberOfPlayers(0), startMoney(0),
|
|
|
|
|
firstSmallBlind(0), raiseIntervalMode(RAISE_ON_HANDNUMBER),
|
|
|
|
|
raiseSmallBlindEveryHandsValue(8), raiseSmallBlindEveryMinutesValue(1),
|
|
|
|
|
raiseMode(DOUBLE_BLINDS), afterManualBlindsMode(AFTERMB_DOUBLE_BLINDS),
|
2010-10-26 21:32:39 +00:00
|
|
|
afterMBAlwaysRaiseValue(0), guiSpeed(4), delayBetweenHandsSec(6),
|
|
|
|
|
playerActionTimeoutSec(20) {}
|
2010-03-26 22:15:27 +00:00
|
|
|
GameType gameType;
|
2007-11-16 15:24:25 +00:00
|
|
|
int maxNumberOfPlayers;
|
|
|
|
|
int startMoney;
|
|
|
|
|
int firstSmallBlind;
|
|
|
|
|
RaiseIntervalMode raiseIntervalMode;
|
|
|
|
|
int raiseSmallBlindEveryHandsValue;
|
|
|
|
|
int raiseSmallBlindEveryMinutesValue;
|
|
|
|
|
RaiseMode raiseMode;
|
|
|
|
|
std::list<int> manualBlindsList;
|
|
|
|
|
AfterManualBlindsMode afterManualBlindsMode;
|
|
|
|
|
int afterMBAlwaysRaiseValue;
|
|
|
|
|
int guiSpeed;
|
2009-10-24 21:49:11 +00:00
|
|
|
int delayBetweenHandsSec;
|
2007-11-16 15:24:25 +00:00
|
|
|
int playerActionTimeoutSec;
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
struct GameInfo {
|
2007-11-16 15:24:25 +00:00
|
|
|
GameInfo() : mode(GAME_MODE_CREATED), adminPlayerId(0), isPasswordProtected(false) {}
|
|
|
|
|
std::string name;
|
|
|
|
|
GameData data;
|
|
|
|
|
GameMode mode;
|
|
|
|
|
unsigned adminPlayerId;
|
|
|
|
|
PlayerIdList players;
|
2013-08-19 22:50:56 +02:00
|
|
|
PlayerIdList spectators;
|
2013-09-29 13:15:37 +02:00
|
|
|
PlayerIdList spectatorsDuringGame;
|
2007-11-16 15:24:25 +00:00
|
|
|
bool isPasswordProtected;
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
struct StartData {
|
2007-11-16 15:24:25 +00:00
|
|
|
StartData() : startDealerPlayerId(0), numberOfPlayers(0) {}
|
|
|
|
|
unsigned startDealerPlayerId;
|
|
|
|
|
int numberOfPlayers;
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-11 20:02:08 +00:00
|
|
|
struct VoteKickData {
|
2008-11-25 22:18:17 +00:00
|
|
|
VoteKickData()
|
2011-02-11 20:02:08 +00:00
|
|
|
: petitionId(0), kickPlayerId(0), numVotesToKick(0),
|
|
|
|
|
numVotesInFavourOfKicking(0), numVotesAgainstKicking(0), timeLimitSec(0),
|
|
|
|
|
voteTimer(boost::posix_time::time_duration(0, 0, 0), boost::timers::portable::microsec_timer::auto_start) {}
|
2008-11-16 22:57:11 +00:00
|
|
|
unsigned petitionId;
|
|
|
|
|
unsigned kickPlayerId;
|
2008-12-06 21:10:46 +00:00
|
|
|
int numVotesToKick;
|
|
|
|
|
int numVotesInFavourOfKicking;
|
|
|
|
|
int numVotesAgainstKicking;
|
2008-12-07 11:04:42 +00:00
|
|
|
int timeLimitSec;
|
2008-11-16 22:57:11 +00:00
|
|
|
boost::timers::portable::microsec_timer voteTimer;
|
2008-12-06 21:10:46 +00:00
|
|
|
PlayerIdList votedPlayerIds;
|
2008-11-16 22:57:11 +00:00
|
|
|
};
|
|
|
|
|
|
2007-11-16 15:24:25 +00:00
|
|
|
#endif
|
|
|
|
|
|