forked from github/server
remove produce_exp caching in static variables (more slowdown)
This commit is contained in:
parent
6b83120c7a
commit
66dd1b8172
2 changed files with 1 additions and 7 deletions
|
@ -259,7 +259,6 @@ extern "C" {
|
||||||
/* the following are some cached values, because get_param can be slow.
|
/* the following are some cached values, because get_param can be slow.
|
||||||
* you should almost never need to touch them */
|
* you should almost never need to touch them */
|
||||||
int cookie;
|
int cookie;
|
||||||
double producexpchance_;
|
|
||||||
} settings;
|
} settings;
|
||||||
|
|
||||||
typedef struct helpmode {
|
typedef struct helpmode {
|
||||||
|
|
|
@ -1931,12 +1931,7 @@ bool unit_can_study(const unit *u) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static double produceexp_chance(void) {
|
static double produceexp_chance(void) {
|
||||||
static int update = 0;
|
return get_param_flt(global.parameters, "study.from_use", 1.0 / 3);
|
||||||
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))
|
void produceexp_ex(struct unit *u, skill_t sk, int n, bool (*learn)(unit *, skill_t, double))
|
||||||
|
|
Loading…
Reference in a new issue