From: nethack.rankin Date: Mon, 3 Oct 2011 01:16:05 +0000 (+0000) Subject: more wishing assistance (trunk only) X-Git-Tag: MOVE2GIT~167 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e63a64a4ef9cbd4552fe1dffe46f066165147be;p=nethack more wishing assistance (trunk only) It's possible to ask for help on the first wish attempt, even though the prompt hasn't been adjusted to mention that yet, so the one message which is composed dynamically needs to have its phrasing tweaked a bit more if the user happens to do that. Also, allow help to be requested even when the cmdassist option is toggled off. Now that option just controls whether the prompt string is augmented for retry attempts. --- diff --git a/src/zap.c b/src/zap.c index 87fc49bd4..df38947e0 100644 --- a/src/zap.c +++ b/src/zap.c @@ -4606,15 +4606,18 @@ int damage, tell; return(resisted); } +#define MAXWISHTRY 5 + STATIC_OVL void wishcmdassist(triesleft) int triesleft; { static NEARDATA const char *wishinfo[] = { - "cmdassist: wish mechanics", + "Wish details:", "", "Enter the name of an object, such as \"potion of monster detection\",", - "\"scroll labeled README\", \"elven mithril-coat\", or \"Grimtooth\".", + "\"scroll labeled README\", \"elven mithril-coat\", or \"Grimtooth\"", + "(without the quotes).", "", "For object types which come in stacks, you may specify a plural name", "such as \"potions of healing\", or specify a count, such as \"1000 gold", @@ -4629,7 +4632,7 @@ int triesleft; }, preserve_wishless[] = "Doing so will preserve 'wishless' conduct.", retry_info[] = - "If you specify an unrecognized object name %s more time%s,", + "If you specify an unrecognized object name %s%s time%s,", retry_too[] = "a randomly chosen item will be granted.", suppress_cmdassist[] = "(Suppress this assistance with !cmdassist in your config file.)", @@ -4649,17 +4652,17 @@ int triesleft; Sprintf(buf, retry_info, (triesleft >= 0 && triesleft < SIZE(cardinals)) ? cardinals[triesleft] : too_many, + (triesleft < MAXWISHTRY) ? " more" : "", plur(triesleft)); putstr(win, 0, buf); putstr(win, 0, retry_too); putstr(win, 0, ""); - putstr(win, 0, suppress_cmdassist); + if (iflags.cmdassist) + putstr(win, 0, suppress_cmdassist); display_nhwindow(win, FALSE); destroy_nhwindow(win); } -#define MAXWISHTRY 5 - void makewish() { @@ -4671,18 +4674,18 @@ makewish() nothing = zeroobj; /* lint suppression; only its address matters */ if (flags.verbose) You("may wish for an object."); retry: - Strcpy(promptbuf,"For what do you wish"); - if (iflags.cmdassist && tries > 0) { - Sprintf(eos(promptbuf), - " (enter 'help' for assistance)"); - } - Strcat(promptbuf,"?"); + Strcpy(promptbuf, "For what do you wish"); + if (iflags.cmdassist && tries > 0) + Strcat(promptbuf, " (enter 'help' for assistance)"); + Strcat(promptbuf, "?"); getlin(promptbuf, buf); - if(iflags.cmdassist && !strcmpi(buf,"help")) { - wishcmdassist(MAXWISHTRY - tries); - goto retry; + (void)mungspaces(buf); + if (buf[0] == '\033') { + buf[0] = '\0'; + } else if (!strcmpi(buf, "help")) { + wishcmdassist(MAXWISHTRY - tries); + goto retry; } - if(buf[0] == '\033') buf[0] = 0; /* * Note: if they wished for and got a non-object successfully, * otmp == &zeroobj. That includes gold, or an artifact that