ms_game.h is done

This commit is contained in:
MarcUs7i 2025-01-28 16:55:09 +01:00
parent 3eb8dc8f15
commit 9d8811c3b7

View file

@ -11,7 +11,17 @@
* ---------------------------------------------------------- * ----------------------------------------------------------
*/ */
#ifndef ___MS_GAME_H
#define ___MS_GAME_H
#include <stdbool.h>
#include "general.h"
#include "ms_board.h"
#include "ms_cell.h"
/** The type for the Mine Sweeper game. */ /** The type for the Mine Sweeper game. */
typedef struct MsGameData* MsGame;
/** /**
* Starts a new game using the given mode. If a mode with a * Starts a new game using the given mode. If a mode with a
@ -24,7 +34,7 @@
* @return The game if if could be started with a predefined configuration, * @return The game if if could be started with a predefined configuration,
* or 0 if it was not started because a custom configuration is required. * or 0 if it was not started because a custom configuration is required.
*/ */
<type> msg_start_configured_game(<params>); MsGame msg_start_configured_game(GameMode mode);
/** /**
* Starts a new game, regardless of the state of the current game. * Starts a new game, regardless of the state of the current game.
@ -40,7 +50,7 @@
* It must be greater than 0; * It must be greater than 0;
* @return The started game or 0 in case errors. * @return The started game or 0 in case errors.
*/ */
<type> msg_start_game(<params>); MsGame msg_start_game(Count column_count, Count row_count, Count mine_count);
/** /**
* Determines whether or not the given game is valid. * Determines whether or not the given game is valid.
@ -54,7 +64,7 @@
* @param game The game instance in focus. * @param game The game instance in focus.
* @return True if the given game is valid, false otherwise. * @return True if the given game is valid, false otherwise.
*/ */
<type> msg_is_valid(<params>); bool msg_is_valid(MsGame game);
/** /**
* Selects the addressed cell without performing any action on that cell. Only * Selects the addressed cell without performing any action on that cell. Only
@ -70,7 +80,7 @@
* @param row The row of the cell to select in the format used on the UI (e.g. 1, 2). * @param row The row of the cell to select in the format used on the UI (e.g. 1, 2).
* @return True if the addressed cell is selected, false otherwise. * @return True if the addressed cell is selected, false otherwise.
*/ */
<type> msg_select_cell(<params>); bool msg_select_cell(MsGame game, ColAddr column, RowAddr row);
/** /**
* Provides the currently selected cell. * Provides the currently selected cell.
@ -78,7 +88,7 @@
* @return The currently selected cell or 0, * @return The currently selected cell or 0,
* if no cell is selected. * if no cell is selected.
*/ */
<type> msg_get_selected_cell(<params>); MsCell msg_get_selected_cell(MsGame game);
/** /**
* Uncovers the currently selected cell. * Uncovers the currently selected cell.
@ -97,7 +107,7 @@
* *
* @param game The game instance in focus. * @param game The game instance in focus.
*/ */
<type> msg_uncover_selected_cell(<params>); void msg_uncover_selected_cell(MsGame game);
/** /**
* Sets the marker on the addressed cell. To clear the marker, the marker ´NONE´ is used. * Sets the marker on the addressed cell. To clear the marker, the marker ´NONE´ is used.
@ -111,7 +121,7 @@
* @param game The game instance in focus. * @param game The game instance in focus.
* @param marker The marker to apply. * @param marker The marker to apply.
*/ */
<type> msg_mark_selected_cell(<params>); void msg_mark_selected_cell(MsGame game, CellMarker marker);
/** /**
* Determines the state of the current game. * Determines the state of the current game.
@ -119,7 +129,7 @@
* @param game The game instance in focus. * @param game The game instance in focus.
* @return The state of the current game. * @return The state of the current game.
*/ */
<type> msg_get_state(<params>); GameState msg_get_state(MsGame game);
/** /**
* Provides the number of mines that are detected. * Provides the number of mines that are detected.
@ -131,7 +141,7 @@
* @return The number of undetected mines * @return The number of undetected mines
* or 0, if the game is not valid. * or 0, if the game is not valid.
*/ */
<type> msg_get_mines_left_count(<params>); Count msg_get_mines_left_count(MsGame game);
/** /**
* Provides the number of cells that are suspected carrying mines. * Provides the number of cells that are suspected carrying mines.
@ -140,7 +150,7 @@
* @return The number of suspected mines * @return The number of suspected mines
* or 0, if the game is not valid. * or 0, if the game is not valid.
*/ */
<type> msg_get_mines_suspected_count(<params>); Count msg_get_mines_suspected_count(MsGame game);
/** /**
* Provides the number of times a cell was actively uncovered by the user. * Provides the number of times a cell was actively uncovered by the user.
@ -152,7 +162,7 @@
* @return The number of times the used uncovered a cell * @return The number of times the used uncovered a cell
* or 0, if the game is not valid. * or 0, if the game is not valid.
*/ */
<type> msg_get_uncover_action_count(<params>); Count msg_get_uncover_action_count(MsGame game);
/** /**
* Provides access to the underlying game board. This function is intended * Provides access to the underlying game board. This function is intended
@ -162,4 +172,6 @@
* @param game The game instance in focus. * @param game The game instance in focus.
* @return The board used by the game instance or 0, if the game is invalid. * @return The board used by the game instance or 0, if the game is invalid.
*/ */
<type> msg_get_board(<params>); MsBoard msg_get_board(MsGame game);
#endif