X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=blobdiff_plain;f=src%2Flib%2F16_map.c;h=33c27d1446fb98d81c362e15519466160c1bd331;hp=1799921951aa23dc37ada73ca08ce32c3f84e8dd;hb=def418b6ee7f06ce7229e6eae5dbfbe44e9b9e82;hpb=40f6a462ab3580c79bc91e86da49fa5ed37a853c diff --git a/src/lib/16_map.c b/src/lib/16_map.c index 17999219..33c27d14 100755 --- a/src/lib/16_map.c +++ b/src/lib/16_map.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * Copyright (C) 2012-2019 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -23,6 +23,8 @@ //TODO USE CA AND THIS FILE FORMAT #include "src/lib/16_map.h" +//#define JSMN_STATIC +#include "src/lib/jsmn/jsmn.h" #include // Ideally, preprocess json during compilation and read serialized data @@ -180,7 +182,7 @@ int newloadmap(char *mn, map_t *map) { int status; /* Prepare parser */ - jsmn_init((jsmn_parser *)&p); + jsmn_init(&p); file_s = filesize(fh); js = malloc(file_s);//TODO: USE MM_ CA_ AND PM_ @@ -195,11 +197,11 @@ int newloadmap(char *mn, map_t *map) { fclose(fh); return 1; } - tokcount = jsmn_parse((jsmn_parser *)&p, js, file_s, NULL, 0); + tokcount = jsmn_parse(&p, js, file_s, NULL, 0); tok = malloc(tokcount*sizeof(jsmntok_t));//TODO: USE MM_ CA_ AND PM_ printf("Allocated %d tokens", tokcount); - jsmn_init((jsmn_parser *)&p); - if((status = jsmn_parse((jsmn_parser *)&p, js, file_s, tok, tokcount)) < 0) + jsmn_init(&p); + if((status = jsmn_parse(&p, js, file_s, tok, tokcount)) < 0) { printf("Error: %d\n", status); return status; @@ -228,15 +230,15 @@ int CA_loadmap(char *mn, map_t *map, global_game_variables_t *gvar) int status; /* Prepare parser */ - jsmn_init((jsmn_parser *)&p); + jsmn_init(&p); file_s = filesize(fh); CA_LoadFile(mn, MEMPTRCONV MAPSEGINLM, gvar); - tokcount = jsmn_parse((jsmn_parser *)&p, (char const *)MAPSEGINLM, file_s, NULL, 0); + tokcount = jsmn_parse(&p, (char const *)MAPSEGINLM, file_s, NULL, 0); tok = malloc(tokcount*sizeof(jsmntok_t));//TODO: USE MM_ CA_ AND PM_ // printf("Allocated %d tokens", tokcount); - jsmn_init((jsmn_parser *)&p); - if((status = jsmn_parse((jsmn_parser *)&p, (char const *)MAPSEGINLM, file_s, tok, tokcount)) < 0) + jsmn_init(&p); + if((status = jsmn_parse(&p, (char const *)MAPSEGINLM, file_s, tok, tokcount)) < 0) { printf("Error: %d\n", status); return status;