diff --git a/src/battle.c b/src/battle.c index 3f33381f4..018763093 100644 --- a/src/battle.c +++ b/src/battle.c @@ -1042,6 +1042,41 @@ static int natural_armor(unit * du) return an; } +static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_type *wtype) +{ + const race *ar = u_race(au); + int m, modifier = 0; + + switch (old_race(ar)) { + case RC_HALFLING: + if (wtype != NULL && dragonrace(u_race(du))) { + modifier += 5; + } + break; + default: + break; + } + if (wtype != NULL && wtype->modifiers != NULL) { + for (m = 0; wtype->modifiers[m].value; ++m) { + /* weapon damage for this weapon, possibly by race */ + if (wtype->modifiers[m].flags & WMF_DAMAGE) { + race_list *rlist = wtype->modifiers[m].races; + if (rlist != NULL) { + while (rlist) { + if (rlist->data == ar) + break; + rlist = rlist->next; + } + if (rlist == NULL) + continue; + } + modifier += wtype->modifiers[m].value; + } + } + } + return modifier; +} + bool terminate(troop dt, troop at, int type, const char *damage, bool missile) { @@ -1163,7 +1198,7 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile) } } - da += rc_specialdamage(u_race(au), u_race(du), awtype); + da += rc_specialdamage(au, du, awtype); if (awtype != NULL && fval(awtype, WTF_MISSILE)) { /* missile weapon bonus */ diff --git a/src/kernel/race.c b/src/kernel/race.c index 875920d28..e3953ea98 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -280,42 +280,6 @@ const char *racename(const struct locale *loc, const unit * u, const race * rc) return str ? str : rc->_name; } -int -rc_specialdamage(const race * ar, const race * dr, -const struct weapon_type *wtype) -{ - race_t art = old_race(ar); - int m, modifier = 0; - - if (wtype != NULL && wtype->modifiers != NULL) - for (m = 0; wtype->modifiers[m].value; ++m) { - /* weapon damage for this weapon, possibly by race */ - if (wtype->modifiers[m].flags & WMF_DAMAGE) { - race_list *rlist = wtype->modifiers[m].races; - if (rlist != NULL) { - while (rlist) { - if (rlist->data == ar) - break; - rlist = rlist->next; - } - if (rlist == NULL) - continue; - } - modifier += wtype->modifiers[m].value; - } - } - switch (art) { - case RC_HALFLING: - if (wtype != NULL && dragonrace(dr)) { - modifier += 5; - } - break; - default: - break; - } - return modifier; -} - void write_race_reference(const race * rc, struct storage *store) { WRITE_TOK(store, rc ? rc->_name : "none"); diff --git a/src/kernel/race.h b/src/kernel/race.h index 3cf24f84a..d7f9e12b8 100644 --- a/src/kernel/race.h +++ b/src/kernel/race.h @@ -178,8 +178,6 @@ extern "C" { extern race *rc_get_or_create(const char *name); extern const race *rc_find(const char *); - extern int rc_specialdamage(const race *, const race *, - const struct weapon_type *); void free_races(void); typedef enum name_t { NAME_SINGULAR, NAME_PLURAL, NAME_DEFINITIVE, NAME_CATEGORY } name_t;