no more find_spellbyid for resource files.

This commit is contained in:
Enno Rehling 2006-01-01 17:19:51 +00:00
parent 657fc3d123
commit eadda41bcb
3 changed files with 10 additions and 16 deletions

View File

@ -942,10 +942,9 @@ cr_find_address(FILE * F, const faction * uf, const faction_list * addresses)
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
static void static void
cr_reportspell(FILE * F, spellid_t id, const struct locale * lang) cr_reportspell(FILE * F, spell *sp, const struct locale * lang)
{ {
int k; int k;
spell *sp = find_spellbyid(id);
const char * name = add_translation(mkname("spell", sp->sname), spell_name(sp, lang)); const char * name = add_translation(mkname("spell", sp->sname), spell_name(sp, lang));
fprintf(F, "ZAUBER %d\n", hashstring(spell_name(sp, default_locale))); fprintf(F, "ZAUBER %d\n", hashstring(spell_name(sp, default_locale)));
@ -1180,7 +1179,8 @@ report_computer(const char * filename, report_context * ctx)
cr_find_address(F, f, ctx->addresses); cr_find_address(F, f, ctx->addresses);
a = a_find(f->attribs, &at_reportspell); a = a_find(f->attribs, &at_reportspell);
while (a) { while (a) {
cr_reportspell(F, (spellid_t)a->data.i, f->locale); spell *sp = find_spellbyid((spellid_t)a->data.i);
cr_reportspell(F, sp, f->locale);
a = a->nexttype; a = a->nexttype;
} }
for (a=a_find(f->attribs, &at_showitem);a;a=a->nexttype) { for (a=a_find(f->attribs, &at_showitem);a;a=a->nexttype) {

View File

@ -71,13 +71,7 @@ xml_spell(xmlNode * node, const char * name)
const spell * sp = NULL; const spell * sp = NULL;
xmlChar * property = xmlGetProp(node, BAD_CAST name); xmlChar * property = xmlGetProp(node, BAD_CAST name);
if (property!=NULL) { if (property!=NULL) {
int i = atoi((const char *)property);
if (i>0) {
sp = find_spellbyid((spellid_t)i);
}
if (sp==NULL) {
sp = find_spell(M_NONE, (const char *)property); sp = find_spell(M_NONE, (const char *)property);
}
assert(sp); assert(sp);
xmlFree(property); xmlFree(property);
} }

View File

@ -146,9 +146,9 @@
<attack type="4" damage="3d20"/> <attack type="4" damage="3d20"/>
<attack type="4" damage="3d20"/> <attack type="4" damage="3d20"/>
<attack type="4" damage="5d30"/> <attack type="4" damage="5d30"/>
<attack type="6" spell="174"/> <attack type="6" spell="drain_skills"/>
<attack type="6" spell="175"/> <attack type="6" spell="aura_of_fear"/>
<precombatspell spell="176"/> <precombatspell spell="shadowcall"/>
</race> </race>
<race name="apophis" magres="0.950000" maxaura="1.000000" regaura="3.000000" recruitcost="2500000" weight="100" capacity="100000" speed="1.000000" hp="2700" ac="10" damage="2d60" unarmedattack="0" unarmeddefense="0" attackmodifier="10" defensemodifier="12" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" shapeshift="yes"> <race name="apophis" magres="0.950000" maxaura="1.000000" regaura="3.000000" recruitcost="2500000" weight="100" capacity="100000" speed="1.000000" hp="2700" ac="10" damage="2d60" unarmedattack="0" unarmeddefense="0" attackmodifier="10" defensemodifier="12" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" shapeshift="yes">
<ai splitsize="1" killpeasants="yes" learn="yes"/> <ai splitsize="1" killpeasants="yes" learn="yes"/>
@ -159,9 +159,9 @@
<attack type="4" damage="3d20"/> <attack type="4" damage="3d20"/>
<attack type="4" damage="3d20"/> <attack type="4" damage="3d20"/>
<attack type="4" damage="5d30"/> <attack type="4" damage="5d30"/>
<attack type="6" spell="174"/> <attack type="6" spell="drain_skills"/>
<attack type="6" spell="175"/> <attack type="6" spell="aura_of_fear"/>
<precombatspell spell="176"/> <precombatspell spell="shadowcall"/>
</race> </race>
<race name="phoenix" magres="0.900000" maxaura="1.000000" regaura="2.000000" recruitcost="50000" weight="50000" capacity="30000" speed="2.000000" hp="500" ac="6" damage="1d20" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" resistcut="yes" resistpierce="yes"> <race name="phoenix" magres="0.900000" maxaura="1.000000" regaura="2.000000" recruitcost="50000" weight="50000" capacity="30000" speed="2.000000" hp="500" ac="6" damage="1d20" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" resistcut="yes" resistpierce="yes">