summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-11-27 07:30:26 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-11-27 07:38:26 +0100
commitd9a3adf89754520a355b92fcc95cb17e0286c959 (patch)
tree781282d8872760cae6d955320c00722cf75f38ee
parentdafda3d524e6ef31de92a74779cec631878b0263 (diff)
Chi only from left.
-rw-r--r--server/game.cpp14
-rw-r--r--server/game.h2
2 files changed, 9 insertions, 7 deletions
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<Game> {
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<int> Targets;