From 09412274e6c52934df0ad94ae5a8463ed37929a7 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 27 May 2019 17:38:54 -0400 Subject: [PATCH 1/6] Windows .rc files bump the version in the win/win32/*.rc files side note: winhack.rc wasn't properly updated for the 3.6.2 release --- win/win32/nethack.rc | 10 +++++----- win/win32/winhack.rc | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/win/win32/nethack.rc b/win/win32/nethack.rc index 4330f14f1..c7ee38399 100644 --- a/win/win32/nethack.rc +++ b/win/win32/nethack.rc @@ -60,8 +60,8 @@ IDI_ICON1 ICON "nethack.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,6,2,0 - PRODUCTVERSION 3,6,2,0 + FILEVERSION 3,6,3,0 + PRODUCTVERSION 3,6,3,0 FILEFLAGSMASK 0x1fL #ifdef _DEBUG FILEFLAGS 0x9L @@ -77,12 +77,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "NetHack for Windows - TTY Interface" - VALUE "FileVersion", "3.6.2" + VALUE "FileVersion", "3.6.3" VALUE "InternalName", "NetHack" - VALUE "LegalCopyright", "Copyright (C) 1985 - 2018. By Stichting Mathematisch Centrum and M. Stephenson. See license for details." + VALUE "LegalCopyright", "Copyright (C) 1985 - 2019. By Stichting Mathematisch Centrum and M. Stephenson. See license for details." VALUE "OriginalFilename", "NetHack.exe" VALUE "ProductName", "NetHack" - VALUE "ProductVersion", "3.6.2" + VALUE "ProductVersion", "3.6.3" END END BLOCK "VarFileInfo" diff --git a/win/win32/winhack.rc b/win/win32/winhack.rc index aa8c23e9a..1ac42d05d 100644 --- a/win/win32/winhack.rc +++ b/win/win32/winhack.rc @@ -320,8 +320,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,6,1,0 - PRODUCTVERSION 3,6,1,0 + FILEVERSION 3,6,3,0 + PRODUCTVERSION 3,6,3,0 FILEFLAGSMASK 0x1fL #ifdef _DEBUG FILEFLAGS 0x9L @@ -337,13 +337,13 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "NetHack for Windows - Graphical Interface" - VALUE "FileVersion", "3.6.1" + VALUE "FileVersion", "3.6.3" VALUE "InternalName", "NetHackW" - VALUE "LegalCopyright", "Copyright (C) 1985 - 2018. By Stichting Mathematisch Centrum and M. Stephenson. See license for details." + VALUE "LegalCopyright", "Copyright (C) 1985 - 2019. By Stichting Mathematisch Centrum and M. Stephenson. See license for details." VALUE "OriginalFilename", "NetHackW.exe" VALUE "PrivateBuild", "140606" VALUE "ProductName", "NetHack" - VALUE "ProductVersion", "3.6.1" + VALUE "ProductVersion", "3.6.3" END END BLOCK "VarFileInfo" From 6f71f483d2ab2a23ddaeac15c65d56dbf0e6a0e6 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 27 May 2019 18:42:25 -0400 Subject: [PATCH 2/6] make the rc file match the build target name for Windows --- sys/winnt/Makefile.msc | 14 +++++++------- win/win32/{winhack.c => NetHackW.c} | 0 win/win32/{winhack.rc => NetHackW.rc} | 0 win/win32/vs2017/NetHackW.vcxproj | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) rename win/win32/{winhack.c => NetHackW.c} (100%) rename win/win32/{winhack.rc => NetHackW.rc} (100%) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 38502bfd4..355fe9791 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -265,7 +265,7 @@ OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \ GUIOBJ = $(O)mhaskyn.o $(O)mhdlg.o \ $(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \ $(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o $(O)mhsplash.o \ - $(O)mhstatus.o $(O)mhtext.o $(O)mswproc.o $(O)winhack.o + $(O)mhstatus.o $(O)mhtext.o $(O)mswproc.o $(O)NetHackW.o GUIHDR = $(MSWIN)\mhaskyn.h $(MSWIN)\mhdlg.h $(MSWIN)\mhfont.h \ $(MSWIN)\mhinput.h $(MSWIN)\mhmain.h $(MSWIN)\mhmap.h $(MSWIN)\mhmenu.h \ @@ -748,11 +748,11 @@ $(O)utility.tag: $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \ tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe @echo Optional tile development utilities are up to date. -$(O)winhack.res: $(TILEBMP16) $(MSWIN)\winhack.rc $(MSWIN)\mnsel.bmp \ +$(O)NetHackW.res: $(TILEBMP16) $(MSWIN)\NetHackW.rc $(MSWIN)\mnsel.bmp \ $(MSWIN)\mnselcnt.bmp $(MSWIN)\mnunsel.bmp \ $(MSWIN)\petmark.bmp $(MSWIN)\pilemark.bmp $(MSWIN)\NetHack.ico $(MSWIN)\rip.bmp \ $(MSWIN)\splash.bmp - @$(rc) -r -fo$@ -i$(MSWIN) -dNDEBUG $(MSWIN)\winhack.rc + @$(rc) -r -fo$@ -i$(MSWIN) -dNDEBUG $(MSWIN)\NetHackW.rc $(O)console.res: $(MSWSYS)\console.rc $(MSWSYS)\NetHack.ico @$(rc) -r -fo$@ -i$(MSWSYS) -dNDEBUG $(MSWSYS)\console.rc @@ -826,7 +826,7 @@ $(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)gu # objs: $(GAMEOBJ) $(GUIOBJ) $(O)tile.o $(O)ttystub.o $(GAMEDIR)\NetHackW.exe : $(O)gamedir.tag $(O)tile.o $(O)ttystub.o \ - $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)winhack.res $(O)gamedir.tag $(KEYDLLS) + $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)NetHackW.res $(O)gamedir.tag $(KEYDLLS) @if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR) @echo Linking $(@:\=/) $(link) $(lflagsBuild) $(guilflags) /STACK:2048 /PDB:$(GAMEDIR)\$(@B).PDB \ @@ -835,7 +835,7 @@ $(GAMEDIR)\NetHackW.exe : $(O)gamedir.tag $(O)tile.o $(O)ttystub.o \ $(GUIOBJ) $(O)tile.o $(O)ttystub.o - $(O)winhack.res + $(O)NetHackW.res << @if exist $(O)install.tag del $(O)install.tag @@ -1468,8 +1468,8 @@ $(O)guistub.o: $(HACK_H) $(MSWSYS)\stubs.c # WIN32 dependencies # -$(O)winhack.o: $(HACK_H) $(MSWIN)\winhack.c - @$(cc) $(cflagsBuild) -I$(MSWSYS) -I$(MSWIN) -Fo$@ $(MSWIN)\winhack.c +$(O)NetHackW.o: $(HACK_H) $(MSWIN)\NetHackW.c + @$(cc) $(cflagsBuild) -I$(MSWSYS) -I$(MSWIN) -Fo$@ $(MSWIN)\NetHackW.c #if you aren't linking in the full tty then #include the following stub for proper linkage. diff --git a/win/win32/winhack.c b/win/win32/NetHackW.c similarity index 100% rename from win/win32/winhack.c rename to win/win32/NetHackW.c diff --git a/win/win32/winhack.rc b/win/win32/NetHackW.rc similarity index 100% rename from win/win32/winhack.rc rename to win/win32/NetHackW.rc diff --git a/win/win32/vs2017/NetHackW.vcxproj b/win/win32/vs2017/NetHackW.vcxproj index c18c49578..793158e01 100644 --- a/win/win32/vs2017/NetHackW.vcxproj +++ b/win/win32/vs2017/NetHackW.vcxproj @@ -181,10 +181,10 @@ - + - + @@ -212,4 +212,4 @@ - \ No newline at end of file + From c61d3d64038e3d3a88514c451e7c325cd8d80e0f Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 28 May 2019 01:52:37 -0700 Subject: [PATCH 3/6] curses message window Fix a 'FIXME': don't follow a message with two spaces in anticipation of combining with the next one, precede the next one with two spaces when they're being combined. Keeps nethack's message window coordinates in sync with curses' internal coordinates. --- win/curses/cursmesg.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 13c3109ba..e006bd76f 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -96,12 +96,15 @@ curses_message_win_puts(const char *message, boolean recursed) mesg_add_line(message); } - linespace = width - 3 - (mx - border_space); + /* -2: room for trailing ">>" (if More>> is needed) or leading " " + (if combining this message with preceding one) */ + linespace = (width - 1) - 2 - (mx - border_space); if (linespace < message_length) { if (my - border_space >= height - 1) { /* bottom of message win */ - if (++turn_lines >= height) { /* || height == 1) */ + if (++turn_lines > height + || (turn_lines == height && mx > border_space)) { /* Pause until key is hit - Esc suppresses any further messages that turn */ if (curses_more() == '\033') { @@ -119,6 +122,13 @@ curses_message_win_puts(const char *message, boolean recursed) ++turn_lines; } } + } else { /* don't need to move to next line */ + /* if we aren't at the start of the line, we're combining multiple + messages on one line; use 2-space separation */ + if (mx > border_space) { + waddstr(win, " "); + mx += 2; + } } bold = (height > 1 && !last_messages); @@ -142,14 +152,6 @@ curses_message_win_puts(const char *message, boolean recursed) free(tmpstr); } else { mvwprintw(win, my, mx, "%s", message), mx += message_length; - /* two spaces to separate this message from next one if they happen - to fit on the same line; (FIXME: it would be better if this was - done at start of next message rather than end of this one since - it impacts placement of "More>>") */ - if (mx < width - 2) { - if (++mx < width - 2) - ++mx; - } if (bold) curses_toggle_color_attr(win, NONE, A_BOLD, OFF); } @@ -705,10 +707,7 @@ directional_scroll(winid wid, int nlines) wscrl(win, nlines); scrollok(win, FALSE); if (wid == MESSAGE_WIN) { - if (border) - mx = 1; - else - mx = 0; + mx = border ? 1 : 0; } if (border) { box(win, 0, 0); From f478b4ec9578a73df309da65fb3b93df3670ddd7 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 28 May 2019 02:27:40 -0700 Subject: [PATCH 4/6] curses getline() After going back and forth between prompts causing message lines to be overwritten and to be skipped, this yoyo might have finally run out of string. Fingers crossed.... --- doc/fixes36.3 | 4 +++- win/curses/cursmesg.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index ba04dc4d3..05ed99bd2 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.24 $ $NHDT-Date: 1558921075 2019/05/27 01:37:55 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.25 $ $NHDT-Date: 1559035655 2019/05/28 09:27:35 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -57,6 +57,8 @@ curses: when display windows get reconfigured (after setting align_status, when feasible it combines short lines, resulting in N messages on fewer than N lines and leaving some of the available lines blank.] curses: plug memory leak when getting a line of input is cancelled by ESC +curses: after requesting a line of input from player, next line of message + window could end up being skipped tty: re-do one optimization used when status conditions have all been removed and remove another that tried to check whether condition text to be displayed next was the same as the existing value; sometimes new diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index e006bd76f..d752223fa 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -584,6 +584,9 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) #endif curs_set(0); switch (ch) { + case ERR: /* should not happen */ + *answer = '\0'; + goto alldone; case '\033': /* DOESCAPE */ /* if there isn't any input yet, return ESC */ if (len == 0) { @@ -610,20 +613,25 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) *p_answer = '\0'; len = 0; break; - case ERR: /* should not happen */ - *answer = '\0'; - goto alldone; case '\r': case '\n': (void) strncpy(answer, p_answer, buffer); answer[buffer - 1] = '\0'; Strcpy(toplines, tmpbuf); mesg_add_line(tmpbuf); +#if 1 + /* position at end of current line so next message will be + written on next line regardless of whether it could fit here */ + mx = border_space ? (width + 1) : (width - 1); + wmove(win, my, mx); +#else /* after various other changes, this resulted in getline() + * prompt+answer being following by a blank message line */ if (++my > maxy) { scroll_window(MESSAGE_WIN); my--; } mx = border_space; +#endif /*0*/ goto alldone; case '\177': /* DEL/Rubout */ case KEY_DC: /* delete-character */ From f476638ee02b4205e2fee5a3b71807e59c667c87 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 28 May 2019 17:08:48 -0700 Subject: [PATCH 5/6] wizard mode memory leak in endgame Leaving the Plane of Water to return to a previously visited endgame level didn't free the air bubbles unless/until you visit a new level. Returning to that level creates a new set of air bubbles, losing track of the previous set. Likewise with Plane of Air and its clouds. (Not an issue with actual save and restore when on those levels, or when just moving forward to not-yet-visited levels.) Not applicable to normal play where it isn't possible to return to a previously visited endgame level. For 3.7, bubble save/restore ought to become part of savlev() instead of being handled by savegamestate(). --- doc/fixes36.3 | 4 +++- src/do.c | 13 ++++++++++++- src/mkmaze.c | 42 +++++++++++++++++------------------------- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 05ed99bd2..7f7371c8a 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.25 $ $NHDT-Date: 1559035655 2019/05/28 09:27:35 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.26 $ $NHDT-Date: 1559088523 2019/05/29 00:08:43 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -30,6 +30,8 @@ free ball and chain if Punished hero dies while descending stairs or dies or quits while swallowed; put ball and chain in bones for the stairs case if hero dies while a thrown or kicked object is in transit, put that object on the map in case bones data gets saved +fix a memory leak that occurred if player used wizard mode to leave and return + to the Plane of Air or Plane of Water (not possible in normal play) Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/do.c b/src/do.c index 20aadf751..9c887c037 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1548978604 2019/01/31 23:50:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.189 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1559088523 2019/05/29 00:08:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.190 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1365,6 +1365,16 @@ boolean at_stairs, falling, portal; } savelev(fd, ledger_no(&u.uz), cant_go_back ? FREE_SAVE : (WRITE_SAVE | FREE_SAVE)); + /* air bubbles and clouds are saved in game-state rather than with the + level they're used on; in normal play, you can't leave and return + to any endgame level--bubbles aren't needed once you move to the + next level so used to be discarded when the next special level was + loaded; but in wizard mode you can leave and return, and since they + aren't saved with the level and restored upon return (new ones are + created instead), we need to discard them to avoid a memory leak; + so bubbles are now discarded as we leave the level they're used on */ + if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) + save_waterlevel(fd, FREE_SAVE); /* note: doesn't use 'fd' */ bclose(fd); if (cant_go_back) { /* discard unreachable levels; keep #0 */ @@ -1428,6 +1438,7 @@ boolean at_stairs, falling, portal; oinit(); /* reassign level dependent obj probabilities */ } reglyph_darkroom(); + u.uinwater = 0; /* do this prior to level-change pline messages */ vision_reset(); /* clear old level's line-of-sight */ vision_full_recalc = 0; /* don't let that reenable vision yet */ diff --git a/src/mkmaze.c b/src/mkmaze.c index 2a8dc226c..7bea6485e 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkmaze.c $NHDT-Date: 1558562368 2019/05/22 21:59:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.70 $ */ +/* NetHack 3.6 mkmaze.c $NHDT-Date: 1559088524 2019/05/29 00:08:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.71 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -460,8 +460,6 @@ baalz_fixup() bughack.inarea.y2 = bughack.delarea.y2 = 0; } -static boolean was_waterlevel; /* ugh... this shouldn't be needed */ - /* this is special stuff that the level compiler cannot (yet) handle */ void fixup_special() @@ -472,14 +470,8 @@ fixup_special() struct mkroom *croom; boolean added_branch = FALSE; - if (was_waterlevel) { - was_waterlevel = FALSE; - u.uinwater = 0; - unsetup_waterlevel(); - } if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) { level.flags.hero_memory = 0; - was_waterlevel = TRUE; /* water level is an odd beast - it has to be set up before calling place_lregions etc. */ setup_waterlevel(); @@ -497,6 +489,7 @@ fixup_special() lev.dlevel = atoi(r->rname.str); } else { s_level *sp = find_level(r->rname.str); + lev = sp->dlevel; } /*FALLTHRU*/ @@ -1574,13 +1567,13 @@ int fd, mode; int n = 0; for (b = bbubbles; b; b = b->next) ++n; - bwrite(fd, (genericptr_t) &n, sizeof(int)); - bwrite(fd, (genericptr_t) &xmin, sizeof(int)); - bwrite(fd, (genericptr_t) &ymin, sizeof(int)); - bwrite(fd, (genericptr_t) &xmax, sizeof(int)); - bwrite(fd, (genericptr_t) &ymax, sizeof(int)); + bwrite(fd, (genericptr_t) &n, sizeof n); + bwrite(fd, (genericptr_t) &xmin, sizeof xmin); + bwrite(fd, (genericptr_t) &ymin, sizeof ymin); + bwrite(fd, (genericptr_t) &xmax, sizeof xmax); + bwrite(fd, (genericptr_t) &ymax, sizeof ymax); for (b = bbubbles; b; b = b->next) - bwrite(fd, (genericptr_t) b, sizeof(struct bubble)); + bwrite(fd, (genericptr_t) b, sizeof *b); } if (release_data(mode)) unsetup_waterlevel(); @@ -1597,15 +1590,15 @@ int fd; return; set_wportal(); - mread(fd, (genericptr_t) &n, sizeof(int)); - mread(fd, (genericptr_t) &xmin, sizeof(int)); - mread(fd, (genericptr_t) &ymin, sizeof(int)); - mread(fd, (genericptr_t) &xmax, sizeof(int)); - mread(fd, (genericptr_t) &ymax, sizeof(int)); + mread(fd, (genericptr_t) &n, sizeof n); + mread(fd, (genericptr_t) &xmin, sizeof xmin); + mread(fd, (genericptr_t) &ymin, sizeof ymin); + mread(fd, (genericptr_t) &xmax, sizeof xmax); + mread(fd, (genericptr_t) &ymax, sizeof ymax); for (i = 0; i < n; i++) { btmp = b; - b = (struct bubble *) alloc(sizeof(struct bubble)); - mread(fd, (genericptr_t) b, sizeof(struct bubble)); + b = (struct bubble *) alloc(sizeof *b); + mread(fd, (genericptr_t) b, sizeof *b); if (bbubbles) { btmp->next = b; b->prev = btmp; @@ -1617,7 +1610,6 @@ int fd; } ebubbles = b; b->next = (struct bubble *) 0; - was_waterlevel = TRUE; } const char * @@ -1740,7 +1732,7 @@ int x, y, n; if (bmask[n][1] > MAX_BMASK) { panic("bmask size is larger than MAX_BMASK"); } - b = (struct bubble *) alloc(sizeof(struct bubble)); + b = (struct bubble *) alloc(sizeof *b); if ((x + (int) bmask[n][0] - 1) > bxmax) x = bxmax - bmask[n][0] + 1; if ((y + (int) bmask[n][1] - 1) > bymax) @@ -1751,7 +1743,7 @@ int x, y, n; b->dy = 1 - rn2(3); /* y dimension is the length of bitmap data - see bmask above */ (void) memcpy((genericptr_t) b->bm, (genericptr_t) bmask[n], - (bmask[n][1] + 2) * sizeof(b->bm[0])); + (bmask[n][1] + 2) * sizeof (b->bm[0])); b->cons = 0; if (!bbubbles) bbubbles = b; From b51c0ebb6f09d3bd48d242a9cb5eb96c099728fd Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 28 May 2019 21:24:04 -0400 Subject: [PATCH 6/6] clean up Windows panic results further --- sys/winnt/winnt.c | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index d583253b5..f6a9aa791 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -54,6 +54,7 @@ static HWND GetConsoleHwnd(void); extern void NDECL(backsp); #endif int NDECL(windows_console_custom_nhgetch); +extern void NDECL(safe_routines); /* The function pointer nt_kbhit contains a kbhit() equivalent * which varies depending on which window port is active. @@ -251,35 +252,18 @@ Delay(int ms) void win32_abort() { - boolean is_tty = FALSE; + int c; -#ifdef TTY_GRAPHICS - is_tty = WINDOWPORT("tty"); -#endif + if (WINDOWPORT("mswin") || WINDOWPORT("tty")) { + if (iflags.window_inited) + exit_nhwindows((char *) 0); + iflags.window_inited = FALSE; + } + if (!WINDOWPORT("mswin") && !WINDOWPORT("safe-startup")) + safe_routines(); if (wizard) { - int c, ci, ct; - - if (!iflags.window_inited) - c = 'n'; - ct = 0; - msmsg("Execute debug breakpoint wizard?"); - while ((ci = nhgetch()) != '\n') { - if (ct > 0) { - if (is_tty) - backsp(); /* \b is visible on NT console */ - (void) putchar(' '); - if (is_tty) - backsp(); - ct = 0; - c = 'n'; - } - if (ci == 'y' || ci == 'n' || ci == 'Y' || ci == 'N') { - ct = 1; - c = ci; - msmsg("%c", c); - } - } - if (c == 'y') + raw_print("Execute debug breakpoint wizard?"); + if ((c = nhgetch()) == 'y' || c == 'Y') DebugBreak(); } abort(); @@ -540,13 +524,16 @@ void getreturn(str) const char *str; { + static boolean in_getreturn = FALSE; char buf[BUFSZ]; - if (!getreturn_enabled) + if (in_getreturn || !getreturn_enabled) return; + in_getreturn = TRUE; Sprintf(buf,"Hit %s.", str); raw_print(buf); wait_synch(); + in_getreturn = FALSE; return; }