From 9d8811c3b79abcef43c39021bdface4c30d066c0 Mon Sep 17 00:00:00 2001 From: MarcUs7i Date: Tue, 28 Jan 2025 16:55:09 +0100 Subject: [PATCH] ms_game.h is done --- ms_game.h | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/ms_game.h b/ms_game.h index c43ab2f..10207b8 100644 --- a/ms_game.h +++ b/ms_game.h @@ -11,7 +11,17 @@ * ---------------------------------------------------------- */ +#ifndef ___MS_GAME_H +#define ___MS_GAME_H + +#include + +#include "general.h" +#include "ms_board.h" +#include "ms_cell.h" + /** The type for the Mine Sweeper game. */ +typedef struct MsGameData* MsGame; /** * 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, * or 0 if it was not started because a custom configuration is required. */ - msg_start_configured_game(); +MsGame msg_start_configured_game(GameMode mode); /** * Starts a new game, regardless of the state of the current game. @@ -40,7 +50,7 @@ * It must be greater than 0; * @return The started game or 0 in case errors. */ - msg_start_game(); +MsGame msg_start_game(Count column_count, Count row_count, Count mine_count); /** * Determines whether or not the given game is valid. @@ -54,7 +64,7 @@ * @param game The game instance in focus. * @return True if the given game is valid, false otherwise. */ - msg_is_valid(); +bool msg_is_valid(MsGame game); /** * 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). * @return True if the addressed cell is selected, false otherwise. */ - msg_select_cell(); +bool msg_select_cell(MsGame game, ColAddr column, RowAddr row); /** * Provides the currently selected cell. @@ -78,7 +88,7 @@ * @return The currently selected cell or 0, * if no cell is selected. */ - msg_get_selected_cell(); +MsCell msg_get_selected_cell(MsGame game); /** * Uncovers the currently selected cell. @@ -97,7 +107,7 @@ * * @param game The game instance in focus. */ - msg_uncover_selected_cell(); +void msg_uncover_selected_cell(MsGame game); /** * 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 marker The marker to apply. */ - msg_mark_selected_cell(); +void msg_mark_selected_cell(MsGame game, CellMarker marker); /** * Determines the state of the current game. @@ -119,7 +129,7 @@ * @param game The game instance in focus. * @return The state of the current game. */ - msg_get_state(); +GameState msg_get_state(MsGame game); /** * Provides the number of mines that are detected. @@ -131,7 +141,7 @@ * @return The number of undetected mines * or 0, if the game is not valid. */ - msg_get_mines_left_count(); +Count msg_get_mines_left_count(MsGame game); /** * Provides the number of cells that are suspected carrying mines. @@ -140,7 +150,7 @@ * @return The number of suspected mines * or 0, if the game is not valid. */ - msg_get_mines_suspected_count(); +Count msg_get_mines_suspected_count(MsGame game); /** * 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 * or 0, if the game is not valid. */ - msg_get_uncover_action_count(); +Count msg_get_uncover_action_count(MsGame game); /** * Provides access to the underlying game board. This function is intended @@ -162,4 +172,6 @@ * @param game The game instance in focus. * @return The board used by the game instance or 0, if the game is invalid. */ - msg_get_board(); +MsBoard msg_get_board(MsGame game); + +#endif \ No newline at end of file