summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2024-01-24 09:27:36 +0100
committerkdx <kikoodx@paranoici.org>2024-01-24 09:27:36 +0100
commitca6b25303c7a5977a86d24fd54172608826a8abc (patch)
tree0b74fe0044d2de01251fead513dd4a84b5255668
parentaee126336212aadad63290c69ca5a6a313510e49 (diff)
downloadtiled2c-ca6b25303c7a5977a86d24fd54172608826a8abc.tar.gz
bool properties
-rw-r--r--src/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 185107a..2accc42 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,6 +21,12 @@
return -1; \
}
+#define JSON_GET_BOOL(j, s) JSON_GET(j, s); \
+ if (!cJSON_IsBool(s)) { \
+ fprintf(stderr, #s " is no bool\n"); \
+ return -1; \
+ }
+
#define JSON_GET_ARRAY(j, s) JSON_GET(j, s); \
if (!cJSON_IsArray(s)) { \
fprintf(stderr, #s " is no array\n"); \
@@ -96,6 +102,11 @@ process_property(cJSON *json)
if (type->valuestring[0] == 's') {
JSON_GET_STRING(json, value);
printf("\"%s\",0},", value->valuestring);
+ } else if (type->valuestring[0] == 'b') {
+ JSON_GET_BOOL(json, value);
+ printf("\"%s\",%d},",
+ value->valueint ? "true" : "false",
+ value->valueint);
} else {
JSON_GET(json, value);
printf("\"%f\",%f},",