edit game_play_move (adding history management);
This commit is contained in:
1 parent
00b8f92e0c
commit
ef565007ec
1 file changed
+7
@@ -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) {
|
void game_play_move(game g, uint i, uint j, square s) {
|
||||||
game_set_square(g, i, j, s);
|
game_set_square(g, i, j, s);
|
||||||
game_update_flags(g);
|
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) {
|
void delete_flags(game g) {
|
||||||
|
|||||||
Reference in new issue
Block a user