src: more code fixes
parent
91e3465541
commit
1f3d6d1f5d
|
@ -10,7 +10,7 @@ font_t font_create(char *font_name, char *filename) {
|
|||
char errbuf[200];
|
||||
map_t *map;
|
||||
|
||||
printf("Processing %s...\n", font_name);
|
||||
printf(" Processing %s...\n", font_name);
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <toml.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "script.h"
|
||||
|
||||
#define ERRBUFSZ 200
|
||||
|
||||
|
@ -37,5 +38,11 @@ int main(int argc, char **argv) {
|
|||
error("missing key: name", "");
|
||||
}
|
||||
|
||||
printf("Preparing to process %s...\n", name.u.s);
|
||||
printf("Processing game %s...\n", name.u.s);
|
||||
toml_array_t *scripts = toml_array_in(conf, "script");
|
||||
|
||||
for (int i = 0; ; i++) {
|
||||
toml_table_t *toml_script = toml_table_at(scripts, i);
|
||||
script_t script = script_create(toml_script);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,11 @@ script_t script_create(toml_table_t *table) {
|
|||
#define TOML_GET_KEY(var, key, func) toml_datum_t (var) = func(table, (key));\
|
||||
if (!(var).ok) {\
|
||||
char str[200];\
|
||||
snprintf(str, 200, "key '%s' missing from", (key)); \
|
||||
error(str, filename.u.s); \
|
||||
snprintf(str, 200, "key '%s' missing", (key)); \
|
||||
error(str, ""); \
|
||||
}
|
||||
TOML_GET_KEY(name, "name", toml_string_in)
|
||||
printf(" Processing script %s...\n", name.u.s);
|
||||
TOML_GET_KEY(filename, "filename", toml_string_in)
|
||||
TOML_GET_KEY(font_name, "font", toml_string_in)
|
||||
TOML_GET_KEY(min_tiles, "min_tiles_per_line", toml_int_in)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "font.h"
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *filename;
|
||||
font_t font;
|
||||
char *format;
|
||||
|
@ -20,4 +21,7 @@ typedef struct {
|
|||
bool little_endian;
|
||||
} script_t;
|
||||
|
||||
script_t script_create(toml_table_t *table);
|
||||
void script_destroy(script_t script);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue