From 3eb8dc8f157581bf0a380e2bbc6f9988a804ee9f Mon Sep 17 00:00:00 2001 From: MarcUs7i Date: Tue, 28 Jan 2025 16:46:46 +0100 Subject: [PATCH] ms_cell.h is done --- ms_cell.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/ms_cell.h b/ms_cell.h index 62a67c7..187cd9d 100644 --- a/ms_cell.h +++ b/ms_cell.h @@ -14,10 +14,16 @@ #ifndef ___MS_CELL_H #define ___MS_CELL_H +#include + +#include "config.h" +#include "general.h" + /* Note: The 'CellMarker' enumeration is declared in 'general.h' to enable mapping between enum and presentation in 'ms_ui_utils' */ /** Declares type for a single 'Mine Sweeper' cell */ +typedef struct MsCellData* MsCell; /** * Provides another, yet unused instance, initialized Mine Sweeper cell @@ -28,13 +34,13 @@ * * @return The fresh cell instance or 0, if no more instance is available. */ - msc_produce_cell(); +MsCell msc_produce_cell(); /** * Resets the internal cell factory. Function `msc_produce_cell` is capable * to produce the full number of cell after this function is called. */ - msc_reset_cell_factory(); +void msc_reset_cell_factory(); /** * Determines whether or not the given cell is valid. @@ -44,7 +50,7 @@ * @param cell The cell instance in focus. * @return True if the given cell is valid, false otherwise. */ - msc_is_valid(); +bool msc_is_valid(MsCell cell); /** * Determines whether or not the given cell is currently covered. @@ -52,7 +58,7 @@ * @param cell The cell instance in focus. * @return True if the given cell is covered, false otherwise. */ - msc_is_covered(); +bool msc_is_covered(MsCell cell); /** * Uncovers the given cell. @@ -63,8 +69,9 @@ * Note: an uncovered cell cannot be covered again. * * @param cell The cell instance in focus. + * @return True if the cell was successfully uncovered, false otherwise. */ - msc_uncover(); +bool msc_uncover(MsCell cell); /** * Determines whether or not the given cell carries a mine. @@ -72,7 +79,7 @@ * @param cell The cell instance in focus. * @return True if the cell carries a mine, false otherwise. */ - msc_has_mine(); +bool msc_has_mine(MsCell cell); /** * Specifies that the given cell carries a mine. @@ -80,7 +87,7 @@ * * @param cell The cell instance in focus. */ - msc_drop_mine(); +void msc_drop_mine(MsCell cell); /** * Provides the number of direct neighbor cells, which carries a mine. @@ -89,7 +96,7 @@ * @return The number between 0 to 8 that encounters the neighbor cells * that carries a mine or 255 if the cell is not valid. */ - msc_get_dangerous_neighbor_count(); +Byte msc_get_dangerous_neighbor_count(MsCell cell); /** * Increments (+1) the count of neighbor cells that carries a mine. @@ -97,7 +104,7 @@ * * @param cell The cell instance in focus. */ - msc_inc_dangerous_neighbor_count(); +void msc_inc_dangerous_neighbor_count(MsCell cell); /** * Provides the given marker of the given cell. @@ -106,7 +113,7 @@ * @return The marker carried by the cell * or `NONE`, if the cell is not valid. */ - msc_get_marker(); +CellMarker msc_get_marker(MsCell cell); /** * Applies the given marker to the given cell. The marker is cleared @@ -116,6 +123,6 @@ * @param cell The cell instance in focus. * @param marker The marker to apply. */ - msc_set_marker(); +void msc_set_marker(MsCell cell, CellMarker marker); #endif \ No newline at end of file