Allocate MIA and target char space.
This commit is contained in:
parent
d51e96c74a
commit
b878a61854
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue