follow-up for #name permanent inventory update

Using extended #name for an object on the floor (for example)
wasn't updating the permanent inventory to reflect the updated
object type name if there was also one in inventory.
This commit is contained in:
nhmall
2025-12-09 14:17:42 -05:00
parent 68aaa5a3ae
commit 6ba053669e
3 changed files with 14 additions and 1 deletions

View File

@@ -1360,6 +1360,7 @@ extern void perm_invent_toggled(boolean negated);
extern void prepare_perminvent(winid window);
extern struct obj *carrying_stoning_corpse(void);
extern void repopulate_perminvent(void);
extern boolean hero_has_one_of_these(short);
/* ### ioctl.c ### */

View File

@@ -671,7 +671,7 @@ docall(struct obj *obj)
*uname_p = dupstr(buf);
discover_object(obj->otyp, FALSE, TRUE, TRUE); /* possibly add to disco[] */
}
if (obj->where == OBJ_INVENT)
if (obj->where == OBJ_INVENT || hero_has_one_of_these(obj->otyp))
update_inventory();
}

View File

@@ -2779,6 +2779,18 @@ learn_unseen_invent(void)
update_inventory();
}
boolean
hero_has_one_of_these(short otyp)
{
struct obj *otmp;
for (otmp = gi.invent; otmp; otmp = otmp->nobj) {
if (otmp->otyp == otyp)
return TRUE;
}
return FALSE;
}
/* persistent inventory window is maintained by interface code;
'update_inventory' used to be a macro for
(*windowprocs.win_update_inventory) but the restore hackery to suppress