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; }
explicit hotkey_item(const config& cfg, bool is_default): command_("null"), shift_(false), ctrl_(false), cmd_(false), alt_(false), character_(-1), keycode_(-1), joystick_(-1), mouse_(-1), button_(-1), hat_(-1), value_(-1), is_default_(is_default) { load_from_config(cfg); }
void load_hotkeys(const config& cfg, bool set_as_default) { for (const config &hk : cfg.child_range("hotkey")) { hotkey_ptr item = load_from_config(hk); if (!set_as_default) { item->unset_default(); } if (!item->null()) { add_hotkey(item); } } if (set_as_default) { default_hotkey_cfg_ = cfg; } }
int ObScanParamLoader::load(const char *config_file_name, const char *section_name) { int ret = config_.load(config_file_name); if (ret == EXIT_SUCCESS) { ret = load_from_config(section_name); if (ret == OB_SUCCESS) { config_loaded_ = true; } } else { TBSYS_LOG(WARN, "fail to load config file [%s]", config_file_name); ret = OB_ERROR; } return ret; }
explicit acquaintance(const config& cfg) { load_from_config(cfg); }