add pickup_thrown option (trunk only)
This patch by <email deleted> was released when 3.4.1 was current and has been incorporated into slash'em. It is extremely useful while using ranged weapons. When both autopickup and pickup_thrown are enabled, walking across previously thrown objects will pick them up even if they don't match the current pickup_types list. [See cvs log for patchlevel.h for longer description.]
This commit is contained in:
@@ -24,6 +24,7 @@ null allow nulls to be sent to your terminal [TRUE]
|
|||||||
try turning this option off (forcing NetHack to use its own
|
try turning this option off (forcing NetHack to use its own
|
||||||
delay code) if moving objects seem to teleport across rooms
|
delay code) if moving objects seem to teleport across rooms
|
||||||
perm_invent keep inventory in a permanent window [FALSE]
|
perm_invent keep inventory in a permanent window [FALSE]
|
||||||
|
pickup_thrown override pickup_types for thrown objects [TRUE]
|
||||||
prayconfirm use confirmation prompt when #pray command issued [TRUE]
|
prayconfirm use confirmation prompt when #pray command issued [TRUE]
|
||||||
pushweapon when wielding a new weapon, put your previously
|
pushweapon when wielding a new weapon, put your previously
|
||||||
wielded weapon into the secondary weapon slot [FALSE]
|
wielded weapon into the secondary weapon slot [FALSE]
|
||||||
|
|||||||
@@ -2083,6 +2083,12 @@ When you pick up an item that would exceed this encumbrance
|
|||||||
level (Unburdened, Burdened, streSsed, straiNed, overTaxed,
|
level (Unburdened, Burdened, streSsed, straiNed, overTaxed,
|
||||||
or overLoaded), you will be asked if you want to continue.
|
or overLoaded), you will be asked if you want to continue.
|
||||||
(Default `S').
|
(Default `S').
|
||||||
|
.lp pickup_thrown
|
||||||
|
If this option is on and
|
||||||
|
.op autopickup
|
||||||
|
is also on, try to pick up things that you threw, even if they aren't in
|
||||||
|
.op pickup_types
|
||||||
|
or match an autopickup exception. Default is on.
|
||||||
.lp pickup_types
|
.lp pickup_types
|
||||||
Specify the object types to be picked up when
|
Specify the object types to be picked up when
|
||||||
.op autopickup
|
.op autopickup
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
\begin{document}
|
\begin{document}
|
||||||
%
|
%
|
||||||
% input file: guidebook.mn
|
% input file: guidebook.mn
|
||||||
% $Revision: 1.97 $ $Date: 2006/04/23 17:22:45 $
|
% $Revision: 1.98 $ $Date: 2006/04/30 17:55:09 $
|
||||||
%
|
%
|
||||||
%.ds h0 "
|
%.ds h0 "
|
||||||
%.ds h1 %.ds h2 \%
|
%.ds h1 %.ds h2 \%
|
||||||
@@ -2550,6 +2550,11 @@ level (Unburdened, Burdened, streSsed, straiNed, overTaxed,
|
|||||||
or overLoaded), you will be asked if you want to continue.
|
or overLoaded), you will be asked if you want to continue.
|
||||||
(Default `S').
|
(Default `S').
|
||||||
%.lp
|
%.lp
|
||||||
|
\item[\ib{pickup\_thrown}]
|
||||||
|
If this option is on and ``{\it autopickup\/}'' is also on, try to pick up
|
||||||
|
things that you threw, even if they aren't in ``{\it pickup\_types\/}'' or
|
||||||
|
match an autopickup exception. Default is on.
|
||||||
|
%.lp
|
||||||
\item[\ib{pickup\_types}]
|
\item[\ib{pickup\_types}]
|
||||||
Specify the object types to be picked up when ``{\it autopickup\/}''
|
Specify the object types to be picked up when ``{\it autopickup\/}''
|
||||||
is on. Default is all types. If your copy of the game has the
|
is on. Default is all types. If your copy of the game has the
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ allow digging an adjacent pit with wand of digging while trapped in a pit
|
|||||||
#terrain command for debug mode
|
#terrain command for debug mode
|
||||||
digging can activate or disarm some types of traps
|
digging can activate or disarm some types of traps
|
||||||
some monsters can eat tins in addition to corpses to cure some ailments
|
some monsters can eat tins in addition to corpses to cure some ailments
|
||||||
|
add Roderick Schertler's pickup_thrown patch
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific New Features
|
Platform- and/or Interface-Specific New Features
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ struct flag {
|
|||||||
boolean null; /* OK to send nulls to the terminal */
|
boolean null; /* OK to send nulls to the terminal */
|
||||||
boolean perm_invent; /* keep full inventories up until dismissed */
|
boolean perm_invent; /* keep full inventories up until dismissed */
|
||||||
boolean pickup; /* whether you pickup or move and look */
|
boolean pickup; /* whether you pickup or move and look */
|
||||||
|
boolean pickup_thrown; /* auto-pickup items you threw */
|
||||||
boolean pushweapon; /* When wielding, push old weapon into second slot */
|
boolean pushweapon; /* When wielding, push old weapon into second slot */
|
||||||
boolean rest_on_space; /* space means rest */
|
boolean rest_on_space; /* space means rest */
|
||||||
boolean safe_dog; /* give complete protection to the dog */
|
boolean safe_dog; /* give complete protection to the dog */
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ struct obj {
|
|||||||
#endif
|
#endif
|
||||||
Bitfield(greased,1); /* covered with grease */
|
Bitfield(greased,1); /* covered with grease */
|
||||||
Bitfield(nomerge,1); /* set temporarily to prevent merging */
|
Bitfield(nomerge,1); /* set temporarily to prevent merging */
|
||||||
/* 1 free bit */
|
Bitfield(was_thrown,1); /* thrown by hero since last picked up */
|
||||||
|
|
||||||
Bitfield(in_use,1); /* for magic items before useup items */
|
Bitfield(in_use,1); /* for magic items before useup items */
|
||||||
Bitfield(bypass,1); /* mark this as an object to be skipped by bhito() */
|
Bitfield(bypass,1); /* mark this as an object to be skipped by bhito() */
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ boolean restore;
|
|||||||
otmp->cknown = 0;
|
otmp->cknown = 0;
|
||||||
otmp->invlet = 0;
|
otmp->invlet = 0;
|
||||||
otmp->no_charge = 0;
|
otmp->no_charge = 0;
|
||||||
|
otmp->was_thrown = 0;
|
||||||
|
|
||||||
/* strip user-supplied names */
|
/* strip user-supplied names */
|
||||||
/* Statue and some corpse names are left intact,
|
/* Statue and some corpse names are left intact,
|
||||||
|
|||||||
@@ -923,6 +923,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
|||||||
}
|
}
|
||||||
|
|
||||||
thrownobj = obj;
|
thrownobj = obj;
|
||||||
|
thrownobj->was_thrown = 1;
|
||||||
|
|
||||||
if(u.uswallow) {
|
if(u.uswallow) {
|
||||||
mon = u.ustuck;
|
mon = u.ustuck;
|
||||||
|
|||||||
@@ -298,6 +298,7 @@ struct obj *obj;
|
|||||||
if (obj->where != OBJ_FREE)
|
if (obj->where != OBJ_FREE)
|
||||||
panic("addinv: obj not free");
|
panic("addinv: obj not free");
|
||||||
obj->no_charge = 0; /* not meaningful for invent */
|
obj->no_charge = 0; /* not meaningful for invent */
|
||||||
|
obj->was_thrown = 0; /* ditto */
|
||||||
|
|
||||||
addinv_core1(obj);
|
addinv_core1(obj);
|
||||||
#ifndef GOLDOBJ
|
#ifndef GOLDOBJ
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ static struct Bool_Opt
|
|||||||
{"page_wait", (boolean *)0, FALSE, SET_IN_FILE},
|
{"page_wait", (boolean *)0, FALSE, SET_IN_FILE},
|
||||||
#endif
|
#endif
|
||||||
{"perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME},
|
{"perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME},
|
||||||
|
{"pickup_thrown", &flags.pickup_thrown, TRUE, SET_IN_GAME},
|
||||||
{"popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME}, /*WC*/
|
{"popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME}, /*WC*/
|
||||||
{"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME},
|
{"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME},
|
||||||
{"preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME}, /*WC*/
|
{"preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME}, /*WC*/
|
||||||
|
|||||||
38
src/pickup.c
38
src/pickup.c
@@ -662,35 +662,39 @@ menu_item **pick_list; /* list of objects and counts to pick up */
|
|||||||
menu_item *pi; /* pick item */
|
menu_item *pi; /* pick item */
|
||||||
struct obj *curr;
|
struct obj *curr;
|
||||||
int n;
|
int n;
|
||||||
|
boolean pickit;
|
||||||
const char *otypes = flags.pickup_types;
|
const char *otypes = flags.pickup_types;
|
||||||
|
|
||||||
/* first count the number of eligible items */
|
/* first count the number of eligible items */
|
||||||
for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow))
|
for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow)) {
|
||||||
|
pickit = (!*otypes || index(otypes, curr->oclass));
|
||||||
|
#ifdef AUTOPICKUP_EXCEPTIONS
|
||||||
#ifndef AUTOPICKUP_EXCEPTIONS
|
/* check for "always pick up */
|
||||||
if (!*otypes || index(otypes, curr->oclass))
|
if (!pickit) pickit = is_autopickup_exception(curr, TRUE);
|
||||||
#else
|
/* then for "never pick up */
|
||||||
if ((!*otypes || index(otypes, curr->oclass) ||
|
if (pickit) pickit = !is_autopickup_exception(curr, FALSE);
|
||||||
is_autopickup_exception(curr, TRUE)) &&
|
|
||||||
!is_autopickup_exception(curr, FALSE))
|
|
||||||
#endif
|
#endif
|
||||||
n++;
|
/* pickup_thrown overrides pickup_types and exceptions */
|
||||||
|
if (!pickit) pickit = (flags.pickup_thrown && curr->was_thrown);
|
||||||
|
/* finally, do we count this object? */
|
||||||
|
if (pickit) ++n;
|
||||||
|
}
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
*pick_list = pi = (menu_item *) alloc(sizeof(menu_item) * n);
|
*pick_list = pi = (menu_item *) alloc(sizeof(menu_item) * n);
|
||||||
for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow))
|
for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow)) {
|
||||||
#ifndef AUTOPICKUP_EXCEPTIONS
|
pickit = (!*otypes || index(otypes, curr->oclass));
|
||||||
if (!*otypes || index(otypes, curr->oclass)) {
|
#ifdef AUTOPICKUP_EXCEPTIONS
|
||||||
#else
|
if (!pickit) pickit = is_autopickup_exception(curr, TRUE);
|
||||||
if ((!*otypes || index(otypes, curr->oclass) ||
|
if (pickit) pickit = !is_autopickup_exception(curr, FALSE);
|
||||||
is_autopickup_exception(curr, TRUE)) &&
|
|
||||||
!is_autopickup_exception(curr, FALSE)) {
|
|
||||||
#endif
|
#endif
|
||||||
|
if (!pickit) pickit = (flags.pickup_thrown && curr->was_thrown);
|
||||||
|
if (pickit) {
|
||||||
pi[n].item.a_obj = curr;
|
pi[n].item.a_obj = curr;
|
||||||
pi[n].count = curr->quan;
|
pi[n].count = curr->quan;
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user