fix issue #1455 - fully thrown quiver stack won't
autoquiver when picked back up
Issue reported by ars3niy: empty quiver used to be refilled when
picking a thrown item or stack up. Bug introduced by a previous fix
(commit 593a93d254) dealing with the
post-3.6 obj->how_lost field.
As with the last time I dealt with this, there was a lot of trial
and error involved. This fixes the quiver issue without bringing
the earlier problem back. This time the problem was that how_lost
got cleared before it was used to check whether an item being picked
up had been thrown.
Dropping part of a stack and throwing another part of the same stack
may behave oddly if a monster picks both up. I am not going to try
to figure that out.
Fixes #1466
This commit is contained in:
14
src/pickup.c
14
src/pickup.c
@@ -1805,7 +1805,6 @@ pickup_object(
|
||||
long count, /* if non-zero, pick up a subset of this amount */
|
||||
boolean telekinesis) /* not picking it up directly by hand */
|
||||
{
|
||||
unsigned save_how_lost;
|
||||
int res;
|
||||
|
||||
if (obj->quan < count) {
|
||||
@@ -1862,16 +1861,12 @@ pickup_object(
|
||||
}
|
||||
}
|
||||
|
||||
save_how_lost = obj->how_lost;
|
||||
/* obj has either already passed autopick_testobj or we are explicitly
|
||||
picking it off the floor, so override obj->how_lost; otherwise we
|
||||
couldn't pick up a thrown, stolen, or dropped item that was split
|
||||
off from a carried stack even while still carrying the rest of the
|
||||
stack unless we have at least one free slot available */
|
||||
obj->how_lost &= ~LOSTOVERRIDEMASK; /* affects merge_choice() */
|
||||
picking it off the floor, so addinv() will override obj->how_lost;
|
||||
otherwise we couldn't pick up a thrown, stolen, or dropped item that
|
||||
was split off from a carried stack even while still carrying the
|
||||
rest of the stack unless we have at least one free slot available */
|
||||
res = lift_object(obj, (struct obj *) 0, &count, telekinesis);
|
||||
obj->how_lost = save_how_lost; /* even when res > 0,
|
||||
* in case we call splitobj() below */
|
||||
if (res <= 0)
|
||||
return res;
|
||||
|
||||
@@ -1881,7 +1876,6 @@ pickup_object(
|
||||
if (obj->quan != count && obj->otyp != LOADSTONE)
|
||||
obj = splitobj(obj, count);
|
||||
|
||||
obj->how_lost &= ~LOSTOVERRIDEMASK;
|
||||
obj = pick_obj(obj);
|
||||
|
||||
if (uwep && uwep == obj)
|
||||
|
||||
Reference in New Issue
Block a user