Add 'pickup_stolen' option

Add pickup_stolen option to autopick items stolen from you by a nymph or
monkey, even if they don't match your normal autopickup settings.
Replace was_dropped, was_thrown with a 2-bit bitfield that can contain
values LOST_DROPPED, LOST_THROWN, and LOST_STOLEN (or 0), since they
should all be mutually exclusive anyway as they track the most recent
way the item left the hero's inventory.

[Rebase/merge conflict fixed up.  PR]
This commit is contained in:
Michael Meyer
2023-11-17 09:37:16 -05:00
committed by PatR
parent ecda85cc32
commit 1736f3caaa
15 changed files with 54 additions and 23 deletions

View File

@@ -48,6 +48,7 @@ struct flag {
boolean nopick_dropped; /* items you dropped may be autopicked */
boolean null; /* OK to send nulls to the terminal */
boolean pickup; /* whether you pickup or move and look */
boolean pickup_stolen; /* auto-pickup items stolen by a monster */
boolean pickup_thrown; /* auto-pickup items you threw */
boolean pushweapon; /* When wielding, push old weapon into second slot */
boolean quick_farsight; /* True disables map browsing during random

View File

@@ -124,10 +124,9 @@ struct obj {
#define on_ice recharged /* corpse on ice */
Bitfield(lamplit, 1); /* a light-source -- can be lit */
Bitfield(globby, 1); /* combines with like types on adjacent squares */
Bitfield(greased, 1); /* covered with grease */
Bitfield(nomerge, 1); /* set temporarily to prevent merging */
Bitfield(was_thrown, 1); /* thrown by hero since last picked up */
Bitfield(was_dropped, 1); /* dropped deliberately by the hero */
Bitfield(greased, 1); /* covered with grease */
Bitfield(nomerge, 1); /* set temporarily to prevent merging */
Bitfield(how_lost, 2); /* stolen by mon or thrown, dropped by hero */
Bitfield(in_use, 1); /* for magic items before useup items */
Bitfield(bypass, 1); /* mark this as an object to be skipped by bhito() */
@@ -459,6 +458,12 @@ struct obj {
#define POTHIT_MONST_THROW 2 /* thrown by a monster */
#define POTHIT_OTHER_THROW 3 /* propelled by some other means [scatter()] */
/* tracking how an item left your inventory */
#define LOST_NONE 0 /* still in inventory, or method not covered below */
#define LOST_THROWN 1 /* thrown or fired by the hero */
#define LOST_DROPPED 2 /* dropped or tipped out of a container by the hero */
#define LOST_STOLEN 3 /* stolen from hero's inventory by a monster */
/*
* Notes for adding new oextra structures:
*

View File

@@ -534,6 +534,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
NHOPTC(pickup_burden, Advanced, 20, opt_in, set_in_game,
No, Yes, No, Yes, NoAlias,
"maximum burden picked up before prompt")
NHOPTB(pickup_stolen, Behavior, 0, opt_out, set_in_game,
On, Yes, No, No, NoAlias, &flags.pickup_stolen, Term_False,
"autopickup thrown items")
NHOPTB(pickup_thrown, Behavior, 0, opt_out, set_in_game,
On, Yes, No, No, NoAlias, &flags.pickup_thrown, Term_False,
"autopickup thrown items")