diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 0b9d2d982..ec6d9195f 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -149,6 +149,7 @@ unicorn can't catch gems if it is asleep or paralyzed fix grammar when choking on gold some messages which referred to "mirror" ought to have used "looking glass" incubi react to mirrors +alignment of Angels was handled inconsistently Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index b2ccde1ee..0fd51656f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1663,6 +1663,7 @@ E int FDECL(move_special, (struct monst *,BOOLEAN_P,SCHAR_P,BOOLEAN_P,BOOLEAN_P, E char FDECL(temple_occupied, (char *)); E int FDECL(pri_move, (struct monst *)); E void FDECL(priestini, (d_level *,struct mkroom *,int,int,BOOLEAN_P)); +E aligntyp FDECL(mon_aligntyp, (struct monst *)); E char *FDECL(priestname, (struct monst *,char *)); E boolean FDECL(p_coaligned, (struct monst *)); E struct monst *FDECL(findpriest, (CHAR_P)); diff --git a/src/artifact.c b/src/artifact.c index c8950b1e5..9ea4ae6c8 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)artifact.c 3.5 2005/09/20 */ +/* SCCS Id: @(#)artifact.c 3.5 2005/10/01 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -507,7 +507,7 @@ touch_artifact(obj,mon) badclass = self_willed && oart->role != NON_PM && oart != &artilist[ART_EXCALIBUR]; badalign = (oart->spfx & SPFX_RESTR) && oart->alignment != A_NONE && - (oart->alignment != sgn(mon->data->maligntyp)); + (oart->alignment != sgn(mon_aligntyp(mon))); } else { /* an M3_WANTSxxx monster or a fake player */ /* special monsters trying to take the Amulet, invocation tools or quest item can touch anything except for `spec_applies' artifacts */ diff --git a/src/pline.c b/src/pline.c index ffc458e64..c9b071a4d 100644 --- a/src/pline.c +++ b/src/pline.c @@ -1,10 +1,9 @@ -/* SCCS Id: @(#)pline.c 3.5 2005/06/22 */ +/* SCCS Id: @(#)pline.c 3.5 2005/10/01 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ #define NEED_VARARGS /* Uses ... */ /* comment line for pre-compiled headers */ #include "hack.h" -#include "epri.h" #ifdef WIZARD #include "edog.h" #endif @@ -304,18 +303,9 @@ void mstatusline(mtmp) register struct monst *mtmp; { - aligntyp alignment; + aligntyp alignment = mon_aligntyp(mtmp); char info[BUFSZ], monnambuf[BUFSZ]; - if (mtmp->ispriest || mtmp->data == &mons[PM_ALIGNED_PRIEST] - || mtmp->data == &mons[PM_ANGEL]) - alignment = EPRI(mtmp)->shralign; - else - alignment = mtmp->data->maligntyp; - alignment = (alignment > 0) ? A_LAWFUL : - (alignment < 0) ? A_CHAOTIC : - A_NEUTRAL; - info[0] = 0; if (mtmp->mtame) { Strcat(info, ", tame"); #ifdef WIZARD diff --git a/src/priest.c b/src/priest.c index 79490e07e..f98ba9e32 100644 --- a/src/priest.c +++ b/src/priest.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)priest.c 3.5 2002/11/06 */ +/* SCCS Id: @(#)priest.c 3.5 2005/10/01 */ /* Copyright (c) Izchak Miller, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -221,6 +221,19 @@ boolean sanctum; /* is it the seat of the high priest? */ } } +/* get a monster's alignment type without caller needing EPRI & EMIN */ +aligntyp +mon_aligntyp(mon) +struct monst *mon; +{ + aligntyp algn = mon->ispriest ? EPRI(mon)->shralign : + mon->isminion ? EMIN(mon)->min_align : + mon->data->maligntyp; + + if (algn == A_NONE) return A_NONE; /* negative but differs from chaotic */ + return (algn > 0) ? A_LAWFUL : (algn < 0) ? A_CHAOTIC : A_NEUTRAL; +} + /* * Specially aligned monsters are named specially. * - aligned priests with ispriest and high priests have shrines