diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-05 06:58:43 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-05 06:59:48 +0100 |
commit | 9cc4a3ca144332166c8b63f95c85ac6395698237 (patch) | |
tree | bef6a86b2f32a24fb899d009a43058fdd8e86cfa | |
parent | af4fdad3bd82c926ef742aa419c18cb15595703d (diff) |
Renamed target types.
-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)); } } } |