summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-12-11 07:17:28 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-12-11 07:17:28 +0100
commitfc4b974402a47f99ee08f5fe5520e2755c7b1dd7 (patch)
treee74a231ce74b29c635d45202bc7d7c24a97d3da0 /server
parent70ca1e294fe9e8b23bd45bea7db4a2574698f1fa (diff)
Added Score::fu_rounded().
Diffstat (limited to 'server')
-rw-r--r--server/score.cpp6
-rw-r--r--server/score.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/server/score.cpp b/server/score.cpp
index b4750c3..7d0dc41 100644
--- a/server/score.cpp
+++ b/server/score.cpp
@@ -16,10 +16,14 @@ int Score::han() {
return yaku + dora;
}
+int Score::fu_rounded() {
+ return roundup(fu, 10);
+}
+
int Score::base_points() {
if(han() < 5) {
// Normal hand.
- return max(roundup(fu, 10) << (2 + han()), 2000);
+ return max(fu_rounded() << (2 + han()), 2000);
} else if(han() <= 5) {
// Mangan.
diff --git a/server/score.h b/server/score.h
index 677fde8..6dee09a 100644
--- a/server/score.h
+++ b/server/score.h
@@ -18,6 +18,9 @@ class Score {
//! Calculate han. (yaku + dora)
int han();
+ //! Calculate fu rounded up to closest 10.
+ int fu_rounded();
+
//! Calculate base points.
int base_points();