From: Sean Hunt Date: Sat, 28 Feb 2015 00:24:28 +0000 (-0500) Subject: Make REDO unconditional. X-Git-Tag: NetHack-3.6.0_RC01~658 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0001534d040b793eb79af669d308f7543c562b20;p=nethack Make REDO unconditional. --- diff --git a/include/config.h b/include/config.h index db5070a3a..5cf035b54 100644 --- a/include/config.h +++ b/include/config.h @@ -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) */ diff --git a/include/decl.h b/include/decl.h index 4733b5317..92f1e8240 100644 --- a/include/decl.h +++ b/include/decl.h @@ -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; diff --git a/include/extern.h b/include/extern.h index 836b64d5f..bfd361326 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 *)); diff --git a/include/global.h b/include/global.h index 985066520..e3292e243 100644 --- a/include/global.h +++ b/include/global.h @@ -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. diff --git a/include/ntconf.h b/include/ntconf.h index 539833aed..4ad1a6e73 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -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 diff --git a/include/os2conf.h b/include/os2conf.h index eeb4e53aa..1c24c10fd 100644 --- a/include/os2conf.h +++ b/include/os2conf.h @@ -100,11 +100,6 @@ #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 */ diff --git a/include/pcconf.h b/include/pcconf.h index 70a519c00..77a496dac 100644 --- a/include/pcconf.h +++ b/include/pcconf.h @@ -249,11 +249,6 @@ #include -#ifndef REDO -# undef Getchar -# define Getchar nhgetch -#endif - #ifdef MSDOS # define TEXTCOLOR /* */ # define PORT_HELP "msdoshlp.txt" /* msdos port specific help file */ diff --git a/include/unixconf.h b/include/unixconf.h index 0ffa2e119..c85611c2a 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -281,9 +281,6 @@ #define HLOCK "perm" /* an empty file used for locking purposes */ -#ifndef REDO -#define Getchar nhgetch -#endif #define tgetch getchar #ifndef NOSHELL diff --git a/include/vmsconf.h b/include/vmsconf.h index d675588e2..f3045bed7 100644 --- a/include/vmsconf.h +++ b/include/vmsconf.h @@ -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" diff --git a/include/wceconf.h b/include/wceconf.h index 808334768..52ad4d1f1 100644 --- a/include/wceconf.h +++ b/include/wceconf.h @@ -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 */ diff --git a/src/allmain.c b/src/allmain.c index d56f11bda..2bb1c4240 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -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 } } diff --git a/src/cmd.c b/src/cmd.c index 1477eabdc..f7e858e01 100644 --- 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') diff --git a/src/decl.c b/src/decl.c index 47043d0cd..f7601bda0 100644 --- a/src/decl.c +++ b/src/decl.c @@ -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 diff --git a/src/invent.c b/src/invent.c index 7a7a83734..e3cd20247 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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; diff --git a/src/o_init.c b/src/o_init.c index 102160635..4ae8892e9 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -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 { diff --git a/sys/share/pcsys.c b/sys/share/pcsys.c index 0fc5ee8ed..16d36bbb7 100644 --- a/sys/share/pcsys.c +++ b/sys/share/pcsys.c @@ -407,7 +407,7 @@ const char *str; #else msmsg("Hit %s.", str); #endif - while (Getchar() != '\n') ; + while (pgetchar() != '\n') ; return; } diff --git a/util/makedefs.c b/util/makedefs.c index c61b561d1..9ea0d3898 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -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 diff --git a/win/tty/getline.c b/win/tty/getline.c index 6dfa10a6e..2dd90ae3f 100644 --- a/win/tty/getline.c +++ b/win/tty/getline.c @@ -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);