Save game when awarding trophies in Hub.

This commit is contained in:
Steve 2018-03-04 16:01:44 +00:00
parent 222147665e
commit 4c08307f18
2 changed files with 16 additions and 3 deletions

View File

@ -693,10 +693,12 @@ static void loadMissions(void)
static void awardMissionTrophies(void) static void awardMissionTrophies(void)
{ {
int beach, greenlands, underground, outpost; int beach, greenlands, underground, outpost, save;
HubMission *mission; HubMission *mission;
beach = greenlands = underground = outpost = 1; beach = greenlands = underground = outpost = 1;
save = 0;
for (mission = hubMissionHead.next ; mission != NULL ; mission = mission->next) for (mission = hubMissionHead.next ; mission != NULL ; mission = mission->next)
{ {
@ -724,33 +726,44 @@ static void awardMissionTrophies(void)
if (beach) if (beach)
{ {
awardTrophy("BEACH"); awardTrophy("BEACH");
save = 1;
} }
if (greenlands) if (greenlands)
{ {
awardTrophy("GREENLANDS"); awardTrophy("GREENLANDS");
save = 1;
} }
if (underground) if (underground)
{ {
awardTrophy("UNDERGROUND"); awardTrophy("UNDERGROUND");
save = 1;
} }
if (outpost) if (outpost)
{ {
awardTrophy("OUTPOST"); awardTrophy("OUTPOST");
save = 1;
} }
/* ignore training mission */ /* ignore training mission */
if (game.stats[STAT_MISSIONS_COMPLETE] == 2) if (game.stats[STAT_MISSIONS_COMPLETE] == 2)
{ {
awardTrophy("CLEAN"); awardTrophy("CLEAN");
save = 1;
} }
/* ignore Teeka's */ /* ignore Teeka's */
if (game.totalMissions - game.stats[STAT_MISSIONS_COMPLETE] == 1) if (game.totalMissions - game.stats[STAT_MISSIONS_COMPLETE] == 1)
{ {
awardTrophy("FULLY_CLEAN"); awardTrophy("FULLY_CLEAN");
save = 1;
}
if (save)
{
saveGame();
} }
} }

View File

@ -40,6 +40,8 @@ extern void cameraTrack(Entity *e);
extern void clearControl(int type); extern void clearControl(int type);
extern void clearControls(void); extern void clearControls(void);
extern void clearScreen(void); extern void clearScreen(void);
extern void clipCamera(void);
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
extern Entity *createEntity(char *typeStr); extern Entity *createEntity(char *typeStr);
extern void destroyEntities(void); extern void destroyEntities(void);
extern void destroyObjectives(void); extern void destroyObjectives(void);
@ -114,8 +116,6 @@ extern int rrnd(int low, int high);
extern void showWidgetGroup(char *group); extern void showWidgetGroup(char *group);
extern void startSectionTransition(void); extern void startSectionTransition(void);
extern void stopMusic(void); extern void stopMusic(void);
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
extern void clipCamera(void);
extern App app; extern App app;
extern Camera camera; extern Camera camera;