int init_level(struct level *lvl, int xsz, int ysz)
{
+ memset(lvl, 0, sizeof *lvl);
+
if(!(lvl->cells = calloc(xsz * ysz, sizeof *lvl->cells))) {
free(lvl);
return -1;
lvl->fname = strdup(fname);
if((lvl->dirname = malloc(strlen(fname) + 1))) {
+#ifndef LEVEL_EDITOR
path_dir(lvl->fname, lvl->dirname);
+#endif
}
if(!(ts = ts_load(fname))) {
return -1;
}
+#ifndef LEVEL_EDITOR
+
static int load_tileset(struct level *lvl, struct ts_node *tsn)
{
static const char *tile_types[] = {"empty", "straight", "corner", "door", 0};
}
return 0;
}
+
+#else
+
+static int load_tileset(struct level *lvl, struct ts_node *tsn)
+{
+ return 0; /* in the level editor we don't need tileset loading */
+}
+
+#endif /* !LEVEL_EDITOR */