symset restrictions attribute (trunk only)

Pat Rankin wrote:
> I was about to also suggest that there
> be a rogue/non-rogue (with perhaps a third choice meaning "both")
> attribute.  That way we could keep the rogue choices from being
> listed in the "symset" menu and the non-rogue choices from the
> "roguesymset" menu.  Players who deliberately wanted to switch
> over would need to modify the attribute, possibly on a cloned set.
> Or perhaps they could just explicitly set their desired choices
> via NETHACKOPTIONS or .nethackrc and not use the 'O' menues--the
> new attribute doesn't necessary have to block which sets get used
> where, just filter menu entries to display the most applicable
> candidates.
This commit is contained in:
nethack.allison
2006-10-03 02:38:40 +00:00
parent 084dce82d0
commit 0ce424b71a
5 changed files with 111 additions and 21 deletions

View File

@@ -541,6 +541,11 @@ boolean name_too;
symset[which_set].nocolor = 0;
symset[which_set].handling = H_UNK;
symset[which_set].desc = (char *)0;
symset[which_set].nocolor = 0;
/* initialize restriction bits */
symset[which_set].primary = 0;
symset[which_set].rogue = 0;
if (name_too) {
if (symset[which_set].name)
@@ -562,6 +567,25 @@ const char *known_handling[] = {
(const char *)0,
};
/*
* Accepted keywords for symset restrictions.
* These can be virtually anything that you want to
* be able to test in the code someplace.
* Be sure to:
* - add a corresponding Bitfield to the symsetentry struct in rm.h
* - initialize the field to zero in parse_sym_line in the SYM_CONTROL
* case 0 section of the idx switch. The location is prefaced with
* with a comment stating "initialize restriction bits".
* - set the value appropriately based on the index of your keyword
* under the case 5 sections of the same SYM_CONTROL idx switches.
* - add the field to clear_symsetentry()
*/
const char *known_restrictions[] = {
"primary",
"rogue",
(const char *)0,
};
struct symparse loadsyms[] = {
{SYM_CONTROL, 0, "start"},
{SYM_CONTROL, 0, "begin"},
@@ -570,6 +594,7 @@ struct symparse loadsyms[] = {
{SYM_CONTROL, 3, "description"},
{SYM_CONTROL, 4, "color"},
{SYM_CONTROL, 4, "colour"},
{SYM_CONTROL, 5, "restrictions"},
{SYM_PCHAR, S_stone, "S_stone"},
{SYM_PCHAR, S_vwall, "S_vwall"},
{SYM_PCHAR, S_hwall, "S_hwall"},