Implementing optional unlimited thinking time in LAN games on server side (GUI missing) ticket #24
This commit is contained in:
+1
-1
@@ -339,7 +339,7 @@ NetGameInfo ::= SEQUENCE {
|
|||||||
},
|
},
|
||||||
proposedGuiSpeed INTEGER(1..11),
|
proposedGuiSpeed INTEGER(1..11),
|
||||||
delayBetweenHands INTEGER(5..20), -- These are seconds
|
delayBetweenHands INTEGER(5..20), -- These are seconds
|
||||||
playerActionTimeout INTEGER(5..60), -- These are seconds
|
playerActionTimeout INTEGER(0..60), -- These are seconds
|
||||||
firstSmallBlind INTEGER(1..20000),
|
firstSmallBlind INTEGER(1..20000),
|
||||||
endRaiseSmallBlindValue INTEGER(0..1000000),
|
endRaiseSmallBlindValue INTEGER(0..1000000),
|
||||||
startMoney INTEGER(1..1000000),
|
startMoney INTEGER(1..1000000),
|
||||||
|
|||||||
@@ -1002,9 +1002,16 @@ ServerGame::CheckPassword(const string &password) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ServerGame::CheckSettings(const GameData &data, const string &password)
|
ServerGame::CheckSettings(const GameData &data, const string &password, ServerMode mode)
|
||||||
{
|
{
|
||||||
bool retVal = true;
|
bool retVal = true;
|
||||||
|
if (mode != SERVER_MODE_LAN)
|
||||||
|
{
|
||||||
|
if (data.playerActionTimeoutSec < 5)
|
||||||
|
{
|
||||||
|
retVal = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (data.gameType == GAME_TYPE_RANKING)
|
if (data.gameType == GAME_TYPE_RANKING)
|
||||||
{
|
{
|
||||||
if ((data.startMoney != RANKING_GAME_START_CASH)
|
if ((data.startMoney != RANKING_GAME_START_CASH)
|
||||||
|
|||||||
@@ -1315,11 +1315,14 @@ 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
|
||||||
|
|
||||||
|
if (timeoutSec != SERVER_PLAYER_TIMEOUT_ADD_DELAY_SEC) // minimum value means unlimited thinking time
|
||||||
|
{
|
||||||
server->GetStateTimer1().expires_from_now(boost::posix_time::seconds(timeoutSec));
|
server->GetStateTimer1().expires_from_now(boost::posix_time::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));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerGameStateWaitPlayerAction::Exit(boost::shared_ptr<ServerGame> server)
|
ServerGameStateWaitPlayerAction::Exit(boost::shared_ptr<ServerGame> server)
|
||||||
|
|||||||
@@ -1405,7 +1405,7 @@ ServerLobbyThread::HandleNetPacketCreateGame(SessionWrapper session, const std::
|
|||||||
{
|
{
|
||||||
SendJoinGameFailed(session.sessionData, gameId, NTF_NET_JOIN_GUEST_FORBIDDEN);
|
SendJoinGameFailed(session.sessionData, gameId, NTF_NET_JOIN_GUEST_FORBIDDEN);
|
||||||
}
|
}
|
||||||
else if (!ServerGame::CheckSettings(tmpData, password))
|
else if (!ServerGame::CheckSettings(tmpData, password, GetServerMode()))
|
||||||
{
|
{
|
||||||
SendJoinGameFailed(session.sessionData, gameId, NTF_NET_JOIN_INVALID_SETTINGS);
|
SendJoinGameFailed(session.sessionData, gameId, NTF_NET_JOIN_INVALID_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
bool IsPasswordProtected() const;
|
bool IsPasswordProtected() const;
|
||||||
bool CheckPassword(const std::string &password) const;
|
bool CheckPassword(const std::string &password) const;
|
||||||
static bool CheckSettings(const GameData &data, const std::string &password);
|
static bool CheckSettings(const GameData &data, const std::string &password, ServerMode mode);
|
||||||
const GameData &GetGameData() const;
|
const GameData &GetGameData() const;
|
||||||
|
|
||||||
boost::shared_ptr<PlayerData> GetPlayerDataByUniqueId(unsigned playerId) const;
|
boost::shared_ptr<PlayerData> GetPlayerDataByUniqueId(unsigned playerId) const;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -349,7 +349,7 @@ memb_playerActionTimeout_constraint_1(asn_TYPE_descriptor_t *td, const void *spt
|
|||||||
|
|
||||||
value = *(const long *)sptr;
|
value = *(const long *)sptr;
|
||||||
|
|
||||||
if((value >= 5 && value <= 60)) {
|
if((value >= 0 && value <= 60)) {
|
||||||
/* Constraint check succeeded */
|
/* Constraint check succeeded */
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user