remove race.age from XML data (set in rc_create)

This commit is contained in:
Enno Rehling 2017-02-20 21:19:13 +01:00
parent 44f6336e1f
commit a1dc3dc8e4
5 changed files with 10 additions and 19 deletions

View File

@ -699,7 +699,6 @@
<race name="undead" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="20" damage="1d7" unarmedattack="0" unarmeddefense="0" attackmodifier="1" defensemodifier="1" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes">
<ai splitsize="20000" moverandom="yes"/>
<function name="name" value="nameundead"/>
<function name="age" value="ageundead"/>
<attack type="4" damage="1d7"/>
<attack type="5"/>
</race>
@ -752,7 +751,6 @@
<race name="ghoul" magres="30" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="30" ac="1" damage="1d7" unarmedattack="3" unarmeddefense="3" attackmodifier="3" defensemodifier="3" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes">
<ai splitsize="10000" killpeasants="yes" moverandom="yes"/>
<function name="name" value="nameghoul"/>
<function name="age" value="ageghoul"/>
<skill name="crossbow" modifier="1"/>
<skill name="bow" modifier="1"/>
<skill name="catapult" modifier="1"/>
@ -788,7 +786,6 @@
<race name="zombie" magres="20" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="40" ac="1" damage="1d7" unarmedattack="2" unarmeddefense="2" attackmodifier="5" defensemodifier="5" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
<ai splitsize="10000" killpeasants="yes" moverandom="yes"/>
<function name="name" value="namezombie"/>
<function name="age" value="agezombie"/>
<skill name="crossbow" modifier="1"/>
<skill name="bow" modifier="1"/>
<skill name="catapult" modifier="1"/>
@ -820,7 +817,6 @@
<race name="skeleton" magres="10" maxaura="1.0" regaura="1.0" weight="500" capacity="540" speed="1.0" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
<ai splitsize="10000" killpeasants="yes" moverandom="yes"/>
<function name="name" value="nameskeleton"/>
<function name="age" value="ageskeleton"/>
<skill name="crossbow" modifier="1"/>
<skill name="bow" modifier="1"/>
<skill name="catapult" modifier="1"/>

View File

@ -723,7 +723,6 @@
<race name="dragon" magres="70" maxaura="1.000000" regaura="2.000000" weight="10000" capacity="1000000" speed="1.500000" hp="900" ac="6" damage="2d30" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes" dragon="yes">
<ai splitsize="2" killpeasants="yes" learn="yes"/>
<function name="name" value="namedragon"/>
<function name="age" value="agedragon"/>
<skill name="magic" modifier="8"/>
<skill name="tactics" modifier="8"/>
<skill name="perception" modifier="5"/>
@ -735,7 +734,6 @@
<race name="youngdragon" magres="50" maxaura="1.000000" regaura="1.000000" weight="20000" capacity="10000" speed="1.000000" hp="300" ac="4" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="6" killpeasants="yes" learn="yes"/>
<function name="name" value="namedragon"/>
<function name="age" value="agefiredragon"/>
<skill name="magic" modifier="4"/>
<skill name="tactics" modifier="4"/>
<skill name="stealth" modifier="2"/>
@ -748,7 +746,6 @@
<race name="undead" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="20" damage="1d7" unarmedattack="0" unarmeddefense="0" attackmodifier="1" defensemodifier="1" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes">
<ai splitsize="20000" moverandom="yes"/>
<function name="name" value="nameundead"/>
<function name="age" value="ageundead"/>
<attack type="4" damage="1d7"/>
<attack type="5"/>
</race>
@ -1019,7 +1016,6 @@
<race name="ghoul" magres="30" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="30" ac="1" damage="1d7" unarmedattack="3" unarmeddefense="3" attackmodifier="3" defensemodifier="3" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes">
<ai splitsize="10000" killpeasants="yes" moverandom="yes"/>
<function name="name" value="nameghoul"/>
<function name="age" value="ageghoul"/>
<skill name="crossbow" modifier="1"/>
<skill name="bow" modifier="1"/>
<skill name="catapult" modifier="1"/>
@ -1053,7 +1049,6 @@
<race name="zombie" magres="20" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="40" ac="1" damage="1d7" unarmedattack="2" unarmeddefense="2" attackmodifier="5" defensemodifier="5" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
<ai splitsize="10000" killpeasants="yes" moverandom="yes"/>
<function name="name" value="namezombie"/>
<function name="age" value="agezombie"/>
<skill name="crossbow" modifier="1"/>
<skill name="bow" modifier="1"/>
<skill name="catapult" modifier="1"/>
@ -1083,7 +1078,6 @@
<race name="skeleton" magres="10" maxaura="1.000000" regaura="1.000000" weight="500" capacity="540" speed="1.000000" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
<ai splitsize="10000" killpeasants="yes" moverandom="yes"/>
<function name="name" value="nameskeleton"/>
<function name="age" value="ageskeleton"/>
<skill name="crossbow" modifier="1"/>
<skill name="bow" modifier="1"/>
<skill name="catapult" modifier="1"/>

View File

@ -327,6 +327,7 @@ race *rc_create(const char *zName)
{
race *rc;
int i;
char zText[64];
assert(zName);
rc = (race *)calloc(sizeof(race), 1);
@ -350,6 +351,9 @@ race *rc_create(const char *zName)
rc->index = num_races++;
++rc_changes;
rc->next = races;
snprintf(zText, sizeof(zText), "age_%s", zName);
rc->age = (void(*) (struct unit *))get_function(zText);
return races = rc;
}

View File

@ -1795,9 +1795,6 @@ static int parse_races(xmlDocPtr doc)
if (strcmp((const char *)propValue, "name") == 0) {
rc->generate_name = (race_name_func)fun;
}
else if (strcmp((const char *)propValue, "age") == 0) {
rc->age = (void(*)(struct unit *))fun;
}
else {
log_error("unknown function type '%s' for race %s\n", (const char *)propValue, rc->_name);
}

View File

@ -84,10 +84,10 @@ void register_races(void)
register_function((pf_generic)equip_newunits, "equip_newunits");
/* function age for race->age() */
register_function((pf_generic)age_undead, "ageundead");
register_function((pf_generic)age_skeleton, "ageskeleton");
register_function((pf_generic)age_zombie, "agezombie");
register_function((pf_generic)age_ghoul, "ageghoul");
register_function((pf_generic)age_dragon, "agedragon");
register_function((pf_generic)age_firedragon, "agefiredragon");
register_function((pf_generic)age_undead, "age_undead");
register_function((pf_generic)age_skeleton, "age_skeleton");
register_function((pf_generic)age_zombie, "age_zombie");
register_function((pf_generic)age_ghoul, "age_ghoul");
register_function((pf_generic)age_dragon, "age_dragon");
register_function((pf_generic)age_firedragon, "age_youngdragon");
}