From ccff127394cbf9c9e32fc6239b7658ce541778e9 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 3 Jun 2016 14:10:22 +0100 Subject: [PATCH] Allow optional missions to expire. --- data/missions/krasst/01 - infiltration #5.json | 1 + data/missions/phylent/01 - infiltration #1.json | 1 + data/missions/sampi-persei vii/01 - infiltration #2.json | 1 + data/missions/tigris/01 - infiltration #3.json | 1 + data/missions/trilliack/99 - infiltration #4.json | 1 + src/galaxy/mission.c | 8 +++++++- src/structs.h | 1 + 7 files changed, 13 insertions(+), 1 deletion(-) diff --git a/data/missions/krasst/01 - infiltration #5.json b/data/missions/krasst/01 - infiltration #5.json index 8479228..eaf0d71 100644 --- a/data/missions/krasst/01 - infiltration #5.json +++ b/data/missions/krasst/01 - infiltration #5.json @@ -3,6 +3,7 @@ "name" : "Infiltration #5", "description" : "You've done well so far, Hicks. We appreciate that things have not been easy, but you're in a better position than many of us had hoped for. As soon as you're able, begin your search for the admiral. Once located, you will need to open a dialog with him. Whatever you do, do not kill him.", "requires" : 66, + "expires" : 67, "requiresOptional" : 4, "isOptional" : 1, "hasSuspicionLevel" : 1, diff --git a/data/missions/phylent/01 - infiltration #1.json b/data/missions/phylent/01 - infiltration #1.json index f139edd..07a3b2e 100644 --- a/data/missions/phylent/01 - infiltration #1.json +++ b/data/missions/phylent/01 - infiltration #1.json @@ -2,6 +2,7 @@ "name" : "Infiltration #1", "description" : "An opportunity has been granted for us to infiltrate Mitikas space, the Pandoran army, and ultimate get close to Jason Zackaria or Julian Rissard. If nothing else, we could still discover the whereabouts of these two elusive men, which could assist in future operations to capture them. Your goal is to acquire an Angel, an outdated INF fighter that currently lies in the hands of mercenaries. They have retreated to Phylent to affect repairs, so now is the chance to strike.", "requires" : 10, + "expires" : 15, "isOptional" : 1, "background" : "gfx/backgrounds/background01.jpg", "planet" : "gfx/planets/arlos.png", diff --git a/data/missions/sampi-persei vii/01 - infiltration #2.json b/data/missions/sampi-persei vii/01 - infiltration #2.json index 2cce825..6c7b1f5 100644 --- a/data/missions/sampi-persei vii/01 - infiltration #2.json +++ b/data/missions/sampi-persei vii/01 - infiltration #2.json @@ -2,6 +2,7 @@ "name" : "Infiltration #2", "description" : "This is a very dangerous mission. While the Pandorans appear to have accepted you as one of their pilots, they will still be highly suspicious. You should therefore do whatever possible to keep their suspicions low. Stick close to the wing commander when not in combat. Do not fire your guns or use your ECM if you don't need to, and eliminate your targets with extreme prejudice, no matter what.", "requires" : 25, + "expires" : 30, "requiresOptional" : 1, "isOptional" : 1, "hasSuspicionLevel" : 1, diff --git a/data/missions/tigris/01 - infiltration #3.json b/data/missions/tigris/01 - infiltration #3.json index 2fa39a3..b215b3d 100644 --- a/data/missions/tigris/01 - infiltration #3.json +++ b/data/missions/tigris/01 - infiltration #3.json @@ -2,6 +2,7 @@ "name" : "Infiltration #3", "description" : "", "requires" : 52, + "expires" : 57, "requiresOptional" : 2, "isOptional" : 1, "hasSuspicionLevel" : 1, diff --git a/data/missions/trilliack/99 - infiltration #4.json b/data/missions/trilliack/99 - infiltration #4.json index df66672..4b284d6 100644 --- a/data/missions/trilliack/99 - infiltration #4.json +++ b/data/missions/trilliack/99 - infiltration #4.json @@ -2,6 +2,7 @@ "name" : "Infiltration #4", "description" : "We're sorry, Hicks, but you need to continue following orders. We're aware of what is about to happen, but this is for the greater good. Try to get through this in one piece. Both metally and physically.", "requires" : 63, + "expires" : 65, "requiresOptional" : 3, "isOptional" : 1, "hasSuspicionLevel" : 1, diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index f8ebb98..ffa0080 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -54,6 +54,7 @@ Mission *loadMissionMeta(char *filename) mission->isOptional = getJSONValue(root, "isOptional", 0); mission->requiresOptional = getJSONValue(root, "requiresOptional", 0); + mission->expires = getJSONValue(root, "expires", 0); if (cJSON_GetObjectItem(root, "epic")) { @@ -466,7 +467,12 @@ void updateAllMissions(void) int isMissionAvailable(Mission *mission, Mission *prev) { - return (prev->completed && mission->requires <= game.completedMissions && game.stats[STAT_OPTIONAL_COMPLETED] >= mission->requiresOptional) || dev.debug; + return ( + prev->completed && + mission->requires <= game.completedMissions && + game.stats[STAT_OPTIONAL_COMPLETED] >= mission->requiresOptional && + (!mission->expires || (game.completedMissions < mission->expires)) + ) || dev.debug; } static unsigned long hashcode(const char *str) diff --git a/src/structs.h b/src/structs.h index f8b0581..a22b4b6 100644 --- a/src/structs.h +++ b/src/structs.h @@ -278,6 +278,7 @@ struct Mission { char filename[MAX_DESCRIPTION_LENGTH]; int requires; int requiresOptional; + int expires; char pilot[MAX_NAME_LENGTH]; char squadron[MAX_NAME_LENGTH]; char craft[MAX_NAME_LENGTH];