Test world type before loading entities.
This commit is contained in:
parent
c22c09e78f
commit
9128fd84e9
|
@ -51,6 +51,9 @@ void loadWorld(char *filename)
|
||||||
STRNCPY(world.tileset, cJSON_GetObjectItem(root, "tileset")->valuestring, MAX_NAME_LENGTH);
|
STRNCPY(world.tileset, cJSON_GetObjectItem(root, "tileset")->valuestring, MAX_NAME_LENGTH);
|
||||||
STRNCPY(world.background, cJSON_GetObjectItem(root, "background")->valuestring, MAX_FILENAME_LENGTH);
|
STRNCPY(world.background, cJSON_GetObjectItem(root, "background")->valuestring, MAX_FILENAME_LENGTH);
|
||||||
world.entityCounter = cJSON_GetObjectItem(root, "entityCounter")->valueint;
|
world.entityCounter = cJSON_GetObjectItem(root, "entityCounter")->valueint;
|
||||||
|
world.isTrainingMission = strcmp(world.id, "beachApproach") == 0;
|
||||||
|
world.isBossMission = strncmp(world.id, "boss", 4) == 0;
|
||||||
|
world.isOutpostMission = strncmp(world.id, "outpost", 7) == 0;
|
||||||
|
|
||||||
loadEnemyTypes(cJSON_GetObjectItem(root, "enemyTypes")->valuestring);
|
loadEnemyTypes(cJSON_GetObjectItem(root, "enemyTypes")->valuestring);
|
||||||
|
|
||||||
|
@ -64,10 +67,6 @@ void loadWorld(char *filename)
|
||||||
|
|
||||||
loadObjectives(cJSON_GetObjectItem(root, "objectives"));
|
loadObjectives(cJSON_GetObjectItem(root, "objectives"));
|
||||||
|
|
||||||
world.isTrainingMission = strcmp(world.id, "beachApproach") == 0;
|
|
||||||
world.isBossMission = strncmp(world.id, "boss", 4) == 0;
|
|
||||||
world.isOutpostMission = strncmp(world.id, "outpost", 7) == 0;
|
|
||||||
|
|
||||||
cJSON_Delete(root);
|
cJSON_Delete(root);
|
||||||
|
|
||||||
free(text);
|
free(text);
|
||||||
|
|
Loading…
Reference in New Issue