Allow dropping just picked up items

When using a menu to drop or put in items into a container,
allow putting in the item (or items) you picked up previously,
by selecting the 'P' entry from the item class menu

Inspired by the itemcat patch by Stanislav Traykov.

Invalidates saves and bones.
This commit is contained in:
Pasi Kallinen
2021-09-17 20:52:54 +03:00
parent e43ec0cef1
commit b30061b5ad
14 changed files with 183 additions and 30 deletions

View File

@@ -1094,6 +1094,8 @@ struct instance_globals {
boolean class_filter;
boolean bucx_filter;
boolean shop_filter;
boolean picked_filter;
boolean loot_reset_justpicked;
/* pline.c */
unsigned pline_flags;

View File

@@ -1076,7 +1076,7 @@ extern void free_pickinv_cache(void);
extern int count_unpaid(struct obj *);
extern int count_buc(struct obj *, int, boolean(*)(struct obj *));
extern void tally_BUCX(struct obj *, boolean, int *, int *, int *, int *,
int *);
int *, int *);
extern long count_contents(struct obj *, boolean, boolean, boolean, boolean);
extern void carry_obj_effects(struct obj *);
extern const char *currency(long);
@@ -1950,6 +1950,9 @@ extern boolean allow_category(struct obj *);
extern boolean is_worn_by_type(struct obj *);
extern int ck_bag(struct obj *);
extern void removed_from_icebox(struct obj *);
extern void reset_justpicked(struct obj *);
extern int count_justpicked(struct obj *);
extern struct obj *find_justpicked(struct obj *);
extern int pickup(int);
extern int pickup_object(struct obj *, long, boolean);
extern int query_category(const char *, struct obj *, int, menu_item **, int);

View File

@@ -366,6 +366,7 @@ typedef struct sortloot_item Loot;
#define BUC_CURSED 0x0200
#define BUC_UNCURSED 0x0400
#define BUC_UNKNOWN 0x0800
#define JUSTPICKED 0x1000
#define BUC_ALLBKNOWN (BUC_BLESSED | BUC_CURSED | BUC_UNCURSED)
#define BUCX_TYPES (BUC_ALLBKNOWN | BUC_UNKNOWN)
#define ALL_TYPES_SELECTED -2

View File

@@ -117,7 +117,8 @@ struct obj {
Bitfield(cknown, 1); /* for containers (including statues): the contents
* are known; also applicable to tins */
Bitfield(lknown, 1); /* locked/unlocked status is known */
/* 4 free bits */
Bitfield(pickup_prev, 1); /* was picked up previously */
/* 3 free bits */
int corpsenm; /* type of corpse is mons[corpsenm] */
#define leashmon corpsenm /* gets m_id of attached pet */

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 40
#define EDITLEVEL 41
/*
* Development status possibilities.