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:
cohrs
2002-05-21 05:04:09 +00:00
parent 40aef2b8e6
commit 94837b78d4
6 changed files with 64 additions and 47 deletions
+1
View File
@@ -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 would kill the golem twice, resulting in an impossible error
usually stop mimicing if you polymorph while using #monster mimic capability 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, 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 Platform- and/or Interface-Specific Fixes
+2
View File
@@ -614,6 +614,7 @@ int retry;
/* Hack: gold is not in the inventory, so make a gold object /* Hack: gold is not in the inventory, so make a gold object
and put it at the head of the inventory list. */ and put it at the head of the inventory list. */
u_gold = mkgoldobj(u.ugold); /* removes from u.ugold */ u_gold = mkgoldobj(u.ugold); /* removes from u.ugold */
u_gold->in_use = TRUE;
u.ugold = u_gold->quan; /* put the gold back */ u.ugold = u_gold->quan; /* put the gold back */
assigninvlet(u_gold); /* might end up as NOINVSYM */ assigninvlet(u_gold); /* might end up as NOINVSYM */
u_gold->nobj = invent; u_gold->nobj = invent;
@@ -686,6 +687,7 @@ int retry;
/* didn't drop [all of] it */ /* didn't drop [all of] it */
u_gold = invent; u_gold = invent;
invent = u_gold->nobj; invent = u_gold->nobj;
u_gold->in_use = FALSE;
dealloc_obj(u_gold); dealloc_obj(u_gold);
update_inventory(); update_inventory();
} }
+1
View File
@@ -480,6 +480,7 @@ struct obj *obj;
if (obj->oclass == GOLD_CLASS) { if (obj->oclass == GOLD_CLASS) {
#ifndef GOLDOBJ #ifndef GOLDOBJ
u.ugold -= obj->quan; u.ugold -= obj->quan;
obj->in_use = FALSE;
#endif #endif
flags.botl = 1; flags.botl = 1;
return; return;
+2
View File
@@ -2084,6 +2084,7 @@ ask_again2:
* and put it at the head of the inventory list. * and put it at the head of the inventory list.
*/ */
u_gold = mkgoldobj(u.ugold); /* removes from u.ugold */ u_gold = mkgoldobj(u.ugold); /* removes from u.ugold */
u_gold->in_use = TRUE;
u.ugold = u_gold->quan; /* put the gold back */ u.ugold = u_gold->quan; /* put the gold back */
assigninvlet(u_gold); /* might end up as NOINVSYM */ assigninvlet(u_gold); /* might end up as NOINVSYM */
u_gold->nobj = invent; u_gold->nobj = invent;
@@ -2118,6 +2119,7 @@ ask_again2:
/* didn't stash [all of] it */ /* didn't stash [all of] it */
u_gold = invent; u_gold = invent;
invent = u_gold->nobj; invent = u_gold->nobj;
u_gold->in_use = FALSE;
dealloc_obj(u_gold); dealloc_obj(u_gold);
} }
#endif #endif
+11
View File
@@ -106,6 +106,17 @@ boolean quietly;
for (otmp = invent; otmp; otmp = otmp2) { for (otmp = invent; otmp; otmp = otmp2) {
otmp2 = otmp->nobj; 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 (otmp->in_use) {
if (!quietly) pline("Finishing off %s...", xname(otmp)); if (!quietly) pline("Finishing off %s...", xname(otmp));
useup(otmp); useup(otmp);
+1 -1
View File
@@ -2494,7 +2494,6 @@ boolean *lostsome;
{ {
int invc = inv_cnt(); int invc = inv_cnt();
while (near_capacity() > (Punished ? UNENCUMBERED : SLT_ENCUMBER)) { while (near_capacity() > (Punished ? UNENCUMBERED : SLT_ENCUMBER)) {
register struct obj *obj, *otmp = (struct obj *)0; register struct obj *obj, *otmp = (struct obj *)0;
register int i; register int i;
@@ -2534,6 +2533,7 @@ boolean *lostsome;
* and put it at the head of the inventory list. * and put it at the head of the inventory list.
*/ */
obj = mkgoldobj(u.ugold); /* removes from u.ugold */ obj = mkgoldobj(u.ugold); /* removes from u.ugold */
obj->in_use = TRUE;
u.ugold = obj->quan; /* put the gold back */ u.ugold = obj->quan; /* put the gold back */
assigninvlet(obj); /* might end up as NOINVSYM */ assigninvlet(obj); /* might end up as NOINVSYM */
obj->nobj = invent; obj->nobj = invent;