]> granicus.if.org Git - nethack/commitdiff
shopkeeper names when hallucinating (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 15 Dec 2005 05:33:15 +0000 (05:33 +0000)
committernethack.rankin <nethack.rankin>
Thu, 15 Dec 2005 05:33:15 +0000 (05:33 +0000)
     A bug report complained that Izchak is identifiable when the hero is
hallucinating.  That's true but it wasn't particular to him; all shop
transactions were giving accurate shk name regardless of hallucination.
This is a quick fix that avoids changing shk message handling:  pick some
shk name at random each time one is used.  I didn't intend for it to also
force Izchak to use the general chat response instead of his set of special
messages, but that ends up happening due to randomized name not matching
his, so you really can't recognize him when hallucinating anymore.

     The almost never seen names now have a chance to come into play....

doc/fixes35.0
src/shknam.c

index c8ffe572bce5dfba5b4a2b91815e879f3316eaac..e9a97e8226dc9a17427affd55d4fc8e1f79cfddc 100644 (file)
@@ -103,6 +103,7 @@ grammar bit if killed by stealing a cockatrice corpse from a monster
 being petrified by swallowing a cockatrice violates foodless conduct
 devouring Medusa whole is fatal
 eating pet won't continue eating after becoming paralyzed or falling asleep
+randomize shopkeeper names when hallucinating
 
 
 Platform- and/or Interface-Specific Fixes
index 32b5c378dcab13acab8635fd78a67fa6030c6bfd..c0cead96434a243858c341fc8ceede6034fd8a75 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)shknam.c   3.5     2005/03/05      */
+/*     SCCS Id: @(#)shknam.c   3.5     2005/12/14      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -653,6 +653,22 @@ struct monst *mtmp;
 {
     const char *shknm = ESHK(mtmp)->shknam;
 
+    if (Hallucination && !program_state.gameover) {
+       const char * const *nlp;
+       int num;
+
+       /* count the number of non-unique shop types;
+          pick one randomly, ignoring shop generation probabilities;
+          pick a name at random from that shop type's list */
+       for (num = 0; num < SIZE(shtypes); num++)
+           if (shtypes[num].prob == 0) break;
+       if (num > 0) {
+           nlp = shtypes[rn2(num)].shknms;
+           for (num = 0; nlp[num]; num++) continue;
+           if (num > 0) shknm = nlp[rn2(num)];
+       }
+    }
+
     /* strip prefix if present */
     if (!letter(*shknm)) ++shknm;
     return shknm;