Make REDO unconditional.

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