equal
deleted
inserted
replaced
36 } |
36 } |
37 } |
37 } |
38 |
38 |
39 int flib_mapcfg_read(const char *dataDirPath, const char *mapname, flib_mapcfg *out) { |
39 int flib_mapcfg_read(const char *dataDirPath, const char *mapname, flib_mapcfg *out) { |
40 int result = -1; |
40 int result = -1; |
41 if(!log_badparams_if(!dataDirPath || !mapname || !out) |
41 if(!log_badargs_if4(dataDirPath==NULL, mapname==NULL, out==NULL, flib_contains_dir_separator(mapname))) { |
42 && !log_e_if(flib_contains_dir_separator(mapname), "Illegal character in mapname %s", mapname)) { |
|
43 char *path = flib_asprintf("%sMaps/%s/map.cfg", dataDirPath, mapname); |
42 char *path = flib_asprintf("%sMaps/%s/map.cfg", dataDirPath, mapname); |
44 if(path) { |
43 if(path) { |
45 FILE *file = fopen(path, "rb"); |
44 FILE *file = fopen(path, "rb"); |
46 if(!log_e_if(!file, "Unable to open map config file %s", path)) { |
45 if(!log_e_if(!file, "Unable to open map config file %s", path)) { |
47 if(!log_e_if(!fgets(out->theme, sizeof(out->theme), file), "Error reading theme from %s", path)) { |
46 if(!log_e_if(!fgets(out->theme, sizeof(out->theme), file), "Error reading theme from %s", path)) { |