order of execution for XML parser changed.

This commit is contained in:
Enno Rehling 2005-10-08 18:38:26 +00:00
parent c7c6f169cb
commit f34f09e7b6
2 changed files with 18 additions and 17 deletions

View File

@ -648,7 +648,7 @@ xml_readweapon(xmlXPathContextPtr xpath, item_type * itype)
property = xmlGetProp(node, BAD_CAST "name"); property = xmlGetProp(node, BAD_CAST "name");
if (property!=NULL) { if (property!=NULL) {
const race * rc = rc_find((const char*)property); const race * rc = rc_find((const char*)property);
assert(rc!=NULL); if (rc==NULL) rc = rc_add(rc_new((const char*)property));
racelist_insert(&wtype->modifiers[k].races, rc); racelist_insert(&wtype->modifiers[k].races, rc);
xmlFree(property); xmlFree(property);
} }
@ -1327,12 +1327,13 @@ parse_races(xmlDocPtr doc)
xmlNodePtr node = result->nodesetval->nodeTab[k]; xmlNodePtr node = result->nodesetval->nodeTab[k];
xmlChar * property = xmlGetProp(node, BAD_CAST "spell"); xmlChar * property = xmlGetProp(node, BAD_CAST "spell");
if (property!=NULL) { if (property!=NULL) {
const spell * sp = find_spell(M_NONE, (const char *)property); const spell * sp = NULL;
int i = atoi((const char *)property);
if (i>0) {
sp = find_spellbyid((spellid_t)i);
}
if (sp==NULL) { if (sp==NULL) {
int i = atoi((const char *)property); sp = find_spell(M_NONE, (const char *)property);
if (i>0) {
sp = find_spellbyid((spellid_t)i);
}
} }
assert(sp); assert(sp);
rc->precombatspell = sp; rc->precombatspell = sp;
@ -1634,12 +1635,12 @@ register_xmlreader(void)
xml_register_callback(parse_strings); xml_register_callback(parse_strings);
xml_register_callback(parse_prefixes); xml_register_callback(parse_prefixes);
xml_register_callback(parse_messages); xml_register_callback(parse_messages);
xml_register_callback(parse_races);
xml_register_callback(parse_resources); xml_register_callback(parse_resources);
xml_register_callback(parse_buildings);
xml_register_callback(parse_ships); xml_register_callback(parse_buildings); /* requires resources */
xml_register_callback(parse_equipment); xml_register_callback(parse_ships); /* requires resources */
xml_register_callback(parse_equipment); /* requires resources */
xml_register_callback(parse_spells); /* requires resources */
xml_register_callback(parse_races); /* requires spells */
xml_register_callback(parse_calendar); xml_register_callback(parse_calendar);
xml_register_callback(parse_spells);
} }

View File

@ -1295,8 +1295,8 @@
<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="174"/>
<attack type="6" spell="175"/> <attack type="6" spell="aura_of_fear"/>
<precombatspell spell="176"/> <precombatspell spell="shadowcall"/>
</race> </race>
<race name="shadowbat" magres="0.800000" maxaura="0.000000" regaura="0.000000" recruitcost="500" weight="500" capacity="200" speed="1.000000" hp="1" ac="4" damage="2d4" unarmedattack="0" unarmeddefense="0" attackmodifier="3" defensemodifier="3" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes"> <race name="shadowbat" magres="0.800000" maxaura="0.000000" regaura="0.000000" recruitcost="500" weight="500" capacity="200" speed="1.000000" hp="1" ac="4" damage="2d4" unarmedattack="0" unarmeddefense="0" attackmodifier="3" defensemodifier="3" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes">
<ai splitsize="5000" killpeasants="yes"/> <ai splitsize="5000" killpeasants="yes"/>
@ -1340,7 +1340,7 @@
<attack type="4" damage="3d20"/> <attack type="4" damage="3d20"/>
<attack type="4" damage="5d30"/> <attack type="4" damage="5d30"/>
<attack type="6" spell="83"/> <attack type="6" spell="83"/>
<attack type="6" spell="175"/> <attack type="6" spell="aura_of_fear"/>
</race> </race>
<race name="littlescarab" magres="0.000000" maxaura="0.000000" regaura="0.000000" recruitcost="50" weight="500" capacity="200" speed="1.000000" hp="25" ac="1" damage="2d6" unarmedattack="0" unarmeddefense="0" attackmodifier="6" defensemodifier="3" walk="yes" teach="no" giveitem="yes" getitem="yes"> <race name="littlescarab" magres="0.000000" maxaura="0.000000" regaura="0.000000" recruitcost="50" weight="500" capacity="200" speed="1.000000" hp="25" ac="1" damage="2d6" unarmedattack="0" unarmeddefense="0" attackmodifier="6" defensemodifier="3" walk="yes" teach="no" giveitem="yes" getitem="yes">
<ai splitsize="5000"/> <ai splitsize="5000"/>
@ -1390,8 +1390,8 @@
<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="174"/>
<attack type="6" spell="175"/> <attack type="6" spell="aura_of_fear"/>
<precombatspell spell="176"/> <precombatspell spell="shadowcall"/>
</race> </race>
<race name="mummy" magres="0.600000" maxaura="1.000000" regaura="1.000000" recruitcost="5" weight="1000" capacity="540" speed="1.000000" hp="60" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" teach="no" noheal="yes" undead="yes" equipment="yes" nogive="yes"> <race name="mummy" magres="0.600000" maxaura="1.000000" regaura="1.000000" recruitcost="5" weight="1000" capacity="540" speed="1.000000" hp="60" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" teach="no" noheal="yes" undead="yes" equipment="yes" nogive="yes">
<ai splitsize="10000" moverandom="yes"/> <ai splitsize="10000" moverandom="yes"/>