is_elf(), is_dwarf(), is_gnome(), is_orc(), is_human()
Those tests were only checking the permonst mflags2 field so anytime those tests were used in the code, they came up false for things like an elven ranger. An elven ranger should return true for an is_elf() test, as an example. That happens because the profession monsters in monst.c are defined with M2_HUMAN. This augments those is_*() race tests to also check for a matching player race as well.
This commit is contained in:
@@ -101,11 +101,21 @@
|
||||
#define is_shapeshifter(ptr) (((ptr)->mflags2 & M2_SHAPESHIFTER) != 0L)
|
||||
#define is_undead(ptr) (((ptr)->mflags2 & M2_UNDEAD) != 0L)
|
||||
#define is_were(ptr) (((ptr)->mflags2 & M2_WERE) != 0L)
|
||||
#define is_elf(ptr) (((ptr)->mflags2 & M2_ELF) != 0L)
|
||||
#define is_dwarf(ptr) (((ptr)->mflags2 & M2_DWARF) != 0L)
|
||||
#define is_gnome(ptr) (((ptr)->mflags2 & M2_GNOME) != 0L)
|
||||
#define is_orc(ptr) (((ptr)->mflags2 & M2_ORC) != 0L)
|
||||
#define is_human(ptr) (((ptr)->mflags2 & M2_HUMAN) != 0L)
|
||||
#define is_elf(ptr) ((((ptr)->mflags2 & M2_ELF) != 0L) \
|
||||
|| ((ptr) == g.youmonst.data && \
|
||||
!Upolyd && Race_if(PM_ELF)))
|
||||
#define is_dwarf(ptr) ((((ptr)->mflags2 & M2_DWARF) != 0L) \
|
||||
|| ((ptr) == g.youmonst.data && \
|
||||
!Upolyd && Race_if(PM_DWARF)))
|
||||
#define is_gnome(ptr) ((((ptr)->mflags2 & M2_GNOME) != 0L) \
|
||||
|| ((ptr) == g.youmonst.data && \
|
||||
!Upolyd && Race_if(PM_GNOME)))
|
||||
#define is_orc(ptr) ((((ptr)->mflags2 & M2_ORC) != 0L) \
|
||||
|| ((ptr) == g.youmonst.data && \
|
||||
!Upolyd && Race_if(PM_ORC)))
|
||||
#define is_human(ptr) ((((ptr)->mflags2 & M2_HUMAN) != 0L) \
|
||||
|| ((ptr) == g.youmonst.data && \
|
||||
!Upolyd && Race_if(PM_HUMAN)))
|
||||
#define your_race(ptr) (((ptr)->mflags2 & g.urace.selfmask) != 0L)
|
||||
#define is_bat(ptr) \
|
||||
((ptr) == &mons[PM_BAT] || (ptr) == &mons[PM_GIANT_BAT] \
|
||||
|
||||
Reference in New Issue
Block a user