From 92c5013d6fcc63ecf615d1e0e2acfe570175a6de Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 11 Dec 2010 08:50:43 +0100 Subject: Added Player::won and Player::won_value. --- server/player.cpp | 5 +++++ server/player.h | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'server') diff --git a/server/player.cpp b/server/player.cpp index 27c4b73..bf3973c 100644 --- a/server/player.cpp +++ b/server/player.cpp @@ -14,6 +14,7 @@ void Player::round_start(int w) { riichi = false; score = 25000; wind = w; + won = 0; // Notify client of round start. client->round_start(); @@ -434,6 +435,8 @@ void Player::declare_ron(Tile tile) { } void Player::declare_tsumo() { + won = true; + List hands = Hand::get_breakdowns(hand); Sets hand = hands.front(); @@ -442,6 +445,8 @@ 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_value = score; } Score Player::calculate_score(const Sets& hand, bool tsumo) { diff --git a/server/player.h b/server/player.h index ea17926..d5ca4e6 100644 --- a/server/player.h +++ b/server/player.h @@ -25,6 +25,12 @@ class Player { //! Indexes of tiles that will give tenpai (used after riichi declaration). List tenpai_indexes; + //! Player has won. + bool won; + + //! Value of winning hand. + Score won_value; + //! Prepare for a new round. void round_start(int w); -- cgit v1.2.3