forked from github/server
fix spellbook entries in at_reportspell (crash)
This commit is contained in:
parent
58cbc3ccbc
commit
fc259d232b
|
@ -280,7 +280,7 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
}
|
||||
} else {
|
||||
if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR) {
|
||||
itemanz *= sbe->level;
|
||||
itemanz *= sp->level;
|
||||
}
|
||||
bytes =
|
||||
snprintf(bufp, size, "%d %s", itemanz, LOC(lang, resourcename(rtype,
|
||||
|
|
|
@ -428,7 +428,11 @@ static void update_spells(faction * f, sc_mage * mage, int level, const spellboo
|
|||
add_spellname(mage, sp);
|
||||
}
|
||||
if (!ismonster && !already_seen(f, sp)) {
|
||||
a_add(&f->attribs, a_new(&at_reportspell))->data.v = sp;
|
||||
attrib * a = a_new(&at_reportspell);
|
||||
spellbook_entry * entry = (spellbook_entry *)a->data.v;
|
||||
entry->level = level;
|
||||
entry->sp = sp;
|
||||
a_add(&f->attribs, a);
|
||||
a_add(&f->attribs, a_new(&at_seenspell))->data.v = sp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1662,8 +1662,14 @@ static int parse_spells(xmlDocPtr doc)
|
|||
propValue = xmlGetProp(node, BAD_CAST "cost");
|
||||
if (propValue != NULL) {
|
||||
if (strcmp((const char *)propValue, "linear") == 0) {
|
||||
if ((sp->sptyp&SPELLLEVEL)==0) {
|
||||
log_error("spell '%s' has linear cost but fixed level\n", sp->sname);
|
||||
}
|
||||
component->cost = SPC_LINEAR;
|
||||
} else if (strcmp((const char *)propValue, "level") == 0) {
|
||||
if ((sp->sptyp&SPELLLEVEL)==0) {
|
||||
log_error("spell '%s' has levelled cost but fixed level\n", sp->sname);
|
||||
}
|
||||
component->cost = SPC_LEVEL;
|
||||
}
|
||||
xmlFree(propValue);
|
||||
|
|
Loading…
Reference in New Issue