strcpy(l->author, v);
else if (CASE("special"))
l->is_bonus = atoi(v);
- /*else
- fprintf(stderr, "File %s, ignore %s metadata.\n", l->file, c);*/
c = e;
}
return 1;
}
+/* Load the sol file 'filename' and fill the 'level' structure. Return 1 on
+ * success, 0 on error. */
+
int level_load(const char *filename, struct level *level)
-/* Load the sol file 'filename' and fill the 'level' structure
- * return 1 on success, 0 on error */
{
- struct s_file sol; /* The solid file data */
- int i;
- int money; /* sum of coin value */
+ struct s_file sol;
- /* raz level */
- memset(level, 0, sizeof(struct level));
+ int money;
+ int i;
- memset(&sol, 0, sizeof(sol));
+ memset(level, 0, sizeof (struct level));
+ memset(&sol, 0, sizeof (sol));
/* Try to load the sol file */
if (!sol_load_only_file(&sol, filename))
{
- fprintf(stderr, _("Error while loading level file '%s': "), filename);
- if (errno)
- perror(NULL);
- else
- fprintf(stderr, _("Not a valid level file\n"));
+ fprintf(stderr, _("Error while loading level file '%s': \n"), filename,
+ errno ? strerror(errno) : _("Not a valid level file\n"));
return 0;
}
- /* Set filename */
strcpy(level->file, filename);
/* Init hs with default values */
HOP(level->goal_score.timer, <=);
HOP(level->coin_score.coins, >=);
- /* Free the sol structure, no more needed */
sol_free(&sol);
return 1;
case MODE_NORMAL: return _("Normal");
case MODE_PRACTICE: return _("Practice");
case MODE_SINGLE: return _("Single");
- default: return "???";
+ default: return _("Unknown");
}
}
case GAME_SPEC:
case GAME_GOAL: return _("Success");
case GAME_FALL: return _("Fall-out");
- default: return "???";
+ default: return _("Unknown");
}
}