jsmn_init(&p);\r
\r
file_s = filesize(fh);\r
- /*js = malloc(file_s);\r
- if(js == NULL) {\r
- fprintf(stderr, "malloc(): errno = %d", 2);\r
- fclose(fh);\r
- return 3;\r
- }\r
- if(fread(js, 1, file_s, fh) != file_s) {\r
- fprintf(stderr, "Map read error");\r
- free(js);\r
- fclose(fh);\r
- return 1;\r
- }*/\r
CA_LoadFile(mn, &MAPBUFINLM, gvar);\r
tokcount = jsmn_parse(&p, MAPBUFINLM, file_s, NULL, 0);\r
tok = malloc(tokcount*sizeof(jsmntok_t));\r
}\r
else if(status != tokcount) { printf("Warning: used %d tok\n", status);}\r
extract_map(MAPBUFINLM, tok, tokcount, map);\r
- //CA_mapdump(MAPBUFINLM, tok, p.toknext, map, 0, gvar);\r
\r
- //free(js);\r
free(tok);\r
fclose(fh);\r
\r
\r
int jsoneq(const char *json, jsmntok_t *tok, const char *s);\r
//word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, map_t *map, dword q);\r
-int loadmap(char *mn, map_t *map, global_game_variables_t *gvar);\r
-int newloadmap(char *mn, map_t *map);\r
+//int loadmap(char *mn, map_t *map, global_game_variables_t *gvar);\r
+//int newloadmap(char *mn, map_t *map);\r
int CA_loadmap(char *mn, map_t *map, global_game_variables_t *gvar);\r
\r
#endif/*_16_LIB__H_*/\r
\r
/* create the map */\r
// fprintf(stderr, "testing map load~ ");\r
- loadmap("data/test.map", &map, &gvar);\r
+ CA_loadmap("data/test.map", &map, &gvar);\r
chkmap(&map, 0);\r
// printf("chkmap ok ");\r
// fprintf(stderr, "yay map loaded~~\n");\r