From: nethack.allison Date: Sat, 9 Sep 2006 19:38:25 +0000 (+0000) Subject: console colour follow up 2 X-Git-Tag: MOVE2GIT~915 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94bc5885b122cfc1d5af4ea51683ae9ebb1f7c2d;p=nethack console colour follow up 2 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. --- diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index cd83db87e..afafb6161 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -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; }