forked from github/server
store maxaura as an integer, not a float.
This commit is contained in:
parent
e51742da90
commit
250227cad2
|
@ -461,7 +461,7 @@ static void json_race(cJSON *json, race *rc) {
|
||||||
rc->magres = child->valueint;
|
rc->magres = child->valueint;
|
||||||
}
|
}
|
||||||
else if (strcmp(child->string, "maxaura") == 0) {
|
else if (strcmp(child->string, "maxaura") == 0) {
|
||||||
rc->maxaura = (float)child->valuedouble;
|
rc->maxaura = child->valueint;
|
||||||
}
|
}
|
||||||
else if (strcmp(child->string, "regaura") == 0) {
|
else if (strcmp(child->string, "regaura") == 0) {
|
||||||
rc->regaura = (float)child->valuedouble;
|
rc->regaura = (float)child->valuedouble;
|
||||||
|
|
|
@ -137,7 +137,7 @@ static void test_races(CuTest * tc)
|
||||||
const char * data = "{\"races\": { \"orc\" : { "
|
const char * data = "{\"races\": { \"orc\" : { "
|
||||||
"\"damage\" : \"1d4\","
|
"\"damage\" : \"1d4\","
|
||||||
"\"magres\" : 100,"
|
"\"magres\" : 100,"
|
||||||
"\"maxaura\" : 2.0,"
|
"\"maxaura\" : 200,"
|
||||||
"\"regaura\" : 3.0,"
|
"\"regaura\" : 3.0,"
|
||||||
"\"speed\" : 4.0,"
|
"\"speed\" : 4.0,"
|
||||||
"\"recruitcost\" : 1,"
|
"\"recruitcost\" : 1,"
|
||||||
|
@ -165,7 +165,8 @@ static void test_races(CuTest * tc)
|
||||||
CuAssertStrEquals(tc, "1d4", rc->def_damage);
|
CuAssertStrEquals(tc, "1d4", rc->def_damage);
|
||||||
CuAssertIntEquals(tc, 100, rc->magres);
|
CuAssertIntEquals(tc, 100, rc->magres);
|
||||||
CuAssertDblEquals(tc, 1.0, rc_magres(rc), 0.0);
|
CuAssertDblEquals(tc, 1.0, rc_magres(rc), 0.0);
|
||||||
CuAssertDblEquals(tc, 2.0, rc->maxaura, 0.0);
|
CuAssertIntEquals(tc, 200, rc->maxaura);
|
||||||
|
CuAssertDblEquals(tc, 2.0, rc_maxaura(rc), 0.0);
|
||||||
CuAssertDblEquals(tc, 3.0, rc->regaura, 0.0);
|
CuAssertDblEquals(tc, 3.0, rc->regaura, 0.0);
|
||||||
CuAssertDblEquals(tc, 4.0, rc->speed, 0.0);
|
CuAssertDblEquals(tc, 4.0, rc->speed, 0.0);
|
||||||
CuAssertIntEquals(tc, 1, rc->recruitcost);
|
CuAssertIntEquals(tc, 1, rc->recruitcost);
|
||||||
|
|
|
@ -287,7 +287,7 @@ double rc_magres(const race *rc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
double rc_maxaura(const race *rc) {
|
double rc_maxaura(const race *rc) {
|
||||||
return rc->maxaura;
|
return rc->maxaura / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* rc_name(const race * rc, name_t n, char *name, size_t size) {
|
const char* rc_name(const race * rc, name_t n, char *name, size_t size) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ extern "C" {
|
||||||
char *_name;
|
char *_name;
|
||||||
int magres;
|
int magres;
|
||||||
int healing;
|
int healing;
|
||||||
double maxaura; /* Faktor auf Maximale Aura */
|
int 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 */
|
||||||
int index;
|
int index;
|
||||||
|
|
|
@ -1637,7 +1637,7 @@ static int parse_races(xmlDocPtr doc)
|
||||||
|
|
||||||
rc->magres = xml_ivalue(node, "magres", rc->magres);
|
rc->magres = xml_ivalue(node, "magres", rc->magres);
|
||||||
rc->healing = (int)(xml_fvalue(node, "healing", rc->healing) * 100); // TODO: store as int in XML
|
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 = (int)(xml_fvalue(node, "maxaura", rc->maxaura) * 100); // TODO: store as int in XML
|
||||||
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);
|
||||||
rc->maintenance = xml_ivalue(node, "maintenance", rc->maintenance);
|
rc->maintenance = xml_ivalue(node, "maintenance", rc->maintenance);
|
||||||
|
|
|
@ -433,9 +433,9 @@ static void test_max_spellpoints(CuTest *tc) {
|
||||||
rc = test_create_race("human");
|
rc = test_create_race("human");
|
||||||
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0));
|
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0));
|
||||||
CuAssertIntEquals(tc, 1, max_spellpoints(u->region, u));
|
CuAssertIntEquals(tc, 1, max_spellpoints(u->region, u));
|
||||||
rc->maxaura = 1.0;
|
rc->maxaura = 100;
|
||||||
CuAssertIntEquals(tc, 1, max_spellpoints(u->region, u));
|
CuAssertIntEquals(tc, 1, max_spellpoints(u->region, u));
|
||||||
rc->maxaura = 2.0;
|
rc->maxaura = 200;
|
||||||
CuAssertIntEquals(tc, 2, max_spellpoints(u->region, u));
|
CuAssertIntEquals(tc, 2, max_spellpoints(u->region, u));
|
||||||
create_mage(u, M_GRAY);
|
create_mage(u, M_GRAY);
|
||||||
set_level(u, SK_MAGIC, 1);
|
set_level(u, SK_MAGIC, 1);
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct race *test_create_race(const char *name)
|
||||||
race *rc = rc_get_or_create(name);
|
race *rc = rc_get_or_create(name);
|
||||||
rc->maintenance = 10;
|
rc->maintenance = 10;
|
||||||
rc->hitpoints = 20;
|
rc->hitpoints = 20;
|
||||||
rc->maxaura = 1.0;
|
rc->maxaura = 100;
|
||||||
rc->ec_flags |= GETITEM;
|
rc->ec_flags |= GETITEM;
|
||||||
rc->battle_flags = BF_EQUIPMENT;
|
rc->battle_flags = BF_EQUIPMENT;
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Reference in New Issue