From 77bb02113ab33f2fbfcb441e141265e40a4c8fea Mon Sep 17 00:00:00 2001 From: lotodore Date: Thu, 25 Dec 2008 21:11:05 +0000 Subject: [PATCH] Let the server automatically perform call/all in without the client having to provide values. --- docs/net_protocol.txt | 4 ++-- src/net/common/servergamestate.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/net_protocol.txt b/docs/net_protocol.txt index 02446c86..24c7b371 100644 --- a/docs/net_protocol.txt +++ b/docs/net_protocol.txt @@ -636,8 +636,8 @@ Player Action: 0x05 - Raise 0x06 - All in Player Bet: - 0 (ignored) - actions fold, check, - > 0 - atcions call, bet, raise, all in + 0 (ignored) - actions fold, check, all in (optionally call) + > 0 - actions call, bet, raise Server Notification: Player's Action Done diff --git a/src/net/common/servergamestate.cpp b/src/net/common/servergamestate.cpp index f722f765..c6b1ccd5 100644 --- a/src/net/common/servergamestate.cpp +++ b/src/net/common/servergamestate.cpp @@ -982,6 +982,17 @@ ServerGameStateWaitPlayerAction::InternalProcess(ServerGameThread &server, Sessi code = ACTION_CODE_NOT_YOUR_TURN; } + // If the client omitted some values, fill them in. + if (actionData.playerAction == PLAYER_ACTION_CALL && actionData.playerBet == 0) + { + if (curGame.getCurrentHand()->getCurrentBeRo()->getHighestSet() >= tmpPlayer->getMySet() + tmpPlayer->getMyCash()) + actionData.playerAction = PLAYER_ACTION_ALLIN; + else + actionData.playerBet = curGame.getCurrentHand()->getCurrentBeRo()->getHighestSet() - tmpPlayer->getMySet(); + } + if (actionData.playerAction == PLAYER_ACTION_ALLIN && actionData.playerBet == 0) + actionData.playerBet = tmpPlayer->getMyCash(); + // Check whether the action is valid. if (code == ACTION_CODE_VALID && (tmpPlayer->checkMyAction(