Only increment player death stat once.

This commit is contained in:
Steve 2016-07-27 16:17:56 +01:00
parent bd4b5c81c6
commit dcf7277ee9
1 changed files with 18 additions and 8 deletions

View File

@ -38,6 +38,7 @@ static int isPriorityMissionTarget(Entity *e, int dist, int closest);
static int targetOutOfRange(void);
static void rechargeBoostECM(void);
static void setPilotName(void);
static void updateDeathStats(void);
static int selectedPlayerIndex;
static int availableGuns[BT_MAX];
@ -146,27 +147,25 @@ void doPlayer(void)
if (player->health <= 0 && battle.status == MS_IN_PROGRESS)
{
battle.stats[STAT_PLAYER_KILLED]++;
/* the player is known as "Player", so we need to check the craft they were assigned to */
if (strcmp(game.currentMission->craft, "ATAF") == 0)
{
awardTrophy("ATAF_DESTROYED");
}
if (game.currentMission->challengeData.isChallenge)
{
if (!game.currentMission->challengeData.allowPlayerDeath)
{
updateDeathStats();
failMission();
}
}
else if (!battle.isEpic)
{
updateDeathStats();
failMission();
}
else if (player->health == -FPS)
{
updateDeathStats();
initPlayerSelect();
}
}
@ -197,6 +196,17 @@ void doPlayer(void)
}
}
static void updateDeathStats(void)
{
battle.stats[STAT_PLAYER_KILLED]++;
/* the player is known as "Player", so we need to check the craft they were assigned to */
if (strcmp(game.currentMission->craft, "ATAF") == 0)
{
awardTrophy("ATAF_DESTROYED");
}
}
static void rechargeBoostECM(void)
{
int boostTimer, ecmTimer;