This introduces two new command line options, -extra-opt-first and -extra-opt-last, which make crawl think that the specified options were (respectively) at the start and end of the options file. For example:
crawl -extra-opt-last wiz_mode=yes
The two options can be used multiple times to specify multiple options.
LEE5GXPHL6MES4O3OK7IE75NTFONMY26SPESEACTO35YKQI5L4DQC
IS4ME6I2KKHOGVGXRFVYR4F3IMDI6VXEL53T7QWW2WDTTYXUT2ZAC
SLL3SBE2LEJOAKMZL4KQSBJKP7ZFH2VLR652YOQTBVPA5IN6ROJAC
HYVYGSYBKN6CE7NGBGXAAXVNVR3FMIXQOR6ONVPLBDIISIKFDXQQC
UMEXJ5ZLOF5W4RMWNYXIM7QZLUBCTGASM7LBKYUIKFTYSNWUFJ2AC
UQLP4ZSPMGYNCPZ42KF7X37GMX3U7DJGGIVJWV3IMHJAGTKSYSEAC
3AVTUQ5KWUIU33W4G7N3EFTIZDKDHGFUDDUPKWGWBZCZVQT5T5YQC
C55G5JGGSVWMU7XVEJL6YZZLDXQZGRN7JQOAALS6WIKFPX3L2U6QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
Z3RI4XAN7J2GUABAQ5G6YIOQYMBOAEQFFGRBWHMUEB2A2QYXO5MQC
Z5PVF4BKRAUD3CTW26IDYI2XV7H2YDKFKBWDQYWUUABCKWHF4KWAC
POACC5YR6QQGEX6GGMUJKGCDQNX6P6FUF4UQTYGOSHFOHJ26X4SQC
5L4JYB3F4PNEU2GYNP7RY4YAKYXW7PYS36KYJNVHRGUFQVTEGDEAC
CH7JECYYH35H4TRHRNRTRJCQTQLZ2WRH62TKV72SUIU2RTK5OH7AC
SV4XJBN5JF7SRWFSW2KTTM4OSKSRFQLHQYGZSN6O4LESFFXWAD3QC
RVST2QHYJ757ZHK4AUJ5NGPDZ44AD6RVFVXYPKQIBJXZBDNUCHXQC
EHSY6DVGUMI6C67WKET3GDJVLWJWGYBYQONNDK5JVT7BCTHBEZVAC
TP5EDQXPVPTKQYTAMN3VQYHM4WRT2RNIR4EDLWLDAV2OQGKSB6KAC
WL5WZXFJ6TONUQRSHUY4GQ5USU47ILWNN5X2JDQZO4CRJJZSRQIAC
Options.filename = "unknown";
Options.filename = "extra opts last";
Options.basefilename = "extra opts last";
Options.line_num = 0;
for (unsigned int i = 0; i < SysEnv.extra_opts_last.size(); i++)
{
Options.line_num++;
Options.read_option_line(SysEnv.extra_opts_last[i], false);
}
Options.filename = "unknown";
if (opt[0] == ':' || opt[0] == '<' || opt[0] == '{'
|| starts_with(opt, "L<") || starts_with(opt, "Lua{"))
{
fprintf(stderr, "An extra option can't use Lua (%s)\n",
_opt);
return (false);
}
if (opt[0] == '#')
{
fprintf(stderr, "An extra option can't be a comment (%s)\n",
_opt);
return (false);
}
if (opt.find_first_of('=') == std::string::npos)
{
fprintf(stderr, "An extra opt must contain a '=' (%s)\n",
_opt);
return (false);
}
std::vector<std::string> parts = split_string(opt, "=");
if (opt.find_first_of('=') == 0 || parts[0].length() == 0)
{
fprintf(stderr, "An extra opt must have an option name (%s)\n",
_opt);
return (false);
}
return (true);
}
case CLO_EXTRA_OPT_FIRST:
if (!next_is_param)
return (false);
if (!_check_extra_opt(next_arg))
// Don't print the help message if the opt was wrong
return (true);
SysEnv.extra_opts_first.push_back(next_arg);
nextUsed = true;
// Can be used multiple times.
arg_seen[o] = false;
break;
case CLO_EXTRA_OPT_LAST:
if (!next_is_param)
return false;
if (!_check_extra_opt(next_arg))
// Don't print the help message if the opt was wrong
return (true);
SysEnv.extra_opts_last.push_back(next_arg);
nextUsed = true;
// Can be used multiple times.
arg_seen[o] = false;
break;
0-b Options and how to set them.
A quick way to make small changes to the options, without having to
switch to a different option file, is to use the command line options
-extra-opt-first or -extra-opt-last, which make it as if the given
option was (repsecitvely) at the top or bottom of the option file. For
example,
-extra-opt-last wiz_mode=yes
will cause any new game to start in wizard mode. -extra-opt-first and
-extra-opt-last can be used multiple times on the same command line.
0-c Options and how to set them.
Options can be rerefenced by lua via "options.option_name". For
example:
:if string.find(options.autopickup, "!") then
# Do something here if potions are included in autopickup
:end
"options.option_name" can even be used for options that crawl itself
doesn't recognize. This can be combined with setting options on the
command line (see section 0-b) to use the command line to control
conditionalization of options in the options files. For example, on the
command line you could set the option "foobar" with "-extra-opt-first
foobar=true", and then do:
:if options.foobar then
# Do things here
:end
7-c Conditional option caveats.
-----------------------------------