farlook of detected objects

At the end of December, farlook was changed to use doname() instead
of xname() in order to give more information when looking at stuff
the player had already seen.  But it ended up giving away precise
stack size for mergable objects too, even if they hadn't been seen
up close.  Changing doname() to be vague when dknown wasn't set
only worked for items in particular classes; dknown is pre-set for
a lot of things.  So this changes mksobj()'s dknown handling to not
do that for stackable items.

The change to objclass.h is just comment formatting (for the first
part of the file only), provoked by the second line of the one for
oc_pre_discovered.
This commit is contained in:
PatR
2016-04-30 18:55:52 -07:00
parent 89dd37f8c7
commit 16c08f7296
4 changed files with 29 additions and 22 deletions

View File

@@ -234,6 +234,8 @@ post-3.6.0: fix inventory menu for response of '?' to getobj (more sortloot
revamp fallout)
post-3.6.0: rings covered by non-cursed gloves not listed as 'R' candidates
post-3.6.0: in baalz_fixup, move any monster away from the two fake pool spots
post-3.6.0: switching farlook from xname to doname was giving away information
for items located via object detection (quantity of detected gold)
Platform- and/or Interface-Specific Fixes

View File

@@ -1,28 +1,28 @@
/* NetHack 3.6 objclass.h $NHDT-Date: 1447755971 2015/11/17 10:26:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
/* NetHack 3.6 objclass.h $NHDT-Date: 1462067744 2016/05/01 01:55:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#ifndef OBJCLASS_H
#define OBJCLASS_H
/* definition of a class of objects */
/* [misnamed] definition of a type of object */
struct objclass {
short oc_name_idx; /* index of actual name */
short oc_descr_idx; /* description when name unknown */
char *oc_uname; /* called by user */
short oc_name_idx; /* index of actual name */
short oc_descr_idx; /* description when name unknown */
char *oc_uname; /* called by user */
Bitfield(oc_name_known, 1);
Bitfield(oc_merge, 1); /* merge otherwise equal objects */
Bitfield(oc_uses_known, 1); /* obj->known affects full description */
/* otherwise, obj->dknown and obj->bknown */
/* tell all, and obj->known should always */
/* be set for proper merging behavior */
Bitfield(oc_pre_discovered, 1); /* Already known at start of game; */
/* won't be listed as a discovery. */
Bitfield(oc_magic, 1); /* inherently magical object */
Bitfield(oc_charged, 1); /* may have +n or (n) charges */
Bitfield(oc_unique, 1); /* special one-of-a-kind object */
Bitfield(oc_nowish, 1); /* cannot wish for this object */
Bitfield(oc_merge, 1); /* merge otherwise equal objects */
Bitfield(oc_uses_known, 1); /* obj->known affects full description;
otherwise, obj->dknown and obj->bknown
tell all, and obj->known should always
be set for proper merging behavior. */
Bitfield(oc_pre_discovered, 1); /* Already known at start of game;
won't be listed as a discovery. */
Bitfield(oc_magic, 1); /* inherently magical object */
Bitfield(oc_charged, 1); /* may have +n or (n) charges */
Bitfield(oc_unique, 1); /* special one-of-a-kind object */
Bitfield(oc_nowish, 1); /* cannot wish for this object */
Bitfield(oc_big, 1);
#define oc_bimanual oc_big /* for weapons & tools used as weapons */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkobj.c $NHDT-Date: 1454715975 2016/02/05 23:46:15 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.119 $ */
/* NetHack 3.6 mkobj.c $NHDT-Date: 1462067745 2016/05/01 01:55:45 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.122 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -734,7 +734,8 @@ boolean artif;
otmp->where = OBJ_FREE;
otmp->dknown = index(dknowns, let) ? 0 : 1;
if ((otmp->otyp >= ELVEN_SHIELD && otmp->otyp <= ORCISH_SHIELD)
|| otmp->otyp == SHIELD_OF_REFLECTION)
|| otmp->otyp == SHIELD_OF_REFLECTION
|| objects[otmp->otyp].oc_merge)
otmp->dknown = 0;
if (!objects[otmp->otyp].oc_uses_known)
otmp->known = 1;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1457570258 2016/03/10 00:37:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.166 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1462067746 2016/05/01 01:55:46 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.169 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -762,7 +762,7 @@ register struct obj *obj;
boolean with_price;
{
boolean ispoisoned = FALSE;
boolean known, cknown, bknown, lknown;
boolean known, dknown, cknown, bknown, lknown;
int omndx = obj->corpsenm;
char prefix[PREFIX];
char tmpbuf[PREFIX + 1]; /* for when we have to add something at
@@ -771,9 +771,10 @@ boolean with_price;
register char *bp = xname(obj);
if (iflags.override_ID) {
known = cknown = bknown = lknown = TRUE;
known = dknown = cknown = bknown = lknown = TRUE;
} else {
known = obj->known;
dknown = obj->dknown;
cknown = obj->cknown;
bknown = obj->bknown;
lknown = obj->lknown;
@@ -791,7 +792,10 @@ boolean with_price;
}
if (obj->quan != 1L) {
Sprintf(prefix, "%ld ", obj->quan);
if (dknown)
Sprintf(prefix, "%ld ", obj->quan);
else
Strcpy(prefix, "some ");
} else if (obj->otyp == CORPSE) {
/* skip article prefix for corpses [else corpse_xname()
would have to be taught how to strip it off again] */