]> granicus.if.org Git - nethack/commitdiff
#fix #H2061 - ESC at music prompts (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 17 Dec 2009 02:51:03 +0000 (02:51 +0000)
committernethack.rankin <nethack.rankin>
Thu, 17 Dec 2009 02:51:03 +0000 (02:51 +0000)
     From a bug report, attempting to respond with ESC when playing an instrument
just continued with the playing sequence.  This adds a q choice to the
"Improvise? [yn]" and "Play passtune? [yn]" prompts, and also checks
for ESC as the 5-note tune when not improvising, yielding "Never mind"
and not using up a turn if the player opts not to play any music.

     I put the fixes entry in the new features section since the old
behavior wasn't much of a bug.

doc/fixes35.0
src/music.c

index 615b450ac2f13dea6074fae9be1f88fab1e0f3d2..72ac336cecd154ed179100ba1e58b9ee3d823880 100644 (file)
@@ -446,6 +446,7 @@ make '[' command more precise when poly'd hero has embedded dragon scales/mail
 fainting while wielding a cockatrice corpse will be fatal
 Sunsword's light radius depends on its curse/bless state
 Add M-C and M-R meta-key shortcuts for #conduct and #ride, respectively 
+can now use ESC to cancel out of prompts for playing musical instruments
 
 
 Platform- and/or Interface-Specific New Features
index 797bf03e32fdaca805f5f57820d1084920d46844..cb6f58d56c69cea75b349ded2b1ee33429fe1105 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 music.c $Date$  $Revision$ */
-/*     SCCS Id: @(#)music.c    3.5     2007/07/08      */
 /*     Copyright (c) 1989 by Jean-Christophe Collet */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -563,14 +562,20 @@ struct obj *instr;
        return(0);
     }
     if (instr->otyp != LEATHER_DRUM && instr->otyp != DRUM_OF_EARTHQUAKE) {
-       c = yn("Improvise?");
+       c = ynq("Improvise?");
+       if (c == 'q') goto nevermind;
     }
     if (c == 'n') {
-       if (u.uevent.uheard_tune == 2 && yn("Play the passtune?") == 'y') {
+       if (u.uevent.uheard_tune == 2) c = ynq("Play the passtune?");
+       if (c == 'q') {
+           goto nevermind;
+       } else if (c == 'y') {
            Strcpy(buf, tune);
        } else {
            getlin("What tune are you playing? [5 notes, A-G]", buf);
            (void)mungspaces(buf);
+           if (*buf == '\033') goto nevermind;
+
            /* convert to uppercase and change any "H" to the expected "B" */
            for (s = buf; *s; s++) {
 #ifndef AMIGA
@@ -684,6 +689,10 @@ struct obj *instr;
        return 1;
     } else
            return do_improvisation(instr);
+
+ nevermind:
+    pline(Never_mind);
+    return 0;
 }
 
 #ifdef UNIX386MUSIC