Teyaku is paid to the appropriate players

This commit is contained in:
Bill Rossi 2025-02-23 05:53:55 -05:00
parent 76da2656b4
commit e8a1389cda

17
game.c
View File

@ -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) {