diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 761d1e02e..f0986f9a2 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -398,6 +398,8 @@ DUMPLOG: genocided and extinct species was always a blank line; vanquished creatures was just a blank line if nothing had been killed DUMPLOG: RIP tombstone was printed for characters who survived (ascended, escaped dungeon, quit, trickery or panic) +artifact creation violated illiterate conduct when artifact name was assigned, + behavior intended only for creating Sting or Orcrist via naming Platform- and/or Interface-Specific Fixes diff --git a/src/do_name.c b/src/do_name.c index d494942ce..98293152e 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_name.c $NHDT-Date: 1452669022 2016/01/13 07:10:22 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.90 $ */ +/* NetHack 3.6 do_name.c $NHDT-Date: 1489494376 2017/03/14 12:26:16 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.116 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1011,10 +1011,12 @@ do_mname() (void) christen_monst(mtmp, buf); } +STATIC_VAR int via_naming = 0; + /* - * This routine changes the address of obj. Be careful not to call it - * when there might be pointers around in unknown places. For now: only - * when obj is in the inventory. + * This routine used to change the address of 'obj' so be unsafe if not + * used with extreme care. Applying a name to an object no longer + * allocates a replacement object, so that old risk is gone. */ STATIC_OVL void @@ -1079,7 +1081,9 @@ register struct obj *obj; display_nhwindow(WIN_MESSAGE, FALSE); You("engrave: \"%s\".", buf); } + ++via_naming; /* This ought to be an argument rather than a static... */ obj = oname(obj, buf); + --via_naming; /* ...but oname() is used in a lot of places, so defer. */ } struct obj * @@ -1119,8 +1123,10 @@ const char *name; /* if obj is owned by a shop, increase your bill */ if (obj->unpaid) alter_cost(obj, 0L); - /* violate illiteracy conduct since successfully wrote arti-name */ - u.uconduct.literate++; + if (via_naming) { + /* violate illiteracy conduct since successfully wrote arti-name */ + u.uconduct.literate++; + } } if (carried(obj)) update_inventory();