Allow optional missions to expire.

This commit is contained in:
Steve 2016-06-03 14:10:22 +01:00
parent 6af1df919d
commit ccff127394
7 changed files with 13 additions and 1 deletions

View File

@ -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,

View File

@ -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",

View File

@ -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,

View File

@ -2,6 +2,7 @@
"name" : "Infiltration #3",
"description" : "",
"requires" : 52,
"expires" : 57,
"requiresOptional" : 2,
"isOptional" : 1,
"hasSuspicionLevel" : 1,

View File

@ -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,

View File

@ -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)

View File

@ -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];