implementation of history in struct game and fcts

This commit is contained in:
Théophyl Hoguet committed 2021-12-10 14:38:18 +01:00
1 parent 256556e1f8
commit b48d52bb6b
3 files changed
+7 -1

No files matched your search

+4
View File
@@ -36,6 +36,7 @@ game game_new_empty(void) {
g->wrapped = false;
g->height = DEFAULT_SIZE;
g->width = DEFAULT_SIZE;
g->hist = NULL;
return g;
}
@@ -69,6 +70,9 @@ void game_delete(game g) {
free(g->tab_cell);
if (g->tab_cell != NULL)
g->tab_cell = NULL;
history_delete_entire_history(g->hist);
if (g->hist != NULL)
g->hist = NULL;
free(g);
if (g != NULL)
g = NULL;
+2
View File
@@ -8,6 +8,7 @@
#ifndef __GAME_H__
#define __GAME_H__
#include <stdbool.h>
#include "history.h"
/**
* @brief Standard unsigned integer type.
@@ -63,6 +64,7 @@ struct game_s {
bool wrapped;
uint height;
uint width;
history hist;
};
/**
+1 -1
View File
@@ -43,7 +43,7 @@ void history_free(history h);
history history_create_empty(void);
/**
* @brief Delete every element after h
* @brief Delete every element of h (before and after)
*
* @param h the head of the history
*/