]> granicus.if.org Git - nethack/commitdiff
doclassdisco() - missing start_menu() call
authorPatR <rankin@nethack.org>
Tue, 8 Dec 2015 15:21:48 +0000 (07:21 -0800)
committerPatR <rankin@nethack.org>
Tue, 8 Dec 2015 15:21:48 +0000 (07:21 -0800)
Apparently tty doesn't mind if you use add_menu() without preceding
it with start_menu(), because doclassdisco() (the new with 3.6.0 '`'
command) works for me with all four settings of menustyle.

src/o_init.c

index 17f49b8ba592b0ed1a965be71bfef905b51206f7..a6aef9f908572f0070995a5e32fafdca39b6f270 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 o_init.c        $NHDT-Date: 1446892449 2015/11/07 10:34:09 $  $NHDT-Branch: master $:$NHDT-Revision: 1.20 $ */
+/* NetHack 3.6 o_init.c        $NHDT-Date: 1449588093 2015/12/08 15:21:33 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.21 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -436,11 +436,8 @@ dodiscovered() /* free after Robert Viduya */
 
     /* several classes are omitted from packorder; one is of interest here */
     Strcpy(classes, flags.inv_order);
-    if (!index(classes, VENOM_CLASS)) {
-        s = eos(classes);
-        *s++ = VENOM_CLASS;
-        *s = '\0';
-    }
+    if (!index(classes, VENOM_CLASS))
+        (void) strkitten(classes, VENOM_CLASS); /* append char to string */
 
     for (s = classes; *s; s++) {
         oclass = *s;
@@ -497,14 +494,17 @@ doclassdisco()
         discosyms[2 + MAXOCLASSES + 1], buf[BUFSZ];
     int i, ct, dis, xtras;
     boolean traditional;
-    winid tmpwin;
+    winid tmpwin = WIN_ERR;
     anything any;
     menu_item *pick_list = 0;
 
     discosyms[0] = '\0';
     traditional = (flags.menu_style == MENU_TRADITIONAL
                    || flags.menu_style == MENU_COMBINATION);
-    tmpwin = !traditional ? create_nhwindow(NHW_MENU) : WIN_ERR;
+    if (!traditional) {
+        tmpwin = create_nhwindow(NHW_MENU);
+        start_menu(tmpwin);
+    }
     any = zeroany;
     menulet = 'a';
 
@@ -534,7 +534,7 @@ doclassdisco()
        classes are omitted from packorder and one is of interest here */
     Strcpy(allclasses, flags.inv_order);
     if (!index(allclasses, VENOM_CLASS))
-        Sprintf(eos(allclasses), "%c", VENOM_CLASS);
+        (void) strkitten(allclasses, VENOM_CLASS); /* append char to string */
     /* construct discosyms[] */
     for (s = allclasses; *s; ++s) {
         oclass = *s;
@@ -572,8 +572,8 @@ doclassdisco()
             c = def_oc_syms[(int) *s].sym;
             if (!index(discosyms, c)) {
                 if (!xtras++)
-                    Sprintf(eos(discosyms), "%c", '\033');
-                Sprintf(eos(discosyms), "%c", c);
+                    (void) strkitten(discosyms, '\033');
+                (void) strkitten(discosyms, c);
             }
         }
         /* get the class (via its symbol character) */