hats vs horns

Some recent newsgroup discussion claiming that a pet ki-rin was
wearing a helmet (I think poster was hallucinating) caused me to look
at some of the hat handling code.  There were a couple of noticeable
problems and one latent one in code added for 3.4.1.  Polymorphing
into a minotaur pushes hard helmets off hero's head, but nothing
prevented you from putting one right back on.  Helmet wearing monsters
who polymorphed into minotaurs weren't affected at all.  And message
handling always assumed multiple horns even though we have some singled
horned monsters, but since all those have no hands they can't wear any
armor and that potential pluralization issue wasn't noticeable.
This commit is contained in:
nethack.rankin
2003-01-09 01:20:49 +00:00
parent 9988440b2e
commit f52b94336f
6 changed files with 58 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mondata.c 3.4 2002/12/09 */
/* SCCS Id: @(#)mondata.c 3.4 2003/01/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -301,6 +301,26 @@ sticks(ptr) /* creature sticks other creatures it hits */
attacktype(ptr,AT_HUGS)));
}
/* number of horns this type of monster has on its head */
int
num_horns(ptr)
struct permonst *ptr;
{
switch (monsndx(ptr)) {
case PM_HORNED_DEVIL: /* ? "more than one" */
case PM_MINOTAUR:
return 2;
case PM_WHITE_UNICORN:
case PM_GRAY_UNICORN:
case PM_BLACK_UNICORN:
case PM_KI_RIN:
return 1;
default:
break;
}
return 0;
}
struct attack *
dmgtype_fromattack(ptr, dtyp, atyp)
struct permonst *ptr;
@@ -365,7 +385,7 @@ monsndx(ptr) /* return an index into the mons array */
/* ought to switch this to use `fmt_ptr' */
panic("monsndx - could not index monster (%lx)",
(unsigned long)ptr);
return FALSE; /* will not get here */
return NON_PM; /* will not get here */
}
return(i);