From 69ce21fe0b4a5c9a2e8ffda027dcd67455876918 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Sat, 26 Jan 2002 15:05:00 +0000 Subject: [PATCH] Add a macro to provide universal consistency around the check for what sort of creatures tend to revive. --- include/mondata.h | 3 +++ src/invent.c | 2 +- src/mon.c | 5 +---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mondata.h b/include/mondata.h index 8355a9fb9..f9e03c934 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -129,6 +129,9 @@ (ptr) == &mons[PM_GIANT] || \ (ptr) == &mons[PM_ELF] || \ (ptr) == &mons[PM_HUMAN]) +/* return TRUE if the monster tends to revive */ +#define is_reviver(ptr) (is_rider(ptr) || (ptr)->mlet == S_TROLL) + /* this returns the light's range, or 0 if none; if we add more light emitting monsters, we'll likely have to add a new light range field to mons[] */ #define emits_light(ptr) (((ptr)->mlet == S_LIGHT || \ diff --git a/src/invent.c b/src/invent.c index 808b3683c..514a3e5e9 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2155,7 +2155,7 @@ mergable(otmp, obj) /* returns TRUE if obj & otmp can be merged */ /* hatching eggs don't merge; ditto for revivable corpses */ if ((obj->otyp == EGG && (obj->timed || otmp->timed)) || (obj->otyp == CORPSE && otmp->corpsenm >= LOW_PM && - mons[otmp->corpsenm].mlet == S_TROLL)) + is_reviver(&mons[otmp->corpsenm]))) return FALSE; /* allow candle merging only if their ages are close */ diff --git a/src/mon.c b/src/mon.c index 4f02e0bfc..4912980f2 100644 --- a/src/mon.c +++ b/src/mon.c @@ -100,11 +100,8 @@ STATIC_VAR short cham_to_pm[] = { PM_SANDESTIN, }; -/* return TRUE if the monster tends to revive */ -#define REVIVER(ptr) (is_rider(ptr) || ptr->mlet == S_TROLL) - #define KEEPTRAITS(mon) (mon->isshk || mon->mtame || \ - (mon->data->geno & G_UNIQ) || REVIVER(mon->data) || \ + (mon->data->geno & G_UNIQ) || is_reviver(mon->data) || \ (mon->m_id == quest_status.leader_m_id)) /* Creates a monster corpse, a "special" corpse, or nothing if it doesn't