From: PatR Date: Sun, 8 Mar 2020 17:29:39 +0000 (-0700) Subject: ^G limit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=feb85ad83c51eacb32355103c0361cbd48f19f1a;p=nethack ^G limit Relax the count limit from 255 to ROWNO*(COLNO-1) so that it can be big enough to fill an entire level yet remain small enough to not churn away seemingly forever if an absurd amount is specified for 'random' or for a class rather than a type. (By-type already gives up as soon as failure occurs, so is implicitly limited to a count matching the available space on the level.) Also impose the same limit on 'count ^G monster' as '^G count monster'. --- diff --git a/src/minion.c b/src/minion.c index dac4430a0..eb5697967 100644 --- a/src/minion.c +++ b/src/minion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 minion.c $NHDT-Date: 1575245071 2019/12/02 00:04:31 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.44 $ */ +/* NetHack 3.6 minion.c $NHDT-Date: 1583688543 2020/03/08 17:29:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.53 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -39,6 +39,8 @@ boolean spotted; /* seen|sensed vs all */ for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; + if (mtmp->isgd && mtmp->mx == 0) + continue; if (spotted && !canspotmon(mtmp)) continue; ++count; diff --git a/src/read.c b/src/read.c index a9feab136..87320dca8 100644 --- a/src/read.c +++ b/src/read.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 read.c $NHDT-Date: 1561485713 2019/06/25 18:01:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.172 $ */ +/* NetHack 3.6 read.c $NHDT-Date: 1583688568 2020/03/08 17:29:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.190 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2464,17 +2464,25 @@ struct _create_particular_data *d; d->sleeping = d->saddled = d->invisible = d->hidden = FALSE; /* quantity */ - if (digit(*bufp) && strcmp(bufp, "0")) { - d->quan = min(255, atoi(bufp)); + if (digit(*bufp)) { + d->quan = atoi(bufp); while (digit(*bufp)) bufp++; while (*bufp == ' ') bufp++; } +#define QUAN_LIMIT (ROWNO * (COLNO - 1)) + /* maximum possible quantity is one per cell: (0..ROWNO-1) x (1..COLNO-1) + [21*79==1659 for default map size; could subtract 1 for hero's spot] */ + if (d->quan < 1 || d->quan > QUAN_LIMIT) + d->quan = QUAN_LIMIT - monster_census(FALSE); +#undef QUAN_LIMIT + /* gear -- extremely limited number of possibilities supported */ if ((tmpp = strstri(bufp, "saddled ")) != 0) { d->saddled = TRUE; (void) memset(tmpp, ' ', sizeof "saddled " - 1); } + /* state -- limited number of possibilitie supported */ if ((tmpp = strstri(bufp, "sleeping ")) != 0) { d->sleeping = TRUE; (void) memset(tmpp, ' ', sizeof "sleeping " - 1);