new container flags

[Attention: This patch increments EDITLEVEL in patchlevel.h, rendering all
 previous save and bones files obsolete.]

Here's the first cut at the two recommended flags lknown and cknown.
I've attempted to stay close to Pat's recommendations:
   "Containers ought to have two new flags:  lknown for lock status known,
    and cknown for contents known (ie, `secret').  Formatted box and chest
    descriptions should include locked/unlocked/broken when that is known
    and empty/nonempty (or something like "holds N items") when contents
    are known. The contents indicator would also apply to nonlockable
    containers."

I probably overlooked a place where a flag should be adjusted, but this
should give us a good starting point.

I wasn't sure what to do with the case of the auditory feedback for
magical locking "Click" and "Clunk". The question that came to my mind
was: Should those reveal the locked or unlocked status of a box?
I suppose if you knew the type of wand you were zapping or the spell
you were casting, you could argue that they should.

In the end, I opted for setting lknown right off the zap/cast effect
for anyone playing a Wizard role, and not setting it for anyone else,
thus advancing class differentiation a little bit too.

I haven't checked the cknown results under all flags.menu_style options
at this point, only MENU_FULL.
This commit is contained in:
nethack.allison
2004-12-15 23:50:18 +00:00
parent 10b227e242
commit 5a433fe0e0
10 changed files with 79 additions and 8 deletions

View File

@@ -569,6 +569,11 @@ register struct obj *obj;
if (obj->oinvis) Strcat(prefix,"invisible ");
#endif
/* "empty" goes at the beginning, but item count goes at the end */
if (obj->cknown &&
(Is_container(obj) || obj->otyp == STATUE) && !Has_contents(obj))
Strcat(prefix, "empty ");
if (obj->bknown &&
obj->oclass != COIN_CLASS &&
(obj->otyp != POT_WATER || !objects[POT_WATER].oc_name_known
@@ -602,8 +607,28 @@ register struct obj *obj;
Strcat(prefix, "uncursed ");
}
if (obj->lknown && Is_box(obj)) {
if (obj->obroken)
Strcat(prefix, "unlockable ");
else if (obj->olocked)
Strcat(prefix, "locked ");
else
Strcat(prefix, "unlocked ");
}
if (obj->greased) Strcat(prefix, "greased ");
if (obj->cknown && Has_contents(obj)) {
struct obj *curr;
long itemcount = 0L;
/* Count the number of contained objects */
for (curr = obj->cobj; curr; curr = curr->nobj)
itemcount += curr->quan;
Sprintf(eos(bp), " containing %ld item%s",
itemcount, plur(itemcount));
}
switch(obj->oclass) {
case AMULET_CLASS:
if(obj->owornmask & W_AMUL)