]> granicus.if.org Git - nethack/commitdiff
Make REDO unconditional.
authorSean Hunt <scshunt@csclub.uwaterloo.ca>
Sat, 28 Feb 2015 00:24:28 +0000 (19:24 -0500)
committerSean Hunt <scshunt@csclub.uwaterloo.ca>
Sat, 28 Feb 2015 00:33:52 +0000 (19:33 -0500)
18 files changed:
include/config.h
include/decl.h
include/extern.h
include/global.h
include/ntconf.h
include/os2conf.h
include/pcconf.h
include/unixconf.h
include/vmsconf.h
include/wceconf.h
src/allmain.c
src/cmd.c
src/decl.c
src/invent.c
src/o_init.c
sys/share/pcsys.c
util/makedefs.c
win/tty/getline.c

index db5070a3a222d9351155651d1650b94e86ef5e32..5cf035b5421da56369c30cdfb54234e56a9f03b1 100644 (file)
@@ -417,16 +417,13 @@ typedef unsigned char     uchar;
 #define WALLIFIED_MAZE /* Fancy mazes - Jean-Christophe Collet */
 /* monsters & objects */
 /* I/O */
-#define REDO           /* support for redoing last command - DGK */
 #if !defined(MAC)
 # if !defined(NOCLIPPING)
 # define CLIPPING      /* allow smaller screens -- ERS */
 # endif
 #endif
 
-#ifdef REDO
-# define DOAGAIN '\001' /* ^A, the "redo" key used in cmd.c and getline.c */
-#endif
+#define DOAGAIN '\001' /* ^A, the "redo" key used in cmd.c and getline.c */
 
 #define EXP_ON_BOTL    /* Show experience on bottom line */
 /* #define SCORE_ON_BOTL */    /* added by Gary Erickson (erickson@ucivax) */
index 4733b531725515d0672cdce6936d7bbd7132e469..92f1e824036dfc09c8e1bef7c10451c0152aa1ba 100644 (file)
@@ -39,9 +39,7 @@ E NEARDATA int warn_obj_cnt;          /* count of monsters meeting criteria */
 E int x_maze_max, y_maze_max;
 E int otg_temp;
 
-#ifdef REDO
 E NEARDATA int in_doagain;
