minimal_xname (trunk only)

simple_typename and obj_typename operate on item types rather than
particular objects so have to assume that the item involved has been seen.
That means that simple_typename(obj->otyp) is not suitable; if obj->dknown
hasn't been set, it gives away information.  This adds mininal_xname(obj)
to be used for that purpose.  I'm not aware of any straightforward way to
actually expose the original problem; it's more than hypothetical but not
something anyone's likely to have come across.

     Not fixed:  test driver program reveals that obj_typename(GOLD_PIECE)
and simple_typename(GOLD_PIECE) yield "coin of gold piece".  But I don't
think there's any way to get nethack to show that to the user.
This commit is contained in:
nethack.rankin
2006-11-26 05:15:52 +00:00
parent 95729beb4a
commit 59354953cc
4 changed files with 54 additions and 13 deletions

View File

@@ -517,7 +517,7 @@ int alter_type;
xchar ox, oy;
char objroom;
boolean set_bknown;
const char *those, *them, *what;
const char *those, *them;
struct monst *shkp = 0;
if (alter_type < 0 || alter_type >= SIZE(alteration_verbs)) {
@@ -559,10 +559,9 @@ int alter_type;
case OBJ_FREE: /* obj_no_longer_held() */
case OBJ_INVENT:
if (set_bknown) obj->bknown = 1;
what = simple_typename(obj->otyp);
if (obj->quan != 1L) what = makeplural(what);
verbalize("You %s %s %s, you pay for %s!",
alteration_verbs[alter_type], those, what, them);
alteration_verbs[alter_type], those,
simpleonames(obj), them);
bill_dummy_object(obj);
break;
case OBJ_FLOOR: