diff --git a/res/e3a/races.xml b/res/e3a/races.xml index 1036ba223..e2cc60e55 100644 --- a/res/e3a/races.xml +++ b/res/e3a/races.xml @@ -34,7 +34,6 @@ - @@ -48,7 +47,6 @@ - @@ -76,7 +74,6 @@ - @@ -103,7 +100,6 @@ - @@ -123,7 +119,6 @@ - @@ -142,7 +137,6 @@ - @@ -165,7 +159,6 @@ - diff --git a/res/eressea/races.xml b/res/eressea/races.xml index 6899a8070..70dd1af9f 100644 --- a/res/eressea/races.xml +++ b/res/eressea/races.xml @@ -12,7 +12,6 @@ - @@ -780,7 +779,6 @@ - @@ -799,7 +797,6 @@ - @@ -825,7 +822,6 @@ - @@ -858,7 +854,6 @@ - @@ -888,7 +883,6 @@ - @@ -919,7 +913,6 @@ - @@ -951,7 +944,6 @@ - @@ -1149,7 +1141,6 @@ - @@ -1179,7 +1170,6 @@ - @@ -1206,7 +1196,6 @@ - diff --git a/res/races/aquarian.xml b/res/races/aquarian.xml index a0e1189b7..19fd3aee7 100644 --- a/res/races/aquarian.xml +++ b/res/races/aquarian.xml @@ -1,7 +1,6 @@ - diff --git a/res/races/cat.xml b/res/races/cat.xml index 75bc8019a..5986c223c 100644 --- a/res/races/cat.xml +++ b/res/races/cat.xml @@ -1,7 +1,6 @@ - diff --git a/res/races/demon.xml b/res/races/demon.xml index 0ce4c86ff..69d98145f 100644 --- a/res/races/demon.xml +++ b/res/races/demon.xml @@ -6,7 +6,6 @@ unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" shapeshift="yes" giveperson="yes" giveunit="yes" getitem="yes" recruitethereal="yes" equipment="yes" healing="1.5"> - diff --git a/res/races/dwarf.xml b/res/races/dwarf.xml index c5c4f2fcf..043b76aa7 100644 --- a/res/races/dwarf.xml +++ b/res/races/dwarf.xml @@ -1,7 +1,6 @@ - @@ -30,4 +29,4 @@ - \ No newline at end of file + diff --git a/res/races/elf.xml b/res/races/elf.xml index ee1278a26..683ee823b 100644 --- a/res/races/elf.xml +++ b/res/races/elf.xml @@ -1,7 +1,6 @@ - @@ -26,4 +25,4 @@ - \ No newline at end of file + diff --git a/res/races/goblin-2.xml b/res/races/goblin-2.xml index f8964d7c0..f26fa780e 100644 --- a/res/races/goblin-2.xml +++ b/res/races/goblin-2.xml @@ -5,7 +5,6 @@ speed="1.0" hp="16" damage="1d5" unarmedattack="-2" unarmeddefense="0" playerrace="yes" walk="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes" healing="2.0"> - diff --git a/res/races/goblin-3.xml b/res/races/goblin-3.xml index 4ad83967d..3fd594939 100644 --- a/res/races/goblin-3.xml +++ b/res/races/goblin-3.xml @@ -5,7 +5,6 @@ speed="1.0" hp="16" damage="1d5" unarmedattack="-2" unarmeddefense="0" playerrace="yes" walk="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes" healing="2.0"> - diff --git a/res/races/goblin.xml b/res/races/goblin.xml index 101cdaa86..a05d127e3 100644 --- a/res/races/goblin.xml +++ b/res/races/goblin.xml @@ -6,7 +6,6 @@ unarmedattack="-2" unarmeddefense="0" playerrace="yes" walk="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes" healing="2.0"> - diff --git a/res/races/halfling.xml b/res/races/halfling.xml index 4801685a0..3628d2b35 100644 --- a/res/races/halfling.xml +++ b/res/races/halfling.xml @@ -1,8 +1,7 @@ - - + diff --git a/res/races/human.xml b/res/races/human.xml index 8f1ad5cb4..f91ba7daf 100644 --- a/res/races/human.xml +++ b/res/races/human.xml @@ -1,7 +1,6 @@ - diff --git a/res/races/insect.xml b/res/races/insect.xml index dc9faa06d..75e16f7af 100644 --- a/res/races/insect.xml +++ b/res/races/insect.xml @@ -1,7 +1,6 @@ - @@ -27,4 +26,4 @@ - \ No newline at end of file + diff --git a/res/races/troll.xml b/res/races/troll.xml index c70020fa2..9168a6d0e 100644 --- a/res/races/troll.xml +++ b/res/races/troll.xml @@ -6,7 +6,6 @@ unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes" healing="1.5"> - diff --git a/src/battle.c b/src/battle.c index 9ce22918a..0ff8eecaa 100644 --- a/src/battle.c +++ b/src/battle.c @@ -925,14 +925,12 @@ void kill_troop(troop dt) if (!df->alive) { char eqname[64]; const struct equipment *eq; - if (u_race(du)->itemdrop) { - item *drops = u_race(du)->itemdrop(u_race(du), du->number - df->run.number); - - if (drops != NULL) { - i_merge(&du->items, &drops); - } + const race *rc = u_race(du); + item *drops = item_spoil(rc, du->number - df->run.number); + if (drops != NULL) { + i_merge(&du->items, &drops); } - sprintf(eqname, "%s_spoils", u_race(du)->_name); + sprintf(eqname, "%s_spoils", rc->_name); eq = get_equipment(eqname); if (eq != NULL) { equip_items(&du->items, eq); diff --git a/src/kernel/item.c b/src/kernel/item.c index 177e44831..c37e3d40c 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -1175,7 +1175,7 @@ attrib_type at_resourcelimit = { finalize_resourcelimit, }; -static item *default_spoil(const struct race *rc, int size) +item *item_spoil(const struct race *rc, int size) { item *itm = NULL; @@ -1303,7 +1303,6 @@ void register_resources(void) register_function((pf_generic)res_changepermaura, "changepermaura"); register_function((pf_generic)res_changehp, "changehp"); register_function((pf_generic)res_changeaura, "changeaura"); - register_function((pf_generic)default_spoil, "defaultdrops"); register_item_use(use_potion, "usepotion"); register_item_use(use_potion_delayed, "usepotion_delayed"); diff --git a/src/kernel/item.h b/src/kernel/item.h index e6301c314..79e6f103d 100644 --- a/src/kernel/item.h +++ b/src/kernel/item.h @@ -309,6 +309,7 @@ extern "C" { extern const struct potion_type *oldpotiontype[]; const struct resource_type *get_resourcetype(resource_t rt); + struct item *item_spoil(const struct race *rc, int size); int get_item(const struct unit * u, const struct item_type *itype); int set_item(struct unit * u, const struct item_type *itype, int value); diff --git a/src/kernel/race.h b/src/kernel/race.h index 32ff05ebd..380b843bd 100644 --- a/src/kernel/race.h +++ b/src/kernel/race.h @@ -145,7 +145,6 @@ extern "C" { race_name_func generate_name; void(*age) (struct unit * u); - struct item *(*itemdrop) (const struct race *, int size); void(*init_familiar) (struct unit *); struct rcoption *options; /* rarely used properties */ diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index 508516671..97fab3b8d 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -1798,9 +1798,6 @@ static int parse_races(xmlDocPtr doc) else if (strcmp((const char *)propValue, "age") == 0) { rc->age = (void(*)(struct unit *))fun; } - else if (strcmp((const char *)propValue, "itemdrop") == 0) { - rc->itemdrop = (struct item * (*)(const struct race *, int))fun; - } else if (strcmp((const char *)propValue, "initfamiliar") == 0) { rc->init_familiar = (void(*)(struct unit *))fun; }