Allocate MIA and target char space.

This commit is contained in:
Steve 2018-02-03 16:21:37 +00:00
parent d51e96c74a
commit b878a61854
1 changed files with 13 additions and 0 deletions

View File

@ -87,6 +87,7 @@ static void loadMetaInfo(void)
{
cJSON *root;
char *text;
int i;
text = readFile("data/meta/meta.json");
@ -100,6 +101,18 @@ static void loadMetaInfo(void)
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Meta [keys=%d, targets=%d, mias=%d, hearts=%d, cells=%d]", game.totalKeys, game.totalTargets, game.totalMIAs, game.totalHearts, game.totalCells);
game.mias = malloc(sizeof(char*) * game.totalMIAs);
for (i = 0 ; i < game.totalMIAs ; i++)
{
game.mias[i] = malloc(MAX_NAME_LENGTH);
}
game.targets = malloc(sizeof(char*) * game.totalTargets);
for (i = 0 ; i < game.totalTargets ; i++)
{
game.targets[i] = malloc(MAX_NAME_LENGTH);
}
cJSON_Delete(root);
free(text);