From: Pasi Kallinen Date: Fri, 7 Feb 2020 17:11:13 +0000 (+0200) Subject: Allow #wizgenesis quantity in the prompt X-Git-Tag: NetHack-3.7.0_WIP-2020-02-14~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eed37c9a84b508068060df606b26316bfa820cc0;p=nethack Allow #wizgenesis quantity in the prompt The #wizgenesis command can also accept a quantity in the input prompt, previously it only accepted a command repeat prefix. (via UnNetHack, originally from NetHack4) --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index c381d5156..d20c94caa 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -51,6 +51,7 @@ throttle long worm growth rate and HP accumulation poly'd hero was able to zap wands, apply tools, and #rub objects without having any hands spellcasting monster got an extra move after casting +allow defining #wizgenesis quantity in the prompt Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/read.c b/src/read.c index 8bb5b80d3..eea79ea8e 100644 --- a/src/read.c +++ b/src/read.c @@ -2440,6 +2440,7 @@ struct obj *from_obj; } struct _create_particular_data { + int quan; int which; int fem; char monclass; @@ -2456,6 +2457,7 @@ struct _create_particular_data *d; char *bufp = str; char *tmpp; + d->quan = 1 + ((g.multi > 0) ? g.multi : 0); d->monclass = MAXMCLASSES; d->which = g.urole.malenum; /* an arbitrary index into mons[] */ d->fem = -1; /* gender not specified */ @@ -2463,6 +2465,14 @@ struct _create_particular_data *d; d->maketame = d->makepeaceful = d->makehostile = FALSE; d->sleeping = d->saddled = d->invisible = d->hidden = FALSE; + /* quantity */ + if (digit(*bufp) && strcmp(bufp, "0")) { + d->quan = atoi(bufp); + while (digit(*bufp)) + bufp++; + while (*bufp == ' ') + bufp++; + } if ((tmpp = strstri(bufp, "saddled ")) != 0) { d->saddled = TRUE; (void) memset(tmpp, ' ', sizeof "saddled " - 1); @@ -2551,7 +2561,7 @@ struct _create_particular_data *d; } whichpm = &mons[d->which]; } - for (i = 0; i <= g.multi; i++) { + for (i = 0; i < d->quan; i++) { if (d->monclass != MAXMCLASSES) whichpm = mkclass(d->monclass, 0); else if (d->randmonst)