diff --git a/src/battle/entities.c b/src/battle/entities.c index 3b2b069..2a817f8 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -223,11 +223,6 @@ void doEntities(void) battle.numAllies = (battle.epic) ? numAllies : numActiveAllies; battle.numEnemies = (battle.epic) ? numEnemies : numActiveEnemies; - if (!battle.numInitialEnemies) - { - battle.numInitialEnemies = battle.numEnemies; - } - if (battle.epic && battle.stats[STAT_TIME] % FPS == 0) { if (numAllies > battle.epicFighterLimit) @@ -482,6 +477,19 @@ static void activateEpicFighters(int n, int side) } } +void countNumEnemies(void) +{ + Entity *e; + + for (e = battle.entityHead.next ; e != NULL ; e = e->next) + { + if (e->side != SIDE_ALLIES) + { + battle.numInitialEnemies++; + } + } +} + static int drawComparator(const void *a, const void *b) { Entity *e1 = *((Entity**)a); diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index dba2b04..0abf527 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -92,6 +92,8 @@ void loadMission(char *filename) activateNextWaypoint(); + countNumEnemies(); + initPlayer(); playMusic(music); diff --git a/src/galaxy/mission.h b/src/galaxy/mission.h index 14c53ab..ffc8bf0 100644 --- a/src/galaxy/mission.h +++ b/src/galaxy/mission.h @@ -46,6 +46,7 @@ extern void retreatEnemies(void); extern void initScript(cJSON *missionJSON); extern char *getFileLocation(char *filename); extern void updateCapitalShipComponentProperties(Entity *parent); +extern void countNumEnemies(void); extern Battle battle; extern Dev dev;