diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 17:39:26 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 17:42:31 +0100 |
commit | 03ee78deb5126ebd8afa7c6cee0d447c6f58d791 (patch) | |
tree | a7110a617aa2954926fb9be75875213a2405084e | |
parent | ac5c469494478bf3774d412581e342d9fa97ec16 (diff) |
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 <duskcoder@gmail.com>
-rw-r--r-- | jouer.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -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 */ |