From: nethack.rankin Date: Sat, 24 Sep 2005 04:21:50 +0000 (+0000) Subject: handling of {DEC,IBM,MAC}graphics options X-Git-Tag: MOVE2GIT~1233 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa7fd20caedeaef5cb471204674b85fa886a0750;p=nethack handling of {DEC,IBM,MAC}graphics options Fix the problems From a bug report. So having OPTIONS=IBMgraphcs OPTIONS=noDECgraphics would yield an ASCII display instead of showing IBMgraphics, but IBMgraphics flag in the Options list would falsely show as on. Manually toggling it off put things back into sync. Avoiding the false setting is completely trivial. And fixing the inappropriate override turns out to be easy too, unless I've bungled this. One thing it does not do is try to warn about attempts to set conflicting options like OPTIONS=IBMgraphcs OPTIONS=DECgraphics Fixing that seems to be too messy to bother with, particularly since the game runs ok (leaving the setting handled last in place). --- diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 5ac658eba..0b9d2d982 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -153,6 +153,9 @@ incubi react to mirrors Platform- and/or Interface-Specific Fixes ----------------------------------------- +tty: when loading user's run-time configuration, explicitly negating one of + {DEC,IBM,MAC}graphics options after enabling another of them switched + to regular ASCII and left the earlier option inaccurately set to "on" unix: remove use of parentheses in nethack man page usage that confused a man page conversion tool winCE: disable processing of double-click messages if the first click diff --git a/src/drawing.c b/src/drawing.c index 6c220d25e..65c4e53e9 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)drawing.c 3.5 1999/12/02 */ +/* SCCS Id: @(#)drawing.c 3.5 2005/09/23 */ /* Copyright (c) NetHack Development Team 1992. */ /* NetHack may be freely redistributed. See license for details. */ @@ -655,6 +655,16 @@ void switch_graphics(gr_set_flag) int gr_set_flag; { + /* We're either toggling back to ASCII, in which case it is + appropriate to negate all the other alternatives, or we're in + the process of toggling one of those other ones on, in which + case it will be set accurately below. */ + iflags.IBMgraphics = FALSE; + iflags.DECgraphics = FALSE; +#ifdef MAC_GRAPHICS_ENV + iflags.MACgraphics = FALSE; +#endif + switch (gr_set_flag) { default: case ASCII_GRAPHICS: @@ -673,7 +683,6 @@ int gr_set_flag; * set the codepage to 437. */ iflags.IBMgraphics = TRUE; - iflags.DECgraphics = FALSE; assign_graphics(ibm_graphics, SIZE(ibm_graphics), MAXPCHARS, 0); #ifdef PC9800 if (ibmgraphics_mode_callback) (*ibmgraphics_mode_callback)(); @@ -686,13 +695,13 @@ int gr_set_flag; * Use the VT100 line drawing character set. */ iflags.DECgraphics = TRUE; - iflags.IBMgraphics = FALSE; assign_graphics(dec_graphics, SIZE(dec_graphics), MAXPCHARS, 0); if (decgraphics_mode_callback) (*decgraphics_mode_callback)(); break; #endif /* TERMLIB */ #ifdef MAC_GRAPHICS_ENV case MAC_GRAPHICS: + iflags.MACgraphics = TRUE; assign_graphics(mac_graphics, SIZE(mac_graphics), MAXPCHARS, 0); break; #endif diff --git a/src/options.c b/src/options.c index ddd1a029f..059e37bd9 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)options.c 3.5 2005/05/14 */ +/* SCCS Id: @(#)options.c 3.5 2005/09/23 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2309,6 +2309,8 @@ goodfruit: * options list */ for (i = 0; boolopt[i].name; i++) { + boolean was_set; + if (match_optname(opts, boolopt[i].name, 3, FALSE)) { /* options that don't exist */ if (!boolopt[i].addr) { @@ -2323,6 +2325,7 @@ goodfruit: return; } + was_set = *(boolopt[i].addr); *(boolopt[i].addr) = !negated; /* 0 means boolean opts */ @@ -2347,19 +2350,25 @@ goodfruit: # endif need_redraw = TRUE; # ifdef TERMLIB - if ((boolopt[i].addr) == &iflags.DECgraphics) - switch_graphics(iflags.DECgraphics ? + if ((boolopt[i].addr) == &iflags.DECgraphics) { + if (iflags.DECgraphics != was_set) + switch_graphics(iflags.DECgraphics ? DEC_GRAPHICS : ASCII_GRAPHICS); + } # endif # ifdef ASCIIGRAPH - if ((boolopt[i].addr) == &iflags.IBMgraphics) - switch_graphics(iflags.IBMgraphics ? + if ((boolopt[i].addr) == &iflags.IBMgraphics) { + if (iflags.IBMgraphics != was_set) + switch_graphics(!negated ? IBM_GRAPHICS : ASCII_GRAPHICS); + } # endif # ifdef MAC_GRAPHICS_ENV - if ((boolopt[i].addr) == &iflags.MACgraphics) - switch_graphics(iflags.MACgraphics ? + if ((boolopt[i].addr) == &iflags.MACgraphics) { + if (iflags.MACgraphics != was_set) + switch_graphics(iflags.MACgraphics ? MAC_GRAPHICS : ASCII_GRAPHICS); + } # endif # ifdef REINCARNATION if (!initial && Is_rogue_level(&u.uz))