container groundwork / splitting welded weapons (trunk only)

Some miscellaneous changes preparatory to enhancing the container
interface.  This also fixes a minor inconsistency in object manipulation:
askchain() wouldn't let you split a stack of welded weapons but getobj()
would, so you couldn't get rid of part of the stack using 'D' or #loot,
but you could with 'd' (and post-3.4.3, with #adjust).  Now getobj() will
behave like askchain(); if you have 3 cursed daggers welded to your hand,
you won't be able to drop 1 or 2 of them anymore.
This commit is contained in:
nethack.rankin
2007-01-04 05:46:14 +00:00
parent dccedb99ba
commit c45ce7a999
6 changed files with 40 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)end.c 3.5 2006/04/14 */
/* SCCS Id: @(#)end.c 3.5 2007/01/02 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -384,7 +384,7 @@ boolean taken;
obj->cknown = obj->lknown = 1;
}
(void) display_inventory((char *)0, TRUE);
container_contents(invent, TRUE, TRUE);
container_contents(invent, TRUE, TRUE, FALSE);
}
if (c == 'q') done_stopprint++;
}
@@ -959,9 +959,9 @@ die:
void
container_contents(list, identified, all_containers)
container_contents(list, identified, all_containers, reportempty)
struct obj *list;
boolean identified, all_containers;
boolean identified, all_containers, reportempty;
{
register struct obj *box, *obj;
char buf[BUFSZ];
@@ -1002,15 +1002,15 @@ boolean identified, all_containers;
display_nhwindow(tmpwin, TRUE);
destroy_nhwindow(tmpwin);
if (all_containers)
container_contents(box->cobj, identified, TRUE);
} else {
if (cat || deadcat) {
pline("%s%s contains Schroedinger's %scat!",
(box->quan > 1L) ? "One of the " : "",
(box->quan > 1L) ? xname(box) : upstart(xname(box)),
(deadcat) ? "dead " : "");
display_nhwindow(WIN_MESSAGE, FALSE);
}
container_contents(box->cobj, identified, TRUE,
reportempty);
} else if (cat || deadcat) {
pline("%s Schroedinger's %scat!",
Tobjnam(box, "contain"), deadcat ? "dead " : "");
display_nhwindow(WIN_MESSAGE, FALSE);
} else if (reportempty) {
pline("%s is empty.", upstart(thesimpleoname(box)));
display_nhwindow(WIN_MESSAGE, FALSE);
}
}
if (!all_containers)