Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-03-12 21:18:46 -04:00
13 changed files with 171 additions and 101 deletions
+6 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.270 $ $NHDT-Date: 1551920371 2019/03/07 00:59:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.273 $ $NHDT-Date: 1552425075 2019/03/12 21:11:15 $
This fixes36.2 file is here to capture information about updates in the 3.6.x This fixes36.2 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.1 in April 2018. Please note, however, lineage following the release of 3.6.1 in April 2018. Please note, however,
@@ -477,6 +477,7 @@ curses: if the interface code ran out of memory, it would crash rather than
curses: when getting multi-character responses from player, support <delete> curses: when getting multi-character responses from player, support <delete>
as well as <backspace> to remove last character entered; also, return as well as <backspace> to remove last character entered; also, return
<escape> to core if ESC is typed when there is no input entered <escape> to core if ESC is typed when there is no input entered
curses: extend preceding <delete> support to typing of extended command names
vms: add compile of isaac64.c to Makefile.src and vmsbuild.com vms: add compile of isaac64.c to Makefile.src and vmsbuild.com
@@ -516,6 +517,8 @@ unix: Makefile.src and Makefile.utl inadvertently relied on a 'gnu make'
specifically requested; use 'make QUIETCC=1 <target>' to get the specifically requested; use 'make QUIETCC=1 <target>' to get the
3.6.1 behavior back 3.6.1 behavior back
unix: add curses window port unix: add curses window port
unix: in nethack.sh, use 'test -f' instead of 'test -e' when checking for
fonts.dir while running under X11
vms: data file processing and playground setup were missing post-3.4.3 files vms: data file processing and playground setup were missing post-3.4.3 files
engrave, epitaph, and bogusmon made from corresponding *.txt engrave, epitaph, and bogusmon made from corresponding *.txt
windows: Added ntassert() mechanism for Windows based port use windows: Added ntassert() mechanism for Windows based port use
@@ -565,6 +568,8 @@ X11: text popups on OSX wouldn't accept keyboard input unless the 'autofocus'
resource was enabled; most noticeable when trying to dismiss 'things resource was enabled; most noticeable when trying to dismiss 'things
that are here' while walking over object piles that are here' while walking over object piles
X11: default to using XPM format tile file and rip screen X11: default to using XPM format tile file and rip screen
X11: when showing graphical tombstone, would crash if file rip.xpm is missing;
revert to text tombstone instead
General New Features General New Features
+2
View File
@@ -98,6 +98,8 @@ extern void FDECL(interject, (int));
#ifdef strcasecmp #ifdef strcasecmp
#undef strcasecmp #undef strcasecmp
#endif #endif
extern void FDECL(nethack_exit, (int));
extern void NDECL(getlock);
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
+1 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 unixconf.h $NHDT-Date: 1552007506 2019/03/08 01:11:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.40 $ */ /* NetHack 3.6 unixconf.h $NHDT-Date: 1552074505 2019/03/08 19:48:25 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.41 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */ /*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -274,8 +274,6 @@
/* Digital Unix/HP Tru64 -- see vmsconf.h for explanation */ /* Digital Unix/HP Tru64 -- see vmsconf.h for explanation */
#if defined(__DECC) && (!defined(__STDC__) || !__STDC__) #if defined(__DECC) && (!defined(__STDC__) || !__STDC__)
#define UCHAR_P unsigned int #define UCHAR_P unsigned int
#else
#define UCHAR_P int
#endif #endif
/* /*
+4 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 vmsconf.h $NHDT-Date: 1552007507 2019/03/08 01:11:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.28 $ */ /* NetHack 3.6 vmsconf.h $NHDT-Date: 1552074506 2019/03/08 19:48:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.29 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -192,6 +192,8 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then
#endif #endif
#endif #endif
/* tradstdc.h has't set this up yet, but config1.h might have */
#ifndef UNWIDENED_PROTOTYPES
/* ANSI C uses "value preserving rules", where 'unsigned char' and /* ANSI C uses "value preserving rules", where 'unsigned char' and
'unsigned short' promote to 'int' if signed int is big enough to hold 'unsigned short' promote to 'int' if signed int is big enough to hold
all possible values, rather than traditional "sign preserving rules" all possible values, rather than traditional "sign preserving rules"
@@ -203,8 +205,7 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then
default 'relaxed' mode, __STDC__ is 1 and uchar widens to 'int'.) */ default 'relaxed' mode, __STDC__ is 1 and uchar widens to 'int'.) */
#if defined(__DECC) && (!defined(__STDC__) || !__STDC__) #if defined(__DECC) && (!defined(__STDC__) || !__STDC__)
#define UCHAR_P unsigned int #define UCHAR_P unsigned int
#else #endif
#define UCHAR_P int
#endif #endif
#ifdef __DECC #ifdef __DECC
+35 -18
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 version.c $NHDT-Date: 1546137502 2018/12/30 02:38:22 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.51 $ */ /* NetHack 3.6 version.c $NHDT-Date: 1552353060 2019/03/12 01:11:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.52 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2018. */ /*-Copyright (c) Michael Allison, 2018. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -17,10 +17,10 @@
#endif #endif
#if defined(NETHACK_GIT_SHA) #if defined(NETHACK_GIT_SHA)
const char * NetHack_git_sha = NETHACK_GIT_SHA; const char *NetHack_git_sha = NETHACK_GIT_SHA;
#endif #endif
#if defined(NETHACK_GIT_BRANCH) #if defined(NETHACK_GIT_BRANCH)
const char * NetHack_git_branch = NETHACK_GIT_BRANCH; const char *NetHack_git_branch = NETHACK_GIT_BRANCH;
#endif #endif
STATIC_DCL void FDECL(insert_rtoption, (char *)); STATIC_DCL void FDECL(insert_rtoption, (char *));
@@ -38,24 +38,21 @@ char *
getversionstring(buf) getversionstring(buf)
char *buf; char *buf;
{ {
boolean details = FALSE;
Strcpy(buf, VERSION_ID); Strcpy(buf, VERSION_ID);
#if defined(RUNTIME_PORT_ID) || \
defined(NETHACK_GIT_SHA) || defined(NETHACK_GIT_BRANCH)
details = TRUE;
#endif
if (details) { #if defined(RUNTIME_PORT_ID) \
#if defined(RUNTIME_PORT_ID) || defined(NETHACK_GIT_SHA) || defined(NETHACK_GIT_BRANCH) || defined(NETHACK_GIT_SHA) || defined(NETHACK_GIT_BRANCH)
{
int c = 0; int c = 0;
#endif
#if defined(RUNTIME_PORT_ID) #if defined(RUNTIME_PORT_ID)
char tmpbuf[BUFSZ]; char tmpbuf[BUFSZ], *tmp;
char *tmp = (char *)0;
#endif #endif
char *p = eos(buf);
boolean dotoff = (p > buf && p[-1] == '.');
Sprintf(eos(buf), " ("); if (dotoff)
--p;
Strcpy(p, " (");
#if defined(RUNTIME_PORT_ID) #if defined(RUNTIME_PORT_ID)
tmp = get_port_id(tmpbuf); tmp = get_port_id(tmpbuf);
if (tmp) if (tmp)
@@ -72,8 +69,15 @@ char *buf;
c++ ? "," : "", NetHack_git_branch); c++ ? "," : "", NetHack_git_branch);
#endif #endif
#endif #endif
Sprintf(eos(buf), ")"); if (c)
Strcat(buf, ")");
else /* if nothing has been added, strip " (" back off */
*p = '\0';
if (dotoff)
Strcat(buf, ".");
} }
#endif /* RUNTIME_PORT_ID || NETHACK_GIT_SHA || NETHACK_GIT_BRANCH */
return buf; return buf;
} }
@@ -92,12 +96,25 @@ int
doextversion() doextversion()
{ {
dlb *f; dlb *f;
char buf[BUFSZ]; char buf[BUFSZ], *p = 0;
winid win = create_nhwindow(NHW_TEXT); winid win = create_nhwindow(NHW_TEXT);
/* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle /* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle
the file manually so we can include dynamic version info */ the file manually so we can include dynamic version info */
putstr(win, 0, getversionstring(buf));
(void) getversionstring(buf);
/* if extra text (git info) is present, put it on separate line */
if (strlen(buf) >= COLNO)
p = rindex(buf, '(');
if (p && p > buf && p[-1] == ' ')
p[-1] = '\0';
else
p = 0;
putstr(win, 0, buf);
if (p) {
*--p = ' ';
putstr(win, 0, p);
}
f = dlb_fopen(OPTIONS_USED, "r"); f = dlb_fopen(OPTIONS_USED, "r");
if (!f) { if (!f) {
+2 -2
View File
@@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# NetHack 3.6 nethack.sh $NHDT-Date: 1524689450 2018/04/25 20:50:50 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.19 $ # NetHack 3.6 nethack.sh $NHDT-Date: 1552425075 2019/03/12 21:11:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details. # NetHack may be freely redistributed. See license for details.
@@ -17,7 +17,7 @@ esac
export XUSERFILESEARCHPATH export XUSERFILESEARCHPATH
# Get font dir added, but only once (and only if there's an xset to be found). # Get font dir added, but only once (and only if there's an xset to be found).
test -n "$DISPLAY" -a -e $HACKDIR/fonts.dir && xset p >/dev/null 2>&1 && ( test -n "$DISPLAY" -a -f $HACKDIR/fonts.dir && xset p >/dev/null 2>&1 && (
xset fp- $HACKDIR >/dev/null 2>&1; xset fp- $HACKDIR >/dev/null 2>&1;
xset fp+ $HACKDIR xset fp+ $HACKDIR
) )
+18 -20
View File
@@ -4,13 +4,12 @@
# #
#============================================================================== #==============================================================================
# #
# Win32 Compilers Tested: # Win32 Compilers Tested with this Makefile.gcc:
# === TDM-GCC Compiler Suite for Windows === # mingw-w64
# --- GCC 4.6 & 4.7 Series --- # from:
# *** Standard MinGW 32-bit Edition *** # https://sourceforge.net/p/mingw-w64/wiki2/GeneralUsageInstructions/
# Toolchain for Windows 32-bit target
# #
# If you don't have this compiler, you can get it at:
# http://tdm-gcc.tdragon.net/
# #
#============================================================================== #==============================================================================
# This is used for building two versions of NetHack: # This is used for building two versions of NetHack:
@@ -92,7 +91,7 @@ TARGET_CPU=x86
# your machine. # your machine.
# #
ADD_CURSES=Y ADD_CURSES=Y
PDCURSES_TOP=..\..\pdcurses PDCURSES_TOP=../../pdcurses
#4b Qt #4b Qt
# #
@@ -180,6 +179,7 @@ OBJ = o
RANDOM = $(OBJ)/random.o RANDOM = $(OBJ)/random.o
#RANDOM = #RANDOM =
BCRYPT=-lbcrypt
WINPFLAG = -DTILES -DMSWIN_GRAPHICS -DWIN32CON -D_WIN32_IE=0x0400 -D_WIN32_WINNT=0x0501 WINPFLAG = -DTILES -DMSWIN_GRAPHICS -DWIN32CON -D_WIN32_IE=0x0400 -D_WIN32_WINNT=0x0501
ifeq "$(WANT_WIN_QT4)" "Y" ifeq "$(WANT_WIN_QT4)" "Y"
@@ -288,7 +288,7 @@ VOBJ06 = $(O)dothrow.o $(O)drawing.o $(O)dungeon.o $(O)eat.o
VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o
VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o
VOBJ09 = $(O)hacklib.o $(O)invent.o $(O)light.o $(O)lock.o VOBJ09 = $(O)hacklib.o $(O)invent.o $(O)light.o $(O)lock.o
VOBJ10 = $(O)mail.o $(O)makemon.o $(O)mapglyph.o VOBJ10 = $(O)mail.o $(O)makemon.o $(O)mapglyph.o $(O)isaac64.o
VOBJ11 = $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o $(O)minion.o VOBJ11 = $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o $(O)minion.o
VOBJ12 = $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o VOBJ12 = $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o
VOBJ13 = $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o VOBJ13 = $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o
@@ -321,8 +321,8 @@ else
CURSESOBJ= CURSESOBJ=
endif endif
SOBJ = $(O)winnt.o $(O)pcsys.o $(O)pcunix.o \ SOBJ = $(O)windmain.o $(O)winnt.o $(O)win10.o \
$(SOUND) $(O)pcmain.o $(O)nhlan.o $(O)safeproc.o $(O)nhlan.o $(SOUND)
OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \ OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \
$(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \ $(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \
@@ -475,10 +475,10 @@ endif
#========================================== #==========================================
#========================================== #==========================================
cc = gcc cc = i686-w64-mingw32-gcc.exe
cxx = g++ cxx = g++
rc = windres rc = windres
link = gcc link = i686-w64-mingw32-gcc.exe
ifeq "$(WANT_WIN_QT4)" "Y" ifeq "$(WANT_WIN_QT4)" "Y"
link = g++ link = g++
endif endif
@@ -497,7 +497,7 @@ CFLAGSBASE = -c $(cflags) $(WINPINC) $(cdebug) $(CURSESDEF)
#LFLAGSBASEC = $(linkdebug) #LFLAGSBASEC = $(linkdebug)
#LFLAGSBASEG = $(linkdebug) -mwindows #LFLAGSBASEG = $(linkdebug) -mwindows
conlibs = -lgdi32 -lwinmm conlibs = -lgdi32 -lwinmm $(BCRYPT)
guilibs = -lcomctl32 -lwinmm guilibs = -lcomctl32 -lwinmm
ifeq "$(WANT_WIN_QT4)" "Y" ifeq "$(WANT_WIN_QT4)" "Y"
# Might be either Qt 4 or Qt 5 # Might be either Qt 4 or Qt 5
@@ -541,7 +541,7 @@ LFLAGSU = $(LFLAGSBASEC)
# - Game build # - Game build
#========================================== #==========================================
CFLAGS = $(CFLAGSBASE) $(WINPFLAG) $(DLBFLG) CFLAGS = $(CFLAGSBASE) $(WINPFLAG) $(DLBFLG) -DSAFEPROCS
lflags = $(LFLAGSBASEC) $(linkdebuf) lflags = $(LFLAGSBASEC) $(linkdebuf)
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
@@ -750,10 +750,8 @@ endif
$(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR)) $(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR))
$(subst /,\,if exist $(DOC)/guidebook.txt copy $(DOC)/guidebook.txt $(GAMEDIR)/Guidebook.txt) $(subst /,\,if exist $(DOC)/guidebook.txt copy $(DOC)/guidebook.txt $(GAMEDIR)/Guidebook.txt)
$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR)/NetHack.txt) $(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR)/NetHack.txt)
$(U)makedefs -c
$(subst /,\,if not exist $(GAMEDIR)/defaults.nh copy fixed_defaults.nh $(GAMEDIR)/defaults.nh)
$(subst /,\,if not exist $(GAMEDIR)/defaults.nh copy $(MSWSYS)/defaults.nh $(GAMEDIR)/defaults.nh) $(subst /,\,if not exist $(GAMEDIR)/defaults.nh copy $(MSWSYS)/defaults.nh $(GAMEDIR)/defaults.nh)
$(subst /,\,-if not exist $(GAMEDIR)/record. goto>$(GAMEDIR)/record.) $(subst /,\,-if not exist $(GAMEDIR)/record. echo.>$(GAMEDIR)/record.)
# #
# #
$(subst /,\,echo install done > $@) $(subst /,\,echo install done > $@)
@@ -1544,9 +1542,9 @@ $(O)topl.o: ../win/tty/topl.c $(HACK_H) $(INCL)/tcap.h
$(O)wintty.o: ../win/tty/wintty.c $(HACK_H) $(INCL)/dlb.h \ $(O)wintty.o: ../win/tty/wintty.c $(HACK_H) $(INCL)/dlb.h \
$(INCL)/date.h $(INCL)/patchlevel.h $(INCL)/tcap.h $(INCL)/date.h $(INCL)/patchlevel.h $(INCL)/tcap.h
$(cc) $(CFLAGS) -o$@ ../win/tty/wintty.c $(cc) $(CFLAGS) -o$@ ../win/tty/wintty.c
$(O)Window.o: ../win/X11/Window.c $(INCL)/xwindowp.h $(INCL)/xwindow.h \ #$(O)Window.o: ../win/X11/Window.c $(INCL)/xwindowp.h $(INCL)/xwindow.h \
$(CONFIG_H) # $(CONFIG_H)
$(cc) $(CFLAGS) -o$@ ../win/X11/Window.c # $(cc) $(CFLAGS) -o$@ ../win/X11/Window.c
$(O)dialogs.o: ../win/X11/dialogs.c $(CONFIG_H) $(O)dialogs.o: ../win/X11/dialogs.c $(CONFIG_H)
$(cc) $(CFLAGS) -o$@ ../win/X11/dialogs.c $(cc) $(CFLAGS) -o$@ ../win/X11/dialogs.c
$(O)winX.o: ../win/X11/winX.c $(HACK_H) $(INCL)/winX.h $(INCL)/dlb.h \ $(O)winX.o: ../win/X11/winX.c $(HACK_H) $(INCL)/winX.h $(INCL)/dlb.h \
+2
View File
@@ -2,6 +2,7 @@
/* Copyright (C) 2018 by Bart House */ /* Copyright (C) 2018 by Bart House */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#ifdef _MSC_VER
#include "win10.h" #include "win10.h"
#include <process.h> #include <process.h>
#include <VersionHelpers.h> #include <VersionHelpers.h>
@@ -79,3 +80,4 @@ void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo)
monitorInfo->left = info.rcMonitor.left; monitorInfo->left = info.rcMonitor.left;
monitorInfo->top = info.rcMonitor.top; monitorInfo->top = info.rcMonitor.top;
} }
#endif /* _MSC_VER */
+1 -1
View File
@@ -44,7 +44,7 @@ void NDECL(windows_nhbell);
int FDECL(windows_nh_poskey, (int *, int *, int *)); int FDECL(windows_nh_poskey, (int *, int *, int *));
void FDECL(windows_raw_print, (const char *)); void FDECL(windows_raw_print, (const char *));
char FDECL(windows_yn_function, (const char *, const char *, CHAR_P)); char FDECL(windows_yn_function, (const char *, const char *, CHAR_P));
void FDECL(windows_getlin, (const char *, char *)); static void FDECL(windows_getlin, (const char *, char *));
extern int NDECL(windows_console_custom_nhgetch); extern int NDECL(windows_console_custom_nhgetch);
void NDECL(safe_routines); void NDECL(safe_routines);
+11 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 winX.c $NHDT-Date: 1546081304 2018/12/29 11:01:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.71 $ */ /* NetHack 3.6 winX.c $NHDT-Date: 1552422652 2019/03/12 20:30:52 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1355,10 +1355,20 @@ int how;
time_t when; time_t when;
{ {
struct xwindow *wp; struct xwindow *wp;
FILE *rip_fp;
check_winid(window); check_winid(window);
wp = &window_list[window]; wp = &window_list[window];
/* make sure the graphic_tombstone is available; it's not easy to
revert to ordinary text tombstone once we're past this point... */
rip_fp = fopen(appResources.tombstone, "r"); /* "rip.xpm" */
if (!rip_fp) {
genl_outrip(window, how, when);
return;
}
(void) fclose(rip_fp);
if (wp->type == NHW_TEXT) { if (wp->type == NHW_TEXT) {
wp->text_information->is_rip = TRUE; wp->text_information->is_rip = TRUE;
} else { } else {
+16 -12
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 wintext.c $NHDT-Date: 1546081305 2018/12/29 11:01:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.17 $ */ /* NetHack 3.6 wintext.c $NHDT-Date: 1552422654 2019/03/12 20:30:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.18 $ */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -181,8 +181,7 @@ boolean blocking;
* _some_ lines. Finally, use the number of lines in the text if * _some_ lines. Finally, use the number of lines in the text if
* there are fewer than the max. * there are fewer than the max.
*/ */
nlines = nlines = (XtScreen(wp->w)->height - text_info->extra_height) / font_height;
(XtScreen(wp->w)->height - text_info->extra_height) / font_height;
nlines -= 4; nlines -= 4;
if (nlines > text_info->text.num_lines) if (nlines > text_info->text.num_lines)
@@ -204,13 +203,16 @@ boolean blocking;
#ifdef GRAPHIC_TOMBSTONE #ifdef GRAPHIC_TOMBSTONE
if (text_info->is_rip) { if (text_info->is_rip) {
Widget rip = create_ripout_widget(XtParent(wp->w)); Widget rip = create_ripout_widget(XtParent(wp->w));
XtSetArg(args[num_args], nhStr(XtNfromVert), rip);
num_args++; if (rip) {
XtSetArg(args[num_args], nhStr(XtNfromVert), rip);
num_args++;
} else
text_info->is_rip = FALSE;
} }
#endif #endif
if (width if (width > (Dimension) XtScreen(wp->w)->width) { /* too wide for screen */
> (Dimension) XtScreen(wp->w)->width) { /* too wide for screen */
/* Back off some amount - we really need to back off the scrollbar */ /* Back off some amount - we really need to back off the scrollbar */
/* width plus some extra. */ /* width plus some extra. */
width = XtScreen(wp->w)->width - 20; width = XtScreen(wp->w)->width - 20;
@@ -420,8 +422,7 @@ boolean concat;
if (str) { if (str) {
(void) memcpy((tb->text + tb->text_last), str, length + 1); (void) memcpy((tb->text + tb->text_last), str, length + 1);
if (length) { if (length) {
/* Remove all newlines. Otherwise we have a confused line count. /* Remove all newlines. Otherwise we have a confused line count. */
*/
copy = (tb->text + tb->text_last); copy = (tb->text + tb->text_last);
while ((copy = index(copy, '\n')) != (char *) 0) while ((copy = index(copy, '\n')) != (char *) 0)
*copy = ' '; *copy = ' ';
@@ -577,6 +578,7 @@ XtPointer widget_data; /* expose event from Window widget */
int len = strlen(rip_line[i]); int len = strlen(rip_line[i]);
XFontStruct *font = WindowFontStruct(w); XFontStruct *font = WindowFontStruct(w);
int width = XTextWidth(font, rip_line[i], len); int width = XTextWidth(font, rip_line[i], len);
XDrawString(dpy, XtWindow(w), gc, x - width / 2, y, rip_line[i], len); XDrawString(dpy, XtWindow(w), gc, x - width / 2, y, rip_line[i], len);
x += appResources.tombtext_dx; x += appResources.tombtext_dx;
y += appResources.tombtext_dy; y += appResources.tombtext_dy;
@@ -603,14 +605,16 @@ create_ripout_widget(Widget parent)
attributes.valuemask = XpmCloseness; attributes.valuemask = XpmCloseness;
attributes.closeness = 65535; /* Try anything */ attributes.closeness = 65535; /* Try anything */
errorcode = errorcode = XpmReadFileToImage(XtDisplay(parent),
XpmReadFileToImage(XtDisplay(parent), appResources.tombstone, appResources.tombstone,
&rip_image, 0, &attributes); &rip_image, 0, &attributes);
if (errorcode != XpmSuccess) { if (errorcode != XpmSuccess) {
char buf[BUFSZ]; char buf[BUFSZ];
Sprintf(buf, "Failed to load %s: %s", appResources.tombstone, Sprintf(buf, "Failed to load %s: %s", appResources.tombstone,
XpmGetErrorString(errorcode)); XpmGetErrorString(errorcode));
X11_raw_print(buf); X11_raw_print(buf);
return (Widget) 0;
} }
rip_width = rip_image->width; rip_width = rip_image->width;
rip_height = rip_image->height; rip_height = rip_image->height;
+58 -26
View File
@@ -17,6 +17,36 @@
#define strncasecmp strncmpi #define strncasecmp strncmpi
#endif #endif
/*
* Note:
*
* Prototypes need to use the widened/unwidened type macros (CHAR_P, &c)
* in order to match fields of the window_procs struct (see winprocs.h).
* But for a standard-conforming compiler, we'll end up with the widened
* types necessary to match the mixed prototype/old-style function
* definition environment as used by nethack's core. Prototype
int func(CHAR_P);
* becomes
int func(int);
* after expansion, which matches the definition
int func(arg) char arg; { ... }
* according to the rules of the C standard. But the use of new-style
* definitions
int func(char arg) { ... }
* by the curses interface turns that into a conflict. No widening takes
* place so it ought to be 'int func(char);' instead. Unfortunately that
* would be incompatible for functions assigned to window_procs.
*
* So, the code here (also cursmain.c and cursinvt.c) is mis-using the
* widening macros for variable types
int func(CHAR_P arg) { ... }
* (no doubt modelling it after the C++ code in win/Qt where the option
* to switch the applicable definitions to old-style isn't available).
* Other alternatives aren't significantly better so just live with it.
* [Redoing the windowing interface to avoid narrow arguments would be
* better since that would fix Qt's usage too.]
*/
/* Dialog windows for curses interface */ /* Dialog windows for curses interface */
@@ -76,7 +106,8 @@ static int menu_max_height(void);
static nhmenu *nhmenus = NULL; /* NetHack menu array */ static nhmenu *nhmenus = NULL; /* NetHack menu array */
/* Get a line of text from the player, such as asking for a character name or a wish */ /* Get a line of text from the player, such as asking for a character name
or a wish */
void void
curses_line_input_dialog(const char *prompt, char *answer, int buffer) curses_line_input_dialog(const char *prompt, char *answer, int buffer)
@@ -341,9 +372,9 @@ curses_ext_cmd()
extwin2 = curses_create_window(25, 1, UP); extwin2 = curses_create_window(25, 1, UP);
wrefresh(extwin2); wrefresh(extwin2);
/* create window inside window to prevent overwriting of border */ /* create window inside window to prevent overwriting of border */
getbegyx(extwin2,y0,x0); getbegyx(extwin2, y0, x0);
getmaxyx(extwin2,h,w); getmaxyx(extwin2, h, w);
extwin = newwin(1, w-2, y0+1, x0+1); extwin = newwin(1, w - 2, y0 + 1, x0 + 1);
if (w - 4 < maxlen) maxlen = w - 4; if (w - 4 < maxlen) maxlen = w - 4;
} else { } else {
curses_get_window_xy(MESSAGE_WIN, &winx, &winy); curses_get_window_xy(MESSAGE_WIN, &winx, &winy);
@@ -355,8 +386,9 @@ curses_ext_cmd()
} }
winy += messageh - 1; winy += messageh - 1;
extwin = newwin(1, messagew-2, winy, winx); extwin = newwin(1, messagew - 2, winy, winx);
if (messagew - 4 < maxlen) maxlen = messagew - 4; if (messagew - 4 < maxlen)
maxlen = messagew - 4;
pline("#"); pline("#");
} }
@@ -390,7 +422,7 @@ curses_ext_cmd()
break; break;
} }
if ((letter == '\r') || (letter == '\n')) { if (letter == '\r' || letter == '\n') {
if (ret == -1) { if (ret == -1) {
for (count = 0; extcmdlist[count].ef_txt; count++) { for (count = 0; extcmdlist[count].ef_txt; count++) {
if (!strcasecmp(cur_choice, extcmdlist[count].ef_txt)) { if (!strcasecmp(cur_choice, extcmdlist[count].ef_txt)) {
@@ -402,7 +434,9 @@ curses_ext_cmd()
break; break;
} }
if ((letter == '\b') || (letter == KEY_BACKSPACE)) { if (letter == '\177') /* DEL/Rubout */
letter = '\b';
if (letter == '\b' || letter == KEY_BACKSPACE) {
if (prompt_width == 0) { if (prompt_width == 0) {
ret = -1; ret = -1;
break; break;
@@ -749,10 +783,9 @@ menu_get_accel(boolean first)
ret = next_letter; ret = next_letter;
if (((next_letter < 'z') && (next_letter >= 'a')) || ((next_letter < 'Z') if ((next_letter < 'z' && next_letter >= 'a')
&& (next_letter >= || (next_letter < 'Z' && next_letter >= 'A')
'A')) || || (next_letter < '9' && next_letter >= '0')) {
((next_letter < '9') && (next_letter >= '0'))) {
next_letter++; next_letter++;
} else if (next_letter == 'z') { } else if (next_letter == 'z') {
next_letter = 'A'; next_letter = 'A';
@@ -789,8 +822,8 @@ menu_is_multipage(nhmenu *menu, int width, int height)
menu_item_ptr->num_lines = num_lines; menu_item_ptr->num_lines = num_lines;
curline += num_lines; curline += num_lines;
menu_item_ptr = menu_item_ptr->next_item; menu_item_ptr = menu_item_ptr->next_item;
if ((curline > height) || ((curline > height - 2) && if (curline > height
(height == menu_max_height()))) { || (curline > height - 2 && height == menu_max_height())) {
break; break;
} }
} }
@@ -895,7 +928,7 @@ menu_win_size(nhmenu *menu)
menu_item_ptr = menu_item_ptr->next_item; menu_item_ptr = menu_item_ptr->next_item;
} }
/* If the widest entry is smaller than maxwidth, reduce maxwidth accordingly */ /* If widest entry is smaller than maxwidth, reduce maxwidth accordingly */
if (maxentrywidth < maxwidth) { if (maxentrywidth < maxwidth) {
maxwidth = maxentrywidth; maxwidth = maxentrywidth;
} }
@@ -922,7 +955,7 @@ menu_win_size(nhmenu *menu)
if (lastline < maxheight) { if (lastline < maxheight) {
maxheight = lastline; maxheight = lastline;
} }
} else { /* If multipage, make sure we have enough width for page footer */ } else { /* If multipage, make sure we have enough width for page footer */
if (width < 20) { if (width < 20) {
width = 20; width = 20;
@@ -1218,8 +1251,8 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how)
menu_item_ptr = menu->entries; menu_item_ptr = menu->entries;
while (menu_item_ptr != NULL) { while (menu_item_ptr != NULL) {
if ((menu_item_ptr->identifier.a_void != NULL) && if (menu_item_ptr->identifier.a_void != NULL
(strstri(menu_item_ptr->str, search_key))) { && strstri(menu_item_ptr->str, search_key)) {
if (how == PICK_ONE) { if (how == PICK_ONE) {
menu_clear_selections(menu); menu_clear_selections(menu);
menu_select_deselect(win, menu_item_ptr, SELECT); menu_select_deselect(win, menu_item_ptr, SELECT);
@@ -1247,12 +1280,11 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how)
menu_item_ptr = menu->entries; menu_item_ptr = menu->entries;
while (menu_item_ptr != NULL) { while (menu_item_ptr != NULL) {
if (menu_item_ptr->identifier.a_void != NULL) { if (menu_item_ptr->identifier.a_void != NULL) {
if (((curletter == menu_item_ptr->accelerator) && if ((curletter == menu_item_ptr->accelerator
((curpage == menu_item_ptr->page_num) || && (curpage == menu_item_ptr->page_num
(!menu->reuse_accels))) || ((menu_item_ptr->group_accel) || !menu->reuse_accels))
&& (curletter == || (menu_item_ptr->group_accel
menu_item_ptr-> && curletter == menu_item_ptr->group_accel)) {
group_accel))) {
if (curpage != menu_item_ptr->page_num) { if (curpage != menu_item_ptr->page_num) {
curpage = menu_item_ptr->page_num; curpage = menu_item_ptr->page_num;
menu_display_page(menu, win, curpage); menu_display_page(menu, win, curpage);
@@ -1266,7 +1298,7 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how)
num_selected = 1; num_selected = 1;
dismiss = TRUE; dismiss = TRUE;
break; break;
} else if ((how == PICK_ANY) && (curletter == count_letter)) { } else if (how == PICK_ANY && curletter == count_letter) {
menu_select_deselect(win, menu_item_ptr, SELECT); menu_select_deselect(win, menu_item_ptr, SELECT);
menu_item_ptr->count = count; menu_item_ptr->count = count;
count = 0; count = 0;
@@ -1280,7 +1312,7 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how)
} }
} }
if ((how == PICK_ANY) && (num_selected != -1)) { if (how == PICK_ANY && num_selected != -1) {
num_selected = 0; num_selected = 0;
menu_item_ptr = menu->entries; menu_item_ptr = menu->entries;
+6 -5
View File
@@ -86,7 +86,7 @@ struct window_procs curses_procs = {
*/ */
int term_rows, term_cols; /* size of underlying terminal */ int term_rows, term_cols; /* size of underlying terminal */
int orig_cursor; /* Preserve initial cursor state */ int orig_cursor; /* Preserve initial cursor state */
WINDOW *base_term; /* underlying terminal window */ WINDOW *base_term; /* underlying terminal window */
boolean counting; /* Count window is active */ boolean counting; /* Count window is active */
WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */ WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */
@@ -307,6 +307,7 @@ void
curses_display_nhwindow(winid wid, BOOLEAN_P block) curses_display_nhwindow(winid wid, BOOLEAN_P block)
{ {
menu_item *selected = NULL; menu_item *selected = NULL;
if (curses_is_menu(wid) || curses_is_text(wid)) { if (curses_is_menu(wid) || curses_is_text(wid)) {
curses_end_menu(wid, ""); curses_end_menu(wid, "");
curses_select_menu(wid, PICK_NONE, &selected); curses_select_menu(wid, PICK_NONE, &selected);
@@ -314,9 +315,9 @@ curses_display_nhwindow(winid wid, BOOLEAN_P block)
} }
/* don't overwrite the splash screen first time through */ /* don't overwrite the splash screen first time through */
if (!iflags.window_inited && wid == MAP_WIN) if (!iflags.window_inited && wid == MAP_WIN) {
iflags.window_inited = TRUE; iflags.window_inited = TRUE;
else { } else {
/* actually display the window */ /* actually display the window */
wnoutrefresh(curses_get_nhwin(wid)); wnoutrefresh(curses_get_nhwin(wid));
/* flush pending writes from other windows too */ /* flush pending writes from other windows too */
@@ -847,8 +848,8 @@ preference_update(preference)
void void
curses_preference_update(const char *pref) curses_preference_update(const char *pref)
{ {
if ((strcmp(pref, "align_status") == 0) || if (!strcmp(pref, "align_status")
(strcmp(pref, "align_message") == 0)) { || !strcmp(pref, "align_message")) {
curses_create_main_windows(); curses_create_main_windows();
curses_last_messages(); curses_last_messages();
doredraw(); doredraw();