Don't fire objectives or conditions if no names.

This commit is contained in:
Steve 2016-05-05 14:06:51 +01:00
parent 9c18974a63
commit ef9ce45aed
1 changed files with 48 additions and 42 deletions

View File

@ -82,6 +82,8 @@ void updateObjective(char *name, int type)
Objective *o; Objective *o;
int completed, hasHidden; int completed, hasHidden;
if (strlen(name))
{
completed = battle.numObjectivesComplete; completed = battle.numObjectivesComplete;
hasHidden = 0; hasHidden = 0;
@ -118,7 +120,7 @@ void updateObjective(char *name, int type)
} }
} }
if (o->isEliminateAll && o->status != OS_COMPLETE && battle.stats[STAT_ENEMIES_KILLED] == battle.numInitialEnemies) if (o->isEliminateAll && o->status != OS_COMPLETE && (battle.stats[STAT_ENEMIES_KILLED] + battle.stats[STAT_CAPITAL_SHIPS_DESTROYED]) == battle.numInitialEnemies)
{ {
addHudMessage(colors.green, _("%s - Objective Complete!"), o->description); addHudMessage(colors.green, _("%s - Objective Complete!"), o->description);
@ -141,6 +143,7 @@ void updateObjective(char *name, int type)
runScriptFunction("ALL_OBJECTIVES_COMPLETE"); runScriptFunction("ALL_OBJECTIVES_COMPLETE");
} }
} }
}
void adjustObjectiveTargetValue(char *name, int type, int amount) void adjustObjectiveTargetValue(char *name, int type, int amount)
{ {
@ -166,6 +169,8 @@ void updateCondition(char *name, int type)
{ {
Objective *o; Objective *o;
if (strlen(name))
{
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next) for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
{ {
if (o->active && o->isCondition && o->targetType == type && o->currentValue < o->targetValue && strcmp(o->targetName, name) == 0) if (o->active && o->isCondition && o->targetType == type && o->currentValue < o->targetValue && strcmp(o->targetName, name) == 0)
@ -184,6 +189,7 @@ void updateCondition(char *name, int type)
} }
} }
} }
}
void completeAllObjectives(void) void completeAllObjectives(void)
{ {