forked from github/server
Merge pull request #240 from badgerman/feature/bug-2069-familiar-races
bug 2069: familiar races
This commit is contained in:
commit
78857d8aa3
|
@ -158,6 +158,7 @@ static race *rc_find_i(const char *name)
|
|||
}
|
||||
if (!rc && strcmp(name, "uruk") == 0) {
|
||||
rc = rc_find_i("orc");
|
||||
log_warning("a reference was made to the retired race '%s', returning '%s'.", name, rc->_name);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,6 @@ extern "C" {
|
|||
int flags;
|
||||
int battle_flags;
|
||||
int ec_flags;
|
||||
race_t oldfamiliars[MAXMAGIETYP];
|
||||
struct att attack[RACE_ATTACKS];
|
||||
signed char bonus[MAXSKILLS];
|
||||
|
||||
|
|
|
@ -1613,7 +1613,7 @@ static int parse_races(xmlDocPtr doc)
|
|||
xmlNodePtr node = nodes->nodeTab[i];
|
||||
xmlNodePtr child;
|
||||
xmlChar *propValue;
|
||||
race *rc;
|
||||
race *rc, *frc = 0;
|
||||
xmlXPathObjectPtr result;
|
||||
int k, study_speed_base, attacks;
|
||||
struct att *attack;
|
||||
|
@ -1810,9 +1810,12 @@ static int parse_races(xmlDocPtr doc)
|
|||
/* reading eressea/races/race/familiar */
|
||||
xpath->node = node;
|
||||
result = xmlXPathEvalExpression(BAD_CAST "familiar", xpath);
|
||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||
if (result->nodesetval->nodeNr > MAXMAGIETYP) {
|
||||
log_error("race %s has %d potential familiars", rc->_name, result->nodesetval->nodeNr);
|
||||
}
|
||||
for (k = 0; k != MAXMAGIETYP; ++k) {
|
||||
if (k < result->nodesetval->nodeNr) {
|
||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||
race *frc;
|
||||
|
||||
propValue = xmlGetProp(node, BAD_CAST "race");
|
||||
assert(propValue != NULL);
|
||||
|
@ -1825,6 +1828,9 @@ static int parse_races(xmlDocPtr doc)
|
|||
rc->familiars[k] = frc;
|
||||
}
|
||||
xmlFree(propValue);
|
||||
} else {
|
||||
rc->familiars[k] = frc;
|
||||
}
|
||||
}
|
||||
xmlXPathFreeObject(result);
|
||||
|
||||
|
|
|
@ -480,6 +480,7 @@ static const race *select_familiar(const race * magerace, magic_t magiegebiet)
|
|||
assert(magerace->familiars[0]);
|
||||
if (rnd >= 70) {
|
||||
retval = magerace->familiars[magiegebiet];
|
||||
assert(retval);
|
||||
}
|
||||
else {
|
||||
retval = magerace->familiars[0];
|
||||
|
|
Loading…
Reference in New Issue