]> granicus.if.org Git - nethack/commitdiff
B01003 - showrace display
authornethack.rankin <nethack.rankin>
Wed, 17 Jul 2002 23:26:36 +0000 (23:26 +0000)
committernethack.rankin <nethack.rankin>
Wed, 17 Jul 2002 23:26:36 +0000 (23:26 +0000)
     Enabling the showrace option displays a nonhuman hero in
white rather than in corresponding monster type's usual color.

src/mapglyph.c

index b81a9f3f8f827b98f3c6e45c668683b840af7d64..f9710f9b2eb1a9c116f5e33f711915d2217db0a1 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mapglyph.c 3.4     2000/08/18      */
+/*     SCCS Id: @(#)mapglyph.c 3.4     2002/07/17      */
 /* Copyright (c) David Cohrs, 1991                               */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -7,6 +7,7 @@
 #include "wintty.h"    /* for prototype of has_color() only */
 #endif
 #include "color.h"
+#define HI_DOMESTIC CLR_WHITE  /* monst.c */
 
 int explcolors[] = {
        CLR_BLACK,      /* dark    */
@@ -194,7 +195,15 @@ unsigned *ospecial;
                color = NO_COLOR;
        } else
 #endif
+       {
            mon_color(glyph);
+           /* special case the hero for `showrace' option */
+#ifdef TEXTCOLOR
+           if (iflags.use_color && x == u.ux && y == u.uy &&
+                   iflags.showrace && !Upolyd)
+               color = HI_DOMESTIC;
+#endif
+       }
     }
 
 #ifdef TEXTCOLOR
@@ -210,21 +219,11 @@ unsigned *ospecial;
 # endif
        color = NO_COLOR;
 #endif
-    if (ochar)
-       *ochar = (int)ch;
-    else
-       impossible("glyphmap(): Invalid output character buffer.");
-
-    if (ospecial)
-       *ospecial = special;
-    else
-       impossible("glyphmap(): Invalid special feature return buffer.");
 
+    *ochar = (int)ch;
+    *ospecial = special;
 #ifdef TEXTCOLOR
-    if (ocolor)
-       *ocolor = color;
-    else
-       impossible("glyphmap(): Invalid color  buffer.");
+    *ocolor = color;
 #endif
     return;
 }