From ef565007ec28144609be83503d192c9f13ce738a Mon Sep 17 00:00:00 2001 From: thibault perrier Date: Fri, 10 Dec 2021 20:19:19 +0100 Subject: [PATCH] edit game_play_move (adding history management); --- game.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/game.c b/game.c index 34c4e19..b0f3c4f 100644 --- a/game.c +++ b/game.c @@ -166,6 +166,13 @@ bool game_check_move(cgame g, uint i, uint j, square s) { void game_play_move(game g, uint i, uint j, square s) { game_set_square(g, i, j, s); game_update_flags(g); + if (g->hist == NULL){ + g->hist = history_create_empty(); + g->hist = history_insert_first(g->hist, s, i, j); + } + else { + g->hist = history_next(history_insert_after(g->hist,g->hist,s,i,j)); + } } void delete_flags(game g) {