edit undo & redo + edit readme

This commit is contained in:
thibault perrier committed 2021-12-16 10:01:24 +01:00
1 parent d70f8a3516
commit 81b4ce358f
2 files changed
+10 -4

No files matched your search

+2 -2
View File
@@ -13,8 +13,8 @@ Projet Techno
| [game_nb_rows](./game_ext.c#L?) | [uint game_nb_rows(cgame g);](./game_ext.h#L43-59) | @nnunes | | <ul><li>[ ] </li></ul> | | [game_nb_rows](./game_ext.c#L?) | [uint game_nb_rows(cgame g);](./game_ext.h#L43-59) | @nnunes | | <ul><li>[ ] </li></ul> |
| [game_nb_cols](./game_ext.c#L?) | [uint game_nb_cols(cgame g);](./game_ext.h#L51-57) | @nnunes | | <ul><li>[ ] </li></ul> | | [game_nb_cols](./game_ext.c#L?) | [uint game_nb_cols(cgame g);](./game_ext.h#L51-57) | @nnunes | | <ul><li>[ ] </li></ul> |
| [game_is_wrapping](./game_ext.c#L?) | [bool game_is_wrapping(cgame g);](./game_ext.h#L59-64) | @nnunes | | <ul><li>[ ] </li></ul> | | [game_is_wrapping](./game_ext.c#L?) | [bool game_is_wrapping(cgame g);](./game_ext.h#L59-64) | @nnunes | | <ul><li>[ ] </li></ul> |
| [game_undo](./game_ext.c#L?) | [void game_undo(game g);](./game_ext.h#L66-75) | @thperrier | | <ul><li>[ ] </li></ul> | | [game_undo](./game_ext.c#L?) | [void game_undo(game g);](./game_ext.h#L66-75) | @thperrier | | <ul><li>[X] </li></ul> |
| [game_redo](./game_ext.c#L?) | [void game_redo(game g);](./game_ext.h#L77-86) | @thperrier | | <ul><li>[ ] </li></ul> | | [game_redo](./game_ext.c#L?) | [void game_redo(game g);](./game_ext.h#L77-86) | @thperrier | | <ul><li>[X] </li></ul> |
## game.c ## game.c
+8 -2
View File
@@ -64,9 +64,15 @@ void game_undo(game g) {
game_update_flags(g); game_update_flags(g);
g->hist = history_prev(g->hist); g->hist = history_prev(g->hist);
} }
return;
} }
void game_redo(game g) { void game_redo(game g) {
return; if (history_next(g->hist) == NULL){
printf("waiting for you to undo first");
}
else{
game_set_square(g, history_i(history_next(g->hist)), history_j(history_next(g->hist)), history_state(history_next(g->hist)));
game_update_flags(g);
g->hist = history_next(g->hist);
}
} }