From a82f8b6f2c724c472213cbeb1add6cd33ef4aa65 Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 21 Nov 2015 17:32:39 +0000 Subject: [PATCH] Renamed FLEE flags to RETREAT. --- data/fighters/civilian.json | 2 +- src/battle/extractionPoint.c | 2 +- src/battle/fighters.c | 4 ++-- src/defs.h | 2 +- src/galaxy/mission.c | 7 ++++++- src/galaxy/mission.h | 2 +- src/system/lookup.c | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/data/fighters/civilian.json b/data/fighters/civilian.json index 05dd15d..c4df807 100644 --- a/data/fighters/civilian.json +++ b/data/fighters/civilian.json @@ -6,6 +6,6 @@ "reloadTime" : 0, "shieldRechargeRate" : 0, "textureName" : "gfx/craft/civilian01.png", - "flags" : "EF_MISSION_TARGET+EF_FLEEING", + "flags" : "EF_MISSION_TARGET+EF_RETREATING", "aiFlags" : "AIF_GOAL_EXTRACTION+AIF_AVOIDS_COMBAT" } diff --git a/src/battle/extractionPoint.c b/src/battle/extractionPoint.c index 45c0cc0..9fb24e2 100644 --- a/src/battle/extractionPoint.c +++ b/src/battle/extractionPoint.c @@ -60,7 +60,7 @@ static void handleFleeingEntities(void) for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i]) { - if (e->health > 0 && e->flags & EF_FLEEING && getDistance(self->x, self->y, e->x, e->y) <= 64) + if (e->health > 0 && e->flags & EF_RETREATING && getDistance(self->x, self->y, e->x, e->y) <= 64) { e->alive = ALIVE_ESCAPED; } diff --git a/src/battle/fighters.c b/src/battle/fighters.c index 05171de..3a26f3a 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -538,7 +538,7 @@ static void straightDie(void) } } -void fleeAllEnemies(void) +void retreatEnemies(void) { Entity *e; @@ -559,7 +559,7 @@ void retreatAllies(void) { if (e->type == ET_FIGHTER && e->side == SIDE_ALLIES) { - e->flags |= EF_FLEEING; + e->flags |= EF_RETREATING; e->aiFlags |= AIF_AVOIDS_COMBAT; e->aiFlags |= AIF_UNLIMITED_RANGE; diff --git a/src/defs.h b/src/defs.h index 4b28c0a..87c3135 100644 --- a/src/defs.h +++ b/src/defs.h @@ -72,7 +72,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define EF_HAS_ROPE (2 << 5) #define EF_COLLECTS_ITEMS (2 << 6) #define EF_MUST_DISABLE (2 << 7) -#define EF_FLEEING (2 << 8) +#define EF_RETREATING (2 << 8) #define EF_NO_EPIC (2 << 9) #define AIF_NONE 0 diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 8b61b66..db8b3f1 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -112,7 +112,7 @@ void completeMission(void) game.stats[STAT_MISSIONS_COMPLETED]++; - fleeAllEnemies(); + retreatEnemies(); } } @@ -249,6 +249,11 @@ static void loadFighters(cJSON *node) f->flags = flagsToLong(cJSON_GetObjectItem(node, "flags")->valuestring); } + if (cJSON_GetObjectItem(node, "aiFlags")) + { + f->aiFlags = flagsToLong(cJSON_GetObjectItem(node, "aiFlags")->valuestring); + } + if (cJSON_GetObjectItem(node, "active")) { f->active = cJSON_GetObjectItem(node, "active")->valueint; diff --git a/src/galaxy/mission.h b/src/galaxy/mission.h index 4807dd7..dd627a1 100644 --- a/src/galaxy/mission.h +++ b/src/galaxy/mission.h @@ -41,7 +41,7 @@ extern void selectWidget(const char *name, const char *group); extern Entity *spawnExtractionPoint(void); extern Entity *spawnItem(char *type); extern void failIncompleteObjectives(void); -extern void fleeAllEnemies(void); +extern void retreatEnemies(void); extern Battle battle; extern Entity *player; diff --git a/src/system/lookup.c b/src/system/lookup.c index a6a3db6..45c77d3 100644 --- a/src/system/lookup.c +++ b/src/system/lookup.c @@ -38,7 +38,7 @@ void initLookups(void) addLookup("EF_MUST_DISABLE", EF_MUST_DISABLE); addLookup("EF_IMMORTAL", EF_IMMORTAL); addLookup("EF_MISSION_TARGET", EF_MISSION_TARGET); - addLookup("EF_FLEEING", EF_FLEEING); + addLookup("EF_RETREATING", EF_RETREATING); addLookup("EF_HAS_ROPE", EF_HAS_ROPE); addLookup("EF_COLLECTS_ITEMS", EF_COLLECTS_ITEMS); addLookup("EF_NO_EPIC", EF_NO_EPIC);