]> granicus.if.org Git - nethack/commitdiff
Allow #wizgenesis quantity in the prompt
authorPasi Kallinen <paxed@alt.org>
Fri, 7 Feb 2020 17:11:13 +0000 (19:11 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 7 Feb 2020 17:11:18 +0000 (19:11 +0200)
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)

doc/fixes37.0
src/read.c

index c381d5156cbaefe9447043fa75b31cec78fad8b1..d20c94caa3c84345eb67d9681d0c779c4c64648a 100644 (file)
@@ -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
index 8bb5b80d3735f8e2b606fad9e79b25c6b535d06a..eea79ea8eecd1ae0a7ce8a33f5d9c8cd88af27d0 100644 (file)
@@ -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)