From 03ee78deb5126ebd8afa7c6cee0d447c6f58d791 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 8 Jan 2015 17:39:26 +0100 Subject: fixed infinite loop when some enemy is dead Because the function Fjouer still relies on some of the deprecated features, some bugs arise. fixed by replacing by the new features. Signed-off-by: Olivier Gayot --- jouer.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'jouer.c') diff --git a/jouer.c b/jouer.c index bbe246d..7e6571f 100644 --- a/jouer.c +++ b/jouer.c @@ -225,9 +225,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally, struc { unsigned int continuer=1; int i; - int Vtourennemi=0; int Vtour; - int Vnbennemis=0; unsigned int gagne,perdu; @@ -287,13 +285,13 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally, struc break; } } - else if(Vtour==ENNEMI) // sinon si c'est le cpu qui joue + else if (Vtour == ENNEMI) // sinon si c'est le cpu qui joue { - while (!enemy->chrs[Vtourennemi].alive) { - if (Vtourennemi < Vnbennemis) { - Vtourennemi++; - } else if (Vtourennemi == Vnbennemis) { - Vtourennemi = 0; + while (!enemy->chrs[enemy->chr_cur].alive) { + if (enemy->chr_cur < enemy->chr_cnt) { + enemy->chr_cur++; + } else if (enemy->chr_cur == enemy->chr_cnt) { + enemy->chr_cur = 0; } } /* TODO reactivate */ -- cgit v1.2.3