summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-12-11 08:50:43 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-12-11 08:50:43 +0100
commit92c5013d6fcc63ecf615d1e0e2acfe570175a6de (patch)
treef2f214fb28bf0da68ccf26f4f3d89a3bb8f90f3b
parent2d45eeee80586ae21d4aeae5b19f08d722e2cc7d (diff)
Added Player::won and Player::won_value.
-rw-r--r--server/player.cpp5
-rw-r--r--server/player.h6
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);