]> granicus.if.org Git - nethack/commitdiff
fix pull request #491 - color of converted altar
authorPatR <rankin@nethack.org>
Sun, 18 Apr 2021 00:16:44 +0000 (17:16 -0700)
committerPatR <rankin@nethack.org>
Sun, 18 Apr 2021 00:16:44 +0000 (17:16 -0700)
A display optimization assumed that the color of a glyph wouldn't
change unless the glyph itself changed, but there is a single glyph
for all altars and unaligned is shown with a different color than
the three aligned ones.  If there was an unaligned altar outside
of Gehennom (orcish mine town, some quests) and an invisible hero
(without see invisible) converted it, it stayed the old color until
there was some other reason to update that screen location.

Fixes #491

doc/fixes37.0
src/display.c

index a6ec8281d1127929e95ce648607b87a1b9ac7aad..bb5c3e4cd2b9ffe1ad20155297e47a64b4f341e2 100644 (file)
@@ -605,6 +605,8 @@ wearing a ring of protection and any amulet behaved as if wearing an amulet of
 messaging for genetic engineer attacks had several problems
 give genetic engineers teleport capability (as they had in slash'em); 'port
        away after polymorphing someone so that they don't just repeat that
+if an invisible hero managed to convert an unaligned altar to an aligned one
+       with color enabled, altar wasn't immediately redrawn with new color
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 1b766f4f4237c162bb499abe1dcc29ada15cd4e4..3a1a8d1117a72fbc206fd45a976e1e189b5d1865 100644 (file)
@@ -1593,11 +1593,17 @@ show_glyph(int x, int y, int glyph)
 
     if (g.gbuf[y][x].glyph != glyph
 #ifndef UNBUFFERED_GLYPHINFO
-           /* I don't think we have to test for changes in TTYCHAR or COLOR
-              because they typically only change if the glyph changed */
-            || g.gbuf[y][x].glyphinfo.glyphflags != glyphinfo.glyphflags
+        /* flags might change (single object vs pile, monster tamed or pet
+           gone feral), color might change (altar's alignment converted by
+           invisible hero), but ttychar normally won't change unless the
+           glyph does too (changing boulder symbol would be an exception,
+           but that triggers full redraw so doesn't matter here); still,
+           be thorough and check everything */
+        || g.gbuf[y][x].glyphinfo.glyphflags != glyphinfo.glyphflags
+        || g.gbuf[y][x].glyphinfo.ttychar != glyphinfo.ttychar
+        || g.gbuf[y][x].glyphinfo.color != glyphinfo.color
 #endif
-            || iflags.use_background_glyph ) {
+        || iflags.use_background_glyph) {
         g.gbuf[y][x].glyph = glyph;
         g.gbuf[y][x].gnew = 1;
 #ifndef UNBUFFERED_GLYPHINFO