forked from github/server
race.healing is now an int percentage, not a float multiplier
This commit is contained in:
parent
fd9583df3d
commit
1c347ca5ba
5 changed files with 6 additions and 6 deletions
|
@ -117,7 +117,7 @@ extern "C" {
|
||||||
typedef struct race {
|
typedef struct race {
|
||||||
char *_name;
|
char *_name;
|
||||||
int magres;
|
int magres;
|
||||||
float healing;
|
int healing;
|
||||||
double maxaura; /* Faktor auf Maximale Aura */
|
double maxaura; /* Faktor auf Maximale Aura */
|
||||||
double regaura; /* Faktor auf Regeneration */
|
double regaura; /* Faktor auf Regeneration */
|
||||||
double recruit_multi; /* Faktor f<>r Bauernverbrauch */
|
double recruit_multi; /* Faktor f<>r Bauernverbrauch */
|
||||||
|
|
|
@ -25,7 +25,7 @@ static void test_rc_defaults(CuTest *tc) {
|
||||||
CuAssertStrEquals(tc, "human", rc->_name);
|
CuAssertStrEquals(tc, "human", rc->_name);
|
||||||
CuAssertIntEquals(tc, 0, rc->magres);
|
CuAssertIntEquals(tc, 0, rc->magres);
|
||||||
CuAssertDblEquals(tc, 0.0, rc_magres(rc), 0.0);
|
CuAssertDblEquals(tc, 0.0, rc_magres(rc), 0.0);
|
||||||
CuAssertDblEquals(tc, 0.0, rc->healing, 0.0);
|
CuAssertIntEquals(tc, 0, rc->healing);
|
||||||
CuAssertDblEquals(tc, 0.0, rc->maxaura, 0.0);
|
CuAssertDblEquals(tc, 0.0, rc->maxaura, 0.0);
|
||||||
CuAssertDblEquals(tc, 1.0, rc->recruit_multi, 0.0);
|
CuAssertDblEquals(tc, 1.0, rc->recruit_multi, 0.0);
|
||||||
CuAssertDblEquals(tc, 1.0, rc->regaura, 0.0);
|
CuAssertDblEquals(tc, 1.0, rc->regaura, 0.0);
|
||||||
|
|
|
@ -2051,7 +2051,7 @@ double u_heal_factor(const unit * u)
|
||||||
{
|
{
|
||||||
const race * rc = u_race(u);
|
const race * rc = u_race(u);
|
||||||
if (rc->healing>0) {
|
if (rc->healing>0) {
|
||||||
return rc->healing;
|
return rc->healing / 100.0;
|
||||||
}
|
}
|
||||||
if (r_isforest(u->region)) {
|
if (r_isforest(u->region)) {
|
||||||
static int rc_cache;
|
static int rc_cache;
|
||||||
|
|
|
@ -498,9 +498,9 @@ static void test_heal_factor(CuTest *tc) {
|
||||||
rsettrees(r, 2, 0);
|
rsettrees(r, 2, 0);
|
||||||
CuAssertTrue(tc, r_isforest(r));
|
CuAssertTrue(tc, r_isforest(r));
|
||||||
CuAssertDblEquals(tc, 1.0, u_heal_factor(u), 0.0);
|
CuAssertDblEquals(tc, 1.0, u_heal_factor(u), 0.0);
|
||||||
rc->healing = 2.0;
|
rc->healing = 200;
|
||||||
CuAssertDblEquals(tc, 2.0, u_heal_factor(u), 0.0);
|
CuAssertDblEquals(tc, 2.0, u_heal_factor(u), 0.0);
|
||||||
rc->healing = 0.0;
|
rc->healing = 0;
|
||||||
rc = rc_get_or_create("elf");
|
rc = rc_get_or_create("elf");
|
||||||
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));
|
||||||
|
|
|
@ -1636,7 +1636,7 @@ static int parse_races(xmlDocPtr doc)
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
|
|
||||||
rc->magres = xml_ivalue(node, "magres", rc->magres);
|
rc->magres = xml_ivalue(node, "magres", rc->magres);
|
||||||
rc->healing = (float)xml_fvalue(node, "healing", rc->healing);
|
rc->healing = (int)(xml_fvalue(node, "healing", rc->healing) * 100); // TODO: store as int in XML
|
||||||
rc->maxaura = (float)xml_fvalue(node, "maxaura", rc->maxaura);
|
rc->maxaura = (float)xml_fvalue(node, "maxaura", rc->maxaura);
|
||||||
rc->regaura = (float)xml_fvalue(node, "regaura", rc->regaura);
|
rc->regaura = (float)xml_fvalue(node, "regaura", rc->regaura);
|
||||||
rc->recruitcost = xml_ivalue(node, "recruitcost", rc->recruitcost);
|
rc->recruitcost = xml_ivalue(node, "recruitcost", rc->recruitcost);
|
||||||
|
|
Loading…
Reference in a new issue