From c342b2c4163c930baeb948b02de5792a384021fc Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Fri, 1 Oct 2021 16:40:30 +0200 Subject: [PATCH] Update get_next_player() --- src/model.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/model.c b/src/model.c index b357fd3..40ba735 100644 --- a/src/model.c +++ b/src/model.c @@ -107,7 +107,11 @@ void free_utictactoe(s_utictactoe *p_uttt){ } e_player get_next_player_to_play(s_utictactoe *p_uttt) { - if ( p_uttt->history->last_move->player == PLAYER_O ) { + if ( p_uttt->outer_tictactoe->winner != NOBODY ) { + return NOBODY; + } + if ( p_uttt->history->last_move->player == PLAYER_O || + p_uttt->history->last_move == NULL ) { return PLAYER_X; } else { @@ -237,7 +241,7 @@ void set_tictactoe_winner(s_tictactoe *p_ttt){ } } } - } + } } e_status play_move(s_utictactoe *p_uttt, s_move *p_move) {