]> granicus.if.org Git - nethack/commitdiff
yet more qbuf
authornethack.allison <nethack.allison>
Fri, 9 May 2003 01:19:29 +0000 (01:19 +0000)
committernethack.allison <nethack.allison>
Fri, 9 May 2003 01:19:29 +0000 (01:19 +0000)
include/extern.h
src/objnam.c
src/pickup.c

index 0b1d7cf0248272401890d003f42f99949402f662..4c47a70b90621b02d1a1f5eca599091fa71e71e5 100644 (file)
@@ -1363,6 +1363,8 @@ E char *FDECL(vtense, (const char *,const char *));
 E char *FDECL(Doname2, (struct obj *));
 E char *FDECL(yname, (struct obj *));
 E char *FDECL(Yname2, (struct obj *));
+E char *FDECL(ysimple_name, (struct obj *));
+E char *FDECL(Ysimple_name2, (struct obj *));
 E char *FDECL(makeplural, (const char *));
 E char *FDECL(makesingular, (const char *));
 E struct obj *FDECL(readobjnam, (char *,struct obj *,BOOLEAN_P));
index 30052f91a56ea824d99bf5dd3a81faee921e8074..bd9e0a6fca93ac5f4411e74d63551988e36599aa 100644 (file)
@@ -1171,6 +1171,32 @@ struct obj *obj;
        return s;
 }
 
+/* returns "your simple_typename(obj->otyp)"
+ * or "Foobar's simple_typename(obj->otyp)"
+ * or "the simple_typename(obj-otyp)"
+ */
+char *
+ysimple_name(obj)
+struct obj *obj;
+{
+       char *outbuf = nextobuf();
+       char *s = shk_your(outbuf, obj);        /* assert( s == outbuf ); */
+       int space_left = BUFSZ - strlen(s) - sizeof " ";
+
+       return strncat(strcat(s, " "), simple_typename(obj->otyp), space_left);
+}
+
+/* capitalized variant of ysimple_name() */
+char *
+Ysimple_name2(obj)
+struct obj *obj;
+{
+       char *s = ysimple_name(obj);
+
+       *s = highc(*s);
+       return s;
+}
+
 static const char *wrp[] = {
        "wand", "ring", "potion", "scroll", "gem", "amulet",
        "spellbook", "spell book",
index 848706b7bc11228ad66a920b4f753fc73bd65a1a..e64c51d55f57b4c8812c7d4fb52a616f5b7913dd 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)pickup.c   3.4     2003/04/26      */
+/*     SCCS Id: @(#)pickup.c   3.4     2003/05/08      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -538,7 +538,9 @@ menu_pickup:
 
                if (!all_of_a_type) {
                    char qbuf[BUFSZ];
-                   Sprintf(qbuf, "Pick up %s?", doname(obj));
+                   Sprintf(qbuf, "Pick up %s?",
+                       safe_qbuf(qbuf, sizeof("Pick up ?"), doname(obj),
+                                       an(simple_typename(obj->otyp)), something));
                    switch ((obj->quan < 2L) ? ynaq(qbuf) : ynNaq(qbuf)) {
                    case 'q': goto end_query;   /* out 2 levels */
                    case 'n': continue;
@@ -1476,7 +1478,10 @@ lootcont:
            nobj = cobj->nexthere;
 
            if (Is_container(cobj)) {
-               Sprintf(qbuf, "There is %s here, loot it?", doname(cobj));
+               Sprintf(qbuf, "There is %s here, loot it?",
+                       safe_qbuf(qbuf, sizeof("There is  here, loot it?"),
+                            doname(cobj), an(simple_typename(cobj->otyp)),
+                            "a container"));
                c = ynq(qbuf);
                if (c == 'q') return (timepassed);
                if (c == 'n') continue;
@@ -2056,8 +2061,9 @@ register int held;
        if (!cnt)
            Sprintf(emptymsg, "%s is empty.", Yname2(obj));
        if (cnt || flags.menu_style == MENU_FULL) {
-           Sprintf(qbuf, "Do you want to take %s out of %s?",
-                   something, yname(obj));
+           Strcpy(qbuf, "Do you want to take something out of ");
+           Sprintf(eos(qbuf), "%s?",
+                   safe_qbuf(qbuf, 1, yname(obj), ysimple_name(obj), "it"));
            if (flags.menu_style != MENU_TRADITIONAL) {
                if (flags.menu_style == MENU_FULL) {
                    int t;