fix part of #2629 - feedback for reverse genocide (trunk only)
authornethack.rankin <nethack.rankin>
Fri, 6 Apr 2012 08:35:00 +0000 (08:35 +0000)
committernethack.rankin <nethack.rankin>
Fri, 6 Apr 2012 08:35:00 +0000 (08:35 +0000)
     From a bug report, if reading a cursed scroll of genocide created only
one monster it would give the plural message "Sent in some <monsters>."
Now it will say "Sent in a(n) <monster>." in such case.  (The grammar is
accurate even if you can't see what happened; that situation is unusual
enough that I'm not going to worry about giving information away.)

doc/fixes35.0
src/read.c

index a4e6b1bd2ca0167bd3377d90053cf36062f5c259..ac621921e55ce8402ee397eb95b797efb1e53f1c 100644 (file)
@@ -411,6 +411,7 @@ theft of worn armor with wear/unwear delay would interfere with completion of
 #sit while swallowed would give the wrong message
 alchemical explosion or evaporation only used up one potion instead of all
        the potions being dipped
+feedback for reverse-genocide was plural even when just one monster was created
 
 
 Platform- and/or Interface-Specific Fixes
index a4eda1fe9cbaae8f2fc868c21c9bd0d3d95d1e3c..686a837b1074b7ae409bbdc5c39b9bae6b6b92e3 100644 (file)
@@ -1934,7 +1934,7 @@ int how;
            kill_genocided_monsters();
            update_inventory(); /* in case identified eggs were affected */
        } else {
-           int cnt = 0;
+           int cnt = 0, census = monster_census(FALSE);
 
            if (!(mons[mndx].geno & G_UNIQ) &&
                    !(mvitals[mndx].mvflags & (G_GENOD | G_EXTINCT)))
@@ -1945,9 +1945,13 @@ int how;
                    if (mvitals[mndx].mvflags & G_EXTINCT)
                        break;  /* just made last one */
                }
-           if (cnt)
-               pline("Sent in some %s.", makeplural(buf));
-           else
+           if (cnt) {
+               /* accumulated 'cnt' doesn't take groups into account;
+                  assume bringing in new mon(s) didn't remove any old ones */
+               cnt = monster_census(FALSE) - census;
+               pline("Sent in %s%s.", (cnt > 1) ? "some " : "",
+                     (cnt > 1) ? makeplural(buf) : an(buf));
+           } else
                pline1(nothing_happens);
        }
 }