From 81e1ca40f1f9de51a3bc211b2884b50f3c681845 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 17 Dec 2009 02:51:03 +0000 Subject: [PATCH] #fix #H2061 - ESC at music prompts (trunk only) 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 | 1 + src/music.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 615b450ac..72ac336ce 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/src/music.c b/src/music.c index 797bf03e3..cb6f58d56 100644 --- a/src/music.c +++ b/src/music.c @@ -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