diff --git a/game_private.c b/game_private.c index 95f7327..5dbbd6e 100644 --- a/game_private.c +++ b/game_private.c @@ -1,5 +1,15 @@ +#include +#include + int max(int a, int b) { if (a > b) return a; return b; +} + +void checkPointer(void* p) { + if (!p) { + fprintf(stderr, "Error on given pointer.\n"); + exit(EXIT_FAILURE); + } } \ No newline at end of file diff --git a/game_private.h b/game_private.h index 3c0134c..28fef93 100644 --- a/game_private.h +++ b/game_private.h @@ -3,13 +3,29 @@ #include "history.h" struct game_s { + // tab of tab of square (eg: tab_cell[i][j]) square** tab_cell; bool wrapping; uint height; // i in general uint width; // j in general + // case of history history hist; }; +/** + * @brief return the max between a and b + * + * @param a int to test + * @param b int to test + * @return the max between a and b + */ int max(int a, int b); +/** + * @brief check if the pointer is NULL fprinf and exit else nothing + * + * @param p any pointer + */ +void checkPointer(void* p); + #endif \ No newline at end of file