]> granicus.if.org Git - nethack/commitdiff
console colour follow up 2
authornethack.allison <nethack.allison>
Sat, 9 Sep 2006 19:38:25 +0000 (19:38 +0000)
committernethack.allison <nethack.allison>
Sat, 9 Sep 2006 19:38:25 +0000 (19:38 +0000)
If you specified one or more palete options in the config file,
but not all 16, you ended up with black for any you didn't
specify - oops.

This patch ensures that the table has a full complement
of 16 colours by initializing it to the windows default colours
just ahead of the first palette option encountered.

As before, if the config file has no palette option in it,
no calls to change the palette are made at all. If the
undocumented method breaks in a future release of
Windows, then avoiding palette options will work
around the problem.

sys/winnt/nttty.c

index cd83db87e6157e5557d923d4b74add26132548fb..afafb6161eac206017c4924d5160d3fbd2d734fe 100644 (file)
@@ -1031,6 +1031,11 @@ long rgb;
                        UserDefinedColors[k] = NetHackColors[k];
                return;
        } else if (color_number >= 0 && color_number < CLR_MAX) {
+               if (!altered_palette) {
+                       /* make sure a full suite is available */
+                       for (k=0; k < CLR_MAX; k++)
+                               UserDefinedColors[k] = DefaultColors[k];
+               }
                idx = win32_color_number[color_number];
                UserDefinedColors[idx] = rgb;
        }