msummon,nasty result counts (trunk only)

Reported in Dec'04 by <email deleted>, the
monster spell "summon nasties" could mistakenly give a message of "a
monster appears" instead of "monsters appear" when more that one monster
gets summoned.  Some of the candidate monsters for nasty() can produce a
group from makemon(), as can ones for msummon() which nasty() sometimes
calls in Gehennom.  Compare the number of monsters before and after the
creation attempt(s) instead of assuming makemon() creates one at a time.

     I don't know whether other routines face the same mis-count issue,
but I suspect there may be several.
This commit is contained in:
nethack.rankin
2007-04-16 03:58:30 +00:00
parent 2aa7cb189b
commit 2872c27e13
4 changed files with 34 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)wizard.c 3.5 2007/02/07 */
/* SCCS Id: @(#)wizard.c 3.5 2007/04/15 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -423,7 +423,11 @@ nasty(mcast)
register int i, j, tmp;
int castalign = (mcast ? sgn(mcast->data->maligntyp) : -1);
coord bypos;
int count;
int count, census;
/* some candidates may be created in groups, so simple count
of non-null makemon() return is inadequate */
census = monster_census();
if(!rn2(10) && Inhell) {
count = msummon((struct monst *) 0); /* summons like WoY */
@@ -463,6 +467,8 @@ nasty(mcast)
}
}
}
if (count) count = monster_census() - census;
return count;
}