From d9a3adf89754520a355b92fcc95cb17e0286c959 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 27 Nov 2010 07:30:26 +0100 Subject: Chi only from left. --- server/game.cpp | 14 ++++++++------ server/game.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'server') diff --git a/server/game.cpp b/server/game.cpp index 3fd7961..ab61a7d 100644 --- a/server/game.cpp +++ b/server/game.cpp @@ -135,7 +135,7 @@ void Game::round_update_discard() { Actions a; if(player != current_player) { - if(a = players[player].get_actions_discard(discarded_tile)) { + if(a = players[player].get_actions_discard(discarded_tile, current_player + player)) { possible_actions[player] = a; } } @@ -307,15 +307,17 @@ Actions Game::Player::get_actions_draw() { return possible_actions; } -Actions Game::Player::get_actions_discard(Tile tile) { +Actions Game::Player::get_actions_discard(Tile tile, PlayerNum discarder) { Actions possible_actions; if(!riichi) { // Check if tile can be called for a chi. Enumerate all combinations. - Targets targets = can_chi(tile); - if(!targets.empty()) { - for(Targets::iterator it = targets.begin(); it != targets.end(); it++) { - possible_actions.push_back(Action(Action::Chi, Action::Hand, *it)); + if(discarder == 3) { + Targets targets = can_chi(tile); + if(!targets.empty()) { + for(Targets::iterator it = targets.begin(); it != targets.end(); it++) { + possible_actions.push_back(Action(Action::Chi, Action::Hand, *it)); + } } } diff --git a/server/game.h b/server/game.h index 1e293f6..c327e66 100644 --- a/server/game.h +++ b/server/game.h @@ -46,7 +46,7 @@ class Game : public boost::enable_shared_from_this { Actions get_actions_draw(); //! Get possible actions on discarded tile. - Actions get_actions_discard(Tile tile); + Actions get_actions_discard(Tile tile, PlayerNum discarder); typedef std::vector Targets; -- cgit v1.2.3