diff -r e65adfc99f15 -r 7e1d72fc03c7 project_files/frontlib/model/schemelist.c --- a/project_files/frontlib/model/schemelist.c Sun Aug 12 23:51:36 2012 +0200 +++ b/project_files/frontlib/model/schemelist.c Wed Aug 15 23:40:10 2012 +0200 @@ -22,7 +22,6 @@ #include "../util/inihelper.h" #include "../util/logging.h" #include "../util/util.h" -#include "../util/refcounter.h" #include "../util/list.h" #include @@ -35,13 +34,12 @@ } static int readSettingsFromIni(flib_ini *ini, flib_scheme *scheme, int index) { - flib_metascheme *meta = scheme->meta; bool error = false; - for(int i=0; isettingCount && !error; i++) { - char *key = makePrefixedName(index, meta->settings[i].name); + for(int i=0; isettings[i], key, meta->settings[i].def)) { + } else if(flib_ini_get_int_opt(ini, &scheme->settings[i], key, flib_meta.settings[i].def)) { flib_log_e("Error reading setting %s in schemes file.", key); error = true; } @@ -51,10 +49,9 @@ } static int readModsFromIni(flib_ini *ini, flib_scheme *scheme, int index) { - flib_metascheme *meta = scheme->meta; bool error = false; - for(int i=0; imodCount && !error; i++) { - char *key = makePrefixedName(index, meta->mods[i].name); + for(int i=0; imods[i], key, false)) { @@ -66,13 +63,13 @@ return error; } -static flib_scheme *readSchemeFromIni(flib_metascheme *meta, flib_ini *ini, int index) { +static flib_scheme *readSchemeFromIni(flib_ini *ini, int index) { flib_scheme *result = NULL; char *schemeNameKey = makePrefixedName(index+1, "name"); if(schemeNameKey) { char *schemeName = NULL; if(!flib_ini_get_str_opt(ini, &schemeName, schemeNameKey, "Unnamed")) { - flib_scheme *tmpScheme = flib_scheme_create(meta, schemeName); + flib_scheme *tmpScheme = flib_scheme_create(schemeName); if(tmpScheme) { if(!readSettingsFromIni(ini, tmpScheme, index) && !readModsFromIni(ini, tmpScheme, index)) { result = tmpScheme; @@ -93,8 +90,8 @@ return NULL; } -flib_schemelist *flib_schemelist_from_ini(flib_metascheme *meta, const char *filename) { - if(log_badargs_if2(meta==NULL, filename==NULL)) { +flib_schemelist *flib_schemelist_from_ini(const char *filename) { + if(log_badargs_if(filename==NULL)) { return NULL; } @@ -117,7 +114,7 @@ } for(int i=0; imeta; bool error = false; char *key = makePrefixedName(index+1, "name"); error |= !key || flib_ini_set_str(ini, key, scheme->name); free(key); - for(int i=0; imodCount && !error; i++) { - char *key = makePrefixedName(index+1, meta->mods[i].name); + for(int i=0; imods[i]); free(key); } - for(int i=0; isettingCount && !error; i++) { - char *key = makePrefixedName(index+1, meta->settings[i].name); + for(int i=0; isettings[i]); free(key); }