diff options
-rw-r--r-- | src/main.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -171,7 +171,15 @@ process_map(const char *word, const char *path, cJSON *json) return -1; } } - printf("},%d,(const Tiled2cObject[]){", cJSON_GetArraySize(layers)); + int numobjects = 0; + cJSON_ArrayForEach(layer, layers) { + JSON_GET_STRING(layer, type); + if (type->valuestring[0] != 'o') + continue; + JSON_GET_ARRAY(layer, objects); + numobjects += cJSON_GetArraySize(objects); + } + printf("},%d,(const Tiled2cObject[]){", numobjects); cJSON_ArrayForEach(layer, layers) { JSON_GET_STRING(layer, type); if (type->valuestring[0] != 'o') |