]> granicus.if.org Git - nethack/commitdiff
cmdassist for wishing
authornethack.allison <nethack.allison>
Sat, 26 Aug 2006 04:03:27 +0000 (04:03 +0000)
committernethack.allison <nethack.allison>
Sat, 26 Aug 2006 04:03:27 +0000 (04:03 +0000)
include/winprocs.h
src/zap.c

index ce8169a7893ce4b0dd31a187a40e23fd7914091b..e9a07432e76df246326d1fb0def9b256a4db4704 100644 (file)
@@ -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                    */
index fc2b73ba2d3ec8fa6a51766e3cd6d0c9b792f87a..76a400316354cc8b1a3b56feb75697c99b4f2605 100644 (file)
--- 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, &nothing);
        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 */