Merge branch 'NetHack-3.6' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6

This commit is contained in:
Bart House
2019-05-28 20:19:33 -07:00
10 changed files with 93 additions and 92 deletions

View File

@@ -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.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
@@ -57,6 +59,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

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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.

View File

@@ -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 <Enter> %s.", str);
raw_print(buf);
wait_synch();
in_getreturn = FALSE;
return;
}

View File

@@ -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);
}
@@ -582,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) {
@@ -608,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 */
@@ -705,10 +715,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);

View File

@@ -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"

View File

@@ -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"

View File

@@ -181,10 +181,10 @@
<ClCompile Include="$(WinWin32Dir)mhstatus.c" />
<ClCompile Include="$(WinWin32Dir)mhtext.c" />
<ClCompile Include="$(WinWin32Dir)mswproc.c" />
<ClCompile Include="$(WinWin32Dir)winhack.c" />
<ClCompile Include="$(WinWin32Dir)NetHackW.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="$(WinWin32Dir)winhack.rc" />
<ResourceCompile Include="$(WinWin32Dir)NetHackW.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(WinWin32Dir)mhaskyn.h" />
@@ -212,4 +212,4 @@
<Target Name="AfterRebuild">
<MSBuild Projects="afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
</Target>
</Project>
</Project>