Check trophies at start of galactic map.

This commit is contained in:
Steve 2016-03-09 15:53:56 +00:00
parent 93dd00c785
commit ba5260104a
4 changed files with 37 additions and 8 deletions

View File

@ -375,11 +375,6 @@ static void postBattle(void)
if (game.currentMission && !game.currentMission->completed)
{
game.currentMission->completed = (battle.status == MS_COMPLETE || !battle.numObjectivesTotal);
if (game.currentMission->completed && game.currentMission->trophyId)
{
awardTrophy(game.currentMission->trophyId);
}
}
}
}

View File

@ -88,7 +88,9 @@ void initGalacticMap(void)
updatePandoranAdvance();
checkStatTrophies();
awardCampaignTrophies();
awardStatsTrophies();
saveGame();

View File

@ -62,7 +62,8 @@ extern char *getTranslatedString(char *string);
extern void clearInput(void);
extern void doTrophies(void);
extern void drawTrophyAlert(void);
extern void checkStatTrophies(void);
extern void awardCampaignTrophies(void);
extern void awardStatsTrophies(void);
extern App app;
extern Colors colors;

View File

@ -174,7 +174,7 @@ static void loadTrophyData(char *filename)
free(text);
}
void checkStatTrophies(void)
void awardStatsTrophies(void)
{
Trophy *t;
@ -188,3 +188,34 @@ void checkStatTrophies(void)
}
}
}
void awardCampaignTrophies(void)
{
char trophyId[MAX_NAME_LENGTH];
char name[MAX_NAME_LENGTH];
int completedMissions, i, len;
StarSystem *ss;
/* check % of missions completed */
completedMissions = (int)getPercent(game.completedMissions, game.totalMissions);
sprintf(trophyId, "CAMPAIGN_%d", completedMissions);
awardTrophy(trophyId);
/* check if all star system missions are completed */
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
{
if (starSystem->totalMissions && starSystem->completedMissions == starSystem->totalMissions)
{
memset(name, '\0', MAX_NAME_LENGTH);
len = strlen(starSystem->name);
for (i = 0 ; i < len ; i++)
{
name[i] = toupper(starSystem->name[i]);
}
sprintf(trophyId, "CAMPAIGN_%s", name);
awardTrophy(trophyId);
}
}
}