diff --git a/res/e3a/races.xml b/res/e3a/races.xml index 83d356f75..b7111b4f1 100644 --- a/res/e3a/races.xml +++ b/res/e3a/races.xml @@ -699,7 +699,6 @@ - @@ -752,7 +751,6 @@ - @@ -788,7 +786,6 @@ - @@ -820,7 +817,6 @@ - diff --git a/res/eressea/races.xml b/res/eressea/races.xml index bce464d78..b9077d98b 100644 --- a/res/eressea/races.xml +++ b/res/eressea/races.xml @@ -723,7 +723,6 @@ - @@ -735,7 +734,6 @@ - @@ -748,7 +746,6 @@ - @@ -1019,7 +1016,6 @@ - @@ -1053,7 +1049,6 @@ - @@ -1083,7 +1078,6 @@ - diff --git a/src/kernel/race.c b/src/kernel/race.c index 56b0590ae..4e8e0817c 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -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; } diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index 2ba8e2b75..5c294d13a 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -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); } diff --git a/src/races/races.c b/src/races/races.c index a05f3d211..92a3d3e3d 100644 --- a/src/races/races.c +++ b/src/races/races.c @@ -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"); }