Updated hasThreats logic.

This commit is contained in:
Steve 2016-05-15 17:28:17 +01:00
parent c7af23e55f
commit 4aec10e614
3 changed files with 19 additions and 17 deletions

View File

@ -52,6 +52,8 @@ void initBattle(void)
app.delegate.logic = &logic;
app.delegate.draw = &draw;
memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
battle.hasThreats = 1;
initQuadtree(&battle.quadtree);

View File

@ -84,7 +84,7 @@ void doEntities(void)
e->health = e->maxHealth;
e->shield = e->maxShield;
}
if (e->active)
{
self = e;
@ -217,11 +217,11 @@ void doEntities(void)
{
numSpawnedEnemies++;
}
}
if (e->health > 0 && !(e->flags & EF_DISABLED))
{
battle.hasThreats = 1;
if (!(e->flags & EF_DISABLED))
{
battle.hasThreats = 1;
}
}
}
}

View File

@ -42,6 +42,17 @@ void doObjectives(void)
{
battle.numConditions++;
}
if (o->isEliminateAll && o->status != OS_COMPLETE && !battle.hasThreats)
{
addHudMessage(colors.green, _("%s - Objective Complete!"), o->description);
o->currentValue = o->targetValue;
o->status = OS_COMPLETE;
runScriptFunction("OBJECTIVES_COMPLETE %d", battle.numObjectivesComplete + 1);
}
}
else
{
@ -119,17 +130,6 @@ void updateObjective(char *name, int type)
runScriptFunction("OBJECTIVES_COMPLETE %d", ++completed);
}
}
if (o->isEliminateAll && o->status != OS_COMPLETE && !battle.hasThreats)
{
addHudMessage(colors.green, _("%s - Objective Complete!"), o->description);
o->currentValue = o->targetValue;
o->status = OS_COMPLETE;
runScriptFunction("OBJECTIVES_COMPLETE %d", ++completed);
}
}
if (!o->active)