From: nethack.allison Date: Sat, 26 Aug 2006 04:03:27 +0000 (+0000) Subject: cmdassist for wishing X-Git-Tag: MOVE2GIT~924 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90fba2f9f9d4754a8a2f343b57d8a47101369b6c;p=nethack cmdassist for wishing --- diff --git a/include/winprocs.h b/include/winprocs.h index ce8169a78..e9a07432e 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -196,7 +196,11 @@ extern NEARDATA struct window_procs windowprocs; #define WC_MAP_MODE 0x10000000L /* 29 map_mode option */ #define WC_WINDOWCOLORS 0x20000000L /* 30 background color for message window */ #define WC_PLAYER_SELECTION 0x40000000L /* 31 background color for message window */ +#ifdef NHSTDC +#define WC_MOUSE_SUPPORT 0x80000000UL /* 32 mouse support */ +#else #define WC_MOUSE_SUPPORT 0x80000000L /* 32 mouse support */ +#endif /* no free bits */ #define WC2_FULLSCREEN 0x01L /* 01 display full screen */ diff --git a/src/zap.c b/src/zap.c index fc2b73ba2..76a400316 100644 --- a/src/zap.c +++ b/src/zap.c @@ -4350,17 +4350,61 @@ int damage, tell; return(resisted); } +#define MAXWISHTRY 5 + +STATIC_OVL void +wishcmdassist(tries) +int tries; +{ + winid win; + char buf[BUFSZ]; + + win = create_nhwindow(NHW_TEXT); + if (!win) return; + Sprintf(buf, "cmdassist: wish mechanics"); + putstr(win, 0, buf); + putstr(win, 0, ""); + buf[0] = 0; + Sprintf(buf, + "You can enter 'nothing' explicitly to scratch this wish."); + putstr(win, 0, buf); + if (!u.uconduct.wishes) { + Sprintf(buf,"Entering 'nothing' will not alter your wishless status."); + putstr(win, 0, buf); + } + Sprintf(buf, + "You will by granted something random after %d more failed attempts.", + MAXWISHTRY - tries); + putstr(win, 0, buf); + putstr(win, 0, ""); + putstr(win, 0, + "(Suppress this assistance with !cmdassist in config file.)"); + display_nhwindow(win, FALSE); + destroy_nhwindow(win); +} + void makewish() { - char buf[BUFSZ]; + char buf[BUFSZ], promptbuf[BUFSZ]; struct obj *otmp, nothing; int tries = 0; + promptbuf[0] = '\0'; nothing = zeroobj; /* lint suppression; only its address matters */ if (flags.verbose) You("may wish for an object."); retry: - getlin("For what do you wish?", buf); + Strcpy(promptbuf,"For what do you wish"); + if (iflags.cmdassist && tries > 0) { + Sprintf(eos(promptbuf), + " (enter 'help' for assistance)"); + } + Strcat(promptbuf,"?"); + getlin(promptbuf, buf); + if(iflags.cmdassist && !strcmpi(buf,"help")) { + wishcmdassist(tries); + goto retry; + } if(buf[0] == '\033') buf[0] = 0; /* * Note: if they wished for and got a non-object successfully, @@ -4371,7 +4415,7 @@ retry: otmp = readobjnam(buf, ¬hing); if (!otmp) { pline("Nothing fitting that description exists in the game."); - if (++tries < 5) goto retry; + if (++tries < MAXWISHTRY) goto retry; pline(thats_enough_tries); otmp = readobjnam((char *)0, (struct obj *)0); if (!otmp) return; /* for safety; should never happen */