-#endif
 
 E struct dgn_topology {                /* special dungeon levels for speed */
     d_level    d_oracle_level;
index 836b64d5f6e38a77e11e9eded8370479f567499c..bfd3613260b1e851e3b1bc494d6a90b9ffc184d5 100644 (file)
@@ -182,11 +182,9 @@ E int NDECL(wiz_wish);
 #endif /* USE_TRAMPOLI */
 E void NDECL(reset_occupations);
 E void FDECL(set_occupation, (int (*)(void),const char *,int));
-#ifdef REDO
 E char NDECL(pgetchar);
 E void FDECL(pushch, (CHAR_P));
 E void FDECL(savech, (CHAR_P));
-#endif
 E void NDECL(add_debug_extended_commands);
 E void FDECL(reset_commands, (BOOLEAN_P));
 E void FDECL(rhack, (char *));
index 985066520e96a41e89f2ac2306fc3e5b2715551b..e3292e24356f211937c1eec0f9e4298d3b181532 100644 (file)
@@ -134,12 +134,6 @@ typedef char nhptext;
  */
 #define LARGEST_INT    32767
 
-
-#ifdef REDO
-#define Getchar pgetchar
-#endif
-
-
 #include "coord.h"
 /*
  * Automatic inclusions for the subsidiary files.
index 539833aed7af2e4a04834ea1b49b0a140faf6015..4ad1a6e739668cd217c9c64ee97639db4adc2c4d 100644 (file)
@@ -229,11 +229,6 @@ int  _RTLENTRY _EXPFUNC read  (int __handle, void _FAR *__buf, unsigned __len);
 #define ALLOCA_HACK    /* used in util/panic.c */
 #endif
 
-#ifndef REDO
-#undef Getchar
-#define Getchar nhgetch
-#endif
-
 extern int FDECL(set_win32_option, (const char *, const char *));
 #ifdef WIN32CON
 #define LEFTBUTTON  FROM_LEFT_1ST_BUTTON_PRESSED
index eeb4e53aac715e0fbc55cecdb6d68c3de687e29e..1c24c10fdc214c0fa37a93b90c216a52e81c214f 100644 (file)
 #define sethanguphandler(foo) (void)signal(SIGHUP, (SIG_RET_TYPE)foo)
 #endif
 
-#ifndef REDO
-# undef        Getchar
-# define Getchar nhgetch
-#endif
-
 void hangup(int i);
 #endif /* OS2CONF_H */
 #endif /* OS2 */
index 70a519c0087046639e2a8550ff62d4fb2108189e..77a496dace7c8bab0b51d7dccbed7c58b61a8ecb 100644 (file)
 
 #include <fcntl.h>
 
-#ifndef REDO
-# undef Getchar
-# define Getchar nhgetch
-#endif
-
 #ifdef MSDOS
 # define TEXTCOLOR /* */
 # define PORT_HELP "msdoshlp.txt" /* msdos port specific help file */
index 0ffa2e119b7e652a8209c57f1107986ce780968d..c85611c2a0a59b00a50d80ac2053de2d6d262129 100644 (file)
 
 #define HLOCK  "perm"  /* an empty file used for locking purposes */
 
-#ifndef REDO
-#define Getchar nhgetch
-#endif
 #define tgetch getchar
 
 #ifndef NOSHELL
index d675588e2923b9e5daad975188d728a95ad8495c..f3045bed7cf3ceffe824ba0e19fb657e378ff037 100644 (file)
@@ -234,9 +234,6 @@ typedef __mode_t mode_t;
 # define O_TRUNC 0x400
 #endif
 
-#ifndef REDO
-# define Getchar nhgetch
-#endif
 #define tgetch vms_getchar
 
 #include "system.h"
index 80833476831f5726cb2c13a5db29c9b45886ba9e..52ad4d1f187fe7f1b406930e44690e716140c406 100644 (file)
@@ -185,11 +185,6 @@ extern void NDECL(toggle_mouse_support);
 #define ALLOCA_HACK    /* used in util/panic.c */
 #endif
 
-#ifndef REDO
-#undef Getchar
-#define Getchar nhgetch
-#endif
-
 #ifdef _MSC_VER
 #if 0
 #pragma warning(disable:4018)  /* signed/unsigned mismatch */
index d56f11bda17da2ed761b2d279dd74ccf691b7326..2bb1c42401781d8e8222a5b517367a46723621d1 100644 (file)
@@ -246,11 +246,9 @@ boolean resuming;
                                if (!next_to_u()) {
                                    check_leash(old_ux, old_uy);
                                }
-#ifdef REDO
                                /* clear doagain keystrokes */
                                pushch(0);
                                savech(0);
-#endif
                            }
                        }
                        /* delayed change may not be valid anymore */
@@ -355,12 +353,10 @@ boolean resuming;
 #if defined(MICRO) || defined(WIN32)
            abort_lev = 0;
            if (kbhit()) {
-               if ((ch = Getchar()) == ABORT)
+               if ((ch = pgetchar()) == ABORT)
                    abort_lev++;
-# ifdef REDO
                else
                    pushch(ch);
-# endif /* REDO */
            }
            if (!abort_lev && (*occupation)() == 0)
 #else
@@ -439,10 +435,8 @@ stop_occupation()
                    You("stop %s.", occtxt);
                occupation = 0;
                context.botl = 1; /* in case u.uhs changed */
-#ifdef REDO
                nomul(0);
                pushch(0);
-#endif
        }
 }
 
index 1477eabdca70f9165dcb72b7e113717f7b526565..f7e858e01f1fe217b252fd4897bb502e788b32e6 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -236,7 +236,6 @@ int xtime;
        return;
 }
 
-#ifdef REDO
 
 STATIC_DCL char NDECL(popch);
 
@@ -298,7 +297,6 @@ char ch;
        }
        return;
 }
-#endif /* REDO */
 
 STATIC_PTR int
 doextcmd(VOID_ARGS)    /* here after # - now read a full-word command */
@@ -2950,7 +2948,6 @@ register char *cmd;
                context.move = FALSE;
                return;
        }
-#ifdef REDO
        if (*cmd == DOAGAIN && !in_doagain && saveq[0]) {
                in_doagain = TRUE;
                stail = 0;
@@ -2960,9 +2957,6 @@ register char *cmd;
        }
        /* Special case of *cmd == ' ' handled better below */
        if(!*cmd || *cmd == (char)0377)
