]> granicus.if.org Git - nethack/commitdiff
class genocide by species name
authorcohrs <cohrs>
Fri, 23 May 2003 02:47:42 +0000 (02:47 +0000)
committercohrs <cohrs>
Fri, 23 May 2003 02:47:42 +0000 (02:47 +0000)
Incorporate a mod submitted by <Someone> to implement the TODO in the
class genocide code by walking thru the species to find a class to genocide
if the user input does not match the class description.

src/read.c

index 4d84e6c472746d705b669dcc71f78388909346be..e1d1ef1cdb51f7daff0bb1a850a243f691235d35 100644 (file)
@@ -1478,9 +1478,27 @@ do_class_genocide()
                    }
                }
                /*
-                * TODO[?]: If user's input doesn't match any class
-                *          description, check individual species names.
+                * If user's input doesn't match any class
+                * description, check individual species names.
                 */
+               if (class == 0) {
+                   for (i = LOW_PM; i < NUMMONS; i++) {
+                       if (strstri(mons[i].mname, buf) != 0) {
+                           class = mons[i].mlet;
+                           break;
+                       }
+                   }
+
+                   if (class != 0) {
+                       for (i = LOW_PM; i < NUMMONS; i++) {
+                           if (mons[i].mlet == class) {
+                               if (!(mons[i].geno & G_GENO)) immunecnt++;
+                               else if(mvitals[i].mvflags & G_GENOD) gonecnt++;
+                               else goodcnt++;
+                           }
+                       }
+                   }
+               }
                if (!goodcnt && class != mons[urole.malenum].mlet &&
                                class != mons[urace.malenum].mlet) {
                        if (gonecnt)