diff --git a/src/kernel/config.h b/src/kernel/config.h index c8fc106e6..ade8bfa63 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -261,7 +261,7 @@ extern "C" { unsigned int data_turn; struct param *parameters; void *vm_state; - float producexpchance; + double producexpchance; int cookie; int data_version; /* TODO: eliminate in favor of gamedata.version */ struct _dictionary_ *inifile; diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 5fb841d9a..696015aef 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1935,7 +1935,12 @@ bool unit_can_study(const unit *u) { } static double produceexp_chance(void) { - return get_param_flt(global.parameters, "study.from_use", 1.0 / 3); + static int update = 0; + if (update != global.cookie) { + global.producexpchance = get_param_flt(global.parameters, "study.from_use", 1.0 / 3); + update = global.cookie; + } + return global.producexpchance; } void produceexp_ex(struct unit *u, skill_t sk, int n, bool (*learn)(unit *, skill_t, double))