diff --git a/include/hack.h b/include/hack.h index df0aab3e5..59beb4ce7 100644 --- a/include/hack.h +++ b/include/hack.h @@ -408,6 +408,8 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */ * or m_initweap() (lawful Angel) */ /* flag congrolling potential livelog event of finding an artifact */ #define ONAME_KNOW_ARTI 0x0100U /* hero is already aware of this artifact */ +/* flag for suppressing perm_invent update when name gets assigned */ +#define ONAME_SKIP_INVUPD 0x0200U /* don't call update_inventory() */ /* Flags to control find_mid() */ #define FM_FMON 0x01 /* search the fmon chain */ diff --git a/src/do_name.c b/src/do_name.c index 3b1bc72c9..0c6c24cca 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -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; } diff --git a/src/invent.c b/src/invent.c index a1412399b..ce7dd7a2f 100644 --- a/src/invent.c +++ b/src/invent.c @@ -726,7 +726,7 @@ merged(struct obj **potmp, struct obj **pobj) else if (!Is_pudding(otmp)) otmp->owt += obj->owt; if (!has_oname(otmp) && has_oname(obj)) - otmp = *potmp = oname(otmp, ONAME(obj), ONAME_NO_FLAGS); + otmp = *potmp = oname(otmp, ONAME(obj), ONAME_SKIP_INVUPD); obj_extract_self(obj); if (obj->pickup_prev && otmp->where == OBJ_INVENT) diff --git a/src/mkobj.c b/src/mkobj.c index d23c2c0df..ce8286a50 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -359,7 +359,7 @@ copy_oextra(struct obj *obj2, struct obj *obj1) if (!obj2->oextra) obj2->oextra = newoextra(); if (has_oname(obj1)) - oname(obj2, ONAME(obj1), ONAME_NO_FLAGS); + oname(obj2, ONAME(obj1), ONAME_SKIP_INVUPD); if (has_omonst(obj1)) { if (!OMONST(obj2)) newomonst(obj2); @@ -427,7 +427,7 @@ splitobj(struct obj *obj, long num) splitbill(obj, otmp); copy_oextra(otmp, obj); if (has_omid(otmp)) - free_omid(otmp); /* only one association with m_id*/ + free_omid(otmp); /* only one association with m_id */ if (obj->timed) obj_split_timers(obj, otmp); if (obj_sheds_light(obj))