project_files/frontlib/model/schemelist.c
changeset 7271 5608ac657362
parent 7269 5b0aeef8ba2a
child 7275 15f722e0b96f
equal deleted inserted replaced
7269:5b0aeef8ba2a 7271:5608ac657362
   123 static int writeSchemeToIni(flib_cfg *scheme, flib_ini *ini, int index) {
   123 static int writeSchemeToIni(flib_cfg *scheme, flib_ini *ini, int index) {
   124 	flib_cfg_meta *meta = scheme->meta;
   124 	flib_cfg_meta *meta = scheme->meta;
   125 	bool error = false;
   125 	bool error = false;
   126 
   126 
   127 	char *key = makePrefixedName(index+1, "name");
   127 	char *key = makePrefixedName(index+1, "name");
   128 	error |= !key || flib_ini_set_str(ini, key, scheme->schemeName);
   128 	error |= !key || flib_ini_set_str(ini, key, scheme->name);
   129 	free(key);
   129 	free(key);
   130 
   130 
   131 	for(int i=0; i<meta->modCount && !error; i++) {
   131 	for(int i=0; i<meta->modCount && !error; i++) {
   132 		char *key = makePrefixedName(index+1, meta->mods[i].name);
   132 		char *key = makePrefixedName(index+1, meta->mods[i].name);
   133 		error |= !key || flib_ini_set_bool(ini, key, scheme->mods[i]);
   133 		error |= !key || flib_ini_set_bool(ini, key, scheme->mods[i]);
   182 }
   182 }
   183 
   183 
   184 flib_cfg *flib_schemelist_find(flib_schemelist *list, const char *name) {
   184 flib_cfg *flib_schemelist_find(flib_schemelist *list, const char *name) {
   185 	if(list && name) {
   185 	if(list && name) {
   186 		for(int i=0; i<list->schemeCount; i++) {
   186 		for(int i=0; i<list->schemeCount; i++) {
   187 			if(!strcmp(name, list->schemes[i]->schemeName)) {
   187 			if(!strcmp(name, list->schemes[i]->name)) {
   188 				return list->schemes[i];
   188 				return list->schemes[i];
   189 			}
   189 			}
   190 		}
   190 		}
   191 	}
   191 	}
   192 	return NULL;
   192 	return NULL;