hangups with temp gold in inventory
- Implement Michael's suggestion of marking temp gold put in inventory so it can be cleaned up during restore.
This commit is contained in:
@@ -109,6 +109,7 @@ when polymorphed, player killing a paper or straw golem via fire damage
|
||||
would kill the golem twice, resulting in an impossible error
|
||||
usually stop mimicing if you polymorph while using #monster mimic capability
|
||||
under !GOLDOBJ, gold shouldn't disappear if you try to throw it at yourself
|
||||
under !GOLDOBJ, remove temp gold from inventory during restore
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
2
src/do.c
2
src/do.c
@@ -614,6 +614,7 @@ int retry;
|
||||
/* Hack: gold is not in the inventory, so make a gold object
|
||||
and put it at the head of the inventory list. */
|
||||
u_gold = mkgoldobj(u.ugold); /* removes from u.ugold */
|
||||
u_gold->in_use = TRUE;
|
||||
u.ugold = u_gold->quan; /* put the gold back */
|
||||
assigninvlet(u_gold); /* might end up as NOINVSYM */
|
||||
u_gold->nobj = invent;
|
||||
@@ -686,6 +687,7 @@ int retry;
|
||||
/* didn't drop [all of] it */
|
||||
u_gold = invent;
|
||||
invent = u_gold->nobj;
|
||||
u_gold->in_use = FALSE;
|
||||
dealloc_obj(u_gold);
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
@@ -480,6 +480,7 @@ struct obj *obj;
|
||||
if (obj->oclass == GOLD_CLASS) {
|
||||
#ifndef GOLDOBJ
|
||||
u.ugold -= obj->quan;
|
||||
obj->in_use = FALSE;
|
||||
#endif
|
||||
flags.botl = 1;
|
||||
return;
|
||||
|
||||
@@ -2084,6 +2084,7 @@ ask_again2:
|
||||
* and put it at the head of the inventory list.
|
||||
*/
|
||||
u_gold = mkgoldobj(u.ugold); /* removes from u.ugold */
|
||||
u_gold->in_use = TRUE;
|
||||
u.ugold = u_gold->quan; /* put the gold back */
|
||||
assigninvlet(u_gold); /* might end up as NOINVSYM */
|
||||
u_gold->nobj = invent;
|
||||
@@ -2118,6 +2119,7 @@ ask_again2:
|
||||
/* didn't stash [all of] it */
|
||||
u_gold = invent;
|
||||
invent = u_gold->nobj;
|
||||
u_gold->in_use = FALSE;
|
||||
dealloc_obj(u_gold);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -106,6 +106,17 @@ boolean quietly;
|
||||
|
||||
for (otmp = invent; otmp; otmp = otmp2) {
|
||||
otmp2 = otmp->nobj;
|
||||
#ifndef GOLDOBJ
|
||||
if (otmp->oclass == GOLD_CLASS) {
|
||||
/* in_use gold is created by some menu operations */
|
||||
if (!otmp->in_use) {
|
||||
impossible("inven_inuse: !in_use gold in inventory");
|
||||
}
|
||||
extract_nobj(otmp, &invent);
|
||||
otmp->in_use = FALSE;
|
||||
dealloc_obj(otmp);
|
||||
} else
|
||||
#endif /* GOLDOBJ */
|
||||
if (otmp->in_use) {
|
||||
if (!quietly) pline("Finishing off %s...", xname(otmp));
|
||||
useup(otmp);
|
||||
|
||||
94
src/trap.c
94
src/trap.c
@@ -2494,64 +2494,64 @@ boolean *lostsome;
|
||||
{
|
||||
int invc = inv_cnt();
|
||||
|
||||
|
||||
while (near_capacity() > (Punished ? UNENCUMBERED : SLT_ENCUMBER)) {
|
||||
register struct obj *obj, *otmp = (struct obj *)0;
|
||||
register int i;
|
||||
register struct obj *obj, *otmp = (struct obj *)0;
|
||||
register int i;
|
||||
|
||||
/* Pick a random object */
|
||||
if (invc > 0) {
|
||||
i = rn2(invc);
|
||||
/* Pick a random object */
|
||||
if (invc > 0) {
|
||||
i = rn2(invc);
|
||||
for (obj = invent; obj; obj = obj->nobj) {
|
||||
/*
|
||||
* Undroppables are: body armor, boots, gloves,
|
||||
* amulets, and rings because of the time and effort
|
||||
* in removing them + loadstone and other cursed stuff
|
||||
* for obvious reasons.
|
||||
*/
|
||||
if (!((obj->otyp == LOADSTONE && obj->cursed) ||
|
||||
obj == uamul || obj == uleft || obj == uright ||
|
||||
obj == ublindf || obj == uarm || obj == uarmc ||
|
||||
obj == uarmg || obj == uarmf ||
|
||||
/*
|
||||
* Undroppables are: body armor, boots, gloves,
|
||||
* amulets, and rings because of the time and effort
|
||||
* in removing them + loadstone and other cursed stuff
|
||||
* for obvious reasons.
|
||||
*/
|
||||
if (!((obj->otyp == LOADSTONE && obj->cursed) ||
|
||||
obj == uamul || obj == uleft || obj == uright ||
|
||||
obj == ublindf || obj == uarm || obj == uarmc ||
|
||||
obj == uarmg || obj == uarmf ||
|
||||
#ifdef TOURIST
|
||||
obj == uarmu ||
|
||||
obj == uarmu ||
|
||||
#endif
|
||||
(obj->cursed && (obj == uarmh || obj == uarms)) ||
|
||||
welded(obj)))
|
||||
otmp = obj;
|
||||
/* reached the mark and found some stuff to drop? */
|
||||
if (--i < 0 && otmp) break;
|
||||
(obj->cursed && (obj == uarmh || obj == uarms)) ||
|
||||
welded(obj)))
|
||||
otmp = obj;
|
||||
/* reached the mark and found some stuff to drop? */
|
||||
if (--i < 0 && otmp) break;
|
||||
|
||||
/* else continue */
|
||||
}
|
||||
/* else continue */
|
||||
}
|
||||
}
|
||||
#ifndef GOLDOBJ
|
||||
if (!otmp) {
|
||||
/* Nothing available left to drop; try gold */
|
||||
if (u.ugold) {
|
||||
pline("In desperation, you drop your purse.");
|
||||
/* Hack: gold is not in the inventory, so make a gold object
|
||||
* and put it at the head of the inventory list.
|
||||
*/
|
||||
obj = mkgoldobj(u.ugold); /* removes from u.ugold */
|
||||
u.ugold = obj->quan; /* put the gold back */
|
||||
assigninvlet(obj); /* might end up as NOINVSYM */
|
||||
obj->nobj = invent;
|
||||
invent = obj;
|
||||
*lostsome = TRUE;
|
||||
dropx(obj);
|
||||
continue; /* Try again */
|
||||
}
|
||||
/* We can't even drop gold! */
|
||||
return (FALSE);
|
||||
if (!otmp) {
|
||||
/* Nothing available left to drop; try gold */
|
||||
if (u.ugold) {
|
||||
pline("In desperation, you drop your purse.");
|
||||
/* Hack: gold is not in the inventory, so make a gold object
|
||||
* and put it at the head of the inventory list.
|
||||
*/
|
||||
obj = mkgoldobj(u.ugold); /* removes from u.ugold */
|
||||
obj->in_use = TRUE;
|
||||
u.ugold = obj->quan; /* put the gold back */
|
||||
assigninvlet(obj); /* might end up as NOINVSYM */
|
||||
obj->nobj = invent;
|
||||
invent = obj;
|
||||
*lostsome = TRUE;
|
||||
dropx(obj);
|
||||
continue; /* Try again */
|
||||
}
|
||||
/* We can't even drop gold! */
|
||||
return (FALSE);
|
||||
}
|
||||
#else
|
||||
if (!otmp) return (FALSE); /* nothing to drop! */
|
||||
if (!otmp) return (FALSE); /* nothing to drop! */
|
||||
#endif
|
||||
if (otmp->owornmask) remove_worn_item(otmp, FALSE);
|
||||
*lostsome = TRUE;
|
||||
dropx(otmp);
|
||||
invc--;
|
||||
if (otmp->owornmask) remove_worn_item(otmp, FALSE);
|
||||
*lostsome = TRUE;
|
||||
dropx(otmp);
|
||||
invc--;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user