diff --git a/src/kernel/config.c b/src/kernel/config.c index 956c622fe..e039ac4c9 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -1572,23 +1572,29 @@ bool markets_module(void) } void config_set(const char *key, const char *value) { - set_param(&global.parameters, key, value); + set_param(&global.parameters_, key, value); } const char *config_get(const char *key) { - return get_param(global.parameters, key); + return get_param(global.parameters_, key); } int config_get_int(const char *key, int def) { - return get_param_int(global.parameters, key, def); + return get_param_int(global.parameters_, key, def); } double config_get_flt(const char *key, double def) { - return get_param_flt(global.parameters, key, def); + return get_param_flt(global.parameters_, key, def); } bool config_token(const char *key, const char *tok) { - return !!check_param(global.parameters, key, tok); + return !!check_param(global.parameters_, key, tok); +} + +void free_config(void) { + global.functions.maintenance = NULL; + global.functions.wage = NULL; + free_params(&global.parameters_); } /** releases all memory associated with the game state. diff --git a/src/kernel/config.h b/src/kernel/config.h index fc6ce99f3..f907e691c 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -246,7 +246,7 @@ extern "C" { const char *gamename; struct attrib *attribs; unsigned int data_turn; - struct param *parameters; + struct param *parameters_; void *vm_state; int data_version; /* TODO: eliminate in favor of gamedata.version */ struct _dictionary_ *inifile; @@ -297,6 +297,7 @@ extern "C" { void init_parameters(struct locale *lang); void free_gamedata(void); + void free_config(void); extern struct helpmode helpmodes[]; extern const char *parameters[]; diff --git a/src/tests.c b/src/tests.c index e7518211e..d553255de 100644 --- a/src/tests.c +++ b/src/tests.c @@ -78,9 +78,7 @@ void test_cleanup(void) free_terrains(); free_resources(); - global.functions.maintenance = NULL; - global.functions.wage = NULL; - free_params(&global.parameters); + free_config(); default_locale = 0; close_orders(); free_locales();