Get initial enemy count at start of mission.

This commit is contained in:
Steve 2015-12-31 11:25:19 +00:00
parent d23b66a583
commit fb8063b581
3 changed files with 16 additions and 5 deletions

View File

@ -223,11 +223,6 @@ void doEntities(void)
battle.numAllies = (battle.epic) ? numAllies : numActiveAllies; battle.numAllies = (battle.epic) ? numAllies : numActiveAllies;
battle.numEnemies = (battle.epic) ? numEnemies : numActiveEnemies; battle.numEnemies = (battle.epic) ? numEnemies : numActiveEnemies;
if (!battle.numInitialEnemies)
{
battle.numInitialEnemies = battle.numEnemies;
}
if (battle.epic && battle.stats[STAT_TIME] % FPS == 0) if (battle.epic && battle.stats[STAT_TIME] % FPS == 0)
{ {
if (numAllies > battle.epicFighterLimit) 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) static int drawComparator(const void *a, const void *b)
{ {
Entity *e1 = *((Entity**)a); Entity *e1 = *((Entity**)a);

View File

@ -92,6 +92,8 @@ void loadMission(char *filename)
activateNextWaypoint(); activateNextWaypoint();
countNumEnemies();
initPlayer(); initPlayer();
playMusic(music); playMusic(music);

View File

@ -46,6 +46,7 @@ extern void retreatEnemies(void);
extern void initScript(cJSON *missionJSON); extern void initScript(cJSON *missionJSON);
extern char *getFileLocation(char *filename); extern char *getFileLocation(char *filename);
extern void updateCapitalShipComponentProperties(Entity *parent); extern void updateCapitalShipComponentProperties(Entity *parent);
extern void countNumEnemies(void);
extern Battle battle; extern Battle battle;
extern Dev dev; extern Dev dev;