Use campaignFinished variable in battle, to prevent script crashes.

This commit is contained in:
Steve 2016-06-01 09:55:28 +01:00
parent 0cd73db62e
commit 4ef44ed636
4 changed files with 9 additions and 3 deletions

View File

@ -36,6 +36,7 @@ static void options(void);
static void returnFromOptions(void); static void returnFromOptions(void);
static void checkSuspicionLevel(void); static void checkSuspicionLevel(void);
static void doTorelliFireStorm(void); static void doTorelliFireStorm(void);
static void endCampaign(void);
static int show; static int show;
static float ssx, ssy; static float ssx, ssy;
@ -116,6 +117,11 @@ static void logic(void)
} }
app.doTrophyAlerts = (battle.status != MS_IN_PROGRESS && battle.missionFinishedTimer <= -FPS * 2); app.doTrophyAlerts = (battle.status != MS_IN_PROGRESS && battle.missionFinishedTimer <= -FPS * 2);
if (battle.campaignFinished)
{
endCampaign();
}
} }
doWidgets(); doWidgets();
@ -425,7 +431,7 @@ static void doTorelliFireStorm(void)
} }
} }
void endCampaign(void) static void endCampaign(void)
{ {
awardTrophy("CAMPAIGN_COMPLETE"); awardTrophy("CAMPAIGN_COMPLETE");

View File

@ -305,7 +305,7 @@ static void executeNextLine(ScriptRunner *runner)
} }
else if (strcmp(command, "END_CAMPAIGN") == 0) else if (strcmp(command, "END_CAMPAIGN") == 0)
{ {
endCampaign(); battle.campaignFinished = 1;
} }
else else
{ {

View File

@ -42,7 +42,6 @@ extern void createChristabelLocation(void);
extern void killEntity(char *name); extern void killEntity(char *name);
extern void updateEntitySide(char *side, char *entity); extern void updateEntitySide(char *side, char *entity);
extern void activateTrespasserSpawner(void); extern void activateTrespasserSpawner(void);
extern void endCampaign(void);
extern Battle battle; extern Battle battle;
extern Colors colors; extern Colors colors;

View File

@ -360,6 +360,7 @@ typedef struct {
int zackariaSuspicionLevel; int zackariaSuspicionLevel;
int destroyTorelli; int destroyTorelli;
float torelliFireStormAlpha; float torelliFireStormAlpha;
int campaignFinished;
Entity *missionTarget; Entity *missionTarget;
Entity *jumpgate; Entity *jumpgate;
Entity *messageSpeaker; Entity *messageSpeaker;