summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-12-11 09:35:55 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-12-11 09:35:55 +0100
commitc6f621957c0ce7d02eca48c2c27ceeb94eb4819d (patch)
tree02babbc5ff47158b2cf55940811f29c7e241b7b8 /server
parent1de8e6eed4c3b5d48e2175e660b50840996cbf63 (diff)
Implement Player::declare_ron().
Diffstat (limited to 'server')
-rw-r--r--server/player.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/server/player.cpp b/server/player.cpp
index bf3973c..5b6fc83 100644
--- a/server/player.cpp
+++ b/server/player.cpp
@@ -431,11 +431,24 @@ void Player::make_kan_extend(int target) {
}
void Player::declare_ron(Tile tile) {
+ hand.push_back(tile);
+ // TODO: Mark winning tile.
+ hand.sort();
+
+ List<Sets> hands = Hand::get_breakdowns(hand);
+
+ Sets hand = hands.front();
+ hand.insert(hand.end(), open.begin(), open.end());
+ Score score = calculate_score(hand, false);
+
+ won = true;
+ won_value = score;
}
void Player::declare_tsumo() {
- won = true;
+ // TODO: Mark winning tile.
+ hand.sort();
List<Sets> hands = Hand::get_breakdowns(hand);
@@ -444,8 +457,7 @@ void Player::declare_tsumo() {
Score score = calculate_score(hand, true);
- std::cout << "Tsumo: " << score.han() << " han, " << score.fu << " fu: " << score.tsumo_east() << "/" << score.tsumo() << "." << std::endl;
-
+ won = true;
won_value = score;
}