summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-11-27 09:48:27 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-11-27 09:48:27 +0100
commit715368035c155adf7b4797619097f4b8e3782053 (patch)
tree606aeab4183cd9b457c3a312b66912a63775a062 /server
parent4fe0de7a49b92b288b4ee577fa96450569b7b9cb (diff)
Added kan-dora.
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;