]> granicus.if.org Git - nethack/commitdiff
Add a macro to provide universal consistency around the check
authornethack.allison <nethack.allison>
Sat, 26 Jan 2002 15:05:00 +0000 (15:05 +0000)
committernethack.allison <nethack.allison>
Sat, 26 Jan 2002 15:05:00 +0000 (15:05 +0000)
for what sort of creatures tend to revive.

include/mondata.h
src/invent.c
src/mon.c

index 8355a9fb9abf378a51bcb652f44dc38c6641d8d5..f9e03c934ec802d561f747f094b41ed62f5fd189 100644 (file)
                                 (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 || \
index 808b3683cfba9d2310824c764ce07585d5d26af9..514a3e5e964c8760528f245a98535b7160335a74 100644 (file)
@@ -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 */
index 4f02e0bfc1ae5e27b5a5a767e9a111162aee2cf4..4912980f2b91dbaaadef834b8e4244e1dc04d2a3 100644 (file)
--- 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