forked from github/server
speeding up produceexp_chance
This commit is contained in:
parent
9bdc811582
commit
8a95ea0c00
|
@ -261,7 +261,7 @@ extern "C" {
|
||||||
unsigned int data_turn;
|
unsigned int data_turn;
|
||||||
struct param *parameters;
|
struct param *parameters;
|
||||||
void *vm_state;
|
void *vm_state;
|
||||||
float producexpchance;
|
double producexpchance;
|
||||||
int cookie;
|
int cookie;
|
||||||
int data_version; /* TODO: eliminate in favor of gamedata.version */
|
int data_version; /* TODO: eliminate in favor of gamedata.version */
|
||||||
struct _dictionary_ *inifile;
|
struct _dictionary_ *inifile;
|
||||||
|
|
|
@ -1935,7 +1935,12 @@ bool unit_can_study(const unit *u) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static double produceexp_chance(void) {
|
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))
|
void produceexp_ex(struct unit *u, skill_t sk, int n, bool (*learn)(unit *, skill_t, double))
|
||||||
|
|
Loading…
Reference in New Issue