From 0843c5d9225d43fe99478be33d4b2b2900081243 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 30 Nov 2019 13:35:14 -0500 Subject: [PATCH] some dead code eliminations and a couple of documentation updates --- doc/fixes36.3 | 5 +++++ doc/window.doc | 4 ++++ sys/winnt/nttty.c | 2 +- win/tty/termcap.c | 38 -------------------------------------- 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 0f584ac0e..8fa4afc0a 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -315,6 +315,11 @@ clairvoyance showed all monsters in range, then after player viewed the map, object at same spot, so skip it for locations where monster refresh is going to immediately redisplay a monster take holes that you avoided into consideration when you're on the brink +update window port spec to include a color-availability table that the window + port can set; merge all has_color() implementations into one central + function in src/windows.c which uses a few data checks only and + elminates multiple string function calls for each map cell update + that were being done in some cases previously unix: fix double DLB definition in linux hints file windows: fix --showpaths output for the data file which relies on being constructed programmatically to incorporate the version suffix diff --git a/doc/window.doc b/doc/window.doc index da1790253..3758bf55b 100644 --- a/doc/window.doc +++ b/doc/window.doc @@ -663,6 +663,10 @@ port can access the fields directly. Your window port identifies what options it will react to and support by setting bits in the window_procs wincap mask and/or wincap2 mask. +Your window port can also fill in the color-availability table for +the window port, has_color[CLR_MAX] to flag the colors it supports +1 it does, or 0 it doesn't. [CLR_MAX is 16 as of 3.6.3.] + See section IX for details of where the wincap masks reside. Two things control whether any preference setting appears in the diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index df817e6c9..8a52fb683 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -792,7 +792,7 @@ init_ttycolor() #if 0 int -has_color(int color) +has_color(int color) /* this function is commented out */ { #ifdef TEXTCOLOR if ((color >= 0) && (color < CLR_MAX)) diff --git a/win/tty/termcap.c b/win/tty/termcap.c index 4d2ac1f62..09a0be55e 100644 --- a/win/tty/termcap.c +++ b/win/tty/termcap.c @@ -1282,44 +1282,6 @@ int color; xputs(hilites[color]); } -#if 0 -/* Replaced by src/windows.c general proc or a macro in 3.6.3 */ - -/* not to be confused with has_colors() in unixtty.c */ -int -has_color(color) -int color; -{ -#ifdef X11_GRAPHICS - /* XXX has_color() should be added to windowprocs */ - if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "X11")) - return 1; -#endif -#ifdef GEM_GRAPHICS - /* XXX has_color() should be added to windowprocs */ - if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Gem")) - return 1; -#endif -#ifdef QT_GRAPHICS - /* XXX has_color() should be added to windowprocs */ - if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Qt")) - return 1; -#endif -#ifdef CURSES_GRAPHICS - /* XXX has_color() should be added to windowprocs */ - /* iflags.wc_color is set to false and the option disabled if the - terminal cannot display color */ - if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "curses")) - return iflags.wc_color; -#endif -#ifdef AMII_GRAPHICS - /* hilites[] not used */ - return iflags.use_color ? 1 : 0; -#else - return hilites[color] != (char *) 0; -#endif -} -#endif /* 0 */ #endif /* TEXTCOLOR */ #endif /* TTY_GRAPHICS && !NO_TERMS */