Allow for star systems to fall to Pandorans, once story missions are complete.
This commit is contained in:
parent
2dd5c66f03
commit
9c532352f5
|
@ -156,6 +156,7 @@
|
||||||
"side" : "SIDE_UNF",
|
"side" : "SIDE_UNF",
|
||||||
"x": 325,
|
"x": 325,
|
||||||
"y": 385,
|
"y": 385,
|
||||||
|
"fallsToPandorans" : 1,
|
||||||
"missions" : [
|
"missions" : [
|
||||||
"data/missions/coyote/01 - coyote assault #1.json",
|
"data/missions/coyote/01 - coyote assault #1.json",
|
||||||
"data/missions/coyote/02 - coyote assault #2.json",
|
"data/missions/coyote/02 - coyote assault #2.json",
|
||||||
|
|
|
@ -176,6 +176,11 @@ static void doStarSystems(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (starSystem->side != SIDE_PANDORAN && starSystem->fallsToPandorans && starSystem->completedMissions == starSystem->totalMissions && starSystem->totalMissions > 0)
|
||||||
|
{
|
||||||
|
starSystem->side = SIDE_PANDORAN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,11 @@ static void loadStarSystem(cJSON *starSystemJSON)
|
||||||
starSystem->x = cJSON_GetObjectItem(starSystemJSON, "x")->valueint;
|
starSystem->x = cJSON_GetObjectItem(starSystemJSON, "x")->valueint;
|
||||||
starSystem->y = cJSON_GetObjectItem(starSystemJSON, "y")->valueint;
|
starSystem->y = cJSON_GetObjectItem(starSystemJSON, "y")->valueint;
|
||||||
|
|
||||||
|
if (cJSON_GetObjectItem(starSystemJSON, "fallsToPandorans"))
|
||||||
|
{
|
||||||
|
starSystem->fallsToPandorans = cJSON_GetObjectItem(starSystemJSON, "fallsToPandorans")->valueint;
|
||||||
|
}
|
||||||
|
|
||||||
starSystem->missionHead.completed = 1;
|
starSystem->missionHead.completed = 1;
|
||||||
starSystem->missionTail = &starSystem->missionHead;
|
starSystem->missionTail = &starSystem->missionHead;
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,7 @@ struct StarSystem {
|
||||||
int y;
|
int y;
|
||||||
int completedMissions;
|
int completedMissions;
|
||||||
int totalMissions;
|
int totalMissions;
|
||||||
|
int fallsToPandorans;
|
||||||
Mission missionHead, *missionTail;
|
Mission missionHead, *missionTail;
|
||||||
StarSystem *next;
|
StarSystem *next;
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,10 +47,15 @@ void loadGame(void)
|
||||||
|
|
||||||
static void loadStarSystems(cJSON *starSystemsJSON)
|
static void loadStarSystems(cJSON *starSystemsJSON)
|
||||||
{
|
{
|
||||||
|
StarSystem *starSystem;
|
||||||
cJSON *starSystemJSON;
|
cJSON *starSystemJSON;
|
||||||
|
|
||||||
for (starSystemJSON = starSystemsJSON->child ; starSystemJSON != NULL ; starSystemJSON = starSystemJSON->next)
|
for (starSystemJSON = starSystemsJSON->child ; starSystemJSON != NULL ; starSystemJSON = starSystemJSON->next)
|
||||||
{
|
{
|
||||||
|
starSystem = getStarSystem(cJSON_GetObjectItem(starSystemJSON, "name")->valuestring);
|
||||||
|
|
||||||
|
starSystem->side = lookup(cJSON_GetObjectItem(starSystemJSON, "side")->valuestring);
|
||||||
|
|
||||||
loadMissions(cJSON_GetObjectItem(starSystemJSON, "missions"));
|
loadMissions(cJSON_GetObjectItem(starSystemJSON, "missions"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,6 @@ extern Challenge *getChallenge(Mission *mission, int type);
|
||||||
extern int lookup(char *lookup);
|
extern int lookup(char *lookup);
|
||||||
extern char *getSaveFilePath(char *filename);
|
extern char *getSaveFilePath(char *filename);
|
||||||
extern char *getLookupName(char *prefix, long num);
|
extern char *getLookupName(char *prefix, long num);
|
||||||
|
extern StarSystem *getStarSystem(char *name);
|
||||||
|
|
||||||
extern Game game;
|
extern Game game;
|
||||||
|
|
|
@ -62,6 +62,7 @@ static void saveStarSystems(cJSON *gameJSON)
|
||||||
starSystemJSON = cJSON_CreateObject();
|
starSystemJSON = cJSON_CreateObject();
|
||||||
|
|
||||||
cJSON_AddStringToObject(starSystemJSON, "name", starSystem->name);
|
cJSON_AddStringToObject(starSystemJSON, "name", starSystem->name);
|
||||||
|
cJSON_AddStringToObject(starSystemJSON, "side", getLookupName("SIDE_", starSystem->side));
|
||||||
cJSON_AddItemToObject(starSystemJSON, "missions", getMissionsJSON(starSystem));
|
cJSON_AddItemToObject(starSystemJSON, "missions", getMissionsJSON(starSystem));
|
||||||
|
|
||||||
cJSON_AddItemToArray(starSystemsJSON, starSystemJSON);
|
cJSON_AddItemToArray(starSystemsJSON, starSystemJSON);
|
||||||
|
|
Loading…
Reference in New Issue