]> granicus.if.org Git - nethack/commitdiff
tty perm_invent options again
authorPatR <rankin@nethack.org>
Tue, 21 Jun 2022 16:56:59 +0000 (09:56 -0700)
committerPatR <rankin@nethack.org>
Tue, 21 Jun 2022 16:56:59 +0000 (09:56 -0700)
I'm not sure what happened but something that worked when I tested
yesterday wouldn't work today.  Have 'O' was pass TRUE rather than
FALSE to tty_perm_invent_toggled() when perm_invent is set to 'on'.
And skip that code for .nethackrc or NETHACKOPTIONS because it was
segfaulting.

src/options.c

index 0aaf1f997ceb6e5625d2e1be1b3cde11ab7364d0..4a24f414055342324318107a93e80b584d11ec22 100644 (file)
@@ -4410,16 +4410,15 @@ optfn_boolean(int optidx, int req, boolean negated, char *opts, char *op)
                tty_perm_invent_toggled() and routines it calls don't check
                iflags.perm_invent so it doesn't matter that 'SET IT HERE'
                hasn't been executed yet */
-            if (WINDOWPORT("tty") && !negated) {
-                tty_perm_invent_toggled(!negated);
+            if (WINDOWPORT("tty") && !g.opt_initial && !negated) {
+                tty_perm_invent_toggled(FALSE);
 
                 if (g.tty_invent_win == WIN_ERR) {
                     /* FIXME: there is some confusion between this and
                        tty_create_nhwindow(NHW_TTYINVENT) over when this
                        should be done */
                     set_option_mod_status("perm_invent", set_gameview);
-                    if (!g.opt_initial)
-                        config_error_add("Enabling perm_invent failed");
+                    config_error_add("Enabling perm_invent failed");
                     return optn_silenterr;
                 }
             }