From 01894d5150073e13525f0b1b10e248f6a877bfac Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 18 Dec 2015 14:28:44 +0000 Subject: [PATCH] Activate objectives by name, not number. --- data/missions/alba/02 - patrol #2.json | 2 +- data/missions/granada/02 - suspect packages #2.json | 8 ++++---- data/missions/granada/03 - suspect packages #3.json | 6 +++++- src/battle/objectives.c | 8 +------- src/battle/script.c | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/data/missions/alba/02 - patrol #2.json b/data/missions/alba/02 - patrol #2.json index 920c941..593ca23 100644 --- a/data/missions/alba/02 - patrol #2.json +++ b/data/missions/alba/02 - patrol #2.json @@ -62,7 +62,7 @@ "function" : "Waypoint #3", "lines" : [ "ACTIVATE_ENTITIES Pandoran", - "ACTIVATE_OBJECTIVES 1", + "ACTIVATE_OBJECTIVES Destroy Pandoran fighters", "MSG_BOX Alba Control;Patrol A-82, you have hostiles incoming. Identified as 3 Mitikas fighters; Jackals, possibly Pandoran. Engage, but exercise extreme caution." ] } diff --git a/data/missions/granada/02 - suspect packages #2.json b/data/missions/granada/02 - suspect packages #2.json index 74a64e1..601c8eb 100644 --- a/data/missions/granada/02 - suspect packages #2.json +++ b/data/missions/granada/02 - suspect packages #2.json @@ -35,7 +35,7 @@ "active" : 0 }, { - "description" : "Destroy Intercepting Darts", + "description" : "Destroy intercepting Darts", "targetName" : "Dart", "targetValue" : 7, "targetType" : "TT_DESTROY", @@ -138,7 +138,7 @@ "WAIT 1", "MSG_BOX Alexandria Orbital;Iron Patriots, we're again identifying a handful of crates drifting close to your current position. Please effect pick up.", "ACTIVATE_ENTITIES package", - "ACTIVATE_OBJECTIVES 1", + "ACTIVATE_OBJECTIVES Retrieve packages", "MSG_BOX Carr;Got it. Heading to the first one now" ] }, @@ -150,7 +150,7 @@ "MSG_BOX Carr;Know anything about the occupant, or affiliation?", "MSG_BOX Alexandria Orbital;Negative, Lieutenant. We'll know more once it's brought in.", "ACTIVATE_ENTITIES Stranded Dart;Tug", - "ACTIVATE_OBJECTIVES 2;3" + "ACTIVATE_OBJECTIVES Bring in Stranded Dart;Do not destroy Stranded Dart" ] }, { @@ -162,7 +162,7 @@ "ACTIVATE_ENTITIES Extraction Point", "WAIT 20", "ACTIVATE_ENTITIES Dart", - "ACTIVATE_OBJECTIVES 4", + "ACTIVATE_OBJECTIVES Destroy intercepting Darts", "MSG_BOX Wingmate;Dan, we've got hostile vessels inbound. More Darts.", "MSG_BOX Carr;Prepare to engage. Protect the asset!" ] diff --git a/data/missions/granada/03 - suspect packages #3.json b/data/missions/granada/03 - suspect packages #3.json index 1f8372c..f12dc5e 100644 --- a/data/missions/granada/03 - suspect packages #3.json +++ b/data/missions/granada/03 - suspect packages #3.json @@ -139,7 +139,11 @@ "MSG_BOX Alexandria Orbital;Patrol, we have a major situation developing. A skirmish is taking place between a number of starfighters: Darts, Nymphs, and Fireflies.", "MSG_BOX Carr;Pirates? Insurgents? Nation of Tzac?", "WAIT_MSG_BOX", - "ACTIVATE_OBJECTIVES 1;2;3;4;5", + "ACTIVATE_OBJECTIVES Disable Pirate Commander", + "ACTIVATE_OBJECTIVES Disable Tzac Commander", + "ACTIVATE_OBJECTIVES Destroy all other opponents", + "ACTIVATE_OBJECTIVES Do not allow Pirate Commander to be killed", + "ACTIVATE_OBJECTIVES Do not allow Tzac Commander to be killed", "ACTIVATE_ENTITY_GROUPS skirmishGroup", "MSG_BOX Alexandria Orbital;Too early to speculate. We want you to disable and bring in one craft from each side. The rest, you can eliminate.", "MSG_BOX Carr;On it." diff --git a/src/battle/objectives.c b/src/battle/objectives.c index 5ccb1cf..c20fcc3 100644 --- a/src/battle/objectives.c +++ b/src/battle/objectives.c @@ -179,25 +179,19 @@ void failIncompleteObjectives(void) void activateObjectives(char *objectives) { char *token; - int i, num; Objective *o; token = strtok(objectives, ";"); while (token) { - i = 0; - num = atoi(token); - for (o = battle.objectiveHead.next ; o != NULL ; o = o->next) { - if (i == num) + if (strcmp(token, o->description) == 0) { addHudMessage(colors.cyan, "New Objective : %s", o->description); o->active = 1; } - - i++; } token = strtok(NULL, ";"); diff --git a/src/battle/script.c b/src/battle/script.c index 45909a4..75fa0c9 100644 --- a/src/battle/script.c +++ b/src/battle/script.c @@ -133,7 +133,7 @@ static void executeNextLine(ScriptRunner *runner) } else if (strcmp(command, "ACTIVATE_OBJECTIVES") == 0) { - sscanf(line, "%*s %s", strParam[0]); + sscanf(line, "%*s %[^\n]", strParam[0]); activateObjectives(strParam[0]); } else if (strcmp(command, "MSG_BOX") == 0)