-#else
-       if(!*cmd || *cmd == (char)0377 || (!flags.rest_on_space && *cmd == ' '))
-#endif
        {
                nhbell();
                context.move = FALSE;
@@ -3253,11 +3247,9 @@ const char *s;
        int is_mov;
 
  retry:
-#ifdef REDO
        if (in_doagain || *readchar_queue)
            dirsym = readchar();
        else
-#endif
            dirsym = yn_function((s && *s != '^') ? s : "In what direction?",
                                        (char *)0, '\0');
        /* remove the prompt string so caller won't have to */
@@ -3267,9 +3259,7 @@ const char *s;
            docrt();            /* redraw */
            goto retry;
        }
-#ifdef REDO
        savech(dirsym);
-#endif
 
        if (dirsym == '.' || dirsym == 's') {
            u.dx = u.dy = u.dz = 0;
@@ -3554,14 +3544,12 @@ parse()
        if (foo == '\033') {   /* esc cancels count (TH) */
            clear_nhwindow(WIN_MESSAGE);
            multi = last_multi = 0;
-# ifdef REDO
        } else if (foo == DOAGAIN || in_doagain) {
            multi = last_multi;
        } else {
            last_multi = multi;
            savech(0);  /* reset input queue */
            savech((char)foo);
-# endif
        }
 
        if (multi) {
@@ -3589,9 +3577,7 @@ parse()
        if (foo == 'g' || foo == 'G' || foo == 'm' || foo == 'M' ||
            foo == 'F' || (Cmd.num_pad && (foo == '5' || foo == '-'))) {
            foo = readchar();
-#ifdef REDO
            savech((char)foo);
-#endif
            in_line[1] = foo;
            in_line[2] = 0;
        }
@@ -3658,11 +3644,7 @@ readchar()
        if ( *readchar_queue )
            sym = *readchar_queue++;
        else
-#ifdef REDO
-           sym = in_doagain ? Getchar() : nh_poskey(&x, &y, &mod);
-#else
-           sym = Getchar();
-#endif
+           sym = in_doagain ? pgetchar() : nh_poskey(&x, &y, &mod);
 
 #ifdef NR_OF_EOFS
        if (sym == EOF) {
@@ -3674,7 +3656,7 @@ readchar()
           */
            do {
                clearerr(stdin);        /* omit if clearerr is undefined */
-               sym = Getchar();
+               sym = pgetchar();
            } while (--cnt && sym == EOF);
        }
 #endif /* NR_OF_EOFS */
@@ -3687,7 +3669,7 @@ readchar()
 #ifdef ALTMETA
        } else if (sym == '\033' && alt_esc) {
            /* iflags.altmeta: treat two character ``ESC c'' as single `M-c' */
-           sym = *readchar_queue ? *readchar_queue++ : Getchar();
+           sym = *readchar_queue ? *readchar_queue++ : pgetchar();
            if (sym == EOF || sym == 0)
                sym = '\033';
            else if (sym != '\033')
index 47043d0cdf7d2129d9f32b222ce6872ffd6ada57..f7601bda0f407032abb2e86469d554527dce9230 100644 (file)
@@ -31,9 +31,7 @@ int x_maze_max = (COLNO-1) & ~1,
 
 int otg_temp;                  /* used by object_to_glyph() [otg] */
 
-#ifdef REDO
 NEARDATA int in_doagain = 0;
-#endif
 
 /*
  *     The following structure will be initialized at startup time with
index 7a7a837342bcea47310aed587499cec82d01816e..e3cd202471d2e546de7f1c2c7179369e12af38f1 100644 (file)
@@ -928,11 +928,9 @@ register const char *let,*word;
                        Sprintf(qbuf, "What do you want to %s? [%s or ?*]",
                                word, buf);
                }
-#ifdef REDO
                if (in_doagain)
                    ilet = readchar();
                else
-#endif
                    ilet = yn_function(qbuf, (char *)0, '\0');
                if (digit(ilet) && !allowcnt) {
                    pline("No count allowed with this command.");
@@ -940,9 +938,7 @@ register const char *let,*word;
                }
                if (ilet == '0') prezero = TRUE;
                while (digit(ilet)) {
-#ifdef REDO
                    if (ilet != '?' && ilet != '*') savech(ilet);
-#endif
                    /* accumulate unless cnt has overflowed */
                    if (allowcnt < 3) {
                        prevcnt = cnt;
@@ -1018,23 +1014,17 @@ register const char *let,*word;
                    }
                }
                context.botl = 1; /* May have changed the amount of money */
-#ifdef REDO
                savech(ilet);
-#endif
                for (otmp = invent; otmp; otmp = otmp->nobj)
                        if (otmp->invlet == ilet) break;
                if(!otmp) {
                        You("don't have that object.");
-#ifdef REDO
                        if (in_doagain) return((struct obj *) 0);
-#endif
                        continue;
                } else if (cnt < 0 || otmp->quan < cnt) {
                        You("don't have that many!  You have only %ld.",
                            otmp->quan);
-#ifdef REDO
                        if (in_doagain) return((struct obj *) 0);
-#endif
                        continue;
                }
                break;
@@ -2102,9 +2092,7 @@ dotypeinv()
 
            if(class_count > 1) {
                c = yn_function(prompt, types, '\0');
-#ifdef REDO
                savech(c);
-#endif
                if(c == '\0') {
                        clear_nhwindow(WIN_MESSAGE);
                        return 0;
index 1021606359d94b2fa1def69af01332ea493134dd..4ae8892e951affe8342254b9f3d063c1df0c23df 100644 (file)
@@ -568,9 +568,7 @@ doclassdisco()
        }
        /* get the class (via its symbol character) */
        c = yn_function(prompt, discosyms, '\0');
-#ifdef REDO
        savech(c);
-#endif
        if (!c)
            clear_nhwindow(WIN_MESSAGE);
     } else {
index 0fc5ee8edd860b2c346558fd0a5b0cdef0220d29..16d36bbb7eee75162d4a727b34887c833d0312ca 100644 (file)
@@ -407,7 +407,7 @@ const char *str;
 #else
        msmsg("Hit <Enter> %s.", str);
 #endif
-       while (Getchar() != '\n') ;
+       while (pgetchar() != '\n') ;
        return;
 }
 
index c61b561d1c5cafcc1f544eb0a50ca212f4737bbd..9ea0d38982e3f3ac62deffe56fa61a0c34228089 100644 (file)
@@ -1261,9 +1261,6 @@ static const char *build_opts[] = {
 #  endif
 # endif
 #endif
-#ifdef REDO
-               "redo command",
-#endif
 #ifdef SELECTSAVED
                "restore saved games via menu",
 #endif
index 6dfa10a6eeb7c65a78a54fab2ce92072b698cf7a..2dd90ae3fb507a41b70bcc7f1704f95302b52b31 100644 (file)
@@ -82,7 +82,7 @@ getlin_hook_proc hook;
 #else
                Strcat(strcat(strcpy(toplines, query), " "), obufp);
 #endif
-               c = Getchar();
+               c = pgetchar();
                if (c == '\033' || c == EOF) {
                    obufp[0] = '\033';
                    obufp[1] = '\0';
@@ -271,26 +271,20 @@ tty_get_ext_cmd()
        if (iflags.extmenu) return extcmd_via_menu();
        /* maybe a runtime option? */
        /* hooked_tty_getlin("#", buf, flags.cmd_comp ? ext_cmd_getlin_hook : (getlin_hook_proc) 0); */
-#ifdef REDO
        hooked_tty_getlin("#", buf, in_doagain ? (getlin_hook_proc)0
                : ext_cmd_getlin_hook);
-#else
-       hooked_tty_getlin("#", buf, ext_cmd_getlin_hook);
-#endif
        (void) mungspaces(buf);
        if (buf[0] == 0 || buf[0] == '\033') return -1;
 
        for (i = 0; extcmdlist[i].ef_txt != (char *)0; i++)
                if (!strcmpi(buf, extcmdlist[i].ef_txt)) break;
 
-#ifdef REDO
        if (!in_doagain) {
            int j;
            for (j = 0; buf[j]; j++)
                savech(buf[j]);
            savech('\n');
        }
-#endif
 
        if (extcmdlist[i].ef_txt == (char *)0) {
                pline("%s: unknown extended command.", buf);