From cf3cbcf832394ef1da6461633e96e36d59ce5ace Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 30 Sep 2023 10:20:27 -0400 Subject: [PATCH] attempt to fix github issue #1104 gui build curses Check for pdcursesmod explicitly, since it is require for curses support under the NetHackW gui version Closes #1104 --- sys/windows/Install.windows | 18 +++++++++--------- sys/windows/Makefile.nmake | 16 +++++++++------- sys/windows/vs/NetHackW/NetHackW.vcxproj | 4 ++-- sys/windows/vs/dirs.props | 20 ++++++++++++++------ win/curses/cursmain.c | 2 ++ 5 files changed, 36 insertions(+), 24 deletions(-) diff --git a/sys/windows/Install.windows b/sys/windows/Install.windows index d78c79258..1c6112684 100644 --- a/sys/windows/Install.windows +++ b/sys/windows/Install.windows @@ -1,4 +1,4 @@ - Copyright (c) NetHack Development Team 1990-2022 + Copyright (c) NetHack Development Team 1990-2023 NetHack may be freely redistributed. See license for details. ============================================================== Instructions for compiling and installing @@ -83,7 +83,7 @@ Via git (recommended) submodules/lua and submodules/pdcurses folders: git submodule init - git submodule update --remote + git submodule update Via zip download @@ -100,13 +100,13 @@ Via zip download tar -xvf lua-5.4.6.tar.gz cd .. - o obtain pdcurses + o obtain pdcursesmod cd lib wget --no-check-certificate ^ - http://github.com/wmcbrine/PDCurses/archive/refs/tags/3.9.zip ^ - --output-document=pdcurses3.9.zip - tar -xvf pdcurses3.9.zip - ren PDCurses-3.9 pdcurses + https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v4.3.7.tar.gz ^ + --output-document=pdcursesmod.tar.gz + tar -xvf pdcursesmod.tar.gz + ren PDCursesMod-4.3.7 pdcursesmod cd .. o update your Makefiles to reflect: @@ -124,9 +124,9 @@ Via zip download In sys/windows/Makefile.nmake change from - PDCURSES_TOP = ..\submodules\pdcurses + PDCURSES_TOP = ..\submodules\pdcursesmod to - PDCURSES_TOP = ..\lib\pdcurses + PDCURSES_TOP = ..\lib\pdcursesmod change from LUATOP = ..\submodules\lua diff --git a/sys/windows/Makefile.nmake b/sys/windows/Makefile.nmake index dbff3a676..31002e9de 100644 --- a/sys/windows/Makefile.nmake +++ b/sys/windows/Makefile.nmake @@ -236,7 +236,7 @@ PDCURSES_TOP=$(LIBDIR)\$(PDCDIST) ADD_CURSES=Y !ENDIF # GIT_AVAILABLE !ELSE # INTERNET_AVAILABLE is not Y below -# Your Makefile settings do not allow pdcurses or pdcursesmod to be obtained by +# Your Makefile settings do not allow $(PDCDIST) to be obtained by # git or by download. Check to see if it is available at one of # the expected locations already, with precedence given to ../submodules, # then ../lib. @@ -249,7 +249,7 @@ PDCURSES_TOP=$(LIBDIR)\$(PDCDIST) ADD_CURSES=Y !ENDIF # pdcurses sources available somewhere !IF "$(ADD_CURSES)" == "Y" -!MESSAGE Your Makefile settings do not allow pdcurses or pdcursesmod to be +!MESSAGE Your Makefile settings do not allow $(PDCDIST) to be !MESSAGE obtained by git or by download, but a copy of pdcurses was !MESSAGE found in $(PDCURSES_TOP), !MESSAGE so that will be used. @@ -431,9 +431,9 @@ LUAOBJFILES = $(LUAOBJFILES) $(OLUA)lbitlib.o # PDCurses build macros # Source for the NetHack repository submodule in # ../submodules/pdcurses -# or ../submodules/pdcursesmod # is https://github.com/wmcbrine/PDCurses.git -# or https://github.com/Bill-Gray/PDCursesMod +# ../submodules/pdcursesmod +# is https://github.com/Bill-Gray/PDCursesMod #================================================================= !IF "$(ADD_CURSES)" == "Y" @@ -471,7 +471,9 @@ PDCWINGUIOBJS = $(OPDC)pdcclip_wingui.o $(OPDC)pdcdisp_wingui.o \ PDCLIB = $(LIBDIR)\$(PDCDIST)-$(TARGET_CPU).lib -PDCINCL = /I$(PDCURSES_TOP) /I$(PDCSRC) /I$(PDCWINCON) +PDCINCL = /I$(PDCURSES_TOP) /I$(PDCSRC) +PDCINCLGUI = /I$(PDCWINCON) +PDCINCLCON = /I$(PDCWINGUI) !ELSE PDCLIB = PDCDEP = @@ -1304,10 +1306,10 @@ DLB = $(Q)$(CC) /wd4244 /wd4267 /wd4774 $(PDCINCL) $(CFLAGS:-w44774= ) $(CURSESDEF2) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< {$(PDCWINCON)}.c{$(OBJPDC)}.o: - $(Q)$(CC) /wd4244 /wd4267 /wd4774 $(PDCINCL) $(CFLAGS) $(CURSESDEF2) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< + $(Q)$(CC) /wd4244 /wd4267 /wd4774 $(PDCINCL) $(PDCINCLCON) $(CFLAGS) $(CURSESDEF2) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< {$(PDCWINGUI)}.c{$(OBJPDC)}.o: - $(Q)$(CC) /wd4244 /wd4267 /wd4774 $(PDCINCL) $(CFLAGS) $(CURSESDEF2) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< + $(Q)$(CC) /wd4244 /wd4267 /wd4774 $(PDCINCL) $(PDCINCLGUI) $(CFLAGS) $(CURSESDEF2) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< #========================================== # Rules for LUA files diff --git a/sys/windows/vs/NetHackW/NetHackW.vcxproj b/sys/windows/vs/NetHackW/NetHackW.vcxproj index f22e6bdb0..802d37edd 100644 --- a/sys/windows/vs/NetHackW/NetHackW.vcxproj +++ b/sys/windows/vs/NetHackW/NetHackW.vcxproj @@ -16,7 +16,7 @@ $(BinDir) - + $(PDCURSES);%(AdditionalIncludeDirectories) CURSES_GRAPHICS;PDC_NCMOUSE;%(PreprocessorDefinitions) @@ -351,4 +351,4 @@ - \ No newline at end of file + diff --git a/sys/windows/vs/dirs.props b/sys/windows/vs/dirs.props index ce4d0b2bf..ce7236230 100644 --- a/sys/windows/vs/dirs.props +++ b/sys/windows/vs/dirs.props @@ -8,12 +8,10 @@ $(ProjectDir)symbols\$(Configuration)\$(Platform)\$(TargetName)\ $(RootDir)tools\$(Configuration)\$(Platform)\ $(vsDir)\Images\ - $(RootDir)submodules\ $(RootDir)util\ $(RootDir)dat\ $(RootDir)doc\ $(RootDir)include\ - $(SubmodulesDir)lua\ $(RootDir)lib\ $(RootDir)sound\wav\ $(RootDir)sound\windsound\ @@ -28,11 +26,21 @@ $(ToolsDir) $(ObjDir) $(RootDir)win\curses\ + $(RootDir)submodules\ + $(SubmodulesDir)lua\ - - $(SubmodulesDir)PDCursesMod\ + + $(SubmodulesDir)PDCursesMod\ + $(PDCURSESMOD) - - $(RootDir)lib\PDCursesMod\ + + $(LibDir)PDCursesMod\ + $(PDCURSESMOD) + + + $(SubmodulesDir)PDCurses\ + + + $(LibDir)PDCurses\ diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index cf961f54c..2b274ad95 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -469,6 +469,8 @@ curses_display_nhwindow(winid wid, boolean block) { menu_item *selected = NULL; + if (wid == WIN_ERR) + return; if (curses_is_menu(wid) || curses_is_text(wid)) { curses_end_menu(wid, ""); (void) curses_select_menu(wid, PICK_NONE, &selected);