summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/game.cpp7
-rw-r--r--server/game.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/server/game.cpp b/server/game.cpp
index 75b369d..de36f2e 100644
--- a/server/game.cpp
+++ b/server/game.cpp
@@ -67,6 +67,8 @@ void Game::round_start() {
dora.clear();
dora.push_back(wall.take_one());
+ kan_dora_pending = false;
+
// Notify players of round start.
// TODO: Tell them where wall is broken.
players[0].round_start();
@@ -163,6 +165,10 @@ void Game::handle_action_draw(Action action) {
switch(action.type) {
case Action::Discard: {
players[current_player].discard(action.target_offset);
+ if(kan_dora_pending) {
+ kan_dora_pending = false;
+ dora.push_back(wall.take_one());
+ }
round_update_discard();
} break;
@@ -249,6 +255,7 @@ void Game::handle_action_discard(Action action, int player) {
case Action::Kan: {
players[preceding_action_owner].make_kan(players[current_player].claim(), preceding_action.target_offset - 2, current_player - preceding_action_owner);
current_player = preceding_action_owner;
+ kan_dora_pending = true;
round_update_draw();
} break;
diff --git a/server/game.h b/server/game.h
index 5d32a77..5613751 100644
--- a/server/game.h
+++ b/server/game.h
@@ -90,6 +90,8 @@ class Game : public boost::enable_shared_from_this<Game> {
Tiles dora;
+ bool kan_dora_pending;
+
PlayerNum current_player;
int awaiting_players;