]> granicus.if.org Git - nethack/commitdiff
action after parse_role_opts() returns FALSE
authornhmall <nhmall@nethack.org>
Mon, 2 Mar 2020 06:11:51 +0000 (01:11 -0500)
committernhmall <nhmall@nethack.org>
Mon, 2 Mar 2020 06:11:51 +0000 (01:11 -0500)
The old parseoptions() would get a FALSE return from parse_role_opts() and
then exit FALSE.

The new parseoptions() was printing an error message due to the FALSE return
value, and then exiting FALSE.

Have it behave the original way following parse_role_opts().

src/options.c

index 8406edf26813fd6cedbb9a9c4afc4b99d601f707..f310d00c7986a4d65e6205ab55f3d32c14612aae 100644 (file)
@@ -87,7 +87,7 @@ enum window_option_types {
     TEXT_OPTION
 };
 
-enum {optn_err = 0, optn_ok};
+enum {optn_silenterr = -1, optn_err = 0, optn_ok};
 enum requests {do_nothing, do_init, do_set, do_handler, get_val};
 
 static struct allopt_t allopt[SIZE(allopt_init)];
@@ -463,6 +463,8 @@ boolean tinitial, tfrom_file;
         }
     }
 
+    if (optresult == optn_silenterr)
+        return FALSE;
     if (optresult == optn_ok)
         return retval;
 
@@ -514,7 +516,7 @@ char *op;
                 return optn_err;
             }
         } else
-            return optn_err;
+            return optn_silenterr;
         return optn_ok;
     }
     if (req == get_val) {
@@ -1321,7 +1323,7 @@ char *op;
             } else
                 flags.female = flags.initgend;
         } else
-            return optn_err;
+            return optn_silenterr;
         return optn_ok;
     }
     if (req == get_val) {
@@ -3041,7 +3043,7 @@ char *op;
             } else /* Backwards compatibility */
                 g.pl_race = *op;
         } else
-            return optn_err;
+            return optn_silenterr;
         return optn_ok;
     }
     if (req == get_val) {
@@ -3116,7 +3118,7 @@ char *op;
             } else /* Backwards compatibility */
                 nmcpy(g.pl_character, op, PL_NSIZ);
         } else
-            return optn_err;
+            return optn_silenterr;
         return optn_ok;
     }
     if (req == get_val) {