Commit 4d00c412 authored by Chris's avatar Chris
Browse files

fixed bug with the scoring menu BACK option

parent 4c9edc20
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ unsigned int take_turn(game_context *ctx, unsigned int num_dice) {
            const unsigned int num_menu_items = sizeof(in_turn_menu) / sizeof(menu_item);
            const enum in_turn_menu_commands player_action = menu_prompt(in_turn_menu, num_menu_items, "Choose from the following:",
                                                  "disabled");
            enum scorecard_command selection;
            enum scorecard_command selection = SCORING_MENU_BACK;
            switch (player_action) {
                case ENTER_HOLD_SELECTION:
                    // enter the menu for which dice to hold
@@ -118,13 +118,14 @@ unsigned int take_turn(game_context *ctx, unsigned int num_dice) {
                case SCORE:
                    // enter the score menu
                    selection = get_player_score_selection_with_menu(&ctx->game_state.scorecard);
                    if (selection != SCORING_MENU_BACK) {
                    unsigned int points_awarded = calculate_selection_score(ctx,
                                                                            selection); // todo we should use the return value for this to assign the point value, not do it within get_player_score_selection()
                    if (selection != SCORING_MENU_BACK) {
                        printf("for selection %s, points awarded: %d\n", name_of_scorecard_command(selection),
                               points_awarded);
                        return 0; // 0 signifies user_quit == false, which will move on to the next turn
                        return 0; // 0 signifies user_quit == false, which will prompt the menu again
                    }
                    break;
                case QUIT:
                    return 1; // 1 signifies user_quit == true, which will end the game
                default: