From 3e36d13d93775f8ce35e56fc796a01b1f936250a Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sun, 28 Nov 2010 07:12:56 +0100 Subject: Handle Ron and Tsumo actions, start a new round after one is over. --- server/game.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'server') diff --git a/server/game.cpp b/server/game.cpp index 9a56b47..aa28263 100644 --- a/server/game.cpp +++ b/server/game.cpp @@ -69,6 +69,8 @@ void Game::start() { } void Game::round_start() { + std::cout << "Starting a new round." << std::endl; + // Build a new wall. wall.build(); @@ -181,9 +183,13 @@ void Game::handle_action_draw(Action action) { round_update_discard(); } break; + case Action::Tsumo: { + // Score calculation or something. + round_end(); + } break; + case Action::Riichi: case Action::Kan: - case Action::Tsumo: case Action::Draw: // Not implemented yet. @@ -268,10 +274,10 @@ void Game::handle_action_discard(Action action, int player) { round_update_draw(); } break; - case Action::Ron: - // Not implemented yet. - std::cout << "Hei, morn, god dag!" << std::endl; - break; + case Action::Ron: { + // Score calculation or something. + round_end(); + } break; // Will never occur on discard: case Action::Discard: @@ -283,17 +289,12 @@ void Game::handle_action_discard(Action action, int player) { } void Game::round_end() { - // Flere runder? round_start() - // Ferdig? game_end() players[0].client->round_end(); players[1].client->round_end(); players[2].client->round_end(); players[3].client->round_end(); - #ifdef DEBUG - - time_t current_time = std::time(0); - std::cout << std::ctime(¤t_time) << " Round is over..." << std::endl; - - #endif + // Flere runder? round_start() + // Ferdig? game_end() + round_start(); } -- cgit v1.2.3