]> granicus.if.org Git - nethack/commitdiff
handling of {DEC,IBM,MAC}graphics options
authornethack.rankin <nethack.rankin>
Sat, 24 Sep 2005 04:21:50 +0000 (04:21 +0000)
committernethack.rankin <nethack.rankin>
Sat, 24 Sep 2005 04:21:50 +0000 (04:21 +0000)
     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).

doc/fixes34.4
src/drawing.c
src/options.c

index 5ac658ebaaafd74d03d5455a15ee19b21ea0b2cd..0b9d2d982d4c219dccc28aaf74e399e4e8ead2b6 100644 (file)
@@ -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
index 6c220d25e8bd9ffa80c38bc46b53927a4e928ffc..65c4e53e9376fac27ad1aaeb5ddb0cc9429760f6 100644 (file)
@@ -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
index ddd1a029f1bc005243427844916f568ebbd9b46e..059e37bd925c6de9cb13a779af7f64c7493fffb5 100644 (file)
@@ -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))