#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.
This commit is contained in:
nethack.rankin
2009-12-17 02:51:03 +00:00
parent 9269642f2a
commit 81e1ca40f1
2 changed files with 13 additions and 3 deletions

View 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

View 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