diff options
-rw-r--r-- | common/action.h | 9 | ||||
-rw-r--r-- | server/player.cpp | 12 |
2 files changed, 12 insertions, 9 deletions
diff --git a/common/action.h b/common/action.h index 122411b..e229d2c 100644 --- a/common/action.h +++ b/common/action.h @@ -20,9 +20,12 @@ class Action { //! Action target type. enum TargetType { - None, // No target - Hand, // Target in hand. - Open // Target in open. + //! Action is targetless. + None, + //! Target is index in first group (concealed hand). + Index, + //! Target is index of group. + Group }; //! Type of action. diff --git a/server/player.cpp b/server/player.cpp index 7e890fb..b6776df 100644 --- a/server/player.cpp +++ b/server/player.cpp @@ -51,18 +51,18 @@ Actions Game::Player::get_actions_draw() { // List all tiles that can be discarded. for(std::size_t i = 0; i < hand.size(); i++) { - possible_actions.push_back(Action(Action::Discard, Action::Hand, i)); + possible_actions.push_back(Action(Action::Discard, Action::Index, i)); } } else { if(tenpai_indexes) { for(List<int>::iterator it = tenpai_indexes.begin(); it != tenpai_indexes.end(); it++) { - possible_actions.push_back(Action(Action::Discard, Action::Hand, *it)); + possible_actions.push_back(Action(Action::Discard, Action::Index, *it)); } tenpai_indexes.clear(); } else { // Only tile that can be discarded is the last drawn one. - possible_actions.push_back(Action(Action::Discard, Action::Hand, hand.size() - 1)); + possible_actions.push_back(Action(Action::Discard, Action::Index, hand.size() - 1)); } } @@ -78,7 +78,7 @@ Actions Game::Player::get_actions_discard(Tile tile, PlayerNum discarder) { 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)); + possible_actions.push_back(Action(Action::Chi, Action::Index, *it)); } } } @@ -86,11 +86,11 @@ Actions Game::Player::get_actions_discard(Tile tile, PlayerNum discarder) { // Check if tile can be called for a pon. int target = can_pon(tile); if(target > 0) { - possible_actions.push_back(Action(Action::Pon, Action::Hand, target + 1)); + possible_actions.push_back(Action(Action::Pon, Action::Index, target + 1)); // Check if tile can be called for a kan. if(can_kan(tile, target)) { - possible_actions.push_back(Action(Action::Kan, Action::Hand, target + 2)); + possible_actions.push_back(Action(Action::Kan, Action::Index, target + 2)); } } } |