forked from github/server
optimization: elf-special "regen.forest" is now a config.
this is an E3 feature eliminates rc.parameters for elves allows use of a local cached static
This commit is contained in:
parent
2ecbf89f1a
commit
3b3e39a319
|
@ -42,6 +42,7 @@
|
||||||
"nmr.timeout": 5,
|
"nmr.timeout": 5,
|
||||||
"nmr.removenewbie": 0,
|
"nmr.removenewbie": 0,
|
||||||
"GiveRestriction": 3,
|
"GiveRestriction": 3,
|
||||||
|
"healing.forest": 2.0,
|
||||||
"hunger.long": false,
|
"hunger.long": false,
|
||||||
"hunger.damage": "1d9+9",
|
"hunger.damage": "1d9+9",
|
||||||
"hunger.demons.skill": true,
|
"hunger.demons.skill": true,
|
||||||
|
|
|
@ -127,7 +127,6 @@
|
||||||
<race name="elf" magres="10" maxaura="1.0" regaura="1.1" recruitcost="200" maintenance="10" weight="1000" capacity="540" speed="1.0" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
<race name="elf" magres="10" maxaura="1.0" regaura="1.1" recruitcost="200" maintenance="10" weight="1000" capacity="540" speed="1.0" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||||
<function name="itemdrop" value="defaultdrops"/>
|
<function name="itemdrop" value="defaultdrops"/>
|
||||||
<param name="regen.forest" value="2.0"/>
|
|
||||||
<skill name="armorer" modifier="-1"/>
|
<skill name="armorer" modifier="-1"/>
|
||||||
<skill name="bow" modifier="2"/>
|
<skill name="bow" modifier="2"/>
|
||||||
<skill name="building" modifier="-1"/>
|
<skill name="building" modifier="-1"/>
|
||||||
|
|
|
@ -2060,9 +2060,10 @@ double u_heal_factor(const unit * u)
|
||||||
rc_elf = get_race(RC_ELF);
|
rc_elf = get_race(RC_ELF);
|
||||||
}
|
}
|
||||||
if (rc == rc_elf) {
|
if (rc == rc_elf) {
|
||||||
double elf_regen = 1.0;
|
static int cache;
|
||||||
if (rc->parameters) {
|
static double elf_regen;
|
||||||
elf_regen = get_param_flt(rc->parameters, "regen.forest", elf_regen);
|
if (config_changed(&cache)) {
|
||||||
|
elf_regen = config_get_flt("healing.forest", 1.0);
|
||||||
}
|
}
|
||||||
return elf_regen;
|
return elf_regen;
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,7 +505,7 @@ static void test_heal_factor(CuTest *tc) {
|
||||||
CuAssertPtrEquals(tc, (void *)rc, (void *)get_race(RC_ELF));
|
CuAssertPtrEquals(tc, (void *)rc, (void *)get_race(RC_ELF));
|
||||||
u_setrace(u, get_race(RC_ELF));
|
u_setrace(u, get_race(RC_ELF));
|
||||||
CuAssertDblEquals(tc, 1.0, u_heal_factor(u), 0.0);
|
CuAssertDblEquals(tc, 1.0, u_heal_factor(u), 0.0);
|
||||||
set_param(&rc->parameters, "regen.forest", "1.5");
|
config_set("healing.forest", "1.5");
|
||||||
CuAssertDblEquals(tc, 1.5, u_heal_factor(u), 0.0);
|
CuAssertDblEquals(tc, 1.5, u_heal_factor(u), 0.0);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue