replace getenv("TTYINV") with perminv_mode option

Add a new option 'perminv_mode' to augment perm_invent.  It handles
the same choices as the temporary TTYINV method:  show all items other
than gold, show full inventory including gold, or only show in-use
items (similar to the '*' command).

For tty, both the all-except-gold and full-inventory modes can add
the poorly named 'sparse' variation which populates unused slots in
its fixed grid with the inventory letter that would go in each.

For others, the default has been changed from full-inventory to
all-except-gold.  Note that gold is treated as part of 'all' or of
'in-use' if it is quivered because having the amount be shown on the
status line doesn't make that redundant.

Changing the default may mess up WinGUI if it assumes that perm_invent
is full inventory with gold.

Initially I was going to change perm_invent into a compound but this
leaves it as an on/off toggle and adds perminv_mode as a separate
option for how to show the inventory when the toggle is on.  It may
make sense to combine them since dual controls is a little confusing,
but right now setting perm_invent On when perminv_mode is 'none'
changes that to 'all' and changing perminv_mode away from 'none' when
perm_invent is Off toggles it to On.

Guidebook.mn has been updated but as usual Guidebook.tex is lagging.
This commit is contained in:
PatR
2023-11-05 02:31:26 -08:00
parent e16f80395b
commit 2ee7509945
8 changed files with 369 additions and 79 deletions

View File

@@ -175,13 +175,31 @@ typedef struct gi {
enum perm_invent_toggles {toggling_off = -1, toggling_not = 0, toggling_on = 1 };
/* inventory modes */
enum inv_modes { InvNormal = 0, InvShowGold = 1, InvSparse = 2, InvInUse = 4 };
/* perm_invent modes */
enum inv_mode_bits {
InvNormal = 1,
InvShowGold = 2,
InvSparse = 4, /* must be ORed with Normal or ShowGold to be valid */
InvInUse = 8
};
enum inv_modes { /* 'perminv_mode' option settings */
InvOptNone = 0, /* no perm_invent */
InvOptOn = InvNormal, /* 1 */
InvOptFull = InvShowGold, /* 2 */
#if 1 /*#ifdef TTY_PERM_INVENT*/
/* confusingly-named "sparse mode" shows all inventory letters, even when
their slots are empty; only meaningful for tty's perm_invent */
InvOptOn_grid = InvNormal | InvSparse, /* 5 */
InvOptFull_grid = InvShowGold | InvSparse, /* 6 */
#endif
InvOptInUse = InvInUse, /* 8 */
};
enum to_core_flags {
active = 0x001,
prohibited = 0x002,
no_init_done = 0x004
no_init_done = 0x004,
too_small = 0x008,
};
enum from_core_requests {