Unix: command line --windowtype:foo fix
initoptions(), including initoptions_finish(), was running to completion with the default window system before windowtype from the command was parsed and activated. When the default window system is tty without MS-DOS the map type gets set to ascii; command line --windowtype:X11 doesn't switch it back to the X11 default of tiled. So, | NETHACKOPTIONS=windowtype:X11 nethack ran nethack in tiles mode but | nethack --windowtype:X11 ran it in text mode (assuming .nethackrc left tiles vs text with the default setting). I think this fix is quite iffy but it seems to work as intended.... It reclassifies '--windowtype' as an "early option" in unixmain.c, and the options.c code ultimately processes it twice.
This commit is contained in:
@@ -376,7 +376,7 @@ lopt(
|
||||
return p;
|
||||
}
|
||||
|
||||
/* caveat: argv elements might be arbitrary long */
|
||||
/* caveat: argv elements might be arbitrarily long */
|
||||
static void
|
||||
process_options(int argc, char *argv[])
|
||||
{
|
||||
@@ -479,14 +479,6 @@ process_options(int argc, char *argv[])
|
||||
flags.initrace = i;
|
||||
}
|
||||
break;
|
||||
case 'w': /* windowtype: "-wfoo" or "-w[indowtype]=foo"
|
||||
* or "-w[indowtype]:foo" or "-w[indowtype] foo" */
|
||||
arg = lopt(arg,
|
||||
(ArgValRequired | ArgNamOneLetter | ArgErrComplain),
|
||||
"-windowtype", origarg, &argc, &argv);
|
||||
if (arg)
|
||||
choose_windows(arg);
|
||||
break;
|
||||
case '@':
|
||||
flags.randomall = 1;
|
||||
break;
|
||||
@@ -667,6 +659,15 @@ early_options(int *argc_p, char ***argv_p, char **hackdir_p)
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
break;
|
||||
case 'w': /* windowtype: "-wfoo" or "-w[indowtype]=foo"
|
||||
* or "-w[indowtype]:foo" or "-w[indowtype] foo" */
|
||||
arg = lopt(arg,
|
||||
(ArgValRequired | ArgNamOneLetter | ArgErrComplain),
|
||||
"-windowtype", origarg, &argc, &argv);
|
||||
if (g.cmdline_windowsys)
|
||||
free((genericptr_t) g.cmdline_windowsys);
|
||||
g.cmdline_windowsys = arg ? dupstr(arg) : NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user