From 6d8a591fc1238e5094c4db5240b0fd9b0aa4c013 Mon Sep 17 00:00:00 2001 From: Alex Kompel Date: Sat, 6 Jun 2015 08:16:30 -0700 Subject: [PATCH] Chatting with priest converted to minion crashes the game (few code paths in priest_talk() assumed the priest has an altar) --- src/priest.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/priest.c b/src/priest.c index fba265259..098186483 100644 --- a/src/priest.c +++ b/src/priest.c @@ -150,7 +150,8 @@ histemple_at(priest, x, y) register struct monst *priest; register xchar x, y; { - return ((boolean)((EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE)) + return ((boolean)(priest && priest->ispriest + && (EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE)) && on_level(&(EPRI(priest)->shrlevel), &u.uz))); } @@ -342,7 +343,7 @@ boolean p_coaligned(priest) struct monst *priest; { - return ((boolean)(u.ualign.type == ((int) EPRI(priest)->shralign))); + return ((boolean)(u.ualign.type == mon_aligntyp(priest))); } STATIC_OVL boolean @@ -542,7 +543,7 @@ register struct monst *priest; } /* priests don't chat unless peaceful and in their own temple */ - if (!histemple_at(priest, priest->mx, priest->my) || !priest->mpeaceful + if (!inhistemple(priest) || !priest->mpeaceful || !priest->mcanmove || priest->msleeping) { static const char *cranky_msg[3] = { "Thou wouldst have words, eh? I'll give thee a word or two!",