summaryrefslogtreecommitdiff
path: root/server/score.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/score.cpp')
-rw-r--r--server/score.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/server/score.cpp b/server/score.cpp
index 1af1d63..4589efe 100644
--- a/server/score.cpp
+++ b/server/score.cpp
@@ -8,28 +8,32 @@ inline int max(int x, int y) {
return x > y ? x : y;
}
-Score::Score(int han_, int fu_) : han(han_), fu(fu_) {
+Score::Score(int yaku_, int fu_, int dora_) : yaku(yaku_), fu(fu_), dora(dora_) {
}
+int Score::han() {
+ return yaku + dora;
+}
+
int Score::base_points() {
- if(han < 5) {
+ if(han() < 5) {
// Normal hand.
- return max(roundup(fu, 10) << (2 + han), 2000);
+ return max(roundup(fu, 10) << (2 + han()), 2000);
- } else if(han <= 5) {
+ } else if(han() <= 5) {
// Mangan.
return 2000;
- } else if(han <= 7) {
+ } else if(han() <= 7) {
// Haneman.
return 3000;
- } else if(han <= 10) {
+ } else if(han() <= 10) {
// Baiman.
return 4000;
- } else if(han <= 12) {
+ } else if(han() <= 12) {
// Sanbaiman.
return 6000;