diff options
-rw-r--r-- | server/player.cpp | 5 | ||||
-rw-r--r-- | server/player.h | 6 |
2 files changed, 11 insertions, 0 deletions
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<Sets> 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<int> tenpai_indexes; + //! Player has won. + bool won; + + //! Value of winning hand. + Score won_value; + //! Prepare for a new round. void round_start(int w); |