race.healing is now an int percentage, not a float multiplier

This commit is contained in:
Enno Rehling 2017-02-03 18:18:55 +01:00
parent fd9583df3d
commit 1c347ca5ba
5 changed files with 6 additions and 6 deletions

View File

@ -117,7 +117,7 @@ extern "C" {
typedef struct race {
char *_name;
int magres;
float healing;
int healing;
double maxaura; /* Faktor auf Maximale Aura */
double regaura; /* Faktor auf Regeneration */
double recruit_multi; /* Faktor f<>r Bauernverbrauch */

View File

@ -25,7 +25,7 @@ static void test_rc_defaults(CuTest *tc) {
CuAssertStrEquals(tc, "human", rc->_name);
CuAssertIntEquals(tc, 0, rc->magres);
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, 1.0, rc->recruit_multi, 0.0);
CuAssertDblEquals(tc, 1.0, rc->regaura, 0.0);

View File

@ -2051,7 +2051,7 @@ double u_heal_factor(const unit * u)
{
const race * rc = u_race(u);
if (rc->healing>0) {
return rc->healing;
return rc->healing / 100.0;
}
if (r_isforest(u->region)) {
static int rc_cache;

View File

@ -498,9 +498,9 @@ static void test_heal_factor(CuTest *tc) {
rsettrees(r, 2, 0);
CuAssertTrue(tc, r_isforest(r));
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);
rc->healing = 0.0;
rc->healing = 0;
rc = rc_get_or_create("elf");
CuAssertPtrEquals(tc, (void *)rc, (void *)get_race(RC_ELF));
u_setrace(u, get_race(RC_ELF));

View File

@ -1636,7 +1636,7 @@ static int parse_races(xmlDocPtr doc)
xmlFree(propValue);
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->regaura = (float)xml_fvalue(node, "regaura", rc->regaura);
rc->recruitcost = xml_ivalue(node, "recruitcost", rc->recruitcost);