summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-08 17:39:26 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-08 17:42:31 +0100
commit03ee78deb5126ebd8afa7c6cee0d447c6f58d791 (patch)
treea7110a617aa2954926fb9be75875213a2405084e
parentac5c469494478bf3774d412581e342d9fa97ec16 (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.c14
1 files changed, 6 insertions, 8 deletions
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 */