SolarSystem *solsys_load(const char *filename) { SolarSystem *ret; ALLEGRO_FILE *file; ALLEGRO_CONFIG *cfg; file = al_fopen(filename, "rb"); if (file == NULL) { log_err("Error opening file %s\n", filename); return NULL; } cfg = al_load_config_file_f(file); if (cfg == NULL) { al_fclose(file); log_err("Not a valid config file\n"); return NULL; } ret = load_from_config(cfg); if (ret == NULL) log_err("Couldn't load solarsystem from file: %s\n", filename); else log_dbg("Loaded a solarsystem with %d bodies\n", ret->num_bodies); al_destroy_config(cfg); al_fclose(file); return ret; }
ALLEGRO_CONFIG * load_config_file_f (ALLEGRO_FILE *file) { ALLEGRO_CONFIG *config = al_load_config_file_f (file); if (! config) error (0, 0, "%s (%p): failed to load configuration file", __func__, file); return config; }