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
This commit is contained in:
nhmall
2026-07-31 08:59:20 -04:00
parent 193da97bac
commit 9447bba227
2 changed files with 8 additions and 2 deletions
+8
View File
@@ -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;
-2
View File
@@ -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_-.", '%',