From e8a1389cdaaead089ea5bf9f59cc3ef1b9558202 Mon Sep 17 00:00:00 2001 From: Bill Rossi Date: Sun, 23 Feb 2025 05:53:55 -0500 Subject: [PATCH] Teyaku is paid to the appropriate players --- game.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/game.c b/game.c index 39fe8bb..46e8419 100644 --- a/game.c +++ b/game.c @@ -560,6 +560,19 @@ void run_frame_selecting_dekiyaku_action(Game *g) { } } +void pay_teyaku_to_player(Game *g, Player *p) { + int points = teyaku_points(&p->teyaku); + transfer_kan(g, &p->points, &g->player.points, points); + transfer_kan(g, &p->points, &g->right.points, points); + transfer_kan(g, &p->points, &g->left.points, points); +} + +void pay_teyaku(Game *g) { + pay_teyaku_to_player(g, &g->player); + pay_teyaku_to_player(g, &g->right); + pay_teyaku_to_player(g, &g->left); +} + void run_frame_calculating_scores(Game *g) { no_dekiyaku_end_of_round_dialog(g); @@ -616,6 +629,7 @@ void run_frame_calculating_scores(Game *g) { if (hp[1] > hp[2]) g->dealer = &g->right; else g->dealer = &g->left; } + pay_teyaku(g); break; } } @@ -656,8 +670,9 @@ void run_frame_calculating_dekiyaku_score(Game *g) { } else if (g->left.dekiyaku_action == DEKIYAKU_ACTION_CANCEL || g->left.dekiyaku_action == DEKIYAKU_ACTION_SHOUBU) { calculate_dekiyaku_score(g, &g->left); } else { - // Hands are exhausted + // TODO: Hands are exhausted } + pay_teyaku(g); } void run_frame_end_of_round(Game *g) {