object name assignment vs persistent inventory

This is an alternate way to deal with pull request #876, where
splitting a stack that has a name assigned updated perm_invent when
cloning the name and ran into trouble with shop billing when trying
to format for persistent inventory display.

The PR#876 fix has been left in place but wouldn't have been needed
if this had gone in first.
This commit is contained in:
PatR
2022-09-26 14:25:06 -07:00
parent caf1eeebf9
commit 0735b790f9
4 changed files with 9 additions and 6 deletions

View File

@@ -1358,11 +1358,12 @@ struct obj *
oname(
struct obj *obj, /* item to assign name to */
const char *name, /* name to assign */
unsigned oflgs) /* flags for artifact creation; otherwise ignored */
unsigned oflgs) /* flags, mostly for artifact creation */
{
int lth;
char buf[PL_PSIZ];
boolean via_naming = (oflgs & ONAME_VIA_NAMING) != 0;
boolean via_naming = (oflgs & ONAME_VIA_NAMING) != 0,
skip_inv_update = (oflgs & ONAME_SKIP_INVUPD) != 0;
lth = *name ? (int) (strlen(name) + 1) : 0;
if (lth > PL_PSIZ) {
@@ -1405,7 +1406,7 @@ oname(
ansimpleoname(obj), bare_artifactname(obj));
}
}
if (carried(obj))
if (carried(obj) && !skip_inv_update)
update_inventory();
return obj;
}