From 9447bba227c6cc227956f2986ae4a9348866f64c Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 31 Jul 2026 08:59:20 -0400 Subject: [PATCH] Windows: don't revert -D on command line Reported by @youbo0 in GitHub issue #1616 This issue text stated: "To enter wizard mode, I have a shortcut with -D -u wizard as suggested by the wiki for Windows players. However, the name is now overridden by a name in .nethackrc since 5.0, resulting in me not actually entering wizard mode due to having the wrong name despite using -u wizard. In the previous version, -u wizard was applying properly regardless." Closes #1616 --- src/options.c | 8 ++++++++ sys/windows/windmain.c | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/options.c b/src/options.c index f3e7c3fdd..351c3903d 100644 --- a/src/options.c +++ b/src/options.c @@ -2559,6 +2559,14 @@ optfn_name( if ((op = string_for_env_opt(allopt[optidx].name, opts, FALSE)) != empty_optstr) { +#ifdef WIN32 + /* + * Under windows, if we already set flags.debug with -D + * on the command line, leave that alone. + */ + if (flags.debug && !strcmpi(svp.plname, "wizard")) + return optn_ok; +#endif nmcpy(svp.plname, op, PL_NSIZ); } else return optn_err; diff --git a/sys/windows/windmain.c b/sys/windows/windmain.c index bc8d3b661..fb21f8271 100644 --- a/sys/windows/windmain.c +++ b/sys/windows/windmain.c @@ -399,8 +399,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ setting of renameallowed; when False, player_selection() won't resent renaming as an option */ iflags.renameallowed = FALSE; - /* Obtain the name of the logged on user and incorporate - * it into the name. */ Sprintf(fnamebuf, "%s", svp.plname); (void) fname_encode( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%',