Don't require optional missions to need the previous mission to be completed.

This commit is contained in:
Steve 2016-06-07 08:31:02 +01:00
parent 345a45f9c4
commit 142c02c1ed
1 changed files with 14 additions and 7 deletions

View File

@ -81,7 +81,8 @@ Mission *loadMissionMeta(char *filename)
}
else
{
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to load '%s'", filename);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Failed to load '%s'", filename);
exit(1);
}
free(text);
@ -467,12 +468,18 @@ void updateAllMissions(void)
int isMissionAvailable(Mission *mission, Mission *prev)
{
return (
prev->completed &&
mission->requires <= game.completedMissions &&
game.stats[STAT_OPTIONAL_COMPLETED] >= mission->requiresOptional &&
(!mission->expires || (game.completedMissions < mission->expires))
) || dev.debug;
if (!mission->isOptional)
{
return (prev->completed && game.completedMissions >= mission->requires) || dev.debug;
}
else
{
return (
game.completedMissions >= mission->requires &&
game.stats[STAT_OPTIONAL_COMPLETED] >= mission->requiresOptional &&
game.completedMissions < mission->expires
) || dev.debug;
}
}
static unsigned long hashcode(const char *str)