From c6f621957c0ce7d02eca48c2c27ceeb94eb4819d Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 11 Dec 2010 09:35:55 +0100 Subject: Implement Player::declare_ron(). --- server/player.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'server') 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 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 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; } -- cgit v1.2.3