[Refactor] Separate Round logic into its own file (#570)
* Everything works, need to clean up * cleanup * fix rebase issue * clang format * docs * clang format * clang format * address part of review * Protect against edge case when discarding at end of hand * Protect undiscard against popping a discarded card that doesn't exist * Protect against out of bounds access to the `played` cards stack * fix condition in `select_four_of_a_kind_cards_in_played_hand` * change `get_played_top() + 1` to `get_played_size()` * move `can_play/discard_hand` functions to round.c --------- Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
This commit is contained in:
@@ -24,6 +24,8 @@ enum BackgroundId
|
||||
BG_MAIN_MENU
|
||||
};
|
||||
|
||||
enum BackgroundId get_current_background(void);
|
||||
|
||||
/**
|
||||
* Change the background
|
||||
*
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @file round.h
|
||||
* @brief API relative to the Rounds we play
|
||||
*/
|
||||
|
||||
#ifndef GAME_ROUND_H
|
||||
#define GAME_ROUND_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief Checks whether the score that would result from the current Chips and Mult exceeds the
|
||||
* current Blind's score requirement, and applies the flaming effect if needed.
|
||||
*/
|
||||
void toggle_flaming_score(void);
|
||||
|
||||
/**
|
||||
* @brief Get the index of the last played card
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int get_played_top(void);
|
||||
|
||||
/**
|
||||
* @brief Get the number of cards played
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int get_played_size(void);
|
||||
|
||||
/**
|
||||
* @brief Get the index of the last discarded card
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int get_discard_top(void);
|
||||
|
||||
/**
|
||||
* @brief Get the index of the card that is currently being scored
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int get_scored_card_index(void);
|
||||
|
||||
/**
|
||||
* @brief Set whether the current card should get triggered again
|
||||
*
|
||||
* @param new_retrigger true if the card should trigger again, false if not
|
||||
*/
|
||||
void set_retrigger(bool new_retrigger);
|
||||
|
||||
/**
|
||||
* @brief Change to the round card selection background
|
||||
*/
|
||||
void game_round_change_background_selecting(void);
|
||||
|
||||
/**
|
||||
* @brief Change to the round card playing background
|
||||
*/
|
||||
void game_round_change_background_playing(void);
|
||||
|
||||
/**
|
||||
* @brief Round state initialization
|
||||
*/
|
||||
void game_round_on_init(void);
|
||||
|
||||
/**
|
||||
* @brief Round state update
|
||||
*/
|
||||
void game_round_on_update(void);
|
||||
|
||||
#endif // GAME_ROUND_H
|
||||
Reference in New Issue
Block a user