Test world type before loading entities.

This commit is contained in:
Steve 2018-02-05 08:38:39 +00:00
parent c22c09e78f
commit 9128fd84e9
1 changed files with 3 additions and 4 deletions

View File

@ -51,6 +51,9 @@ void loadWorld(char *filename)
STRNCPY(world.tileset, cJSON_GetObjectItem(root, "tileset")->valuestring, MAX_NAME_LENGTH);
STRNCPY(world.background, cJSON_GetObjectItem(root, "background")->valuestring, MAX_FILENAME_LENGTH);
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);
@ -64,10 +67,6 @@ void loadWorld(char *filename)
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);
free(text);