From e32618914db172efca15dde2bd8ce9bde99f5cdb Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 28 Jun 2019 18:38:20 -0400 Subject: [PATCH 001/296] merge bit --- win/curses/cursdial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 6d2bed525..9ea8bcc4d 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -992,7 +992,7 @@ menu_win_size(nhmenu *menu) int maxheaderwidth = 0; nhmenu_item *menu_item_ptr; - if (program_state.gameover) { + if (g.program_state.gameover) { /* for final inventory disclosure, use full width */ maxwidth = term_cols - 2; } else { From 7c7f29a2e3cc69d1a498d56dc9286b03ef2d1ff7 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 28 Jun 2019 18:59:06 -0400 Subject: [PATCH 002/296] build fix for Windows if pdcurses is included after recent changes cursmain.o : error LNK2001: unresolved external symbol _erase_char cursmesg.o : error LNK2001: unresolved external symbol _erase_char cursmain.o : error LNK2001: unresolved external symbol _kill_char cursmesg.o : error LNK2001: unresolved external symbol _kill_char --- sys/winnt/Makefile.msc | 3 ++- win/win32/vs2017/NetHack.vcxproj | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index fb8cd9b7e..00c5cd99a 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -634,7 +634,8 @@ DLB = #========================================== {$(WCURSES)}.c{$(OBJ)}.o: - @$(cc) -DPDC_NCMOUSE $(PDCINCL) $(cflagsBuild) -Fo$@ $< + @$(cc) -DPDC_NCMOUSE -DCURSES_DEFINE_ERASE_CHAR \ + $(PDCINCL) $(cflagsBuild) -Fo$@ $< #{$(WCURSES)}.txt{$(DAT)}.txt: # @copy $< $@ diff --git a/win/win32/vs2017/NetHack.vcxproj b/win/win32/vs2017/NetHack.vcxproj index 5494094fd..9d03bf187 100644 --- a/win/win32/vs2017/NetHack.vcxproj +++ b/win/win32/vs2017/NetHack.vcxproj @@ -31,7 +31,7 @@ $(PDCURSES);%(AdditionalIncludeDirectories) - CURSES_GRAPHICS;CHTYPE_32;%(PreprocessorDefinitions) + CURSES_GRAPHICS;CHTYPE_32;PDC_NCMOUSE;CURSES_DEFINE_ERASE_CHAR;%(PreprocessorDefinitions) $(ToolsDir) @@ -267,4 +267,4 @@ - \ No newline at end of file + From 8d0edeb4ff4d63608aec9d368ee522e7096d8a6f Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 28 Jun 2019 17:00:20 -0700 Subject: [PATCH 003/296] curses+EDIT_GETLIN again Turns the "fix" in commit 319dcf4746a81ef0ca413491bdf30b4c08f931c2 handled removing the default answer for single-line-prompt plus multi-line-answer but not for multi-line-prompt plus long-enough- answer-to-reach-another-line. The logic wasn't quite right and I misunderstood what is stored in linestarts[] so even correct logic wouldn't have solved things. --- doc/fixes36.3 | 5 ++++- win/curses/cursmesg.c | 13 +++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 5b177c06e..648ef6902 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.77 $ $NHDT-Date: 1561751390 2019/06/28 19:49:50 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.78 $ $NHDT-Date: 1561766416 2019/06/29 00:00:16 $ 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, @@ -177,6 +177,9 @@ curses+'popup_dialog': show the text cursor at the end of prompts for single character input curses+EDIT_GETLIN: when a prompt's answer was preloaded, using ESC to discard it deleted it from the answer buffer but didn't erase it from screen +curses+EDIT_GETLIN: the preceding fix handled an answer which spanned more + than one line but didn't remove the answer properly if the prompt + portion of prompt+answer spanned more than one line 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 ce46ebfae..ba387f344 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -550,12 +550,13 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) if that is called for; find where the end of the prompt will be without the answer appended */ while (ltmp2 > 0) { - ltmp2 -= ltmp; + if ((ltmp2 -= ltmp) < 0) { + ltmp = -ltmp2; + break; + } promptline -= 1; - ltmp = (int) strlen(linestarts[promptline]); + ltmp = linestarts[promptline + 1] - linestarts[promptline]; } - if (ltmp2 < 0) - ltmp = -ltmp2; promptx = ltmp + border_space; } #endif @@ -597,11 +598,11 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) #endif curs_set(0); - if (erase_char && ch == erase_char) { + if (erase_char && ch == (int) (uchar) erase_char) { ch = '\177'; /* match switch-case below */ /* honor kill_char if it's ^U or similar, but not if it's '@' */ - } else if (kill_char && ch == kill_char + } else if (kill_char && ch == (int) (uchar) kill_char && (ch < ' ' || ch >= '\177')) { /*ASCII*/ if (len == 0) /* nothing to kill; just start over */ continue; From 51f2d610e263f24468a882f2d4fc70104192d6d0 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 01:09:41 -0400 Subject: [PATCH 004/296] update Windows Makefiles to support TRAVIS CI builds --- sys/winnt/Makefile.gcc | 80 ++++++++++++++++++++++++++---------------- sys/winnt/Makefile.msc | 11 +++--- sys/winnt/stubs.c | 3 ++ 3 files changed, 58 insertions(+), 36 deletions(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 1f1272ab4..5fd3181da 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -138,6 +138,13 @@ SKIP_NETHACKW=Y #============================================================================== +# The version of the game this Makefile was designed for +NETHACK_VERSION="3.6.3" + +# A brief version for use in macros +NHV1=$(subst .,,$(NETHACK_VERSION)) +NHV=$(subst ",,$(NHV1)) + # # Source directories. Makedefs hardcodes these, don't change them. # @@ -336,7 +343,7 @@ ifneq "$(SKIP_NETHACKW)" "Y" 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 endif @@ -475,10 +482,18 @@ endif #========================================== #========================================== +ifndef TRAVIS_COMPILER cc = i686-w64-mingw32-gcc.exe cxx = g++ rc = windres link = i686-w64-mingw32-gcc.exe +else +cc = gcc +cxx = g++ +rc = windres +link = gcc +endif + ifeq "$(WANT_WIN_QT4)" "Y" link = g++ endif @@ -547,7 +562,7 @@ lflags = $(LFLAGSBASEC) $(linkdebuf) CXXFLAGS = $(CFLAGS) ifeq "$(USE_DLB)" "Y" -DLB = nhdat +DLB = nhdat$(NHV) else DLB = endif @@ -620,11 +635,11 @@ $(OBJ)/%.o : $(MSWIN)/%.c $(cc) $(CFLAGS) -o$@ $< #========================================== -# Rules for files in win\curses +# Rules for files in win/curses #========================================== $(OBJ)/%.o : $(WCURSES)/%.c - $(cc) $(PDCINCL) $(CFLAGS) -o$@ $< + $(cc) -DPDC_NCMOUSE $(PDCINCL) $(CFLAGS) -o$@ $< #========================================== # Rules for files in PDCurses @@ -728,16 +743,20 @@ default : install all : install -install: initialchk $(GAMEDIR)/NetHack.exe $(U)uudecode.exe $(O)winres.o \ - $(NETHACKW_EXE) install.tag $(EXTRA_FILES) +install: initialchk $(O)utility.tag $(GAMEDIR)/NetHack.exe $(NETHACKW_EXE) \ + $(O)install.tag $(EXTRA_FILES) @echo NetHack is up to date. @echo Done. - -install.tag: $(DAT)/data $(DAT)/rumors $(DAT)/dungeon \ - $(DAT)/oracles $(DAT)/quest.dat sp_lev.tag $(DLB) +$(O)install.tag: $(DAT)/data $(DAT)/rumors $(DAT)/dungeon \ + $(DAT)/oracles $(DAT)/quest.dat $(O)sp_lev.tag $(DLB) +ifdef TRAVIS_COMPILER + ls -l $(SRC) + ls -l $(DAT) + ls -l $(UTIL) +endif ifeq "$(USE_DLB)" "Y" - $(subst /,\,copy nhdat $(GAMEDIR)) + $(subst /,\,copy nhdat$(NHV) $(GAMEDIR)) $(subst /,\,copy $(DAT)/license $(GAMEDIR)) $(subst /,\,copy $(DAT)/opthelp $(GAMEDIR)) else @@ -762,7 +781,7 @@ recover: $(U)recover.exe $(subst /,\,if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR)) $(subst /,\,if exist $(DOC)/recover.txt copy $(DOC)/recover.txt $(GAMEDIR)/recover.txt) -sp_lev.tag: utility.tag $(DAT)/bigroom.des $(DAT)/castle.des \ +$(O)sp_lev.tag: $(O)utility.tag $(DAT)/bigroom.des $(DAT)/castle.des \ $(DAT)/endgame.des $(DAT)/gehennom.des $(DAT)/knox.des \ $(DAT)/medusa.des $(DAT)/oracle.des $(DAT)/tower.des \ $(DAT)/yendor.des $(DAT)/arch.des $(DAT)/barb.des \ @@ -796,9 +815,9 @@ sp_lev.tag: utility.tag $(DAT)/bigroom.des $(DAT)/castle.des \ $(subst /,\,$(U)levcomp $(DAT)/wizard.des) $(subst /,\,copy *.lev $(DAT)) $(subst /,\,del *.lev) - $(subst /,\,echo sp_levs done > sp_lev.tag) + $(subst /,\,echo sp_levs done > $(O)sp_lev.tag) -utility.tag: $(INCL)/date.h $(INCL)/onames.h $(INCL)/pm.h \ +$(O)utility.tag: $(INCL)/date.h $(INCL)/onames.h $(INCL)/pm.h \ $(SRC)/vis_tab.c $(U)levcomp.exe $(INCL)/vis_tab.h \ $(U)dgncomp.exe $(TILEUTIL16) $(subst /,\,@echo utilities made >$@) @@ -807,11 +826,11 @@ 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)winres.o: $(TILEBMP16) $(MSWIN)/winhack.rc $(MSWIN)/mnsel.bmp \ +$(O)winres.o: $(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) -o$@ --include-dir $(MSWIN) -i $(MSWIN)/winhack.rc + $(rc) -o$@ --include-dir $(MSWIN) -i $(MSWIN)/NetHackW.rc $(O)conres.o: $(MSWSYS)/console.rc $(MSWSYS)/NetHack.ico $(rc) -o$@ --include-dir $(MSWSYS) -i $(MSWSYS)/console.rc @@ -830,7 +849,7 @@ $(GAMEDIR)/NetHack.exe : gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)guistu @echo Linking $@... $(link) $(lflags) -o$@ $(ALLOBJ) $(TTYOBJ) $(O)nttty.o $(O)tile.o \ $(O)guistub.o $(O)conres.o $(PDCLIB) $(conlibs) -static -lstdc++ - $(subst /,\,@if exist install.tag del install.tag) + $(subst /,\,@if exist $(O)install.tag del $(O)install.tag) # NetHackW # full tty linkage libs: @@ -846,7 +865,7 @@ $(GAMEDIR)/NetHackW.exe : gamedir.tag $(PDCLIB) $(O)tile.o $(O)ttystub.o \ @echo Linking $@... $(link) $(lflags) -mwindows -o$@ $(ALLOBJ) $(GUIOBJ) $(O)tile.o $(O)ttystub.o \ $(O)winres.o $(PDCLIB) $(guilibs) -static -lstdc++ - $(subst /,\,@if exist install.tag del install.tag) + $(subst /,\,@if exist $(O)install.tag del $(O)install.tag) endif $(O)nhdefkey.o: @@ -926,16 +945,16 @@ $(INCL)/vis_tab.h: $(U)makedefs.exe $(SRC)/vis_tab.c: $(U)makedefs.exe $(subst /,\,$(U)makedefs -z) -$(DAT)/data: utility.tag $(DATABASE) +$(DAT)/data: $(O)utility.tag $(DATABASE) $(subst /,\,$(U)makedefs -d) -$(DAT)/rumors: utility.tag $(DAT)/rumors.tru $(DAT)/rumors.fal +$(DAT)/rumors: $(O)utility.tag $(DAT)/rumors.tru $(DAT)/rumors.fal $(subst /,\,$(U)makedefs -r) -$(DAT)/quest.dat: utility.tag $(DAT)/quest.txt +$(DAT)/quest.dat: $(O)utility.tag $(DAT)/quest.txt $(subst /,\,$(U)makedefs -q) -$(DAT)/oracles: utility.tag $(DAT)/oracles.txt +$(DAT)/oracles: $(O)utility.tag $(DAT)/oracles.txt $(subst /,\,$(U)makedefs -h) $(DAT)/engrave: $(DAT)/engrave.txt $(U)makedefs.exe @@ -947,7 +966,7 @@ $(DAT)/epitaph: $(DAT)/epitaph.txt $(U)makedefs.exe $(DAT)/bogusmon: $(DAT)/bogusmon.txt $(U)makedefs.exe $(subst /,\,$(U)makedefs -s) -$(DAT)/dungeon: utility.tag $(DAT)/dungeon.def +$(DAT)/dungeon: $(O)utility.tag $(DAT)/dungeon.def $(subst /,\,$(U)makedefs -e) $(subst /,\,$(U)dgncomp $(DAT)/dungeon.pdf) @@ -1099,10 +1118,11 @@ $(O)dlb_main.o: $(UTIL)/dlb_main.c $(INCL)/config.h $(INCL)/dlb.h $(DAT)/porthelp: $(MSWSYS)/porthelp $(subst /,\,@copy $(MSWSYS)/porthelp $@ >nul) -nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/oracles $(OPTIONS_FILE) \ +nhdat$(NHV): $(U)dlb_main.exe $(DAT)/data $(DAT)/oracles $(OPTIONS_FILE) \ $(DAT)/quest.dat $(DAT)/rumors $(DAT)/help $(DAT)/hh $(DAT)/cmdhelp $(DAT)/keyhelp \ $(DAT)/history $(DAT)/opthelp $(DAT)/wizhelp $(DAT)/dungeon \ - $(DAT)/porthelp $(DAT)/license $(DAT)/engrave $(DAT)/epitaph $(DAT)/bogusmon $(DAT)/tribute sp_lev.tag + $(DAT)/porthelp $(DAT)/license $(DAT)/engrave \ + $(DAT)/epitaph $(DAT)/bogusmon $(DAT)/tribute $(O)sp_lev.tag $(subst /,\,echo data >$(DAT)/dlb.lst) $(subst /,\,echo oracles >>$(DAT)/dlb.lst) $(subst /,\,if exist $(DAT)/options echo options >>$(DAT)/dlb.lst) @@ -1235,13 +1255,13 @@ ifneq "$(W_GAMEDIR)" "" if exist $(W_GAMEDIR)\nhraykey.dll del $(W_GAMEDIR)\nhraykey.dll if exist $(W_GAMEDIR)\NetHack.exe del $(W_GAMEDIR)\NetHack.exe if exist $(W_GAMEDIR)\NetHack.pdb del $(W_GAMEDIR)\NetHack.pdb - if exist $(W_GAMEDIR)\nhdat del $(W_GAMEDIR)\nhdat + if exist $(W_GAMEDIR)\nhdat$(NHV) del $(W_GAMEDIR)\nhdat$(NHV) endif ifneq "$(W_SRC)" "" if exist $(W_SRC)\vis_tab.c del $(W_SRC)\vis_tab.c if exist $(W_SRC)\tile.c del $(W_SRC)\tile.c if exist $(W_SRC)\vis_tab.c del $(W_SRC)\vis_tab.c - if exist nhdat. del nhdat. + if exist $(W_SRC)\nhdat$(NHV). del $(W_SRC)\nhdat$(NHV). endif ifneq "$(W_DAT)" "" if exist $(W_DAT)\data del $(W_DAT)\data @@ -1334,8 +1354,8 @@ endif clean: if exist initialchk del initialchk - if exist install.tag del install.tag - if exist utility.tag del utility.tag + if exist $(O)install.tag del $(O)install.tag + if exist $(O)utility.tag del $(O)utility.tag ifneq "$(W_UTIL)" "" if exist $(W_UTIL)\makedefs.exe del $(W_UTIL)\makedefs.exe if exist $(W_UTIL)\levcomp.exe del $(W_UTIL)\levcomp.exe @@ -1392,8 +1412,8 @@ endif $(subst /,\,if exist $(TILEBMP32) del $(TILEBMP32)) #clean: -# -test -f install.tag && del install.tag -# -test -f utility.tag && del utility.tag +# -test -f $(O)install.tag && del $(O)install.tag +# -test -f $(O)utility.tag && del $(O)utility.tag # -test -f $(U)makedefs.exe && del $(U)makedefs.exe # -test -f $(U)levcomp.exe && del $(U)levcomp.exe # -test -f $(U)dgncomp.exe && del $(U)dgncomp.exe diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 00c5cd99a..ab2604392 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -72,8 +72,8 @@ DEBUGINFO = Y # PDCurses header (.h) files and PDCURSES_C to the location # of your PDCurses C files. # -#ADD_CURSES=Y -#PDCURSES_TOP=..\..\pdcurses +ADD_CURSES=Y +PDCURSES_TOP=..\..\pdcurses # #============================================================================== # This marks the end of the BUILD DECISIONS section. @@ -365,6 +365,7 @@ DATABASE = $(DAT)\data.base #========================================== cc=cl +cpp=cpp link=link rc=Rc @@ -582,7 +583,7 @@ DLB = @$(cc) $(cflagsBuild) -Fo$@ $< {$(SSYS)}.cpp{$(OBJ)}.o: - @$(CC) $(cflagsBuild) /EHsc -Fo$@ $< + @$(cc) $(cflagsBuild) /EHsc -Fo$@ $< #========================================== # Rules for files in sys\winnt @@ -634,8 +635,7 @@ DLB = #========================================== {$(WCURSES)}.c{$(OBJ)}.o: - @$(cc) -DPDC_NCMOUSE -DCURSES_DEFINE_ERASE_CHAR \ - $(PDCINCL) $(cflagsBuild) -Fo$@ $< + @$(cc) -DPDC_NCMOUSE $(PDCINCL) $(cflagsBuild) -Fo$@ $< #{$(WCURSES)}.txt{$(DAT)}.txt: # @copy $< $@ @@ -838,7 +838,6 @@ $(GAMEDIR)\NetHackW.exe : $(O)gamedir.tag $(O)tile.o $(O)ttystub.o \ $(O)ttystub.o $(O)NetHackW.res << - @if exist $(O)install.tag del $(O)install.tag $(O)gamedir.tag: @if not exist $(GAMEDIR)\*.* echo creating directory $(GAMEDIR:\=/) diff --git a/sys/winnt/stubs.c b/sys/winnt/stubs.c index ea38e3a57..ca7313b5b 100644 --- a/sys/winnt/stubs.c +++ b/sys/winnt/stubs.c @@ -64,6 +64,9 @@ HANDLE hConIn; HANDLE hConOut; int GUILaunched; struct window_procs tty_procs = { "-ttystubs" }; +#ifdef CURSES_GRAPHICS +char erase_char, kill_char; +#endif void win_tty_init(dir) From bef9799eb5108399201acd8fadc3aa58a188bcfa Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 01:10:32 -0400 Subject: [PATCH 005/296] No PDCurses right out-of-the-box; requires an edit --- sys/winnt/Makefile.msc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index ab2604392..492153d1b 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -72,8 +72,8 @@ DEBUGINFO = Y # PDCurses header (.h) files and PDCURSES_C to the location # of your PDCurses C files. # -ADD_CURSES=Y -PDCURSES_TOP=..\..\pdcurses +#ADD_CURSES=Y +#PDCURSES_TOP=..\..\pdcurses # #============================================================================== # This marks the end of the BUILD DECISIONS section. From 148b93a7c1609c3961df49c46613286aa1ffffb0 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 10:19:16 -0400 Subject: [PATCH 006/296] TRAVIS CI updated to include Windows and osx testing TRAVIS CI added Windows to their platform list in late 2018. Update the .travis.yml file to include a pair of Windows in machines in the testing suite, one built with visual studio command line tools and the other with mingw gcc tools. The visual studio build is currently using nmake with the sys/winnt/Makefile.msc Makefile from our distribution, That's the same process we've been using for building our binaries, pretty much. BRH may be able to modernize it over the next couple of weeks to use the msbuild process instead. I went with the HINTS environment variable on windows for consistent self-documenting purposes, even though the environment variable isn't used on windows. included: os: linux Compiler: gcc C HINTS=linux os: linux Compiler: clang C HINTS=linux os: linux Compiler: gcc C HINTS=linux-x11 os: linux Compiler: gcc C HINTS=linux-qt5 os: linux Compiler: gcc C HINTS=linux-minimal os: windows language: shell HINTS=Windows-visual-studio os: windows HINTS=Windows-mingw excluded: os: osx Compiler: clang Xcode: xcode10.2 C HINTS=macosx10.14 --- .travis.yml | 77 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7866ecd0b..f3533b3e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,20 @@ language: c - -script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && QT_SELECT=5 make MOC=moc install" - matrix: include: - - env: HINTS=linux + - os: linux + env: HINTS=linux compiler: gcc - - env: HINTS=linux + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + - os: linux + env: HINTS=linux compiler: clang - - env: HINTS=linux-x11 + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + - os: linux + env: HINTS=linux-x11 compiler: gcc - - env: HINTS=linux-qt5 + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + - os: linux + env: HINTS=linux-qt5 compiler: gcc addons: apt: @@ -18,7 +22,9 @@ matrix: - qtbase5-dev - qtmultimedia5-dev - qtbase5-dev-tools - - env: HINTS=linux-minimal + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && QT_SELECT=5 make MOC=moc install" + - os: linux + env: HINTS=linux-minimal compiler: gcc script: | cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ @@ -43,10 +49,59 @@ matrix: sed -i 's/^#define TEXTCOLOR//' include/unixconf.h make install cat dat/options - + - os: windows + env: HINTS=Windows-visual-studio + language: shell + script: +# - find /c/Program\ Files\ \(x86\) -iname 'rc.exe' -print +# - export + - export VSVER=2017 + - export MSVER=14.16.27023 + - export SDKVER=10.0.17763.0 + - export FRAMEVER=4.0.30319 + - export NETFXVER=4.6.1 + - export WKITVER=10.0.17134.0 +# - export TOOLSVER=Community + - export TOOLSVER=BuildTools + - export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/Common7/IDE/VC/VCPackages:$PATH + - export PATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/bin/$WKITVER/x64:$PATH + - export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/bin/HostX64/x64:$PATH + - export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/bin/HostX64/x86:$PATH + - export PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/Common7/IDE/CommonExtensions/Microsoft/TestWindow + - export PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/MSBuild/Current/bin/Roslyn + - export INCLUDE=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/$TOOLSVER/VC/Tools/MSVC/$MSVER/include + - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/Include/$WKITVER/ucrt + - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/ucrt + - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/shared + - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/um + - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/winrt + - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/cppwinrt + - export LIB=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/ATLMFC/lib/x86 + - export LIB=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/lib/x86:$LIB + - export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/ucrt/x86:$LIB + - export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/um/x86:$LIB +# - export + - cd src + - cp ../sys/winnt/Makefile.msc ./Makefile + - nmake install + - os: windows +# install: choco install mingw + env: HINTS=Windows-mingw + script: + - cd src + - cp ../sys/winnt/Makefile.gcc ./Makefile + - mingw32-make install + exclude: + - os: osx + osx_image: xcode10.2 + env: HINTS=macosx10.14 + compiler: clang + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" +# sudo: false - notifications: email: recipients: - - devteam@nethack.org +# - devteam@nethack.org + + From ae9d68d991f40f033ff09d302313eee8519f9a76 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 10:33:53 -0400 Subject: [PATCH 007/296] lower case windows in .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f3533b3e6..8ccc6a525 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ matrix: make install cat dat/options - os: windows - env: HINTS=Windows-visual-studio + env: HINTS=windows-visual-studio language: shell script: # - find /c/Program\ Files\ \(x86\) -iname 'rc.exe' -print @@ -86,7 +86,7 @@ matrix: - nmake install - os: windows # install: choco install mingw - env: HINTS=Windows-mingw + env: HINTS=windows-mingw script: - cd src - cp ../sys/winnt/Makefile.gcc ./Makefile From 81fef499e01e4fc1a509eadc8eff2af40d915705 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 12:12:42 -0400 Subject: [PATCH 008/296] remove "bogus" bit :) --- win/win32/vs2017/NetHack.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/win32/vs2017/NetHack.vcxproj b/win/win32/vs2017/NetHack.vcxproj index 9d03bf187..bc49f9efc 100644 --- a/win/win32/vs2017/NetHack.vcxproj +++ b/win/win32/vs2017/NetHack.vcxproj @@ -31,7 +31,7 @@ $(PDCURSES);%(AdditionalIncludeDirectories) - CURSES_GRAPHICS;CHTYPE_32;PDC_NCMOUSE;CURSES_DEFINE_ERASE_CHAR;%(PreprocessorDefinitions) + CURSES_GRAPHICS;CHTYPE_32;PDC_NCMOUSE;%(PreprocessorDefinitions) $(ToolsDir) From d4ec664b4f3f03bb1de53feb53a45988defc47f9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 13:22:25 -0400 Subject: [PATCH 009/296] add pdcurses support to travis ci windows test builds pdcurses is obtained on-the-fly from the github source --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ccc6a525..bef2f9891 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,6 +81,9 @@ matrix: - export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/ucrt/x86:$LIB - export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/um/x86:$LIB # - export + - git clone https://github.com/wmcbrine/PDCurses.git ../pdcurses + - export ADD_CURSES=Y + - export PDCURSES_TOP=../../pdcurses - cd src - cp ../sys/winnt/Makefile.msc ./Makefile - nmake install @@ -88,6 +91,9 @@ matrix: # install: choco install mingw env: HINTS=windows-mingw script: + - git clone https://github.com/wmcbrine/PDCurses.git ../pdcurses + - export ADD_CURSES=Y + - export PDCURSES_TOP=../../pdcurses - cd src - cp ../sys/winnt/Makefile.gcc ./Makefile - mingw32-make install @@ -104,4 +110,3 @@ notifications: recipients: # - devteam@nethack.org - From 93ddb5c6d884abe604d0c165bc3bff32d20c0a46 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 30 Jun 2019 10:51:00 -0700 Subject: [PATCH 010/296] attributes disclosure: experience points Wizard mode shows the number of points needed to reach the next level (unless already maxxed out at 30) for ^X and end of game disclosure. Do it in normal play for the latter too. (I think it would ok to do that for ^X too but haven't gone that far.) Even when it was wizard mode only, the phrasing for past tense had a minor grammar bug, and it could make the line a little too long for tty and curses (not sure about others) when level was high, resulting in wrapped text. That looked bad for tty, which first tries removing indentation (just 1 space in this case), making that line outdented as well as wrapped. So change the phrasing slightly when experience level is 'too high'. I had a version which formatted, measured, and re-formatted if necessary but that was overkill; simple hardcoded rephrasing suffices particularly when measuring was against assumed display width (80) rather than actual width. --- doc/fixes36.3 | 7 ++++++- src/cmd.c | 31 ++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 648ef6902..d03090095 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.78 $ $NHDT-Date: 1561766416 2019/06/29 00:00:16 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.79 $ $NHDT-Date: 1561917056 2019/06/30 17:50:56 $ 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, @@ -92,6 +92,8 @@ wizard mode ^I with 'perm_invent' On would unintentionally filter the content change #adjust to treat carrying only gold as not having anything to adjust saving bones with 'perm_invent' On could result in "Bad fruit #N" warnings update persistent inventory window immediately if 'sortpack' option is toggled +grammar bit for wizard mode final disclosure; attribute section could show + "You had N experience points, 1 more were needed to attain level X+1." Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository @@ -196,6 +198,9 @@ classify sources as released, beta, or work-in-progress via NH_DEVEL_STATUS rather than just released vs beta via BETA if you reach the edge of a level (relatively uncommon) and try to move off, report that you can't go farther if the 'mention_walls' option is set +'attributes' disclosure at end of game includes number of experience points + that were needed to reach the next experience level (new for normal + play and explore mode; previously only shown for wizard mode) wizard-mode: display effect to show where an unseen wished-for monster landed curses: enable latent mouse support curses: give menus and text windows a minimum size of 5x25 since tiny ones can diff --git a/src/cmd.c b/src/cmd.c index a3a1e60c5..c69bd4ff1 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1561017215 2019/06/20 07:53:35 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.337 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1561917056 2019/06/30 17:50:56 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.338 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1982,19 +1982,28 @@ int final; enlght_line(You_, "entered ", buf, ""); } if (!Upolyd) { - /* flags.showexp does not matter */ + int ulvl = (int) u.ulevel; + /* [flags.showexp currently does not matter; should it?] */ + /* experience level is already shown above */ Sprintf(buf, "%-1ld experience point%s", u.uexp, plur(u.uexp)); - if (wizard) { - if (u.ulevel < 30) { - int ulvl = (int) u.ulevel; - long nxtlvl = newuexp(ulvl); - /* long oldlvl = (ulvl > 1) ? newuexp(ulvl - 1) : 0; */ + /* TODO? + * Remove wizard-mode restriction since patient players can + * determine the numbers needed without resorting to spoilers + * (even before this started being disclosed for 'final'; + * just enable 'showexp' and look at normal status lines + * after drinking gain level potions or eating wraith corpses + * or being level-drained by vampires). + */ + if (ulvl < 30 && (final || wizard)) { + long nxtlvl = newuexp(ulvl), delta = nxtlvl - u.uexp; - Sprintf(eos(buf), ", %ld %s%sneeded to attain level %d", - (nxtlvl - u.uexp), (u.uexp > 0) ? "more " : "", - !final ? "" : "were ", (ulvl + 1)); - } + Sprintf(eos(buf), ", %ld %s%sneeded %s level %d", + delta, (u.uexp > 0) ? "more " : "", + /* present tense=="needed", past tense=="were needed" */ + !final ? "" : (delta == 1L) ? "was " : "were ", + /* "for": grammatically iffy but less likely to wrap */ + (ulvl < 18) ? "to attain" : "for", (ulvl + 1)); } you_have(buf, ""); } From 7cccf2e4d8b868c298ed0946099f828703826deb Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 14:12:16 -0400 Subject: [PATCH 011/296] add --depth 1 to git clone for travis windows test --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bef2f9891..818b1bf5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,7 +81,7 @@ matrix: - export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/ucrt/x86:$LIB - export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/um/x86:$LIB # - export - - git clone https://github.com/wmcbrine/PDCurses.git ../pdcurses + - git clone --depth 1 https://github.com/wmcbrine/PDCurses.git ../pdcurses - export ADD_CURSES=Y - export PDCURSES_TOP=../../pdcurses - cd src @@ -91,7 +91,7 @@ matrix: # install: choco install mingw env: HINTS=windows-mingw script: - - git clone https://github.com/wmcbrine/PDCurses.git ../pdcurses + - git clone --depth 1 https://github.com/wmcbrine/PDCurses.git ../pdcurses - export ADD_CURSES=Y - export PDCURSES_TOP=../../pdcurses - cd src @@ -110,3 +110,4 @@ notifications: recipients: # - devteam@nethack.org + From 18ae35ef39794cd5b320f3836c4af766865f5c7e Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 30 Jun 2019 11:50:08 -0700 Subject: [PATCH 012/296] curses message history vs dumplog message history When I implemented getmsghistory()/putmsghistory() for curses I was assuming that DUMPLOG would only be used with tty, but it is interface neutral and can be used with curses (or others). So curses message history needs to behave like tty message history and be sure to pass along messages that bypass pline() and the normal message window. (Mainly one-line summaries of long quest messages, but also old messages fetched from a save file and available to be re-saved without having been shown if new session doesn't generate enough new messages to flush them.) --- doc/fixes36.3 | 4 +++- win/curses/cursmesg.c | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index d03090095..261215b97 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.79 $ $NHDT-Date: 1561917056 2019/06/30 17:50:56 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.80 $ $NHDT-Date: 1561920590 2019/06/30 18:49:50 $ 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, @@ -177,6 +177,8 @@ curses+'perm_invent': don't highlight inventory letters since nothing is selectable from the menu comprising the persistent inventory window curses+'popup_dialog': show the text cursor at the end of prompts for single character input +curses+DUMPLOG: pass along old messages from save file and quest message + summaries to dumplog message history curses+EDIT_GETLIN: when a prompt's answer was preloaded, using ESC to discard it deleted it from the answer buffer but didn't erase it from screen curses+EDIT_GETLIN: the preceding fix handled an answer which spanned more diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index ba387f344..7c83ac423 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -887,6 +887,9 @@ boolean restoring_msghist; static boolean initd = FALSE; static int stash_count; static nhprev_mesg *stash_head = 0; +#ifdef DUMPLOG + extern unsigned saved_pline_index; /* pline.c */ +#endif if (restoring_msghist && !initd) { /* hide any messages we've gathered since starting current session @@ -896,12 +899,19 @@ boolean restoring_msghist; stash_head = first_mesg, first_mesg = (nhprev_mesg *) 0; last_mesg = (nhprev_mesg *) 0; /* no need to remember the tail */ initd = TRUE; +#ifdef DUMPLOG + /* this suffices; there's no need to scrub saved_pline[] pointers */ + saved_pline_index = 0; +#endif } if (msg) { mesg_add_line(msg); /* treat all saved and restored messages as turn #1 */ last_mesg->turn = 1L; +#ifdef DUMPLOG + dumplogmsg(last_mesg->str); +#endif } else if (stash_count) { nhprev_mesg *mesg; long mesg_turn; @@ -921,6 +931,9 @@ boolean restoring_msghist; mesg_add_line(mesg->str); /* added line became new tail */ last_mesg->turn = mesg_turn; +#ifdef DUMPLOG + dumplogmsg(mesg->str); +#endif free((genericptr_t) mesg->str); free((genericptr_t) mesg); } From 4db3b55057b5c2abae7617e1d1505dbda5f90360 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 30 Jun 2019 13:45:14 -0700 Subject: [PATCH 013/296] wishing vs EDIT_GETLIN If you ask for help when wishing, don't leave "help" in the buffer for EDIT_GETLIN to use as default answer on next retry. It does still leave anything rejected as unknown so that the player has a change to review the spelling and conceivably add and/or remove from the end witout having to retype everything. --- src/zap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/zap.c b/src/zap.c index 1563d434c..c8bbe34a9 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1559994626 2019/06/08 11:50:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.311 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1561927499 2019/06/30 20:44:59 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.312 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4115,7 +4115,7 @@ boolean say; /* Announce out of sight hit/miss events if true */ break; if (type >= 0) mon->mstrategy &= ~STRAT_WAITMASK; - buzzmonst: + buzzmonst: notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y); if (zap_hit(find_mac(mon), spell_type)) { if (mon_reflects(mon, (char *) 0)) { @@ -4235,7 +4235,7 @@ boolean say; /* Announce out of sight hit/miss events if true */ uchar rmn; boolean fireball; - make_bounce: + make_bounce: bchance = (levl[sx][sy].typ == STONE) ? 10 : (In_mines(&u.uz) && IS_WALL(levl[sx][sy].typ)) ? 20 : 75; @@ -4638,7 +4638,7 @@ short exploding_wand_typ; hear_txt = "crackling."; break; default: - def_case: + def_case: if (exploding_wand_typ > 0) { /* Magical explosion from misc exploding wand */ if (exploding_wand_typ == WAN_STRIKING) { @@ -5282,7 +5282,7 @@ makewish() nothing = zeroobj; /* lint suppression; only its address matters */ if (flags.verbose) You("may wish for an object."); -retry: + retry: Strcpy(promptbuf, "For what do you wish"); if (iflags.cmdassist && tries > 0) Strcat(promptbuf, " (enter 'help' for assistance)"); @@ -5293,6 +5293,7 @@ retry: buf[0] = '\0'; } else if (!strcmpi(buf, "help")) { wishcmdassist(MAXWISHTRY - tries); + buf[0] = '\0'; /* for EDIT_GETLIN */ goto retry; } /* From e35a216e51bc903d8948df3057525a8739e41469 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 16:54:34 -0400 Subject: [PATCH 014/296] last NetHack-3.6 travis build passed so re-enable notifications to devteam --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 818b1bf5a..e2c522f80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,6 +108,6 @@ sudo: false notifications: email: recipients: -# - devteam@nethack.org + - devteam@nethack.org From c928cda7753998ff294835051d1c35d30ed8e4e6 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 30 Jun 2019 16:34:41 -0700 Subject: [PATCH 015/296] Need to check ball and chain after we have procesed floor objects. --- src/restore.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/restore.c b/src/restore.c index 69d4660c5..14612e08e 100644 --- a/src/restore.c +++ b/src/restore.c @@ -672,13 +672,6 @@ unsigned int *stuckid, *steedid; if (otmp->owornmask) setworn(otmp, otmp->owornmask); - if ((uball && !uchain) || (uchain && !uball)) { - impossible("restgamestate: lost ball & chain"); - /* poor man's unpunish() */ - setworn((struct obj *) 0, W_CHAIN); - setworn((struct obj *) 0, W_BALL); - } - /* reset weapon so that player will get a reminder about "bashing" during next fight when bare-handed or wielding an unconventional item; for pick-axe, we aren't able to distinguish between having @@ -921,6 +914,13 @@ register int fd; if (otmp->owornmask) setworn(otmp, otmp->owornmask); + if ((uball && !uchain) || (uchain && !uball)) { + impossible("restgamestate: lost ball & chain"); + /* poor man's unpunish() */ + setworn((struct obj *) 0, W_CHAIN); + setworn((struct obj *) 0, W_BALL); + } + /* in_use processing must be after: * + The inventory has been read so that freeinv() works. * + The current level has been restored so billing information From 1b0d47911fbaa0cba0ae11ad92eea6aaee624a54 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 30 Jun 2019 16:41:24 -0700 Subject: [PATCH 016/296] When restoring game we should not need to invoke rnd to test for hiding. --- src/restore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/restore.c b/src/restore.c index 14612e08e..b6126a227 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1140,7 +1140,7 @@ boolean ghostly; them is different now than when the level was saved */ restore_cham(mtmp); /* give hiders a chance to hide before their next move */ - if (ghostly || elapsed > (long) rnd(10)) + if (ghostly || (elapsed > 00 && elapsed > (long) rnd(10))) hide_monst(mtmp); } From 3e86b46f8a35757e6066a5d23129ae6b136d4e47 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 30 Jun 2019 22:19:37 -0400 Subject: [PATCH 017/296] fix up Windows gcc Makefile --- sys/winnt/Makefile.gcc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 5fd3181da..358965369 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -90,8 +90,8 @@ TARGET_CPU=x86 # of your PDCurses C files which must already be resident on # your machine. # -#ADD_CURSES=Y -#PDCURSES_TOP=../../pdcurses +# ADD_CURSES=Y +# PDCURSES_TOP=../../pdcurses #4b Qt # @@ -404,12 +404,11 @@ PDCSRC = $(PDCURSES_TOP)/pdcurses PDCWINCON = $(PDCURSES_TOP)/wincon PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \ $(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \ - $(O)deprec.o $(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \ + $(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \ $(O)initscr.o $(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o \ $(O)keyname.o $(O)mouse.o $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o \ $(O)panel.o $(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \ - $(O)slk.o $(O)termattr.o $(O)terminfo.o $(O)touch.o $(O)util.o $(O)window.o \ - $(O)debug.o + $(O)slk.o $(O)termattr.o $(O)touch.o $(O)util.o $(O)window.o $(O)debug.o PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \ $(O)pdcsetsc.o $(O)pdcutil.o From 8bb8d3262596a5fccb08cea1edc854839ce02c3b Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 2 Jul 2019 01:37:04 -0700 Subject: [PATCH 018/296] tty status highlighting via attributes Highlighting via attributes got broken three months ago. May or may not have been noticeable depending upon which attributes are supported. Too many variations of attribute designations... --- doc/fixes36.3 | 4 +++- win/tty/termcap.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 261215b97..47f9a162b 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.80 $ $NHDT-Date: 1561920590 2019/06/30 18:49:50 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.81 $ $NHDT-Date: 1562056615 2019/07/02 08:36:55 $ 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, @@ -191,6 +191,8 @@ tty: re-do one optimization used when status conditions have all been removed tty: take two, if/when autodecribe feedback wraps past top line, clear continuation lines and redraw map if needed when top line is cleared ['exposed by git' section has an entry for reversal of 'take one'] +tty: video attributes (bold, inverse, &c) for status highlighting sometimes + were scrambled Windows: some startup error messages were not being delivered successfully diff --git a/win/tty/termcap.c b/win/tty/termcap.c index ca1e08b02..9e0a76eb9 100644 --- a/win/tty/termcap.c +++ b/win/tty/termcap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 termcap.c $NHDT-Date: 1554841008 2019/04/09 20:16:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ */ +/* NetHack 3.6 termcap.c $NHDT-Date: 1562056615 2019/07/02 08:36:55 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.31 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1216,18 +1216,18 @@ term_attr_fixup(msk) int msk; { /* underline is converted to bold if its start sequence isn't available */ - if ((msk & (1 << ATR_ULINE)) && (!nh_US || !*nh_US)) { - msk |= (1 << ATR_BOLD); - msk &= ~(1 << ATR_ULINE); + if ((msk & HL_ULINE) && (!nh_US || !*nh_US)) { + msk |= HL_BOLD; + msk &= ~HL_ULINE; } /* blink used to be converted to bold unconditionally; now depends on MB */ - if (msk & (1 << ATR_BLINK) && (!MB || !*MB)) { - msk |= (1 << ATR_BOLD); - msk &= ~(1 << ATR_BLINK); + if ((msk & HL_BLINK) && (!MB || !*MB)) { + msk |= HL_BOLD; + msk &= ~HL_BLINK; } /* dim is ignored if its start sequence isn't available */ - if (msk & (1 << ATR_DIM) && (!MH || !*MH)) { - msk &= ~(1 << ATR_DIM); + if ((msk & HL_DIM) && (!MH || !*MH)) { + msk &= ~HL_DIM; } return msk; } From 1ac321eadcddf77d6c32557418f4a96a5fda98cb Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 2 Jul 2019 14:01:44 -0400 Subject: [PATCH 019/296] test and adjust for curses with msdos --- doc/fixes36.3 | 1 + sys/msdos/Makefile.GCC | 451 ++++++++++++++++++++++++++--------------- sys/msdos/setup.bat | 9 +- win/curses/cursmain.c | 4 + 4 files changed, 293 insertions(+), 172 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 47f9a162b..2cec56c67 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -184,6 +184,7 @@ curses+EDIT_GETLIN: when a prompt's answer was preloaded, using ESC to discard curses+EDIT_GETLIN: the preceding fix handled an answer which spanned more than one line but didn't remove the answer properly if the prompt portion of prompt+answer spanned more than one line +msdos: code fixes to allow a build with curses and PDCurses 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/sys/msdos/Makefile.GCC b/sys/msdos/Makefile.GCC index 3126d7622..e6a039abc 100644 --- a/sys/msdos/Makefile.GCC +++ b/sys/msdos/Makefile.GCC @@ -1,5 +1,5 @@ # NetHack 3.6 Makefile.GCC $NHDT-Date: 1519600525 2018/02/25 23:15:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.34 $ -# Copyright (c) NetHack PC Development Team 1996-2006. +# Copyright (c) NetHack PC Development Team 1996-2019. # PC NetHack 3.6 Makefile for djgpp V2 # # Gnu gcc compiler for msdos (djgpp) @@ -25,6 +25,23 @@ GAME = nethack # The GNU Make has a problem if you include a drive spec below (unfortunately). GAMEDIR =../binary +# Optional PDCurses support +# Uncomment these and set them appropriately if you want to +# include curses port support alongside TTY support in your +# NetHack.exe binary. +# +# You'll have to set PDCURSES_H to the correct location of the +# PDCurses header (.h) files and PDCURSES_C to the location +# of your PDCurses C files which must already be resident on +# your machine. +# +ADD_CURSES=Y +PDCURSES_TOP=../../pdcurses + +# +#============================================================================== +# This marks the end of the BUILD DECISIONS section. +#============================================================================== # # Directories, gcc likes unix style directory specs # @@ -38,6 +55,7 @@ SRC = ../src SSHR = ../sys/share UTIL = ../util WIN = ../win/tty +WCURSES = ../win/curses WSHR = ../win/share # @@ -67,7 +85,8 @@ LIBRARIES = $(LIBS) $(TERMLIB) # If you have yacc/lex or a work-alike set YACC_LEX to Y # YACC_LEX = N -ifeq ($(YACC_LEX),Y) + +ifeq "$(YACC_LEX)" "Y" DO_YACC = YACC_ACT DO_LEX = LEX_ACT endif @@ -138,97 +157,39 @@ SUPPRESS_GRAPHICS = GAMEFILE = $(GAMEDIR)/$(GAME).exe # Changing this conditional block is not recommended -ifeq ($(USE_DLB),Y) +ifeq "$(USE_DLB)" "Y" DLBFLG = -DDLB else DLBFLG = endif -# -# Flags. -# -ifeq ($(SUPPRESS_GRAPHICS),Y) TERMLIB = # Build NetHack suitable for blind players -# Debugging -#cflags = -pg -c -I../include $(DLBFLG) -DSUPPRESS_GRAPHICS -#LFLAGS = -pg - -cflags = -c -O -I../include $(DLBFLG) -DSUPPRESS_GRAPHICS -LFLAGS = - -else - -# Debugging -#cflags = -g -c -I../include $(DLBFLG) -DUSE_TILES -#LFLAGS = -g - -# Normal -cflags = -c -O -I../include $(DLBFLG) -DUSE_TILES -LFLAGS = -endif - -#========================================== -#================ RULES ================== -#========================================== - -.SUFFIXES: .exe .o .til .uu .c .y .l - -#========================================== -# Rules for files in src -#========================================== - -$(OBJ)/%.o : /%.c - $(CC) $(cflags) -o$@ $< - -$(OBJ)/%.o : $(SRC)/%.c - $(CC) $(cflags) -o$@ $< - -#========================================== -# Rules for files in sys/share -#========================================== - -$(OBJ)/%.o : $(SSHR)/%.c - $(CC) $(cflags) -o$@ $< - -#========================================== -# Rules for files in sys/msdos -#========================================== - -$(OBJ)/%.o : $(MSYS)/%.c - $(CC) $(cflags) -I../sys/msdos -o$@ $< - -#========================================== -# Rules for files in util -#========================================== - -$(OBJ)/%.o : $(UTIL)/%.c - $(CC) $(cflags) -o$@ $< - -#========================================== -# Rules for files in win/share -#========================================== - -$(OBJ)/%.o : $(WSHR)/%.c - $(CC) $(cflags) -I../win/share -o$@ $< - -#{$(WSHR)}.txt{$(DAT)}.txt: -# copy $< $@ - -#========================================== -# Rules for files in win/tty -#========================================== - -$(OBJ)/%.o : $(TTY)/%.c - $(CC) $(cflags) -o$@ $< - #========================================== #================ MACROS ================== #========================================== # This section creates shorthand macros for many objects # referenced later on in the Makefile. # +# Have windows path styles available for use in commands +# +W_OBJ =$(subst /,\, $(OBJ)) +W_INCL =$(subst /,\, $(INCL)) +W_DAT =$(subst /,\, $(DAT)) +W_DOC =$(subst /,\, $(DOC)) +W_UTIL =$(subst /,\, $(UTIL)) +W_SRC =$(subst /,\, $(SRC)) +W_SSYS =$(subst /,\, $(SSYS)) +W_MSWSYS =$(subst /,\, $(MSWSYS)) +W_TTY =$(subst /,\, $(TTY)) +W_MSWIN =$(subst /,\, $(MSWIN)) +ifeq "$(ADD_CURSES)" "Y" +W_WCURSES =$(subst /,\, $(WCURSES)) +endif +W_WSHR =$(subst /,\, $(WSHR)) +W_GAMEDIR =$(subst /,\, $(GAMEDIR)) + # # Shorten up the location for some files # @@ -249,7 +210,7 @@ SPLEVSRC = lev_yacc.c lev_$(LEX).c lev_main.c panic.c DGNCOMPSRC = dgn_yacc.c dgn_$(LEX).c dgn_main.c -MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o +MAKEDEFSOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o SPLEVOBJS = $(O)lev_yacc.o $(O)lev_$(LEX).o $(O)lev_main.o $(O)alloc.o \ $(O)monst.o $(O)objects.o $(O)panic.o \ @@ -339,21 +300,59 @@ VOBJ19 = $(O)trap.o $(O)u_init.o $(O)uhitm.o $(O)vault.o $(O)vision.o VOBJ20 = $(O)vis_tab.o $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows.o VOBJ21 = $(O)wintty.o $(O)wizard.o $(O)worm.o $(O)worn.o $(O)write.o VOBJ22 = $(O)zap.o $(O)light.o $(O)dlb.o $(O)dig.o $(O)teleport.o -VOBJ23 = $(O)region.o $(O)sys.o $(REGEX) +VOBJ23 = $(O)region.o $(O)sys.o $(REGEX) $(O)isaac64.o SOBJ = $(O)msdos.o $(O)sound.o $(O)pcsys.o $(O)tty.o $(O)unix.o \ $(O)video.o $(O)vidtxt.o $(O)pckeys.o VVOBJ = $(O)version.o +ifeq "$(ADD_CURSES)" "Y" +CURSESOBJ= $(O)cursdial.o $(O)cursinit.o $(O)cursinvt.o $(O)cursmain.o \ + $(O)cursmesg.o $(O)cursmisc.o $(O)cursstat.o $(O)curswins.o +else +CURSESOBJ= +endif + VOBJ = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \ $(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \ $(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \ $(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \ - $(VOBJ21) $(VOBJ22) $(VOBJ23) + $(VOBJ21) $(VOBJ22) $(VOBJ23) \ + $(CURSESOBJ) ALLOBJ = $(VOBJ) $(SOBJ) $(TILOBJ) $(TILOBJ2) $(VVOBJ) +ifeq "$(ADD_CURSES)" "Y" +#========================================== +# PDCurses build macros +#========================================== +PDCURSES_CURSES_H = $(PDCURSES_TOP)/curses.h +PDCURSES_CURSPRIV_H = $(PDCURSES_TOP)/curspriv.h +PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) +PDCSRC = $(PDCURSES_TOP)/pdcurses +PDCDOS = $(PDCURSES_TOP)/dos +PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \ + $(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \ + $(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \ + $(O)initscr.o $(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o \ + $(O)keyname.o $(O)mouse.o $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o \ + $(O)panel.o $(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \ + $(O)slk.o $(O)termattr.o $(O)touch.o $(O)util.o $(O)window.o $(O)debug.o + +PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o \ + $(O)pdcscrn.o $(O)pdcsetsc.o $(O)pdcutil.o + +#PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \ +# $(O)pdcsetsc.o $(O)pdcutil.o + +PDCLIB = $(O)pdcurses.a + +PDCINCL = -I$(PDCURSES_TOP) -I$(PDCSRC) -I$(PDCDOS) +else +PDCLIB = +endif + #========================================== # Header file macros #========================================== @@ -410,6 +409,108 @@ DJ1 = $(dir $(DJGPP)) CWSDPMI = $(subst /,\,$(DJ1))bin\CWSDPMI.* endif +#========================================== +# More compiler setup macros +#========================================== +# +ifeq "$(ADD_CURSES)" "Y" +CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" +else +CURSESDEF= +CURSESLIB= +endif + +INCLDIR=-I../include -I../sys/msdos + +# Debugging +#cflags = -pg -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS +#LFLAGS = -pg + +cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS +LFLAGS = + +# Debugging +#cflags = -g -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DUSE_TILES +#LFLAGS = -g + +# Normal +cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DUSE_TILES +LFLAGS = + +#========================================== +#================ RULES ================== +#========================================== + +.SUFFIXES: .exe .o .til .uu .c .y .l + +#========================================== +# Rules for files in src +#========================================== + +$(OBJ)/%.o : /%.c + $(CC) $(cflags) -o$@ $< + +$(OBJ)/%.o : $(SRC)/%.c + $(CC) $(cflags) -o$@ $< + +#========================================== +# Rules for files in sys/share +#========================================== + +$(OBJ)/%.o : $(SSHR)/%.c + $(CC) $(cflags) -o$@ $< + +#========================================== +# Rules for files in sys/msdos +#========================================== + +$(OBJ)/%.o : $(MSYS)/%.c + $(CC) $(cflags) -I../sys/msdos -o$@ $< + +#========================================== +# Rules for files in util +#========================================== + +$(OBJ)/%.o : $(UTIL)/%.c + $(CC) $(cflags) -o$@ $< + +#========================================== +# Rules for files in win/share +#========================================== + +$(OBJ)/%.o : $(WSHR)/%.c + $(CC) $(cflags) -I../win/share -o$@ $< + +#{$(WSHR)}.txt{$(DAT)}.txt: +# copy $< $@ + +#========================================== +# Rules for files in win/tty +#========================================== + +$(OBJ)/%.o : $(TTY)/%.c + $(CC) $(cflags) -o$@ $< + +#========================================== +# Rules for files in win/curses +#========================================== + +$(OBJ)/%.o : $(WCURSES)/%.c + $(CC) -DPDC_NCMOUSE $(PDCINCL) $(cflags) -o$@ $< + +#========================================== +# Rules for files in PDCurses +#========================================== + +$(OBJ)/%.o : $(PDCURSES_TOP)/%.c + $(CC) $(PDCINCL) $(cflags) -o$@ $< + +$(OBJ)/%.o : $(PDCSRC)/%.c + $(CC) $(PDCINCL) $(cflags) -o$@ $< + +$(OBJ)/%.o : $(PDCDOS)/%.c + $(CC) $(PDCINCL) $(cflags) -o$@ $< + #========================================== # Primary Targets. #========================================== @@ -425,9 +526,11 @@ default: $(GAMEFILE) util: $(O)utility.tag -$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \ - $(INCL)/pm.h monstr.c vis_tab.c \ - $(U)lev_comp.exe $(U)dgn_comp.exe $(TILEUTIL) +LEVCOMPEXE = $(U)lev_comp.exe + +$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \ + $(INCL)/pm.h monstr.c vis_tab.c $(LEVCOMPEXE) \ + $(U)dgn_comp.exe $(TILEUTIL) $(subst /,\,echo utilities made > $@) tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe @@ -455,7 +558,7 @@ endif @$(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR)) @$(subst /,\,copy $(SSHR)/NetHack.cnf $(GAMEDIR)/defaults.nh) -@$(subst /,\,touch $(GAMEDIR)/record) - @$(subst /,\,copy $(DOC)/guidebo*.txt $(GAMEDIR)) + @$(subst /,\,copy $(DOC)/guideb*.txt $(GAMEDIR)) @$(subst /,\,copy ../sys/winnt/sysconf $(GAMEDIR)) @$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR)) ifdef CWSDPMI @@ -469,7 +572,8 @@ endif # The main target. #========================================== -$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk +$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) \ + $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk @if exist temp.a del temp.a @ar ru temp.a $(VOBJ01) @ar ru temp.a $(VOBJ02) @@ -494,11 +598,17 @@ $(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk @ar ru temp.a $(VOBJ21) @ar ru temp.a $(VOBJ22) @ar ru temp.a $(VOBJ23) + @ar ru temp.a $(VOBJ24) + @ar ru temp.a $(VOBJ25) @ar ru temp.a $(SOBJ) @ar ru temp.a $(TILOBJ) @ar ru temp.a $(TILOBJ2) @ar ru temp.a $(VVOBJ) - $(LINK) $(LFLAGS) -o$(GAME).exe temp.a $(LIBRARIES) $(ZLIB) +ifeq "$(ADD_CURSES)" "Y" + @ar ru temp.a $(CURSESOBJ) +endif + $(LINK) $(LFLAGS) -o$(GAME).exe temp.a \ + $(PDCLIB) $(LIBRARIES) $(ZLIB) @$(subst /,\,stubedit $(GAME).exe minstack=2048K) @$(subst /,\,copy $(GAME).exe $(GAMEFILE)) @$(subst /,\,del $(GAME).exe) @@ -527,86 +637,15 @@ $(O)$(GAME).lnk: $(ALLOBJ) echo $(VOBJ21) >> $(subst /,\,$@) echo $(VOBJ22) >> $(subst /,\,$@) echo $(VOBJ23) >> $(subst /,\,$@) + echo $(VOBJ24) >> $(subst /,\,$@) + echo $(VOBJ25) >> $(subst /,\,$@) echo $(SOBJ) >> $(subst /,\,$@) echo $(TILOBJ) >> $(subst /,\,$@) echo $(TILOBJ2) >> $(subst /,\,$@) echo $(VVOBJ) >> $(subst /,\,$@) - - -#========================================== -# Housekeeping. -#========================================== - -clean: - $(subst /,\,if exist $(O)*.o del $(O)*.o) - $(subst /,\,if exist $(O)dat.tag del $(O)dat.tag) - $(subst /,\,if exist $(O)install.tag del $(O)install.tag) - $(subst /,\,if exist $(O)$(GAME).lnk del $(O)$(GAME).lnk) - $(subst /,\,if exist $(O)obj.tag del $(O)obj.tag) - $(subst /,\,if exist $(O)sp_lev.tag del $(O)sp_lev.tag) - $(subst /,\,if exist $(O)thintile.tag del $(O)thintile.tag) - $(subst /,\,if exist $(O)utility.tag del $(O)utility.tag) - $(subst /,\,if exist temp.a del temp.a) - -spotless: clean - - $(subst /,\,if exist $(U)lev_flex.c del $(U)lev_flex.c) - $(subst /,\,if exist $(U)lev_lex.c del $(U)lev_lex.c) - $(subst /,\,if exist $(U)lev_yacc.c del $(U)lev_yacc.c) - $(subst /,\,if exist $(U)dgn_flex.c del $(U)dgn_flex.c) - $(subst /,\,if exist $(U)dgn_lex.c del $(U)dgn_lex.c) - $(subst /,\,if exist $(U)dgn_yacc.c del $(U)lev_yacc.c) - $(subst /,\,if exist $(U)makedefs.exe del $(U)makedefs.exe) - $(subst /,\,if exist $(U)lev_comp.exe del $(U)lev_comp.exe) - $(subst /,\,if exist $(U)dgn_comp.exe del $(U)dgn_comp.exe) - $(subst /,\,if exist $(U)recover.exe del $(U)recover.exe) - $(subst /,\,if exist $(U)tilemap.exe del $(U)tilemap.exe) - $(subst /,\,if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe) - $(subst /,\,if exist $(U)tile2bin.exe del $(U)tile2bin.exe) - $(subst /,\,if exist $(U)til2bin2.exe del $(U)til2bin2.exe) - $(subst /,\,if exist $(U)thintile.exe del $(U)thintile.exe) - $(subst /,\,if exist $(U)dlb_main.exe del $(U)dlb_main.exe) - $(subst /,\,if exist $(INCL)/vis_tab.h del $(INCL)/vis_tab.h) - $(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h) - $(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h) - $(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h) - $(subst /,\,if exist $(INCL)/dgn_comp.h del $(INCL)/dgn_comp.h) - $(subst /,\,if exist $(INCL)/lev_comp.h del $(INCL)/lev_comp.h) - $(subst /,\,if exist $(SRC)/monstr.c del $(SRC)/monstr.c) - $(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c) - $(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c) - $(subst /,\,if exist $(DAT)/options del $(DAT)/options) - $(subst /,\,if exist $(DAT)/data del $(DAT)/data) - $(subst /,\,if exist $(DAT)/rumors del $(DAT)/rumors) - $(subst /,\,if exist $(DAT)/dungeon.pdf del $(DAT)/dungeon.pdf) - $(subst /,\,if exist $(DAT)/dungeon del $(DAT)/dungeon) - $(subst /,\,if exist $(DAT)/oracles del $(DAT)/oracles) - $(subst /,\,if exist $(DAT)/quest.dat del $(DAT)/quest.dat) - $(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon) - $(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave) - $(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph) - $(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst) - $(subst /,\,if exist $(DAT)/nhdat del $(DAT)/nhdat) - $(subst /,\,if exist $(DAT)/*.lev del $(DAT)/*.lev) - $(subst /,\,if exist $(TILE_BMP) del $(TILE_BMP)) - $(subst /,\,if exist $(WSHR)/monthin.txt del $(WSHR)/monthin.txt) - $(subst /,\,if exist $(WSHR)/objthin.txt del $(WSHR)/objthin.txt) - $(subst /,\,if exist $(WSHR)/oththin.txt del $(WSHR)/oththin.txt) - -#========================================== -# Create directory for holding object files -#========================================== - -$(O)obj.tag: - -$(subst /,\,@if not exist $(OBJ)/*.* mkdir $(OBJ)) - @$(subst /,\,@echo directory created > $@) - -#=========================================== -# Work around some djgpp long file name woes -#=========================================== - -$(PATCHLEV_H): - @$(subst /,\,if not exist $@ copy $(INCL)/patchlevel.h $(INCL)/patchlev.h) +ifeq "$(ADD_CURSES)" "Y" + echo $(CURSESOBJ) >> $(subst /,\,$@) +endif #========================================== #=========== SECONDARY TARGETS ============ @@ -640,8 +679,8 @@ vis_tab.c: $(U)makedefs.exe # Makedefs Stuff #========================================== -$(U)makedefs.exe: $(MAKEOBJS) - $(LINK) $(LFLAGS) -o$@ $(MAKEOBJS) +$(U)makedefs.exe: $(MAKEDEFSOBJS) + $(LINK) $(LFLAGS) -o$@ $(MAKEDEFSOBJS) $(O)makedefs.o: $(CONFIG_H) $(PERMONST_H) $(INCL)/objclass.h \ $(INCL)/monsym.h $(INCL)/qtext.h $(U)makedefs.c @@ -900,6 +939,13 @@ $(O)viewtib.o: $(MSYS)/viewtib.c endif +#========================================== +# PDCurses Library +#========================================== + +$(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS) + ar rcs $@ $(PDCLIBOBJS) $(PDCOBJS) + #========================================== # Other Util Dependencies. #========================================== @@ -954,7 +1000,8 @@ $(DAT)/engrave: $(O)utility.tag $(DAT)/engrave.txt $(DAT)/epitaph: $(O)utility.tag $(DAT)/epitaph.txt @$(subst /,\,$(U)makedefs.exe -s) -$(O)sp_lev.tag: $(O)utility.tag $(DAT)/bigroom.des $(DAT)/castle.des \ +$(O)sp_lev.tag: $(O)utility.tag \ + $(DAT)/bigroom.des $(DAT)/castle.des \ $(DAT)/endgame.des $(DAT)/gehennom.des $(DAT)/knox.des \ $(DAT)/medusa.des $(DAT)/oracle.des $(DAT)/tower.des \ $(DAT)/yendor.des $(DAT)/arch.des $(DAT)/barb.des \ @@ -1021,6 +1068,76 @@ $(U)dlb_main.exe: $(DLBOBJS) $(O)dlb_main.o: $(U)dlb_main.c $(INCL)/config.h $(DLB_H) $(CC) $(cflags) -o$@ $(U)dlb_main.c +#========================================== +# Housekeeping. +#========================================== + +clean: + $(subst /,\,if exist $(O)*.o del $(O)*.o) + $(subst /,\,if exist $(O)dat.tag del $(O)dat.tag) + $(subst /,\,if exist $(O)install.tag del $(O)install.tag) + $(subst /,\,if exist $(O)$(GAME).lnk del $(O)$(GAME).lnk) + $(subst /,\,if exist $(O)obj.tag del $(O)obj.tag) + $(subst /,\,if exist $(O)sp_lev.tag del $(O)sp_lev.tag) + $(subst /,\,if exist $(O)thintile.tag del $(O)thintile.tag) + $(subst /,\,if exist $(O)utility.tag del $(O)utility.tag) + $(subst /,\,if exist temp.a del temp.a) + +spotless: clean + + $(subst /,\,if exist $(U)dgn_flex.c del $(U)dgn_flex.c) + $(subst /,\,if exist $(U)dgn_lex.c del $(U)dgn_lex.c) + $(subst /,\,if exist $(U)makedefs.exe del $(U)makedefs.exe) + $(subst /,\,if exist $(U)dgn_comp.exe del $(U)dgn_comp.exe) + $(subst /,\,if exist $(U)recover.exe del $(U)recover.exe) + $(subst /,\,if exist $(U)tilemap.exe del $(U)tilemap.exe) + $(subst /,\,if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe) + $(subst /,\,if exist $(U)tile2bin.exe del $(U)tile2bin.exe) + $(subst /,\,if exist $(U)til2bin2.exe del $(U)til2bin2.exe) + $(subst /,\,if exist $(U)thintile.exe del $(U)thintile.exe) + $(subst /,\,if exist $(U)dlb_main.exe del $(U)dlb_main.exe) + $(subst /,\,if exist $(INCL)/vis_tab.h del $(INCL)/vis_tab.h) + $(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h) + $(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h) + $(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h) + $(subst /,\,if exist $(INCL)/dgn_comp.h del $(INCL)/dgn_comp.h) + $(subst /,\,if exist $(INCL)/lev_comp.h del $(INCL)/lev_comp.h) + $(subst /,\,if exist $(SRC)/monstr.c del $(SRC)/monstr.c) + $(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c) + $(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c) + $(subst /,\,if exist $(DAT)/options del $(DAT)/options) + $(subst /,\,if exist $(DAT)/data del $(DAT)/data) + $(subst /,\,if exist $(DAT)/rumors del $(DAT)/rumors) + $(subst /,\,if exist $(DAT)/dungeon.pdf del $(DAT)/dungeon.pdf) + $(subst /,\,if exist $(DAT)/dungeon del $(DAT)/dungeon) + $(subst /,\,if exist $(DAT)/oracles del $(DAT)/oracles) + $(subst /,\,if exist $(DAT)/quest.dat del $(DAT)/quest.dat) + $(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon) + $(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave) + $(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph) + $(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst) + $(subst /,\,if exist $(DAT)/nhdat del $(DAT)/nhdat) + $(subst /,\,if exist $(DAT)/*.lev del $(DAT)/*.lev) + $(subst /,\,if exist $(TILE_BMP) del $(TILE_BMP)) + $(subst /,\,if exist $(WSHR)/monthin.txt del $(WSHR)/monthin.txt) + $(subst /,\,if exist $(WSHR)/objthin.txt del $(WSHR)/objthin.txt) + $(subst /,\,if exist $(WSHR)/oththin.txt del $(WSHR)/oththin.txt) + +#========================================== +# Create directory for holding object files +#========================================== + +$(O)obj.tag: + -$(subst /,\,@if not exist $(OBJ)/*.* mkdir $(OBJ)) + @$(subst /,\,@echo directory created > $@) + +#=========================================== +# Work around some djgpp long file name woes +#=========================================== + +$(PATCHLEV_H): + @$(subst /,\,if not exist $@ copy $(INCL)/patchlevel.h $(INCL)/patchlev.h) + #========================================== # Game Dependencies #========================================== diff --git a/sys/msdos/setup.bat b/sys/msdos/setup.bat index 403b3a69c..8c16863ae 100755 --- a/sys/msdos/setup.bat +++ b/sys/msdos/setup.bat @@ -1,10 +1,10 @@ @echo off REM NetHack 3.6 setup.bat $NHDT-Date: 1432512792 2015/05/25 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ -REM Copyright (c) NetHack PC Development Team 1990 - 2018 +REM Copyright (c) NetHack PC Development Team 1990 - 2019 REM NetHack may be freely redistributed. See license for details. echo. -echo Copyright (c) NetHack PC Development Team 1990 - 2018 +echo Copyright (c) NetHack PC Development Team 1990 - 2019 echo NetHack may be freely redistributed. See license for details. echo. REM setup batch file for msdos, see Install.dos for details. @@ -16,10 +16,9 @@ goto err_set echo Checking to see if directories are set up properly ... if not exist ..\..\include\hack.h goto err_dir if not exist ..\..\src\hack.c goto err_dir -if not exist ..\..\dat\wizard.des goto err_dir +if not exist ..\..\dat\wizard1.lua goto err_dir if not exist ..\..\util\makedefs.c goto err_dir if not exist ..\..\win\tty\wintty.c goto err_dir -if not exist ..\share\lev_yacc.c goto err_dir echo Directories OK. if not exist ..\..\binary\* mkdir ..\..\binary @@ -81,7 +80,7 @@ ren ..\..\sys\share\posixregex.c posixreg.c goto long4ok :long4b echo "Renaming ..\..\sys\share\posixr~1.c -> ..\..\sys\share\posixreg.c" -ren ..\..\sys\share\posixr~1.h posixreg.c +ren ..\..\sys\share\posixr~1.c posixreg.c :long4ok if "%1"=="GCC" goto ok_gcc diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 985778181..c87f68a89 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -5,7 +5,11 @@ #include "curses.h" #include "hack.h" +#ifdef SHORT_FILENAMES +#include "patchlev.h" +#else #include "patchlevel.h" +#endif #include "color.h" #include "wincurs.h" From ad882052298310c520f1610d27b87cc747d85102 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 2 Jul 2019 14:06:14 -0400 Subject: [PATCH 020/296] a bit that crept in from elsewhere --- sys/msdos/setup.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/msdos/setup.bat b/sys/msdos/setup.bat index 8c16863ae..b5c9c9c0b 100755 --- a/sys/msdos/setup.bat +++ b/sys/msdos/setup.bat @@ -16,7 +16,7 @@ goto err_set echo Checking to see if directories are set up properly ... if not exist ..\..\include\hack.h goto err_dir if not exist ..\..\src\hack.c goto err_dir -if not exist ..\..\dat\wizard1.lua goto err_dir +if not exist ..\..\dat\wizard.des goto err_dir if not exist ..\..\util\makedefs.c goto err_dir if not exist ..\..\win\tty\wintty.c goto err_dir echo Directories OK. From 1e7fb839a3a55302457c1e67e400848aa0a0fd9f Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 2 Jul 2019 17:39:23 -0700 Subject: [PATCH 021/296] status_hilite for Xp and Exp by percent rules Extend support for highlight rules that specify percentages from HP and spell power to experience level and experience points. For both of those, the percentage is based on progress from the start of the current Xp level to the start of the next Xp level. 100% isn't possible so is used to enable highlighting a special case: 1 point shy of next level, most likely to occur after losing a level. This is something I had in mind a long time ago and then forgot all about until fiddling with the final disclosure of experience points recently. It turned out to be trickier than expected because it needs to check whether Xp should have a status update when it hasn't changed but Exp has gone up. The latter might hit a percentage threshold that switches to another highlight rule. Fortunately changes to Exp, at least that aren't part of level gain or loss (which always trigger status updating), are all funnelled through a single place (I hope). --- doc/Guidebook.mn | 21 +++++++- doc/Guidebook.tex | 19 ++++++- doc/fixes36.3 | 6 ++- include/extern.h | 3 +- src/botl.c | 134 ++++++++++++++++++++++++++++++++++++++-------- src/exper.c | 11 +++- 6 files changed, 165 insertions(+), 29 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index a2d922a12..7a4ffd8d6 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.305 $ $NHDT-Date: 1557251604 2019/05/07 17:53:24 $ +.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.310 $ $NHDT-Date: 1562114349 2019/07/03 00:39:09 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -4284,7 +4284,24 @@ it also matches when value is below or above the percentage. Use prefix \(oq<\(cq or \(oq>\(cq to match when strictly below or above. (The numeric limit is relaxed slightly for those: \f(CR>-1%\fP and \f(CR<101%\fP are allowed.) -Only valid for \(lqhitpoints\(rq and \(lqpower\(rq fields. +Only four fields support percentage rules. +Percentages for \(lqhitpoints\(rq and \(lqpower\(rq are +straightforward; they're based on the corresponding maximum field. +Percentage highlight rules are also allowed for \(lqexperience level\(rq +and \(lqexperience points\(rq (valid when the +.op showexp +option is enabled). +For those, the percentage is based on the progress from the start of +the current experience level to the start of the next level. +So if level 2 starts at 20 points and level 3 starts at 40 points, +having 30 points is 50% and 35 points is 75%. +100% is unattainable for experience because you'll gain a level and +the calculations will be reset for that new level, but a rule for +\f(CR=100%\fP is allowed and matches the special case of being +exactly 1 experience point short of the next level. +.\" (If you manage to reach level 30, there is no next level and the +.\" percentage will remain at 0% no matter have many additional experience +.\" points you earn.) .lp "*" absolute value sets the attribute when the field value matches that number. diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 1b32dabc7..bc9b5e00f 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -4773,7 +4773,24 @@ it also matches when value is below or above the percentage. Use prefix `{\tt <}' or `{\tt >}' to match when strictly below or above. (The numeric limit is relaxed slightly for those: {\tt >-1\%} and {\tt <101\%} are allowed.) -Only valid for ``{\it hitpoints\/}'' and ``{\it power\/}'' fields. +Only four fields support percentage rules. +Percentages for ``{\it hitpoints\/}'' and ``{\it power\/}'' are +straightforward; they're based on the corresponding maximum field. +Percentage highlight rules are also allowed for ``{\it experience level\/}'' +and ``{\it experience points\/}'' (valid when the +(\it showexp\/} +option is enabled). +For those, the percentage is based on the progress from the start of +the current experience level to the start of the next level. +So if level 2 starts at 20 points and level 3 starts at 40 points, +having 30 points is 50\% and 35 points is 75\%. +100\% is unattainable for experience because you'll gain a level and +the calculations will be reset for that new level, but a rule for +{\tt =100\%} is allowed and matches the special case of being +exactly 1 experience point short of the next level. +% (If you manage to reach level 30, there is no next level and the +% percentage will remain at 0\% no matter have many additional experience +% points you earn.) %.lp "*" \item{\bb{}} absolute value sets the attribute when the field value diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 2cec56c67..22532246b 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.81 $ $NHDT-Date: 1562056615 2019/07/02 08:36:55 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.83 $ $NHDT-Date: 1562114348 2019/07/03 00:39:08 $ 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, @@ -206,6 +206,10 @@ if you reach the edge of a level (relatively uncommon) and try to move off, 'attributes' disclosure at end of game includes number of experience points that were needed to reach the next experience level (new for normal play and explore mode; previously only shown for wizard mode) +status highlighting using percentage rules now supported for experience level + and experience points; for both, percent is based on Exp progress from + the start of the current Xp level to the start of the next Xp level; + 100% isn't possible so used as special case for next_Xp_lvl - 1 Exp_pt wizard-mode: display effect to show where an unseen wished-for monster landed curses: enable latent mouse support curses: give menus and text windows a minimum size of 5x25 since tiny ones can diff --git a/include/extern.h b/include/extern.h index a64b98783..90548cf37 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1560161804 2019/06/10 10:16:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.714 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1562114349 2019/07/03 00:39:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.715 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -177,6 +177,7 @@ E long NDECL(botl_score); E int FDECL(describe_level, (char *)); E void FDECL(status_initialize, (BOOLEAN_P)); E void NDECL(status_finish); +E boolean NDECL(exp_percent_changing); E int NDECL(stat_cap_indx); E int NDECL(stat_hunger_indx); E const char *FDECL(bl_idx_to_fldname, (int)); diff --git a/src/botl.c b/src/botl.c index f43c0f498..06f0a01b5 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.c $NHDT-Date: 1557094795 2019/05/05 22:19:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.145 $ */ +/* NetHack 3.6 botl.c $NHDT-Date: 1562114350 2019/07/03 00:39:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.146 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -433,6 +433,8 @@ struct istat_s { const char *fldfmt; long time; /* moves when this field hilite times out */ boolean chg; /* need to recalc time? */ + boolean percent_matters; + short percent_value; unsigned anytype; anything a; char *val; @@ -452,6 +454,7 @@ STATIC_DCL void NDECL(init_blstats); STATIC_DCL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *)); STATIC_DCL char *FDECL(anything_to_s, (char *, anything *, int)); STATIC_DCL int FDECL(percentage, (struct istat_s *, struct istat_s *)); +STATIC_DCL int NDECL(exp_percentage); #ifdef STATUS_HILITES STATIC_DCL void FDECL(s_to_anything, (anything *, char *, int)); @@ -498,14 +501,18 @@ STATIC_DCL boolean FDECL(status_hilite_menu_add, (int)); #define INIT_THRESH /*empty*/ #endif -#define INIT_BLSTAT(name, fmtstr, anytyp, wid, fld) \ - { name, fmtstr, 0L, FALSE, anytyp, { (genericptr_t) 0 }, (char *) 0, \ +#define INIT_BLSTAT(name, fmtstr, anytyp, wid, fld) \ + { name, fmtstr, 0L, FALSE, FALSE, 0, anytyp, \ + { (genericptr_t) 0 }, (char *) 0, \ wid, -1, fld INIT_THRESH } -#define INIT_BLSTATP(name, fmtstr, anytyp, wid, maxfld, fld) \ - { name, fmtstr, 0L, FALSE, anytyp, { (genericptr_t) 0 }, (char *) 0, \ +#define INIT_BLSTATP(name, fmtstr, anytyp, wid, maxfld, fld) \ + { name, fmtstr, 0L, FALSE, TRUE, 0, anytyp, \ + { (genericptr_t) 0 }, (char *) 0, \ wid, maxfld, fld INIT_THRESH } -/* If entries are added to this, botl.h will require updating too */ +/* If entries are added to this, botl.h will require updating too. + 'max' value of BL_EXP gets special handling since the percentage + involved isn't a direct 100*current/maximum calculation. */ STATIC_VAR struct istat_s initblstats[MAXBLSTATS] = { INIT_BLSTAT("title", "%s", ANY_STR, MAXVALWIDTH, BL_TITLE), INIT_BLSTAT("strength", " St:%s", ANY_INT, 10, BL_STR), @@ -520,7 +527,7 @@ STATIC_VAR struct istat_s initblstats[MAXBLSTATS] = { INIT_BLSTAT("gold", " %s", ANY_LONG, 30, BL_GOLD), INIT_BLSTATP("power", " Pw:%s", ANY_INT, 10, BL_ENEMAX, BL_ENE), INIT_BLSTAT("power-max", "(%s)", ANY_INT, 10, BL_ENEMAX), - INIT_BLSTAT("experience-level", " Xp:%s", ANY_INT, 10, BL_XP), + INIT_BLSTATP("experience-level", " Xp:%s", ANY_INT, 10, BL_EXP, BL_XP), INIT_BLSTAT("armor-class", " AC:%s", ANY_INT, 10, BL_AC), INIT_BLSTAT("HD", " HD:%s", ANY_INT, 10, BL_HD), INIT_BLSTAT("time", " T:%s", ANY_LONG, 20, BL_TIME), @@ -529,7 +536,7 @@ STATIC_VAR struct istat_s initblstats[MAXBLSTATS] = { INIT_BLSTATP("hitpoints", " HP:%s", ANY_INT, 10, BL_HPMAX, BL_HP), INIT_BLSTAT("hitpoints-max", "(%s)", ANY_INT, 10, BL_HPMAX), INIT_BLSTAT("dungeon-level", "%s", ANY_STR, MAXVALWIDTH, BL_LEVELDESC), - INIT_BLSTAT("experience", "/%s", ANY_LONG, 20, BL_EXP), + INIT_BLSTATP("experience", "/%s", ANY_LONG, 20, BL_EXP, BL_EXP), INIT_BLSTAT("condition", "%s", ANY_MASK32, 0, BL_CONDITION) }; @@ -763,8 +770,8 @@ boolean *valsetlist; int pc, chg, color = NO_COLOR; unsigned anytype; boolean updated = FALSE, reset; - struct istat_s *curr = NULL, *prev = NULL; - enum statusfields idxmax; + struct istat_s *curr, *prev; + enum statusfields fldmax; /* * Now pass the changed values to window port. @@ -775,6 +782,31 @@ boolean *valsetlist; color = NO_COLOR; chg = update_all ? 0 : compare_blstats(prev, curr); + /* + * TODO: + * Dynamically update 'percent_matters' as rules are added or + * removed to track whether any of them are precentage rules. + * Then there'll be no need to assume that non-Null 'thresholds' + * means that percentages need to be kept up to date. + * [Affects exp_percent_changing() too.] + */ + if (((chg || update_all || fld == BL_XP) + && curr->percent_matters && curr->thresholds) + /* when 'hitpointbar' is On, percent matters even if HP + hasn't changed and has no percentage rules (in case HPmax + has changed when HP hasn't, where we ordinarily wouldn't + update HP so would miss an update of the hitpoint bar) */ + || (fld == BL_HP && iflags.wc2_hitpointbar)) { + fldmax = curr->idxmax; + pc = (fldmax == BL_EXP) ? exp_percentage() + : (fldmax >= 0) ? percentage(curr, &blstats[idx][fldmax]) + : 0; /* bullet proofing; can't get here */ + if (pc != prev->percent_value) + chg = 1; + curr->percent_value = pc; + } else { + pc = 0; + } /* Temporary? hack: moveloop()'s prolog for a new game sets * context.rndencode after the status window has been init'd, @@ -811,19 +843,7 @@ boolean *valsetlist; } #endif - /* - * TODO? - * It's possible for HPmax (or ENEmax) to change while current - * HP (or energy) stays the same. [Perhaps current and maximum - * both go up, then before the next status update takes place - * current goes down again.] If that happens with HPmax, we - * ought to force the windowport to treat current HP as changed - * if hitpointbar is On, in order for that to be re-rendered. - */ if (update_all || chg || reset) { - idxmax = curr->idxmax; - pc = (idxmax >= 0) ? percentage(curr, &blstats[idx][idxmax]) : 0; - if (!valsetlist[fld]) (void) anything_to_s(curr->val, &curr->a, anytype); @@ -943,6 +963,7 @@ boolean reassessment; /* TRUE: just recheck fields w/o other initialization */ status_enablefield(fld, fieldname, fieldfmt, fldenabl); } update_all = TRUE; + context.botlx = TRUE; } void @@ -1260,6 +1281,75 @@ struct istat_s *bl, *maxbl; return result; } +/* percentage for both xp (level) and exp (points) is the percentage for + (curr_exp - this_level_start) in (next_level_start - this_level_start) */ +STATIC_OVL int +exp_percentage() +{ + int res = 0; + + if (u.ulevel < 30) { + long exp_val, nxt_exp_val, curlvlstart; + + curlvlstart = newuexp(u.ulevel - 1); + exp_val = u.uexp - curlvlstart; + nxt_exp_val = newuexp(u.ulevel) - curlvlstart; + if (exp_val == nxt_exp_val - 1L) { + /* + * Full 100% is unattainable since hero gains a level + * and the threshold for next level increases, but treat + * (next_level_start - 1 point) as a special case. It's a + * key value after being level drained so is something that + * some players would like to be able to highlight distinctly. + */ + res = 100; + } else { + struct istat_s curval, maxval; + + curval.anytype = maxval.anytype = ANY_LONG; + curval.a = maxval.a = zeroany; + curval.a.a_long = exp_val; + maxval.a.a_long = nxt_exp_val; + /* maximum delta between levels is 10000000; calculation of + 100 * (10000000 - N) / 10000000 fits within 32-bit long */ + res = percentage(&curval, &maxval); + } + } + return res; +} + +/* experience points have changed but experience level hasn't; decide whether + botl update is needed for a different percentage highlight rule for Xp */ +boolean +exp_percent_changing() +{ + int pc, color_dummy; + anything a; + struct hilite_s *rule; + struct istat_s *curr; + + /* if status update is already requested, skip this processing */ + if (!context.botl) { + /* + * Status update is warranted iff percent integer changes and the new + * percentage results in a different highlighting rule being selected. + */ + curr = &blstats[now_or_before_idx][BL_XP]; + /* TODO: [see eval_notify_windowport_field() about percent_matters + and the check against 'thresholds'] */ + if (curr->percent_matters && curr->thresholds + && (pc = exp_percentage()) != curr->percent_value) { + a = zeroany; + a.a_int = (int) u.ulevel; + rule = get_hilite(now_or_before_idx, BL_XP, + (genericptr_t) &a, 0, pc, &color_dummy); + if (rule != curr->hilite_rule) + return TRUE; /* caller should set 'context.botl' to True */ + } + } + return FALSE; +} + /* callback so that interface can get capacity index rather than trying to reconstruct that from the encumbrance string or asking the general core what the value is */ diff --git a/src/exper.c b/src/exper.c index 0cead3e97..9b96b5c43 100644 --- a/src/exper.c +++ b/src/exper.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 exper.c $NHDT-Date: 1553296396 2019/03/22 23:13:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.32 $ */ +/* NetHack 3.6 exper.c $NHDT-Date: 1562114352 2019/07/03 00:39:12 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.33 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2007. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,6 +14,8 @@ long newuexp(lev) int lev; { + if (lev < 1) /* for newuexp(u.ulevel - 1) when u.ulevel is 1 */ + return 0L; if (lev < 10) return (10L * (1L << lev)); if (lev < 20) @@ -177,6 +179,11 @@ register int exper, rexp; u.uexp = newexp; if (flags.showexp) context.botl = TRUE; + /* even when experience points aren't being shown, experience level + might be highlighted with a percentage highlight rule and that + percentage depends upon experience points */ + if (!context.botl && exp_percent_changing()) + context.botl = TRUE; } /* newrexp will always differ from oldrexp unless they're LONG_MAX */ if (newrexp != oldrexp) { @@ -303,7 +310,7 @@ boolean incr; /* true iff via incremental experience growth */ } ++u.ulevel; pline("Welcome %sto experience level %d.", - u.ulevelmax < u.ulevel ? "" : "back ", + (u.ulevelmax < u.ulevel) ? "" : "back ", u.ulevel); if (u.ulevelmax < u.ulevel) u.ulevelmax = u.ulevel; From efbe179f64c0ad9e062940e7227dd71605ce72bb Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 2 Jul 2019 22:05:36 -0400 Subject: [PATCH 022/296] fix the msdos build for NetHack-3.7 --- include/decl.h | 6 +++--- src/files.c | 24 +++++++++++++++++++++--- sys/msdos/vidvesa.c | 4 ++-- sys/msdos/vidvga.c | 4 ++-- sys/share/pcmain.c | 41 +++++++++++++++++++++-------------------- 5 files changed, 49 insertions(+), 30 deletions(-) diff --git a/include/decl.h b/include/decl.h index 1ff73009c..05aa7f895 100644 --- a/include/decl.h +++ b/include/decl.h @@ -7,13 +7,13 @@ #define DECL_H #define E extern -#if !defined(MFLOPPY) && !defined(VMS) && !defined(WIN32) +#if !defined(MICRO) && !defined(VMS) && !defined(WIN32) #define LOCKNAMESIZE (PL_NSIZ + 14) /* long enough for uid+name+.99 */ #define LOCKNAMEINIT "1lock" #define BONESINIT "bonesnn.xxx" #define BONESSIZE sizeof(BONESINIT) #else -#if defined(MFLOPPY) +#if defined(MICRO) #define LOCKNAMESIZE FILENAME #define LOCKNAMEINIT "" #define BONESINIT "" @@ -52,7 +52,7 @@ #define SAVEX "" #if !defined(SAVE_EXTENSION) #ifdef MICRO -#define SAVE_EXTENSION ".sav" +#define SAVE_EXTENSION ".svh" #endif #ifdef WIN32 #define SAVE_EXTENSION ".NetHack-saved-game" diff --git a/src/files.c b/src/files.c index 7e3748b44..2e8745fe3 100644 --- a/src/files.c +++ b/src/files.c @@ -1045,7 +1045,14 @@ boolean regularize_it; regoffset = 5; indicator_spot = 2; #endif -#if defined(MICRO) && !defined(VMS) && !defined(WIN32) +#if defined(MSDOS) + if (strlen(g.SAVEP) < (SAVESIZE - 1)) + Strcpy(g.SAVEF, g.SAVEP); + if (strlen(g.SAVEF) < (SAVESIZE - 1)) + (void) strncat(g.SAVEF, g.plname, + (SAVESIZE - strlen(g.SAVEF))); +#endif +#if defined(MICRO) && !defined(VMS) && !defined(WIN32) && !defined(MSDOS) if (strlen(g.SAVEP) < (SAVESIZE - 1)) Strcpy(g.SAVEF, g.SAVEP); else @@ -1076,9 +1083,20 @@ boolean regularize_it; } #ifdef SAVE_EXTENSION if (strlen(SAVE_EXTENSION) > 0 && !overflow) { - if (strlen(g.SAVEF) + strlen(SAVE_EXTENSION) < (SAVESIZE - 1)) + if (strlen(g.SAVEF) + strlen(SAVE_EXTENSION) < (SAVESIZE - 1)) { Strcat(g.SAVEF, SAVE_EXTENSION); - else +#ifdef MSDOS +#ifdef SYSCF + if (idx >= historical && idx <= ascii) { + /* we did leave room for the extra char in SAVE_EXTENSION */ + g.SAVEF[strlen(g.SAVEF)-1] = + (idx == lendian) ? 'l' : + (idx == ascii) ? 'a' : '\0'; + } + sfindicator = sfoprocs[idx].ext; +#endif +#endif + } else overflow = 3; } #endif diff --git a/sys/msdos/vidvesa.c b/sys/msdos/vidvesa.c index e9b7bb183..65ae2e845 100644 --- a/sys/msdos/vidvesa.c +++ b/sys/msdos/vidvesa.c @@ -62,7 +62,7 @@ extern int attrib_text_normal; /* text mode normal attribute */ extern int attrib_gr_normal; /* graphics mode normal attribute */ extern int attrib_gr_intense; /* graphics mode intense attribute */ extern boolean inmap; /* in the map window */ -extern boolean restoring; +/* extern boolean g.restoring; */ /* * Global Variables @@ -609,7 +609,7 @@ int x, y; clipx = clipxmax - (viewport_size - 1); } if (clipx != oldx) { - if (on_level(&u.uz0, &u.uz) && !restoring) + if (on_level(&u.uz0, &u.uz) && !g.restoring) /* (void) doredraw(); */ vesa_redrawmap(); } diff --git a/sys/msdos/vidvga.c b/sys/msdos/vidvga.c index 4e8a18206..13c873737 100644 --- a/sys/msdos/vidvga.c +++ b/sys/msdos/vidvga.c @@ -435,7 +435,7 @@ static void vga_cliparound(x, y) int x, y; { - extern boolean restoring; +/* extern boolean g.restoring; */ int oldx = clipx; if (!iflags.tile_view || iflags.over_view || iflags.traditional_view) @@ -449,7 +449,7 @@ int x, y; clipx = clipxmax - (viewport_size - 1); } if (clipx != oldx) { - if (on_level(&u.uz0, &u.uz) && !restoring) + if (on_level(&u.uz0, &u.uz) && !g.restoring) /* (void) doredraw(); */ vga_redrawmap(1); } diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 6c59b8c00..a48f974b3 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -7,6 +7,7 @@ #include "hack.h" #include "dlb.h" +#include "sfproto.h" #ifndef NO_SIGNAL #include @@ -185,17 +186,17 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ int fd; boolean have_syscf = FALSE; - (void) strncpy(hackdir, dir, PATHLEN - 1); - hackdir[PATHLEN - 1] = '\0'; + (void) strncpy(g.hackdir, dir, PATHLEN - 1); + g.hackdir[PATHLEN - 1] = '\0'; #ifdef NOCWD_ASSUMPTIONS { int prefcnt; - fqn_prefix[0] = (char *) alloc(strlen(hackdir) + 2); - Strcpy(fqn_prefix[0], hackdir); - append_slash(fqn_prefix[0]); + g.fqn_prefix[0] = (char *) alloc(strlen(g.hackdir) + 2); + Strcpy(g.fqn_prefix[0], g.hackdir); + append_slash(g.fqn_prefix[0]); for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++) - fqn_prefix[prefcnt] = fqn_prefix[0]; + g.fqn_prefix[prefcnt] = g.fqn_prefix[0]; #if defined(MSDOS) /* sysconf should be searched for in this location */ @@ -204,11 +205,11 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ if ((sptr = index(envp, ';')) != 0) *sptr = '\0'; if (strlen(envp) > 0) { - fqn_prefix[SYSCONFPREFIX] = + g.fqn_prefix[SYSCONFPREFIX] = (char *) alloc(strlen(envp) + 10); - Strcpy(fqn_prefix[SYSCONFPREFIX], envp); - append_slash(fqn_prefix[SYSCONFPREFIX]); - Strcat(fqn_prefix[SYSCONFPREFIX], "NetHack\\"); + Strcpy(g.fqn_prefix[SYSCONFPREFIX], envp); + append_slash(g.fqn_prefix[SYSCONFPREFIX]); + Strcat(g.fqn_prefix[SYSCONFPREFIX], "NetHack\\"); } } @@ -229,7 +230,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ /* No SYSCF_FILE where there should be one, and without an installer, a user may not be able to place one there. So, let's try somewhere else... */ - fqn_prefix[SYSCONFPREFIX] = fqn_prefix[0]; + g.fqn_prefix[SYSCONFPREFIX] = g.fqn_prefix[0]; /* Is there a SYSCF_FILE there? */ fd = open(fqname(SYSCF_FILE, SYSCONFPREFIX, 0), O_RDONLY); @@ -247,10 +248,10 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ if ((sptr = index(envp, ';')) != 0) *sptr = '\0'; if (strlen(envp) > 0) { - fqn_prefix[CONFIGPREFIX] = + g.fqn_prefix[CONFIGPREFIX] = (char *) alloc(strlen(envp) + 2); - Strcpy(fqn_prefix[CONFIGPREFIX], envp); - append_slash(fqn_prefix[CONFIGPREFIX]); + Strcpy(g.fqn_prefix[CONFIGPREFIX], envp); + append_slash(g.fqn_prefix[CONFIGPREFIX]); } } #endif @@ -286,11 +287,11 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ if (iflags.BIOS && iflags.use_color) set_colors(); #endif - if (!hackdir[0]) + if (!g.hackdir[0]) #if !defined(LATTICE) && !defined(AMIGA) - Strcpy(hackdir, orgdir); + Strcpy(g.hackdir, orgdir); #else - Strcpy(hackdir, HACKDIR); + Strcpy(g.hackdir, HACKDIR); #endif if (argc > 1) { if (argcheck(argc, argv, ARG_VERSION) == 2) @@ -317,7 +318,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ } if (!*dir) error("Flag -d must be followed by a directory name."); - Strcpy(hackdir, dir); + Strcpy(g.hackdir, dir); } if (argc > 1) { /* @@ -326,7 +327,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ */ if (!strncmp(argv[1], "-s", 2)) { #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) - chdirx(hackdir, 0); + chdirx(g.hackdir, 0); #endif #ifdef SYSCF initoptions(); @@ -366,7 +367,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ * code parallel to other ports. */ #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) - chdirx(hackdir, 1); + chdirx(g.hackdir, 1); #endif #if defined(MSDOS) From 25ea6c8f3c936d203001ca5120e86e737d0b1d5f Mon Sep 17 00:00:00 2001 From: Bart House Date: Tue, 2 Jul 2019 19:08:50 -0700 Subject: [PATCH 023/296] Fix crash that can occur in decode_mixed. If a player names an object with a name that ends in '\\', drops that object on the floor nearby and does a look at nearby objects, then the game will crash. This is caused by stack corruption when the decode loop skips over the decode string terminator. --- src/mapglyph.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mapglyph.c b/src/mapglyph.c index 079150657..347ff25a2 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -313,6 +313,15 @@ const char *str; #endif case '\\': break; + case '\0': + /* String ended with '\\'. This can happen when someone + names an object with a name ending with '\\', drops the + named object on the floor nearby and does a look at all + nearby objects. */ + /* brh - should we perhaps not allow things to have names + that contain '\\' */ + str = save_str; + break; } } *put++ = *str++; From 88a48cd6ffb329191233ca2db19874a661946753 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 3 Jul 2019 11:57:19 -0700 Subject: [PATCH 024/296] makedefs dat/options TERMINFO Noticed after building a curses-only binary; configuration setting "terminal info library" is only of interest as an optional feature when the build includes tty. There were several other settings that apply to some interfaces and not others but would be listed if the feature was defined (possibly after building for an interface which supported it, then left in place when switching to another which doesn't). I left most of those with commented out conditionals in case other interfaces start supporting them. So you might still get something like "tiles file in XPM format" for a binary that doesn't support tiles if USE_XPM has been defined for some reason. --- util/makedefs.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/util/makedefs.c b/util/makedefs.c index 813b649e7..42108cc79 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 makedefs.c $NHDT-Date: 1557254354 2019/05/07 18:39:14 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.145 $ */ +/* NetHack 3.6 makedefs.c $NHDT-Date: 1562180226 2019/07/03 18:57:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* Copyright (c) M. Stephenson, 1990, 1991. */ @@ -1526,9 +1526,11 @@ static const char *build_opts[] = { #ifdef TEXTCOLOR "color", #endif +#ifdef TTY_GRAPHICS #ifdef TTY_TILES_ESCCODES "console escape codes for tile hinting", #endif +#endif #ifdef COM_COMPL "command line completion", #endif @@ -1653,20 +1655,25 @@ static const char *build_opts[] = { #ifdef SUSPEND "suspend command", #endif +#ifdef TTY_GRAPHICS #ifdef TERMINFO "terminal info library", #else -#if defined(TERMLIB) \ - || ((!defined(MICRO) && !defined(WIN32)) && defined(TTY_GRAPHICS)) +#if defined(TERMLIB) || (!defined(MICRO) && !defined(WIN32)) "terminal capability library", #endif #endif +#endif /*TTY_GRAPHICS*/ +/*#ifdef X11_GRAPHICS*/ #ifdef USE_XPM - "tile_file in XPM format", + "tiles file in XPM format", #endif +/*#endif*/ +/*#if (defined(QT_GRAPHICS) || defined(X11_GRAPHICS)*/ #ifdef GRAPHIC_TOMBSTONE "graphical RIP screen", #endif +/*#endif*/ #ifdef TIMED_DELAY "timed wait for display effects", #endif @@ -1719,25 +1726,25 @@ static struct win_info window_opts[] = { #ifdef X11_GRAPHICS { "X11", "X11" }, #endif -#ifdef QT_GRAPHICS +#ifdef QT_GRAPHICS /* too vague; there are multiple incompatible versions */ { "Qt", "Qt" }, #endif -#ifdef GNOME_GRAPHICS +#ifdef GNOME_GRAPHICS /* unmaintained/defunct */ { "Gnome", "Gnome" }, #endif -#ifdef MAC +#ifdef MAC /* defunct OS 9 interface */ { "mac", "Mac" }, #endif -#ifdef AMIGA_INTUITION +#ifdef AMIGA_INTUITION /* unmaintained/defunct */ { "amii", "Amiga Intuition" }, #endif -#ifdef GEM_GRAPHICS +#ifdef GEM_GRAPHICS /* defunct Atari interface */ { "Gem", "Gem" }, #endif -#ifdef MSWIN_GRAPHICS +#ifdef MSWIN_GRAPHICS /* win32 */ { "mswin", "mswin" }, #endif -#ifdef BEOS_GRAPHICS +#ifdef BEOS_GRAPHICS /* unmaintained/defunct */ { "BeOS", "BeOS InterfaceKit" }, #endif { 0, 0 } From 4a74968a5890a387d346004d8bfd08b6cadfb4c6 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 3 Jul 2019 13:43:24 -0700 Subject: [PATCH 025/296] shk doname for containers Rescue some old code from bit rot. It may be useful if the shop side of things ever gets fixed. (Itemized billing reveals container contents. I'm sure that it's in the bugzilla list but can't find it.) --- src/objnam.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/objnam.c b/src/objnam.c index 0992fb518..bb876dfd8 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objnam.c $NHDT-Date: 1561081353 2019/06/21 01:42:33 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.244 $ */ +/* NetHack 3.6 objnam.c $NHDT-Date: 1562186589 2019/07/03 20:43:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.245 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1838,6 +1838,30 @@ struct obj *obj; return s; } +#if 0 /* stalled-out work in progress */ +/* Doname2() for itemized buying of 'obj' from a shop */ +char * +payDoname(obj) +struct obj *obj; +{ + static const char and_contents[] = " and its contents"; + char *p = doname(obj); + + if (Is_container(obj) && !obj->cknown) { + if (obj->unpaid) { + if ((int) strlen(p) + sizeof and_contents - 1 < BUFSZ - PREFIX) + Strcat(p, and_contents); + *p = highc(*p); + } else { + p = strprepend(p, "Contents of "); + } + } else { + *p = highc(*p); + } + return p; +} +#endif /*0*/ + /* returns "[your ]xname(obj)" or "Foobar's xname(obj)" or "the xname(obj)" */ char * yname(obj) From 8762c9498e9b2a533e9b758a4d55477e7eca7fd0 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 3 Jul 2019 14:05:19 -0700 Subject: [PATCH 026/296] couple of 3.7 build warnings --- src/dungeon.c | 6 +++--- sys/unix/unixmain.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/dungeon.c b/src/dungeon.c index 95c4a6cdb..180ba601a 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dungeon.c $NHDT-Date: 1559476918 2019/06/02 12:01:58 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.95 $ */ +/* NetHack 3.6 dungeon.c $NHDT-Date: 1562187890 2019/07/03 21:04:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.105 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -153,7 +153,7 @@ boolean perform_write, free_data; for (i = 0; i < g.n_dgns; ++i) sfo_dungeon(nhfp, &g.dungeons[i], "dungeon", "dungeon", 1); sfo_dgn_topology(nhfp, &g.dungeon_topology, "dungeon", "g.dungeon_topology", 1); - for (i = 0; i < sizeof tune; ++i) + for (i = 0; i < (int) sizeof tune; ++i) sfo_char(nhfp, &g.tune[i], "dungeon", "tune", 1); } for (count = 0, curr = g.branches; curr; curr = curr->next) @@ -234,7 +234,7 @@ NHFILE *nhfp; for (i = 0; i < g.n_dgns; ++i) sfi_dungeon(nhfp, &g.dungeons[i], "dungeon", "dungeon", 1); sfi_dgn_topology(nhfp, &g.dungeon_topology, "dungeon", "g.dungeon_topology", 1); - for (i = 0; i < sizeof tune; ++i) + for (i = 0; i < (int) sizeof tune; ++i) sfi_char(nhfp, &g.tune[i], "dungeon", "tune", 1); } last = g.branches = (branch *) 0; diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index bef1ffa51..23d6d55e9 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 unixmain.c $NHDT-Date: 1432512788 2015/05/25 00:13:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.52 $ */ +/* NetHack 3.6 unixmain.c $NHDT-Date: 1562187898 2019/07/03 21:04:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.78 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -50,7 +50,6 @@ main(argc, argv) int argc; char *argv[]; { - register int fd; #ifdef CHDIR register char *dir; #endif From 46b269fc0dfc0465230a313d621c25edbfeeb6d4 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 3 Jul 2019 14:06:53 -0700 Subject: [PATCH 027/296] 3.7 potential status conditions Something else rescued from bit rot. Just a comment... --- include/botl.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/include/botl.h b/include/botl.h index b7f4477b0..d3225153a 100644 --- a/include/botl.h +++ b/include/botl.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.h $NHDT-Date: 1554591222 2019/04/06 22:53:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.24 $ */ +/* NetHack 3.6 botl.h $NHDT-Date: 1562187996 2019/07/03 21:06:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.27 $ */ /* Copyright (c) Michael Allison, 2003 */ /* NetHack may be freely redistributed. See license for details. */ @@ -70,6 +70,56 @@ enum relationships { NO_LTEQGT = -1, #define BL_MASK_BITS 13 /* number of mask bits that can be set */ /* clang-format on */ +/* + * Possible additional conditions: + * major: + * grab - grabbed by eel so about to be drowned ("wrapd"? damage type + * is AD_WRAP but message is " swings itself around you") + * digst - swallowed and being digested + * lava - trapped sinking into lava + * in_between: (potentially severe but don't necessarily lead to death; + * explains to player why he isn't getting to take any turns) + * unconc - unconscious + * parlyz - (multi < 0 && (!strncmp(multi_reason, "paralyzed", 9) + * || !strncmp(multi_reason, "frozen", 6))) + * asleep - (multi < 0 && !strncmp(multi_reason, "sleeping", 8)) + * busy - other multi < 0 + * minor: + * held - grabbed by non-eel or by eel but not susceptible to drowning + * englf - engulfed or swallowed but not being digested (usually + * obvious but the blank symbol set makes that uncertain) + * vomit - vomiting (causes confusion and stun late in countdown) + * trap - trapped in pit, bear trap, web, or floor (solidified lava) + * teth - tethered to buried iron ball + * chain - punished + * slip - slippery fingers + * ice - standing on ice (movement becomes uncertain) + * [underwater - movement uncertain, vision truncated, equipment at risk] + * other: + * [hold - poly'd into grabber and holding adjacent monster] + * Stormbringer - wielded weapon poses risks + * Cleaver - wielded weapon risks unintended consequences + * barehand - not wielding any weapon nor wearing gloves + * no-weapon - not wielding any weapon + * bow/xbow/sling - wielding a missile launcher of specified type + * pole - wielding a polearm + * pick - wielding a pickaxe + * junk - wielding non-weapon, non-weptool + * naked - no armor + * no-gloves - self-explanatory + * no-cloak - ditto + * [no-{other armor slots?} - probably much too verbose] + * conduct? + * [maybe if third status line is added] + * + * Can't add all of these and probably don't want to. But maybe we + * can add some of them and it's not as many as first appears: + * lava/trap/teth are mutually exclusive; + * digst/grab/englf/held/hold are also mutually exclusive; + * Stormbringer/Cleaver/barehand/no-weapon/bow&c/pole/pick/junk too; + * naked/no-{any armor slot} likewise. + */ + #define VIA_WINDOWPORT() \ ((windowprocs.wincap2 & (WC2_HILITE_STATUS | WC2_FLUSH_STATUS)) != 0) From c62db0de3887ee8027cb8457f56af383701fd260 Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 3 Jul 2019 18:32:40 -0400 Subject: [PATCH 028/296] curses link fix in 3.7 --- win/curses/cursmesg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 95d56ae4d..c0f4ac218 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -887,7 +887,7 @@ boolean restoring_msghist; static int stash_count; static nhprev_mesg *stash_head = 0; #ifdef DUMPLOG - extern unsigned saved_pline_index; /* pline.c */ +/* extern unsigned g.saved_pline_index; */ /* pline.c */ #endif if (restoring_msghist && !initd) { @@ -900,7 +900,7 @@ boolean restoring_msghist; initd = TRUE; #ifdef DUMPLOG /* this suffices; there's no need to scrub saved_pline[] pointers */ - saved_pline_index = 0; + g.saved_pline_index = 0; #endif } From 79ff4cd9c30a5b93b15f7c316e88907608b15f91 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 3 Jul 2019 18:30:55 -0700 Subject: [PATCH 029/296] fix github issue #202 - worn items inside engulfer Fixes #202 When swallowed, you can take things from the engulfer's inventory, if there are any, via pickup. Items might be worn by the engulfer and when "picked up" those weren't being unworn before being added to hero's inventory. Then they would be formatted as "(being worn)" and could trigger warnings or worse. Conceptually they should be worn on the outside and not be accessible from the inside, so I've made attempts to pick up worn items fail rather than fix up the unwearing. Using ':' when swallowed to look at the engulfer's inventory describes that inventory as "contents of 's stomach". That's weird for any worn items, but the situation is so rare I haven't made any attempt to deal with it. --- doc/fixes36.3 | 6 +++++- src/invent.c | 17 ++++++++++++++++- src/pickup.c | 44 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 22532246b..52aa675e4 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.83 $ $NHDT-Date: 1562114348 2019/07/03 00:39:08 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.84 $ $NHDT-Date: 1562203850 2019/07/04 01:30:50 $ 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, @@ -94,6 +94,10 @@ saving bones with 'perm_invent' On could result in "Bad fruit #N" warnings update persistent inventory window immediately if 'sortpack' option is toggled grammar bit for wizard mode final disclosure; attribute section could show "You had N experience points, 1 more were needed to attain level X+1." +if an engulfer has any worn items, hero could pick them up from inside and + they wouldn't be unworn properly, eventually triggering warnings or + worse (Juiblex will wear an amulet if created with one; a shapechanger + might wear one and then turn into an engulfer) Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/invent.c b/src/invent.c index fc76a57a4..fe21fa7b4 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 invent.c $NHDT-Date: 1561751391 2019/06/28 19:49:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.260 $ */ +/* NetHack 3.6 invent.c $NHDT-Date: 1562203850 2019/07/04 01:30:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.261 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3372,6 +3372,21 @@ boolean picked_some; if (u.uswallow && u.ustuck) { struct monst *mtmp = u.ustuck; + /* + * FIXME? + * Engulfer's inventory can include worn items (specific case is + * Juiblex being created with an amulet as random defensive item) + * which will be flagged as "(being worn)". This code includes + * such a worn item under the header "Contents of 's stomach", + * a nifty trick for how/where to wear stuff. The situation is + * rare enough to turn a blind eye. + * + * 3.6.3: Pickup has been changed to decline to pick up a worn + * item from inside an engulfer, but if player tries, it just + * says "you can't" without giving a reason why (which would be + * something along the lines of "because it's worn on the outside + * so is unreachable from in here..."). + */ Sprintf(fbuf, "Contents of %s %s", s_suffix(mon_nam(mtmp)), mbodypart(mtmp, STOMACH)); /* Skip "Contents of " by using fbuf index 12 */ diff --git a/src/pickup.c b/src/pickup.c index 77356b1fe..fe25f8a0f 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pickup.c $NHDT-Date: 1559675617 2019/06/04 19:13:37 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.228 $ */ +/* NetHack 3.6 pickup.c $NHDT-Date: 1562203851 2019/07/04 01:30:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.229 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -840,7 +840,8 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ anything any; boolean printed_type_name, first, sorted = (qflags & INVORDER_SORT) != 0, - engulfer = (qflags & INCLUDE_HERO) != 0; + engulfer = (qflags & INCLUDE_HERO) != 0, + engulfer_minvent; unsigned sortflags; Loot *sortedolist, *srtoli; @@ -854,6 +855,13 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ last = curr; n++; } + /* can't depend upon 'engulfer' because that's used to indicate whether + hero should be shown as an extra, fake item */ + engulfer_minvent = (olist && olist->where == OBJ_MINVENT + && u.uswallow && olist->ocarry == u.ustuck); + if (engulfer_minvent && n == 1 && olist->owornmask != 0L) { + qflags &= ~AUTOSELECT_SINGLE; + } if (engulfer) { ++n; /* don't autoselect swallowed hero if it's the only choice */ @@ -957,10 +965,20 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ /* fix up counts: -1 means no count used => pick all; if fake_hero_object was picked, discard that choice */ for (i = k = 0, mi = *pick_list; i < n; i++, mi++) { - if (mi->item.a_obj == &fake_hero_object) + curr = mi->item.a_obj; + if (curr == &fake_hero_object) { + /* this isn't actually possible; fake item representing + hero is only included for look here (':'), not pickup, + and that's PICK_NONE so we can't get here from there */ + You_cant("pick yourself up!"); continue; - if (mi->count == -1L || mi->count > mi->item.a_obj->quan) - mi->count = mi->item.a_obj->quan; + } + if (engulfer_minvent && curr->owornmask != 0L) { + You_cant("pick %s up.", ysimple_name(curr)); + continue; + } + if (mi->count == -1L || mi->count > curr->quan) + mi->count = curr->quan; if (k < i) (*pick_list)[k] = *mi; ++k; @@ -971,10 +989,14 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ *pick_list = 0; n = 0; } else if (k < n) { - /* other stuff plus fake_hero; last slot is now unused */ - (*pick_list)[k].item = zeroany; - (*pick_list)[k].count = 0L; - n = k; + /* other stuff plus fake_hero; last slot is now unused + (could be more than one if player tried to pick items + worn by engulfer) */ + while (n > k) { + --n; + (*pick_list)[n].item = zeroany; + (*pick_list)[n].count = 0L; + } } } else if (n < 0) { /* -1 is used for SIGNAL_NOMENU, so callers don't expect it @@ -1474,6 +1496,10 @@ boolean telekinesis; /* not picking it up directly by hand */ if (obj == uchain) { /* do not pick up attached chain */ return 0; + } else if (obj->where == OBJ_MINVENT && obj->owornmask != 0L + && u.uswallow && obj->ocarry == u.ustuck) { + You_cant("pick %s up.", ysimple_name(obj)); + return 0; } else if (obj->oartifact && !touch_artifact(obj, &youmonst)) { return 0; } else if (obj->otyp == CORPSE) { From 7b1c38499dbbf5c9fd4b692917b0fbf359afe5ac Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 4 Jul 2019 15:56:08 -0700 Subject: [PATCH 030/296] curses prompting tweak With 'popup_dialog' On, a prompt which exactly fills the available width would start the next line with a space (to separate the prompt from user's answer) and then have the cursor waiting after it. That's unlike other behavior in the curses interface where the line split would be instead of the separating space rather than in addition to it. Old: |long prompt?| | X__________| New: |long prompt?| |X___________| where the X represents the cursor sitting over the start of blank space waiting for user's answer. --- win/curses/cursdial.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index ccd962fc1..7dccffa78 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -125,9 +125,7 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer) int map_height, map_width, maxwidth, remaining_buf, winx, winy, count; WINDOW *askwin, *bwin; char *tmpstr; - int prompt_width = (int) strlen(prompt) + buffer + 1; - int prompt_height = 1; - int height = prompt_height; + int prompt_width, prompt_height = 1, height = prompt_height; char input[BUFSZ]; /* if messages were being suppressed for the remainder of the turn, @@ -136,6 +134,8 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer) if (buffer > (int) sizeof input) buffer = (int) sizeof input; + /* +1: space between prompt and answer; buffer already accounts for \0 */ + prompt_width = (int) strlen(prompt) + 1 + buffer; maxwidth = term_cols - 2; if (iflags.window_inited) { @@ -163,23 +163,20 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer) free(tmpstr); } - if (iflags.window_inited) { - bwin = curses_create_window(prompt_width, height, UP); - wrefresh(bwin); - getbegyx(bwin, winy, winx); - askwin = newwin(height, prompt_width, winy + 1, winx + 1); - } else { - bwin = curses_create_window(prompt_width, height, CENTER); - wrefresh(bwin); - getbegyx(bwin, winy, winx); - askwin = newwin(height, prompt_width, winy + 1, winx + 1); - } + bwin = curses_create_window(prompt_width, height, + iflags.window_inited ? UP : CENTER); + wrefresh(bwin); + getbegyx(bwin, winy, winx); + askwin = newwin(height, prompt_width, winy + 1, winx + 1); + for (count = 0; count < prompt_height; count++) { tmpstr = curses_break_str(prompt, maxwidth, count + 1); - if (count == (prompt_height - 1)) { /* Last line */ - mvwprintw(askwin, count, 0, "%s ", tmpstr); - } else { - mvwaddstr(askwin, count, 0, tmpstr); + mvwaddstr(askwin, count, 0, tmpstr); + if (count == prompt_height - 1) { /* Last line */ + if ((int) strlen(tmpstr) < maxwidth) + waddch(askwin, ' '); + else + wmove(askwin, count + 1, 0); } free(tmpstr); } @@ -188,7 +185,7 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer) curs_set(1); wgetnstr(askwin, input, buffer - 1); curs_set(0); - strcpy(answer, input); + Strcpy(answer, input); werase(bwin); delwin(bwin); curses_destroy_win(askwin); From f75deae0bcca5bdd4afddb40291e5e2bb0ecd846 Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 4 Jul 2019 18:06:56 -0700 Subject: [PATCH 031/296] When fuzzing, use the number of moves as a proxy for the hour. Every 1000 moves simulates one hour. --- src/hacklib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hacklib.c b/src/hacklib.c index 7cf5a47c6..b97a78a65 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -1129,7 +1129,8 @@ friday_13th() int night() { - register int hour = getlt()->tm_hour; + register int hour = (iflags.debug_fuzzer ? (moves / 1000) % 24 : + getlt()->tm_hour); return (hour < 6 || hour > 21); } @@ -1137,7 +1138,10 @@ night() int midnight() { - return (getlt()->tm_hour == 0); + register int hour = (iflags.debug_fuzzer ? (moves / 1000) % 24 : + getlt()->tm_hour); + + return (hour == 0); } /* strbuf_init() initializes strbuf state for use */ From 2e7655af4028795dca4d8878ff4ec330e5f04e87 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 4 Jul 2019 23:29:26 -0400 Subject: [PATCH 032/296] Merge branch 'NetHack-3.6' part 2 --- src/hacklib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hacklib.c b/src/hacklib.c index a347e0cfd..e15532fca 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -1129,7 +1129,7 @@ friday_13th() int night() { - register int hour = (iflags.debug_fuzzer ? (moves / 1000) % 24 : + register int hour = (iflags.debug_fuzzer ? (g.moves / 1000) % 24 : getlt()->tm_hour); return (hour < 6 || hour > 21); @@ -1138,7 +1138,7 @@ night() int midnight() { - register int hour = (iflags.debug_fuzzer ? (moves / 1000) % 24 : + register int hour = (iflags.debug_fuzzer ? (g.moves / 1000) % 24 : getlt()->tm_hour); return (hour == 0); From 7e72bc0944491c4d6b3d0094f488722ea558ca07 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 6 Jul 2019 14:18:02 -0700 Subject: [PATCH 033/296] mklev() set xxstairs_room pointers back to NULL upon completion. When mklev() is called multiple times, previous state stored in the xxstairs_room pointers can be mistakenly used when making decisions about the new level being constructed. This caused non-deterministic level creation behavior when replaying from a snapshot. --- src/mklev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mklev.c b/src/mklev.c index 525e0a58e..10f019f82 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -1016,6 +1016,10 @@ mklev() for (ridx = 0; ridx < SIZE(rooms); ridx++) rooms[ridx].orig_rtype = rooms[ridx].rtype; + dnstairs_room = NULL; + upstairs_room = NULL; + sstairs_room = NULL; + reseed_random(rn2); reseed_random(rn2_on_display_rng); } From bf672f7f47f792c9b3d1fb8106ee1bc475b2b23b Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 6 Jul 2019 16:18:23 -0700 Subject: [PATCH 034/296] Xstairs_room followup Add a comment to explain why upstairs_room, dnstairs_room, and sstiars_room aren't handled the same way has other level data. --- src/mklev.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mklev.c b/src/mklev.c index 10f019f82..749304267 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mklev.c $NHDT-Date: 1560304468 2019/06/12 01:54:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.61 $ */ +/* NetHack 3.6 mklev.c $NHDT-Date: 1562455089 2019/07/06 23:18:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.63 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Alex Smith, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -583,6 +583,10 @@ clear_level_structures() register int x, y; register struct rm *lev; + /* note: normally we'd start at x=1 because map column #0 isn't used + (except for placing vault guard at <0,0> when removed from the map + but not from the level); explicitly reset column #0 along with the + rest so that we start the new level with a completely clean slate */ for (x = 0; x < COLNO; x++) { lev = &levl[x][0]; for (y = 0; y < ROWNO; y++) { @@ -637,6 +641,7 @@ clear_level_structures() xdnstair = ydnstair = xupstair = yupstair = 0; sstairs.sx = sstairs.sy = 0; xdnladder = ydnladder = xupladder = yupladder = 0; + dnstairs_room = upstairs_room = sstairs_room = (struct mkroom *) 0; made_branch = FALSE; clear_regions(); } @@ -1016,9 +1021,12 @@ mklev() for (ridx = 0; ridx < SIZE(rooms); ridx++) rooms[ridx].orig_rtype = rooms[ridx].rtype; - dnstairs_room = NULL; - upstairs_room = NULL; - sstairs_room = NULL; + /* something like this usually belongs in clear_level_structures() + but these aren't saved and restored so might not retain their + values for the life of the current level; reset them to default + now so that they never do and no one will be tempted to introduce + a new use of them for anything on this level */ + dnstairs_room = upstairs_room = sstairs_room = (struct mkroom *) 0; reseed_random(rn2); reseed_random(rn2_on_display_rng); From e84a0625dcc3163f74ee02dbaa193853b5ad5b89 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 6 Jul 2019 16:41:04 -0700 Subject: [PATCH 035/296] curses moving left with ^H Typing ^H actually passed a 16-bit value back to the core which got interpreted as ^G after the extra bits were discarded. I don't think any previous changes to the curses interface caused this. It's astonishing that no one ever noticed; the world must be full of numpad users. --- doc/fixes36.3 | 3 ++- win/curses/cursmesg.c | 2 +- win/curses/cursmisc.c | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 52aa675e4..e9dd29e5f 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.84 $ $NHDT-Date: 1562203850 2019/07/04 01:30:50 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.85 $ $NHDT-Date: 1562456458 2019/07/06 23:40:58 $ 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, @@ -169,6 +169,7 @@ curses: when map window was clipped, the 'scrollbars' shown to indicate which the 2nd and 3rd fifths (for example) were currently within view curses: support users's setting for erase char and kill char when getting a line of input with 'popup_dialog' Off (already supported for popup On) +curses: attempting to use ^H to rush left actually executed ^G (#wizgenesis) curses+'perm_invent': entries were wrapping without any control; usually not noticeable because next entry overwrote, but visible for final entry when whole inventory fit within the available height; looked ok with diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 7c83ac423..dfca09397 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -661,7 +661,7 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) goto alldone; case '\177': /* DEL/Rubout */ case KEY_DC: /* delete-character */ - case '\b': /* ^H (Backspace: '\011') */ + case '\b': /* ^H (Backspace: '\010') */ case KEY_BACKSPACE: if (len < 1) { len = 1; diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 5dcbe6d92..4ac85c0a3 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -792,6 +792,13 @@ curses_convert_keys(int key) /* Handle arrow keys */ switch (key) { + case KEY_BACKSPACE: + /* we can't distinguish between a separate backspace key and + explicit Ctrl+H intended to rush to the left; without this, + a value for ^H greater than 255 is passed back to core's + readchar() and stripping the value down to 0..255 yields ^G! */ + ret = C('H'); + break; case KEY_LEFT: if (iflags.num_pad) { ret = '4'; From bac3a75174e261edc176850075231ad81c3a03ae Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 6 Jul 2019 18:14:30 -0700 Subject: [PATCH 036/296] fix #H8164 - kicking altar: injury vs wrath When kicking an altar, trigger divine wrath (minor: luck or alignment loss) before deciding whether hero has hurt himself in the process. Add some variation to the wrath penalty so that it can't be used to precisely control Luck. --- doc/fixes36.3 | 3 ++- src/dokick.c | 4 ++-- src/pray.c | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index e9dd29e5f..d783301bc 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.85 $ $NHDT-Date: 1562456458 2019/07/06 23:40:58 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.86 $ $NHDT-Date: 1562462061 2019/07/07 01:14:21 $ 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, @@ -98,6 +98,7 @@ if an engulfer has any worn items, hero could pick them up from inside and they wouldn't be unworn properly, eventually triggering warnings or worse (Juiblex will wear an amulet if created with one; a shapechanger might wear one and then turn into an engulfer) +kicking an altar ignored god's wrath if hero injured himself during the kick Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/dokick.c b/src/dokick.c index 55df097e5..528b80c28 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dokick.c $NHDT-Date: 1551920353 2019/03/07 00:59:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.131 $ */ +/* NetHack 3.6 dokick.c $NHDT-Date: 1562462061 2019/07/07 01:14:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.133 $ */ /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1058,9 +1058,9 @@ dokick() if (Levitation) goto dumb; You("kick %s.", (Blind ? something : "the altar")); + altar_wrath(x, y); if (!rn2(3)) goto ouch; - altar_wrath(x, y); exercise(A_DEX, TRUE); return 1; } diff --git a/src/pray.c b/src/pray.c index d5958ac52..d40bb933c 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pray.c $NHDT-Date: 1561061321 2019/06/20 20:08:41 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.115 $ */ +/* NetHack 3.6 pray.c $NHDT-Date: 1562462064 2019/07/07 01:14:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2226,13 +2226,21 @@ register int x, y; { aligntyp altaralign = a_align(x, y); - if (!strcmp(align_gname(altaralign), u_gname())) { + if (u.ualign.type == altaralign && u.ualign.record > -rn2(4)) { godvoice(altaralign, "How darest thou desecrate my altar!"); (void) adjattrib(A_WIS, -1, FALSE); + u.ualign.record--; } else { - pline("A voice (could it be %s?) whispers:", align_gname(altaralign)); + pline("%s %s%s:", + !Deaf ? "A voice (could it be" + : "Despite your deafness, you seem to hear", + align_gname(altaralign), + !Deaf ? "?) whispers" : " say"); verbalize("Thou shalt pay, infidel!"); - change_luck(-1); + /* higher luck is more likely to be reduced; as it approaches -5 + the chance to lose another point drops down, eventually to 0 */ + if (Luck > -5 && rn2(Luck + 6)) + change_luck(rn2(20) ? -1 : -2); } } From ceb2d51426ae9a23b5a6282788062b02df7879a7 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 7 Jul 2019 13:52:24 -0700 Subject: [PATCH 037/296] ^X/disclosure of night, moon, Friday 13th For ^X and final disclosure, report external issues that affect game play: midnight, other night, new or full moon, and Friday the 13th. The 'new feature' entry in the fixes file rambles a bit but if it heads off even one spurious bug report, it'll have been worth it. --- doc/fixes36.3 | 9 ++++++++- include/flag.h | 4 +++- src/cmd.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- src/end.c | 5 ++++- 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index d783301bc..904db232c 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.86 $ $NHDT-Date: 1562462061 2019/07/07 01:14:21 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.87 $ $NHDT-Date: 1562532730 2019/07/07 20:52:10 $ 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, @@ -212,6 +212,13 @@ if you reach the edge of a level (relatively uncommon) and try to move off, 'attributes' disclosure at end of game includes number of experience points that were needed to reach the next experience level (new for normal play and explore mode; previously only shown for wizard mode) +report Friday-13th/phase-of-moon/time-of-day for ^X and final disclosure when + their values matter to game play (date and moon are from the start of + current session and are not dynamically updated as real time elapses; + night is a fixed range of hours using the computer's conception of + local time which could differ from player's if there are time zone or + system clock issues or simply seasonal variation based on latitude; + not new but needs to be documented somewhere other than spoilers...) status highlighting using percentage rules now supported for experience level and experience points; for both, percent is based on Exp progress from the start of the current Xp level to the start of the next Xp level; diff --git a/include/flag.h b/include/flag.h index 56352dded..3ea3ada26 100644 --- a/include/flag.h +++ b/include/flag.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 flag.h $NHDT-Date: 1559664948 2019/06/04 16:15:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.151 $ */ +/* NetHack 3.6 flag.h $NHDT-Date: 1562532730 2019/07/07 20:52:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.152 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -241,6 +241,8 @@ struct instance_flags { boolean defer_plname; /* X11 hack: askname() might not set plname */ boolean herecmd_menu; /* use menu when mouseclick on yourself */ boolean invis_goldsym; /* gold symbol is ' '? */ + int at_midnight; /* only valid during end of game disclosure */ + int at_night; /* also only valid during end of game disclosure */ int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */ int in_lava_effects; /* hack for Boots_off() */ int last_msg; /* indicator of last message player saw */ diff --git a/src/cmd.c b/src/cmd.c index c69bd4ff1..b4f613de1 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1561917056 2019/06/30 17:50:56 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.338 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1562532731 2019/07/07 20:52:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.339 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1981,6 +1981,50 @@ int final; /* same phrasing for current and final: "entered" is unconditional */ enlght_line(You_, "entered ", buf, ""); } + + /* for gameover, these have been obtained in really_done() so that they + won't vary if user leaves a disclosure prompt or --More-- unanswered + long enough for the dynamic value to change between then and now */ + if (final ? iflags.at_midnight : midnight()) { + enl_msg("It ", "is ", "was ", "the midnight hour", ""); + } else if (final ? iflags.at_night : night()) { + enl_msg("It ", "is ", "was ", "nighttime", ""); + } + /* other environmental factors */ + if (flags.moonphase == FULL_MOON || flags.moonphase == NEW_MOON) { + /* [This had "tonight" but has been changed to "in effect". + There is a similar issue to Friday the 13th--it's the value + at the start of the current session but that session might + have dragged on for an arbitrary amount of time. We want to + report the values that currently affect play--or affected + play when game ended--rather than actual outside situation.] */ + Sprintf(buf, "a %s moon in effect%s", + (flags.moonphase == FULL_MOON) ? "full" + : (flags.moonphase == NEW_MOON) ? "new" + /* showing these would probably just lead to confusion + since they have no effect on game play... */ + : (flags.moonphase < FULL_MOON) ? "first quarter" + : "last quarter", + /* we don't have access to 'how' here--aside from survived + vs died--so settle for general platitude */ + final ? " when your adventure ended" : ""); + enl_msg("There ", "is ", "was ", buf, ""); + } + if (flags.friday13) { + /* let player know that friday13 penalty is/was in effect; + we don't say "it is/was Friday the 13th" because that was at + the start of the session and it might be past midnight (or + days later if the game has been paused without save/restore), + so phrase this similar to the start up message */ + Sprintf(buf, " Bad things %s on Friday the 13th.", + !final ? "can happen" + : (final == ENL_GAMEOVERALIVE) ? "could have happened" + /* there's no may to tell whether -1 Luck made a + difference but hero has died... */ + : "happened"); + enlght_out(buf); + } + if (!Upolyd) { int ulvl = (int) u.ulevel; /* [flags.showexp currently does not matter; should it?] */ diff --git a/src/end.c b/src/end.c index 8ffcd5c66..c8d25775b 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1561414303 2019/06/24 22:11:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.178 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1562532734 2019/07/07 20:52:14 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.179 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1237,6 +1237,9 @@ int how; time or even day if player is slow responding to --More-- */ urealtime.finish_time = endtime = getnow(); urealtime.realtime += (long) (endtime - urealtime.start_timing); + /* collect these for end of game disclosure (not used during play) */ + iflags.at_night = night(); + iflags.at_midnight = midnight(); dump_open_log(endtime); /* Sometimes you die on the first move. Life's not fair. From cfca15d02c778540e06f0f51aff0b358d6c55786 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 8 Jul 2019 16:57:52 -0700 Subject: [PATCH 038/296] finding hidden monsters Wizard mode ^E and any mode spell of detect unseen or wand of secret door detection failed to find mon->mundetected monsters if they were hiding under objects, and failed to find those or other hiders or mimics when the hidden monster was at a trap location. The fix for the latter initially only worked if the trap was known, so took two tries when a monster hid at the location of an unseen trap. So this makes the additional change to find both things at the same time; it isn't manual searching that stops as soon as something is found. --- doc/fixes36.3 | 4 +++- src/detect.c | 56 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 904db232c..c40383917 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.87 $ $NHDT-Date: 1562532730 2019/07/07 20:52:10 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.88 $ $NHDT-Date: 1562630265 2019/07/08 23:57:45 $ 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, @@ -99,6 +99,8 @@ if an engulfer has any worn items, hero could pick them up from inside and worse (Juiblex will wear an amulet if created with one; a shapechanger might wear one and then turn into an engulfer) kicking an altar ignored god's wrath if hero injured himself during the kick +detect unseen/secret door detection/^E failed to find monsters hiding under + objects and failed to find monsters hiding at trap locations Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/detect.c b/src/detect.c index 45271687d..e7da0f85a 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 detect.c $NHDT-Date: 1544437284 2018/12/10 10:21:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.91 $ */ +/* NetHack 3.6 detect.c $NHDT-Date: 1562630266 2019/07/08 23:57:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.96 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -381,7 +381,7 @@ register struct obj *sobj; You("notice some gold between your %s.", makeplural(body_part(FOOT))); return 0; -outgoldmap: + outgoldmap: cls(); (void) unconstrain_map(); @@ -995,7 +995,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */ Your("%s itch.", makeplural(body_part(TOE))); return 0; -outtrapmap: + outtrapmap: cls(); (void) unconstrain_map(); @@ -1443,6 +1443,8 @@ struct rm *lev; lev->doormask = newmask; } +/* find something at one location; it should find all somethings there + since it is used for magical detection rather than physical searching */ STATIC_PTR void findone(zx, zy, num) int zx, zy; @@ -1451,6 +1453,13 @@ genericptr_t num; register struct trap *ttmp; register struct monst *mtmp; + /* + * This used to use if/else-if/else-if/else/end-if but that only + * found the first hidden thing at the location. Two hidden things + * at the same spot is uncommon, but it's possible for an undetected + * monster to be hiding at the location of an unseen trap. + */ + if (levl[zx][zy].typ == SDOOR) { cvt_sdoor_to_door(&levl[zx][zy]); /* .typ = DOOR */ magic_map_background(zx, zy, 0); @@ -1462,19 +1471,25 @@ genericptr_t num; magic_map_background(zx, zy, 0); newsym(zx, zy); (*(int *) num)++; - } else if ((ttmp = t_at(zx, zy)) != 0) { - if (!ttmp->tseen && ttmp->ttyp != STATUE_TRAP) { - ttmp->tseen = 1; - newsym(zx, zy); - (*(int *) num)++; - } - } else if ((mtmp = m_at(zx, zy)) != 0) { + } + + if ((ttmp = t_at(zx, zy)) != 0 && !ttmp->tseen + /* [shouldn't successful 'find' reveal and activate statue traps?] */ + && ttmp->ttyp != STATUE_TRAP) { + ttmp->tseen = 1; + newsym(zx, zy); + (*(int *) num)++; + } + + if ((mtmp = m_at(zx, zy)) != 0 + /* brings hidden monster out of hiding even if already sensed */ + && (!canspotmon(mtmp) || mtmp->mundetected || M_AP_TYPE(mtmp))) { if (M_AP_TYPE(mtmp)) { seemimic(mtmp); (*(int *) num)++; - } - if (mtmp->mundetected - && (is_hider(mtmp->data) || mtmp->data->mlet == S_EEL)) { + } else if (mtmp->mundetected && (is_hider(mtmp->data) + || hides_under(mtmp->data) + || mtmp->data->mlet == S_EEL)) { mtmp->mundetected = 0; newsym(zx, zy); (*(int *) num)++; @@ -1602,8 +1617,7 @@ struct trap *trap; /* The "Hallucination ||" is to preserve 3.6.1 behaviour, but this behaviour might need a rework in the hallucination case - (e.g. to not prompt if any trap glyph appears on the - square). */ + (e.g. to not prompt if any trap glyph appears on the square). */ if (Hallucination || levl[trap->tx][trap->ty].glyph != trap_to_glyph(trap, rn2_on_display_rng)) { @@ -1636,18 +1650,22 @@ boolean via_warning; if (M_AP_TYPE(mtmp)) { seemimic(mtmp); found_something = TRUE; - } else if (!canspotmon(mtmp)) { - if (mtmp->mundetected - && (is_hider(mtmp->data) || mtmp->data->mlet == S_EEL)) { + } else { + /* this used to only be executed if a !canspotmon() test passed + but that failed to bring sensed monsters out of hiding */ + found_something = !canspotmon(mtmp); + if (mtmp->mundetected && (is_hider(mtmp->data) + || hides_under(mtmp->data) + || mtmp->data->mlet == S_EEL)) { if (via_warning) { Your("warning senses cause you to take a second %s.", Blind ? "to check nearby" : "look close by"); display_nhwindow(WIN_MESSAGE, FALSE); /* flush messages */ } mtmp->mundetected = 0; + found_something = TRUE; } newsym(x, y); - found_something = TRUE; } if (found_something) { From 77aa61a59bb2a1180767412a82a6c1399df7fe8d Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 8 Jul 2019 17:38:00 -0700 Subject: [PATCH 039/296] looking at a trapped monster would describe it as trapped if you could see its location, but if the trap was unseen that trap would remain unseen, at least in some circumstances. Mark the trap as seen. --- doc/fixes36.3 | 3 ++- src/pager.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index c40383917..b7f2c43bb 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.88 $ $NHDT-Date: 1562630265 2019/07/08 23:57:45 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.89 $ $NHDT-Date: 1562632673 2019/07/09 00:37:53 $ 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, @@ -101,6 +101,7 @@ if an engulfer has any worn items, hero could pick them up from inside and kicking an altar ignored god's wrath if hero injured himself during the kick detect unseen/secret door detection/^E failed to find monsters hiding under objects and failed to find monsters hiding at trap locations +when farlook describes a monster at a visible spot as trapped, reveal the trap Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/pager.c b/src/pager.c index ce1aae41b..02c61f966 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pager.c $NHDT-Date: 1558045586 2019/05/16 22:26:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.153 $ */ +/* NetHack 3.6 pager.c $NHDT-Date: 1562632673 2019/07/09 00:37:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.154 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -297,9 +297,11 @@ int x, y; int tt = t ? t->ttyp : NO_TRAP; /* newsym lets you know of the trap, so mention it here */ - if (tt == BEAR_TRAP || is_pit(tt) || tt == WEB) + if (tt == BEAR_TRAP || is_pit(tt) || tt == WEB) { Sprintf(eos(buf), ", trapped in %s", an(defsyms[trap_to_defsym(tt)].explanation)); + t->tseen = 1; + } } /* we know the hero sees a monster at this location, but if it's shown From 9eefeef5d252c95e1a4df7b439b2667cbddd4046 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 9 Jul 2019 17:42:32 -0700 Subject: [PATCH 040/296] fix github issue #200 - docs for 'strange object' Fixes #200 The Guidebook claims that there's no symbol for 'S_strange_object' which is literally true, but there is one for S_strange_obj. It has been in place longer than the paragraph claiming that there's no way to customize that symbol. I'm not sure why variant spelling was used. Also, files.c doesn't use loadsyms[], it calls a routine which returns a pointer to a specific element in that array. --- doc/Guidebook.mn | 12 ++---------- doc/Guidebook.tex | 13 +------------ src/files.c | 5 ++--- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 7a4ffd8d6..9b215d2fb 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.310 $ $NHDT-Date: 1562114349 2019/07/03 00:39:09 $ +.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.311 $ $NHDT-Date: 1562719337 2019/07/10 00:42:17 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -24,7 +24,7 @@ .ds vr "NetHack 3.6 .ds f0 "\*(vr .ds f1 -.ds f2 "May 7, 2019 +.ds f2 "July 9, 2019 . .\" A note on some special characters: .\" \(lq = left double quote @@ -4555,14 +4555,6 @@ z S_zruty (zruty) .\"TABLE_END Do not delete this line. .TE .pg -There is one additional class of object, described as \(lqstrange object\(rq, -which will occasionally be the shape taken on by mimics and shown -as \(oq]\(cq for maps displayed as text characters. -Although the displayed character is the same as the default value for -\(lqS_mimic_def\(rq, it is a different symbol and there is no corresponding -\(lqS_strange_object\(rq symbol nor any way to assign an alternate value -for it. -.pg .hn 2 Configuring NetHack for Play by the Blind .pg diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index bc9b5e00f..d642cfed5 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -45,7 +45,7 @@ %.au \author{Original version - Eric S. Raymond\\ (Edited and expanded for 3.6 by Mike Stephenson and others)} -\date{May 7, 2019} +\date{July 9, 2019} \maketitle @@ -5048,17 +5048,6 @@ Default & Symbol Name & Description\\ \end{longtable}% } -%.pg -There is one additional class of object, described as ``strange object'', -which will occasionally be the shape taken on by mimics and shown as -`{\tt \verb+]+}' -for maps displayed as text characters. -Although the displayed character is the same as the default value for -`S\verb+_+mimic\verb+_+def', it is a different symbol and there is no -corresponding -`S\verb+_+strange\verb+_+object' symbol nor any way to assign an -alternate value for it. - %.pg %.hn 2 \subsection*{Configuring {\it NetHack\/} for Play by the Blind} diff --git a/src/files.c b/src/files.c index 29ad2f1a8..930d36ea2 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 files.c $NHDT-Date: 1559670605 2019/06/04 17:50:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.250 $ */ +/* NetHack 3.6 files.c $NHDT-Date: 1562719337 2019/07/10 00:42:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.252 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3140,7 +3140,6 @@ boolean FDECL((*proc), (char *)); } extern struct symsetentry *symset_list; /* options.c */ -extern struct symparse loadsyms[]; /* drawing.c */ extern const char *known_handling[]; /* drawing.c */ extern const char *known_restrictions[]; /* drawing.c */ static int symset_count = 0; /* for pick-list building only */ @@ -3213,7 +3212,7 @@ char *buf; int which_set; { int val, i; - struct symparse *symp = (struct symparse *) 0; + struct symparse *symp; char *bufp, *commentp, *altp; /* convert each instance of whitespace (tabs, consecutive spaces) From 0e8163e341694172ce1aa3dec38679c086161fe6 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 9 Jul 2019 18:55:10 -0700 Subject: [PATCH 041/296] curses: ncurses vs Ctrl+Click Asking curses to report whether the Ctrl key was being pressed during a mouse click was sending mouse position reports--even those aren't being requested--and actual Ctrl+Left_click was reporting a pair of duplicate Ctrl+Mouse_position_report events when a click was actually performed. So turn off Ctrl key reporting. Mac with one-button mouse can be configured to send "secondary click" for Ctrl+Click. A laptop trackpad handles that differently (press the button while two fingers are on the touchpad to send secondary click) and doesn't support Ctrl+Click as an alternate way to do that. If this would work within curses then they could operate the same regardless of how the user set the mouse or trackpad configuraiton. But I wasn't able to make it work right. --- doc/fixes36.3 | 6 +++++- win/curses/cursmisc.c | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index b7f2c43bb..751b2a4d0 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.89 $ $NHDT-Date: 1562632673 2019/07/09 00:37:53 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.90 $ $NHDT-Date: 1562723693 2019/07/10 01:54:53 $ 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, @@ -174,6 +174,10 @@ curses: when map window was clipped, the 'scrollbars' shown to indicate which curses: support users's setting for erase char and kill char when getting a line of input with 'popup_dialog' Off (already supported for popup On) curses: attempting to use ^H to rush left actually executed ^G (#wizgenesis) +curses: disable the attempt to support Ctrl+Left_click as an alternate way + to generate Right_click for systems with one-button mouse or trackpad; + the mouse data passed to nethack didn't match the curses (ncurses on + OSX 10.11) documentation and things didn't work as intended curses+'perm_invent': entries were wrapping without any control; usually not noticeable because next entry overwrote, but visible for final entry when whole inventory fit within the available height; looked ok with diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 4ac85c0a3..3768e53bd 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -877,13 +877,20 @@ curses_convert_keys(int key) return ret; } -/* we treat buttons 2 and 3 as equivalent so that it doesn't matter which - one is for right-click and which for middle-click; the core uses CLICK_2 - for right-click ("not left" click) even though 2 might be middle button; - we also support Ctrl+left-click as another way to get "not left" click - since Mac is traditionally saddled with a one button mouse or trackpad */ -#define MOUSEBUTTONS ((BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED) \ - | BUTTON_CTRL) +/* + * We treat buttons 2 and 3 as equivalent so that it doesn't matter which + * one is for right-click and which for middle-click. The core uses CLICK_2 + * for right-click ("not left"-click) even though 2 might be middle button. + * + * BUTTON_CTRL was enabled at one point but was not working as intended. + * Ctrl+left_click was generating pairs of duplicated events with Ctrl and + * Report_mouse_position bits set (even though Report_mouse_position wasn't + * enabled) but no button click bit set. (It sort of worked because Ctrl+ + * Report_mouse_position wasn't a left click so passed along CLICK_2, but + * the duplication made that too annoying to use. Attempting to immediately + * drain the second one wasn't working as intended either.) + */ +#define MOUSEBUTTONS (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED) /* Process mouse events. Mouse movement is processed until no further mouse movement events are available. Returns 0 for a mouse click From bc65112ce07c6e2056ed28b5e93954679fb36acd Mon Sep 17 00:00:00 2001 From: Bart House Date: Tue, 9 Jul 2019 22:30:34 -0700 Subject: [PATCH 042/296] Added experimental feature NEW_KEYBOARD_HIT. --- include/config.h | 8 +++- include/extern.h | 15 +++++++ include/ntconf.h | 3 ++ include/unixconf.h | 2 + include/winprocs.h | 12 ++++++ include/wintty.h | 4 ++ src/allmain.c | 4 ++ src/windows.c | 14 +++++++ sys/winnt/nttty.c | 10 +++++ sys/winnt/winnt.c | 7 +++- win/share/safeproc.c | 11 +++++ win/tty/wintty.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ win/win32/mswproc.c | 12 ++++++ win/win32/winMS.h | 3 ++ 14 files changed, 199 insertions(+), 3 deletions(-) diff --git a/include/config.h b/include/config.h index d12576f9d..f054de5c4 100644 --- a/include/config.h +++ b/include/config.h @@ -564,9 +564,13 @@ typedef unsigned char uchar; %N first character of player name DUMPLOG_FILE is not used if SYSCF is defined */ -#endif +#endif /* DUMPLOG_FILE */ -#endif +#endif /* DUMPLOG */ + +/* NEW_KEYBOARD_HIT adds new window proc to return whether keyboard has been hit + and character input is available */ +/* #define NEW_KEYBOARD_HIT */ #define USE_ISAAC64 /* Use cross-plattform, bundled RNG */ diff --git a/include/extern.h b/include/extern.h index 90548cf37..0761d224e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1147,6 +1147,9 @@ E void NDECL(gettty); E void NDECL(setftty); E void FDECL(settty, (const char *)); E int NDECL(tgetch); +#ifdef NEW_KEYBOARD_HIT +E boolean NDECL(tkbhit); +#endif E void FDECL(cmov, (int x, int y)); E void FDECL(nocmov, (int x, int y)); @@ -1552,6 +1555,9 @@ E void FDECL(mplayer_talk, (struct monst *)); #ifndef WIN32 E int NDECL(tgetch); +#ifdef NEW_KEYBOARD_HIT +E boolean NDECL(tkbhit); +#endif #endif #ifndef TOS E char NDECL(switchar); @@ -1582,7 +1588,9 @@ E void FDECL(gotoxy, (int, int)); #endif #ifdef TOS E int FDECL(_copyfile, (char *, char *)); +#ifndef NEW_KEYBOARD_HIT E int NDECL(kbhit); +#endif E void NDECL(set_colors); E void NDECL(restore_colors); #ifdef SUSPEND @@ -1592,7 +1600,9 @@ E int NDECL(dosuspend); #ifdef WIN32 E char *FDECL(get_username, (int *)); E void FDECL(nt_regularize, (char *)); +#ifndef NEW_KEYBOARD_HIT E int NDECL((*nt_kbhit)); +#endif E void FDECL(Delay, (int)); #endif /* WIN32 */ #endif /* MICRO || WIN32 */ @@ -1660,10 +1670,15 @@ E void FDECL(regex_free, (struct nhregex *)); #ifdef WIN32 E void NDECL(get_scr_size); +#ifndef NEW_KEYBOARD_HIT E int NDECL(nttty_kbhit); +#endif E void FDECL(nttty_open, (int)); E void NDECL(nttty_rubout); E int NDECL(tgetch); +#ifdef NEW_KEYBOARD_HIT +E boolean NDECL(tkbhit); +#endif E int FDECL(ntposkey, (int *, int *, int *)); E void FDECL(set_output_mode, (int)); E void NDECL(synch_cursor); diff --git a/include/ntconf.h b/include/ntconf.h index eb106090f..994615c2d 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -252,8 +252,11 @@ int _RTLENTRY _EXPFUNC read(int __handle, void _FAR *__buf, unsigned __len); #ifndef CURSES_GRAPHICS #include /* conflicting definitions with curses.h */ #endif + +#ifndef NEW_KEYBOARD_HIT #undef kbhit /* Use our special NT kbhit */ #define kbhit (*nt_kbhit) +#endif #ifdef LAN_FEATURES #define MAX_LAN_USERNAME 20 diff --git a/include/unixconf.h b/include/unixconf.h index c126d6839..f9ac16f0c 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -311,7 +311,9 @@ #define HLOCK "perm" /* an empty file used for locking purposes */ +#ifndef NEW_KEYBOARD_HIT #define tgetch getchar +#endif #ifndef NOSHELL #define SHELL /* do not delete the '!' command */ diff --git a/include/winprocs.h b/include/winprocs.h index 36962750e..d1cea9a3c 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -79,6 +79,9 @@ struct window_procs { (int, const char *, const char *, BOOLEAN_P)); void FDECL((*win_status_update), (int, genericptr_t, int, int, int, unsigned long *)); boolean NDECL((*win_can_suspend)); +#ifdef NEW_KEYBOARD_HIT + boolean NDECL((*win_keyboard_hit)); +#endif }; extern @@ -160,6 +163,9 @@ extern */ #define status_enablefield (*windowprocs.win_status_enablefield) #define status_update (*windowprocs.win_status_update) +#ifdef NEW_KEYBOARD_HIT +#define keyboard_hit (*windowprocs.win_keyboard_hit) +#endif /* * WINCAP @@ -379,6 +385,9 @@ struct chain_procs { (CARGS, int, const char *, const char *, BOOLEAN_P)); void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int, int, unsigned long *)); boolean FDECL((*win_can_suspend), (CARGS)); +#ifdef NEW_KEYBOARD_HIT + boolean FDECL((*keyboard_hit), (CARGS)); +#endif }; #endif /* WINCHAIN */ @@ -449,6 +458,9 @@ extern void FDECL(safe_status_enablefield, (int, const char *, const char *, BOOLEAN_P)); extern void FDECL(safe_status_update, (int, genericptr_t, int, int, int, unsigned long *)); extern boolean NDECL(safe_can_suspend); +#ifdef NEW_KEYBOARD_HIT +extern boolean NDECL(safe_keyboard_hit); +#endif extern void FDECL(stdio_raw_print, (const char *)); extern void FDECL(stdio_raw_print_bold, (const char *)); extern void NDECL(stdio_wait_synch); diff --git a/include/wintty.h b/include/wintty.h index 4863d6e10..6994fc93f 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -247,6 +247,10 @@ E void FDECL(genl_outrip, (winid, int, time_t)); E char *FDECL(tty_getmsghistory, (BOOLEAN_P)); E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P)); +#ifdef NEW_KEYBOARD_HIT +E boolean NDECL(tty_keyboard_hit); +#endif + #ifdef NO_TERMS #ifdef MAC #ifdef putchar diff --git a/src/allmain.c b/src/allmain.c index b0bb0f3a2..1ce8cad08 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -374,7 +374,11 @@ boolean resuming; if (multi >= 0 && occupation) { #if defined(MICRO) || defined(WIN32) abort_lev = 0; +#ifdef NEW_KEYBOARD_HIT + if (keyboard_hit()) { +#else if (kbhit()) { +#endif if ((ch = pgetchar()) == ABORT) abort_lev++; else diff --git a/src/windows.c b/src/windows.c index ad7b91b0d..0d2ce514d 100644 --- a/src/windows.c +++ b/src/windows.c @@ -523,6 +523,9 @@ static void NDECL(hup_void_ndecl); static void FDECL(hup_void_fdecl_int, (int)); static void FDECL(hup_void_fdecl_winid, (winid)); static void FDECL(hup_void_fdecl_constchar_p, (const char *)); +#ifdef NEW_KEYBOARD_HIT +static boolean NDECL(hup_keyboard_hit); +#endif static struct window_procs hup_procs = { "hup", 0L, 0L, hup_init_nhwindows, @@ -570,6 +573,9 @@ static struct window_procs hup_procs = { hup_void_ndecl, /* status_finish */ genl_status_enablefield, hup_status_update, genl_can_suspend_no, +#ifdef NEW_KEYBOARD_HIT + hup_keyboard_hit +#endif }; static void FDECL((*previnterface_exit_nhwindows), (const char *)) = 0; @@ -624,6 +630,14 @@ hup_nhgetch(VOID_ARGS) return '\033'; /* ESC */ } +#ifdef NEW_KEYBOARD_HIT +static boolean +hup_keyboard_hit(VOID_ARGS) +{ + return FALSE; +} +#endif + /*ARGSUSED*/ static char hup_yn_function(prompt, resp, deflt) diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index 3233dc9cb..a8000bc05 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -398,10 +398,12 @@ int mode; // unused { DWORD cmode; +#ifndef NEW_KEYBOARD_HIT /* Initialize the function pointer that points to * the kbhit() equivalent, in this TTY case nttty_kbhit() */ nt_kbhit = nttty_kbhit; +#endif if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE)) { /* Unable to set control handler */ @@ -436,11 +438,19 @@ int portdebug; return ch; } +#ifndef NEW_KEYBOARD_HIT int nttty_kbhit() { return keyboard_handler.pNHkbhit(console.hConIn, &ir); } +#else +boolean +tkbhit() +{ + return keyboard_handler.pNHkbhit(console.hConIn, &ir) != 0; +} +#endif int tgetch() diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index f6a9aa791..e9041262d 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -56,6 +56,7 @@ extern void NDECL(backsp); int NDECL(windows_console_custom_nhgetch); extern void NDECL(safe_routines); +#ifndef NEW_KEYBOARD_HIT /* The function pointer nt_kbhit contains a kbhit() equivalent * which varies depending on which window port is active. * For the tty port it is tty_kbhit() [from nttty.c] @@ -65,6 +66,7 @@ extern void NDECL(safe_routines); int def_kbhit(void); int (*nt_kbhit)() = def_kbhit; +#endif char switchar() @@ -158,11 +160,13 @@ max_filename() return 0; } +#ifndef NEW_KEYBOARD_HIT int def_kbhit() { return 0; } +#endif /* * Strip out troublesome file system characters. @@ -510,7 +514,9 @@ int code; exit(code); } +#ifndef NEW_KEYBOARD_HIT #undef kbhit +#endif #include int @@ -719,7 +725,6 @@ sys_random_seed(VOID_ARGS) } return ourseed; } - #endif /* WIN32 */ /*winnt.c*/ diff --git a/win/share/safeproc.c b/win/share/safeproc.c index ab5cb1c5a..9f3e0ce2f 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -101,6 +101,9 @@ struct window_procs safe_procs = { safe_status_update, #endif safe_can_suspend, +#ifdef NEW_KEYBOARD_HIT + safe_keyboard_hit +#endif }; struct window_procs * @@ -386,6 +389,14 @@ safe_can_suspend() return FALSE; } +#ifdef NEW_KEYBOARD_HIT +boolean +safe_keyboard_hit() +{ + return FALSE; +} +#endif + void safe_nhbell() { diff --git a/win/tty/wintty.c b/win/tty/wintty.c index ac0d61880..1411839da 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -36,6 +36,12 @@ extern void msmsg(const char *, ...); #endif #endif +#ifdef NEW_KEYBOARD_HIT +#if defined(UNIX) +#include +#endif +#endif + #ifdef TTY_TILES_ESCCODES extern short glyph2tile[]; #define TILE_ANSI_COMMAND 'z' @@ -133,6 +139,9 @@ struct window_procs tty_procs = { genl_status_update, #endif genl_can_suspend_yes, +#ifdef NEW_KEYBOARD_HIT + tty_keyboard_hit +#endif }; static int maxwin = 0; /* number of windows in use */ @@ -3479,6 +3488,7 @@ const char *str; #endif } +#ifndef NEW_KEYBOARD_HIT int tty_nhgetch() { @@ -3533,6 +3543,93 @@ tty_nhgetch() #endif /* TTY_TILES_ESCCODES */ return i; } +#else /* NEW_KEYBOARD_HIT */ +#ifdef UNIX +static boolean stdin_non_blocking = FALSE; + +int +tgetch() +{ + static volatile int nesting = 0; + int i; + char nestbuf; + + if (stdin_non_blocking) { + fcntl(0, F_SETFL, fcntl(0, F_GETFL) & ~O_NONBLOCK); + stdin_non_blocking = FALSE; + } + + /* kludge alert: Some Unix variants return funny values if getc() + * is called, interrupted, and then called again. There + * is non-reentrant code in the internal _filbuf() routine, called by + * getc(). + */ + i = (++nesting == 1) + ? getchar() + : (read(fileno(stdin), (genericptr_t) &nestbuf, 1) == 1) + ? (int) nestbuf : EOF; + --nesting; + + return i; +} + +boolean +tkbhit() +{ + int i; + if (!stdin_non_blocking) { + fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK); + stdin_non_blocking = TRUE; + } + i = getchar(); + if (i != EOF) ungetc(i, stdin); + return (i != EOF); + } +#endif + +int +tty_nhgetch() +{ + int i; + HUPSKIP_RESULT('\033'); + print_vt_code1(AVTC_INLINE_SYNC); + (void) fflush(stdout); + /* Note: if raw_print() and wait_synch() get called to report terminal + * initialization problems, then wins[] and ttyDisplay might not be + * available yet. Such problems will probably be fatal before we get + * here, but validate those pointers just in case... + */ + if (WIN_MESSAGE != WIN_ERR && wins[WIN_MESSAGE]) + wins[WIN_MESSAGE]->flags &= ~WIN_STOP; + if (iflags.debug_fuzzer) { + i = randomkey(); + } else { + i = tgetch(); + } + if (!i) + i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */ + else if (i == EOF) + i = '\033'; /* same for EOF */ + if (ttyDisplay && ttyDisplay->toplin == 1) + ttyDisplay->toplin = 2; +#ifdef TTY_TILES_ESCCODES + { + /* hack to force output of the window select code */ + int tmp = vt_tile_current_window; + + vt_tile_current_window++; + print_vt_code2(AVTC_SELECT_WINDOW, tmp); + } +#endif /* TTY_TILES_ESCCODES */ + return i; +} + +boolean tty_keyboard_hit() +{ + /* tgetch provider needs to also provide tkbhit() */ + return tkbhit(); +} +#endif /* NEW_KEYBOARD_HIT */ /* * return a key, or 0, in which case a mouse button was pressed diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index b637c463f..a5aa02bb4 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -116,6 +116,9 @@ struct window_procs mswin_procs = { mswin_status_init, mswin_status_finish, mswin_status_enablefield, mswin_status_update, genl_can_suspend_yes, +#ifdef NEW_KEYBOARD_HIT + mswin_keyboard_hit +#endif }; /* @@ -1402,6 +1405,15 @@ mswin_nhgetch() return (key); } +#ifdef NEW_KEYBOARD_HIT +/* boolean keyboard_hit() -- returns TRUE if input is available */ +boolean +mswin_keyboard_hit() +{ + return mswin_have_input() != 0; +} +#endif + /* int nh_poskey(int *x, int *y, int *mod) -- Returns a single character input from the user or a diff --git a/win/win32/winMS.h b/win/win32/winMS.h index c5ee77368..c649917dc 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -167,6 +167,9 @@ void mswin_raw_print(const char *str); void mswin_raw_print_bold(const char *str); void mswin_raw_print_flush(); int mswin_nhgetch(void); +#ifdef NEW_KEYBOARD_HIT +boolean mswin_keyboard_hit(void); +#endif int mswin_nh_poskey(int *x, int *y, int *mod); void mswin_nhbell(void); int mswin_doprev_message(void); From 094a9d81619b22218b7401dd5825132b12389561 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 10 Jul 2019 16:15:11 -0700 Subject: [PATCH 043/296] fix github issue #204 - theft while in nymph form Fixes #204 3.6.2's attempts to fix turning off SEDUCE in 'sysconf' introduced an unintentional change in behavior for hero poly'd into nymph form: theft attack always angered the target. The actual change was intentional but its ramifications were unexpected. --- doc/fixes36.3 | 3 ++- src/mhitu.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 751b2a4d0..80002d745 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.90 $ $NHDT-Date: 1562723693 2019/07/10 01:54:53 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.91 $ $NHDT-Date: 1562800503 2019/07/10 23:15:03 $ 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, @@ -102,6 +102,7 @@ kicking an altar ignored god's wrath if hero injured himself during the kick detect unseen/secret door detection/^E failed to find monsters hiding under objects and failed to find monsters hiding at trap locations when farlook describes a monster at a visible spot as trapped, reveal the trap +fix theft when poly'd into nymph form; 3.6.2 change made that anger the victim Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/mhitu.c b/src/mhitu.c index a175daeab..664955fb9 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhitu.c $NHDT-Date: 1556649298 2019/04/30 18:34:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.164 $ */ +/* NetHack 3.6 mhitu.c $NHDT-Date: 1562800504 2019/07/10 23:15:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.166 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2408,9 +2408,13 @@ struct attack *mattk; /* non-Null: current attack; Null: general capability */ if (agrinvis && !defperc && adtyp == AD_SEDU) return 0; + /* nymphs have two attacks, one for steal-item damage and the other + for seduction, both pass the could_seduce() test; + incubi/succubi have three attacks, their claw attacks for damage + don't pass the test */ if ((pagr->mlet != S_NYMPH && pagr != &mons[PM_INCUBUS] && pagr != &mons[PM_SUCCUBUS]) - || (adtyp != AD_SEDU && adtyp != AD_SSEX)) + || (adtyp != AD_SEDU && adtyp != AD_SSEX && adtyp != AD_SITM)) return 0; return (genagr == 1 - gendef) ? 1 : (pagr->mlet == S_NYMPH) ? 2 : 0; From 58583cacf8511625fd805ecbb050481f28de9411 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 10 Jul 2019 17:56:33 -0700 Subject: [PATCH 044/296] hero-as-nymph: steal items vs steal gold Nymphs won't steal gold from the hero (so that their steal-item damage isn't a superset of lerprechaun's steal-gold damage; straightforward back when gold wasn't kept in inventory), but hero poly'd into a nymph would steal gold from monsters. --- doc/fixes36.3 | 3 ++- src/steal.c | 11 ++++++++--- src/uhitm.c | 37 +++++++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 80002d745..3d8a5ed9e 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.91 $ $NHDT-Date: 1562800503 2019/07/10 23:15:03 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.92 $ $NHDT-Date: 1562806584 2019/07/11 00:56:24 $ 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, @@ -103,6 +103,7 @@ detect unseen/secret door detection/^E failed to find monsters hiding under objects and failed to find monsters hiding at trap locations when farlook describes a monster at a visible spot as trapped, reveal the trap fix theft when poly'd into nymph form; 3.6.2 change made that anger the victim +hero poly'd into nymph would steal gold along with other items Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/steal.c b/src/steal.c index 59421e372..2686a5392 100644 --- a/src/steal.c +++ b/src/steal.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 steal.c $NHDT-Date: 1561588404 2019/06/26 22:33:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.73 $ */ +/* NetHack 3.6 steal.c $NHDT-Date: 1562806584 2019/07/11 00:56:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.74 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -247,7 +247,8 @@ struct monst *mtmp; char *objnambuf; { struct obj *otmp; - int tmp, could_petrify, armordelay, olddelay, named = 0, retrycnt = 0; + int tmp, could_petrify, armordelay, olddelay, icnt, + named = 0, retrycnt = 0; boolean monkey_business, /* true iff an animal is doing the thievery */ was_doffing, was_punished = Punished; @@ -263,11 +264,15 @@ char *objnambuf; if (occupation) (void) maybe_finished_meal(FALSE); - if (!invent || (inv_cnt(FALSE) == 1 && uskin)) { + icnt = inv_cnt(FALSE); /* don't include gold */ + if (!icnt || (icnt == 1 && uskin)) { nothing_to_steal: /* Not even a thousand men in armor can strip a naked man. */ if (Blind) pline("Somebody tries to rob you, but finds nothing to steal."); + else if (inv_cnt(TRUE) > inv_cnt(FALSE)) /* ('icnt' might be stale) */ + pline("%s tries to rob you, but isn't interested in gold.", + Monnam(mtmp)); else pline("%s tries to rob you, but there is nothing to steal!", Monnam(mtmp)); diff --git a/src/uhitm.c b/src/uhitm.c index f478d0289..c6fc30c2a 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 uhitm.c $NHDT-Date: 1555720104 2019/04/20 00:28:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.207 $ */ +/* NetHack 3.6 uhitm.c $NHDT-Date: 1562806586 2019/07/11 00:56:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.210 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1498,10 +1498,11 @@ steal_it(mdef, mattk) struct monst *mdef; struct attack *mattk; { - struct obj *otmp, *stealoid, **minvent_ptr; + struct obj *otmp, *gold = 0, *stealoid, **minvent_ptr; long unwornmask; - if (!mdef->minvent) + otmp = mdef->minvent; + if (!otmp || (otmp->oclass == COIN_CLASS && !otmp->nobj)) return; /* nothing to take */ /* look for worn body armor */ @@ -1524,14 +1525,25 @@ struct attack *mattk; if (stealoid) { /* we will be taking everything */ if (gender(mdef) == (int) u.mfemale && youmonst.data->mlet == S_NYMPH) - You("charm %s. She gladly hands over her possessions.", - mon_nam(mdef)); + You("charm %s. She gladly hands over %sher possessions.", + mon_nam(mdef), !gold ? "" : "most of "); else You("seduce %s and %s starts to take off %s clothes.", mon_nam(mdef), mhe(mdef), mhis(mdef)); } + /* prevent gold from being stolen so that steal-item isn't a superset + of steal-gold; shuffling it out of minvent before selecting next + item, and then back in case hero or monster dies (hero touching + stolen c'trice corpse or monster wielding one and having gloves + stolen) is less bookkeeping than skipping it within the loop or + taking it out once and then trying to figure out how to put it back */ + if ((gold = findgold(mdef->minvent)) != 0) + obj_extract_self(gold); + while ((otmp = mdef->minvent) != 0) { + if (gold) /* put 'mdef's gold back */ + mpickobj(mdef, gold), gold = 0; if (!Upolyd) break; /* no longer have ability to steal */ /* take the object away from the monster */ @@ -1564,12 +1576,25 @@ struct attack *mattk; } else if (unwornmask & W_ARMG) { /* stole worn gloves */ mselftouch(mdef, (const char *) 0, TRUE); if (DEADMONSTER(mdef)) /* it's now a statue */ - return; /* can't continue stealing */ + break; /* can't continue stealing */ } if (!stealoid) break; /* only taking one item */ + + /* take gold out of minvent before making next selection; if it + is the only thing left, the loop will terminate and it will be + put back below */ + if ((gold = findgold(mdef->minvent)) != 0) + obj_extract_self(gold); } + + /* put gold back; won't happen if either hero or 'mdef' dies because + gold will be back in monster's inventory at either of those times + (so will be present in mdef's minvent for bones, or in its statue + now if it has just been turned into one) */ + if (gold) + mpickobj(mdef, gold); } int From 08a19108678e772ab52ee195be74101b2792accb Mon Sep 17 00:00:00 2001 From: Bart House Date: Wed, 10 Jul 2019 22:16:08 -0700 Subject: [PATCH 045/296] Improved readability of topline state management. --- include/decl.h | 6 ++++++ win/tty/getline.c | 6 +++--- win/tty/topl.c | 24 ++++++++++++------------ win/tty/wintty.c | 48 ++++++++++++++++++++++++++--------------------- 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/include/decl.h b/include/decl.h index 5ebaa326e..6c0f9721c 100644 --- a/include/decl.h +++ b/include/decl.h @@ -455,6 +455,12 @@ struct early_opt { boolean valallowed; }; +/* topline states */ +#define TOPLINE_EMPTY 0 /* empty */ +#define TOPLINE_NEED_MORE 1 /* non-empty, need --More-- */ +#define TOPLINE_NON_EMPTY 2 /* non-empty, no --More-- required */ +#define TOPLINE_SPECIAL_PROMPT 3 /* special prompt state */ + #undef E #endif /* DECL_H */ diff --git a/win/tty/getline.c b/win/tty/getline.c index f4894a950..a3abfcc53 100644 --- a/win/tty/getline.c +++ b/win/tty/getline.c @@ -52,10 +52,10 @@ getlin_hook_proc hook; struct WinDesc *cw = wins[WIN_MESSAGE]; boolean doprev = 0; - if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP)) + if (ttyDisplay->toplin == TOPLINE_NEED_MORE && !(cw->flags & WIN_STOP)) more(); cw->flags &= ~WIN_STOP; - ttyDisplay->toplin = 3; /* special prompt state */ + ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT; ttyDisplay->inread++; /* issue the prompt */ @@ -193,7 +193,7 @@ getlin_hook_proc hook; } else tty_nhbell(); } - ttyDisplay->toplin = 2; /* nonempty, no --More-- required */ + ttyDisplay->toplin = TOPLINE_NON_EMPTY; ttyDisplay->inread--; clear_nhwindow(WIN_MESSAGE); /* clean up after ourselves */ diff --git a/win/tty/topl.c b/win/tty/topl.c index 62fb3eb53..d2a889cc9 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -138,7 +138,7 @@ const char *str; end_glyphout(); /* in case message printed during graphics output */ putsyms(str); cl_end(); - ttyDisplay->toplin = 1; + ttyDisplay->toplin = TOPLINE_NEED_MORE; if (ttyDisplay->cury && otoplin != 3) more(); } @@ -151,7 +151,7 @@ const char *str; struct WinDesc *cw = wins[WIN_MESSAGE]; if (!(cw->flags & WIN_STOP)) { - if (ttyDisplay->cury && ttyDisplay->toplin == 2) + if (ttyDisplay->cury && ttyDisplay->toplin == TOPLINE_NON_EMPTY) tty_clear_nhwindow(WIN_MESSAGE); cw->curx = cw->cury = 0; @@ -159,8 +159,8 @@ const char *str; cl_end(); addtopl(str); - if (ttyDisplay->cury && ttyDisplay->toplin != 3) - ttyDisplay->toplin = 2; + if (ttyDisplay->cury && ttyDisplay->toplin != TOPLINE_SPECIAL_PROMPT) + ttyDisplay->toplin = TOPLINE_NON_EMPTY; } } @@ -196,7 +196,7 @@ const char *s; tty_curs(BASE_WINDOW, cw->curx + 1, cw->cury); putsyms(s); cl_end(); - ttyDisplay->toplin = 1; + ttyDisplay->toplin = TOPLINE_NEED_MORE; } void @@ -236,7 +236,7 @@ more() home(); cl_end(); } - ttyDisplay->toplin = 0; + ttyDisplay->toplin = TOPLINE_EMPTY; ttyDisplay->inmore = 0; } @@ -252,7 +252,7 @@ register const char *bp; /* If there is room on the line, print message on same line */ /* But messages like "You die..." deserve their own line */ n0 = strlen(bp); - if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP)) + if ((ttyDisplay->toplin == TOPLINE_NEED_MORE || (cw->flags & WIN_STOP)) && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { @@ -263,9 +263,9 @@ register const char *bp; addtopl(bp); return; } else if (!(cw->flags & WIN_STOP)) { - if (ttyDisplay->toplin == 1) { + if (ttyDisplay->toplin == TOPLINE_NEED_MORE) { more(); - } else if (cw->cury) { /* for when flags.toplin == 2 && cury > 1 */ + } else if (cw->cury) { /* for toplin == TOPLINE_NON_EMPTY && cury > 1 */ docorner(1, cw->cury + 1); /* reset cury = 0 if redraw screen */ cw->curx = cw->cury = 0; /* from home--cls() & docorner(1,n) */ } @@ -381,10 +381,10 @@ char def; char prompt[BUFSZ]; yn_number = 0L; - if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP)) + if (ttyDisplay->toplin == TOPLINE_NEED_MORE && !(cw->flags & WIN_STOP)) more(); cw->flags &= ~WIN_STOP; - ttyDisplay->toplin = 3; /* special prompt state */ + ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT; ttyDisplay->inread++; if (resp) { char *rb, respbuf[QBUFSZ]; @@ -531,7 +531,7 @@ char def; dumplogmsg(toplines); #endif ttyDisplay->inread--; - ttyDisplay->toplin = 2; + ttyDisplay->toplin = TOPLINE_NON_EMPTY; if (ttyDisplay->intr) ttyDisplay->intr--; if (wins[WIN_MESSAGE]->cury) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 1411839da..8ea315ab1 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -332,7 +332,7 @@ int sig_unused UNUSED; new_status_window(); if (u.ux) { i = ttyDisplay->toplin; - ttyDisplay->toplin = 0; + ttyDisplay->toplin = TOPLINE_EMPTY; docrt(); bot(); ttyDisplay->toplin = i; @@ -420,7 +420,7 @@ char **argv UNUSED; /* set up tty descriptor */ ttyDisplay = (struct DisplayDesc *) alloc(sizeof (struct DisplayDesc)); - ttyDisplay->toplin = 0; + ttyDisplay->toplin = TOPLINE_EMPTY; ttyDisplay->rows = hgt; ttyDisplay->cols = wid; ttyDisplay->curx = ttyDisplay->cury = 0; @@ -1621,12 +1621,12 @@ winid window; switch (cw->type) { case NHW_MESSAGE: - if (ttyDisplay->toplin) { + if (ttyDisplay->toplin != TOPLINE_EMPTY) { home(); cl_end(); if (cw->cury) docorner(1, cw->cury + 1); - ttyDisplay->toplin = 0; + ttyDisplay->toplin = TOPLINE_EMPTY; } break; case NHW_STATUS: @@ -2317,12 +2317,13 @@ boolean blocking; /* with ttys, all windows are blocking */ switch (cw->type) { case NHW_MESSAGE: - if (ttyDisplay->toplin == 1) { + if (ttyDisplay->toplin == TOPLINE_NEED_MORE) { more(); - ttyDisplay->toplin = 1; /* more resets this */ + ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(window); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } else - ttyDisplay->toplin = 0; + ttyDisplay->toplin = TOPLINE_EMPTY; cw->curx = cw->cury = 0; if (!cw->active) iflags.window_inited = TRUE; @@ -2330,8 +2331,8 @@ boolean blocking; /* with ttys, all windows are blocking */ case NHW_MAP: end_glyphout(); if (blocking) { - if (!ttyDisplay->toplin) - ttyDisplay->toplin = 1; + if (ttyDisplay->toplin != TOPLINE_EMPTY) + ttyDisplay->toplin = TOPLINE_NEED_MORE; tty_display_nhwindow(WIN_MESSAGE, TRUE); return; } @@ -2361,7 +2362,7 @@ boolean blocking; /* with ttys, all windows are blocking */ cw->offx = 0; if (cw->type == NHW_MENU) cw->offy = 0; - if (ttyDisplay->toplin == 1) + if (ttyDisplay->toplin == TOPLINE_NEED_MORE) tty_display_nhwindow(WIN_MESSAGE, TRUE); #ifdef H2344_BROKEN if (cw->maxrow >= (int) ttyDisplay->rows @@ -2377,7 +2378,7 @@ boolean blocking; /* with ttys, all windows are blocking */ cl_eos(); } else clear_screen(); - ttyDisplay->toplin = 0; + ttyDisplay->toplin = TOPLINE_EMPTY; } else { if (WIN_MESSAGE != WIN_ERR) tty_clear_nhwindow(WIN_MESSAGE); @@ -2406,8 +2407,9 @@ winid window; switch (cw->type) { case NHW_MESSAGE: - if (ttyDisplay->toplin) + if (ttyDisplay->toplin != TOPLINE_EMPTY) tty_display_nhwindow(WIN_MESSAGE, TRUE); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -3158,10 +3160,11 @@ const char *mesg; response to a prompt, we'll assume that the display is up to date */ tty_putstr(WIN_MESSAGE, 0, mesg); /* if `mesg' didn't wrap (triggering --More--), force --More-- now */ - if (ttyDisplay->toplin == 1) { + if (ttyDisplay->toplin == TOPLINE_NEED_MORE) { more(); - ttyDisplay->toplin = 1; /* more resets this */ + ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(WIN_MESSAGE); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } /* normally means skip further messages, but in this case it means cancel the current prompt; any other messages should @@ -3201,7 +3204,7 @@ tty_wait_synch() (void) fflush(stdout); } else if (ttyDisplay->inread > program_state.gameover) { /* this can only happen if we were reading and got interrupted */ - ttyDisplay->toplin = 3; + ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT; /* do this twice; 1st time gets the Quit? message again */ (void) tty_doprev_message(); (void) tty_doprev_message(); @@ -3530,8 +3533,9 @@ tty_nhgetch() i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */ else if (i == EOF) i = '\033'; /* same for EOF */ - if (ttyDisplay && ttyDisplay->toplin == 1) - ttyDisplay->toplin = 2; + /* topline has been seen - we can clear need for more */ + if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) + ttyDisplay->toplin = TOPLINE_NON_EMPTY; #ifdef TTY_TILES_ESCCODES { /* hack to force output of the window select code */ @@ -3610,8 +3614,9 @@ tty_nhgetch() i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */ else if (i == EOF) i = '\033'; /* same for EOF */ - if (ttyDisplay && ttyDisplay->toplin == 1) - ttyDisplay->toplin = 2; + /* topline has been seen - we can clear need for more */ + if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) + ttyDisplay->toplin = TOPLINE_NON_EMPTY; #ifdef TTY_TILES_ESCCODES { /* hack to force output of the window select code */ @@ -3656,8 +3661,9 @@ int *x, *y, *mod; i = ntposkey(x, y, mod); if (!i && mod && (*mod == 0 || *mod == EOF)) i = '\033'; /* map NUL or EOF to ESC, nethack doesn't expect either */ - if (ttyDisplay && ttyDisplay->toplin == 1) - ttyDisplay->toplin = 2; + /* topline has been seen - we can clear need for more */ + if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) + ttyDisplay->toplin = TOPLINE_NON_EMPTY; #else /* !WIN32CON */ nhUse(x); nhUse(y); From 188eedc65458e9646569c794f816515f5cb3a35b Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 11 Jul 2019 01:02:34 -0700 Subject: [PATCH 046/296] curses: #extended command vs erase/kill chars Support erase char and kill char when getting an extended command. Also, show the cursor so that it's obvious where input focus is. --- doc/fixes36.3 | 3 ++- win/curses/cursdial.c | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 3d8a5ed9e..391e849da 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.92 $ $NHDT-Date: 1562806584 2019/07/11 00:56:24 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.93 $ $NHDT-Date: 1562832141 2019/07/11 08:02:21 $ 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, @@ -175,6 +175,7 @@ curses: when map window was clipped, the 'scrollbars' shown to indicate which the 2nd and 3rd fifths (for example) were currently within view curses: support users's setting for erase char and kill char when getting a line of input with 'popup_dialog' Off (already supported for popup On) +curses: support erase char and kill char when choosing an extended command curses: attempting to use ^H to rush left actually executed ^G (#wizgenesis) curses: disable the attempt to support Ctrl+Left_click as an alternate way to generate Right_click for systems with one-button mouse or trackpad; diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 7dccffa78..cb65610f5 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -17,6 +17,10 @@ #define strncasecmp strncmpi #endif +/* defined in sys//tty.c or cursmain.c as last resort; + set up by curses_init_nhwindows() */ +extern char erase_char, kill_char; + /* * Note: * @@ -412,7 +416,7 @@ curses_ext_cmd() wmove(extwin, starty, startx + 2); waddstr(extwin, cur_choice); wmove(extwin, starty, (int) strlen(cur_choice) + startx + 2); - wprintw(extwin, " "); + wclrtoeol(extwin); /* if we have an autocomplete command, AND it matches uniquely */ if (matches == 1) { @@ -421,12 +425,12 @@ curses_ext_cmd() wprintw(extwin, "%s", extcmdlist[ret].ef_txt + (int) strlen(cur_choice)); curses_toggle_color_attr(extwin, NONE, A_UNDERLINE, OFF); - mvwprintw(extwin, starty, - (int) strlen(extcmdlist[ret].ef_txt) + 2, " "); } + curs_set(1); wrefresh(extwin); letter = getch(); + curs_set(0); prompt_width = (int) strlen(cur_choice); matches = 0; @@ -448,8 +452,9 @@ curses_ext_cmd() } if (letter == '\177') /* DEL/Rubout */ - letter = '\b'; - if (letter == '\b' || letter == KEY_BACKSPACE) { + letter = '\b'; + if (letter == '\b' || letter == KEY_BACKSPACE + || (erase_char && letter == (int) (uchar) erase_char)) { if (prompt_width == 0) { ret = -1; break; @@ -458,7 +463,15 @@ curses_ext_cmd() letter = '*'; prompt_width--; } + + /* honor kill_char if it's ^U or similar, but not if it's '@' */ + } else if (kill_char && letter == (int) (uchar) kill_char + && (letter < ' ' || letter >= '\177')) { /*ASCII*/ + cur_choice[0] = '\0'; + letter = '*'; + prompt_width = 0; } + if (letter != '*' && prompt_width < maxlen) { cur_choice[prompt_width] = letter; cur_choice[prompt_width + 1] = '\0'; @@ -486,7 +499,8 @@ curses_ext_cmd() } curses_destroy_win(extwin); - if (extwin2) curses_destroy_win(extwin2); + if (extwin2) + curses_destroy_win(extwin2); return ret; } From bfbe4e71ce69ef562303d6d78caf91878c6043cf Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 11 Jul 2019 02:54:02 -0700 Subject: [PATCH 047/296] make #panic honor paranoid_confirmatin:quit If 'paranoid_confirmation:quit' is set, require "yes" instead of 'y' to execute the wizard mode #panic command. --- doc/Guidebook.mn | 21 +++++++++++++++++---- doc/Guidebook.tex | 26 ++++++++++++++++++++------ doc/fixes36.3 | 3 ++- src/cmd.c | 5 +++-- 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 9b215d2fb..ce6d40df0 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.311 $ $NHDT-Date: 1562719337 2019/07/10 00:42:17 $ +.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.312 $ $NHDT-Date: 1562838836 2019/07/11 09:53:56 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -1104,6 +1104,12 @@ Autocompletes. Default key is \(oqM-e\(cq. .lp #exploremode Enter the explore mode. +.lp "" +Requires confirmation; default response is \f(CRn\fP (no). +To really switch to explore mode, respond with \f(CRy\fP. +You can set the +.op paranoid_confirmation:quit +option to require a response of \f(CRyes\fP instead. .lp "#fire " Fire ammunition from quiver. Default key is \(oqf\(cq. @@ -1211,6 +1217,12 @@ Test the panic routine. Terminates the current game. Autocompletes. Debug mode only. +.lp "" +Asks for confirmation; default is \f(CRn\fP (no); continue playing. +To really panic, respond with \f(CRy\fP. +You can set the +.op paranoid_confirmation:quit +option to require a response of \f(CRyes\fP instead. .lp "#pay " Pay your shopping bill. Default key is \(oqp\(cq. @@ -1251,10 +1263,11 @@ Default key is \(oqM-q\(cq. .lp "" Since using this command by accident would throw away the current game, you are asked to confirm your intent before quitting. -By default a response of \(oqy\(cq acknowledges that intent. +Default response is \f(CRn\fP (no); continue playing. +To really quit, respond with \f(CRy\fP. You can set the -.op paranoid_confirmation -option to require a response of \(lqyes\(rq instead. +.op paranoid_confirmation:quit +option to require a response of \f(CRyes\fP instead. .lp "#quiver " Select ammunition for quiver. Default key is \(oqQ\(cq. diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index d642cfed5..7cb9bf0b1 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -1216,7 +1216,13 @@ Advance or check weapon and spell skills. Autocompletes. Default key is `{\tt M-e}'. %.lp \item[\tb{\#exploremode}] -Enter the explore mode. +Enter the explore mode.\\ +%.lp "" +Requires confirmation; default response is `{\tt n}' (no). +To really switch to explore mode, respond with `{\tt y}'. +You can set the +{\it paranoid\verb+_+confirmation:quit\/} +option to require a response of ``{\tt yes}'' instead. %.lp \item[\tb{\#fire}] Fire ammunition from quiver. Default key is `{\tt f}'. @@ -1324,7 +1330,13 @@ Default keys are `{\tt \^{}O}', and `{\tt M-O}'. Test the panic routine. Terminates the current game. Autocompletes. -Debug mode only. +Debug mode only.\\ +%.lp "" +Asks for confirmation; default is `{\tt n}' (no); continue playing. +To really panic, respond with `{\tt y}''. +You can set the +{\it paranoid\verb+_+confirmation:quit\/} +option to require a response of ``{\tt yes}'' instead. %.lp \item[\tb{\#pay}] Pay your shopping bill. Default key is `{\tt p}'. @@ -1361,12 +1373,14 @@ Quaff (drink) something. Default key is `{\tt q}'. %.lp \item[\tb{\#quit}] Quit the program without saving your game. Autocompletes. -Default key is `{\tt M-q}'. +Default key is `{\tt M-q}'.\\ %.lp "" Since using this command by accident would throw away the current game, -you are asked to confirm your intent before quitting. By default a -response of `{\tt y}' acknowledges that intent. You can set the -{\it paranoid\verb+_+confirmation\/} +you are asked to confirm your intent before quitting. +Default response is `{\tt n}' (no); continue playing. +To really quit, respond with `{\tt y}'. +You can set the +{\it paranoid\verb+_+confirmation:quit\/} option to require a response of ``{\tt yes}'' instead. %.lp \item[\tb{\#quiver}] diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 391e849da..909dbd345 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.93 $ $NHDT-Date: 1562832141 2019/07/11 08:02:21 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.94 $ $NHDT-Date: 1562838835 2019/07/11 09:53:55 $ 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, @@ -104,6 +104,7 @@ detect unseen/secret door detection/^E failed to find monsters hiding under when farlook describes a monster at a visible spot as trapped, reveal the trap fix theft when poly'd into nymph form; 3.6.2 change made that anger the victim hero poly'd into nymph would steal gold along with other items +change wizard mode #panic to require "yes" if 'paranoid_confirm:quit' is set Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/cmd.c b/src/cmd.c index b4f613de1..d577d8e91 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1562532731 2019/07/07 20:52:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.339 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1562838823 2019/07/11 09:53:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.340 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1002,7 +1002,8 @@ wiz_panic(VOID_ARGS) u.uen = u.uenmax = 1000; return 0; } - if (yn("Do you want to call panic() and end your game?") == 'y') + if (paranoid_query(ParanoidQuit, + "Do you want to call panic() and end your game?")) panic("Crash test."); return 0; } From 524f5642d55c29e6f1ecedd5a64cb1e96e00c7d6 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 11 Jul 2019 13:29:33 -0700 Subject: [PATCH 048/296] poly'd hero theft fix I moved some stuff around after testing the changes in 58583cacf8511625fd805ecbb050481f28de9411 before committing it. It accidentally ended up with 'gold' always being Null at the first place it gets used (to vary the feedback when stealing everything except gold). --- src/uhitm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uhitm.c b/src/uhitm.c index c6fc30c2a..83bb49ca2 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 uhitm.c $NHDT-Date: 1562806586 2019/07/11 00:56:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.210 $ */ +/* NetHack 3.6 uhitm.c $NHDT-Date: 1562876956 2019/07/11 20:29:16 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.211 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1522,6 +1522,7 @@ struct attack *mattk; } *minvent_ptr = stealoid; /* put armor back into minvent */ } + gold = findgold(mdef->minvent); if (stealoid) { /* we will be taking everything */ if (gender(mdef) == (int) u.mfemale && youmonst.data->mlet == S_NYMPH) @@ -1538,11 +1539,11 @@ struct attack *mattk; stolen c'trice corpse or monster wielding one and having gloves stolen) is less bookkeeping than skipping it within the loop or taking it out once and then trying to figure out how to put it back */ - if ((gold = findgold(mdef->minvent)) != 0) + if (gold) obj_extract_self(gold); while ((otmp = mdef->minvent) != 0) { - if (gold) /* put 'mdef's gold back */ + if (gold) /* put 'mdef's gold back after remembering mdef->minvent */ mpickobj(mdef, gold), gold = 0; if (!Upolyd) break; /* no longer have ability to steal */ From 7bb41c797fb2491dc39102ddd4f1d31bd74c10c8 Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 11 Jul 2019 16:34:25 -0700 Subject: [PATCH 049/296] Moved declaration of topline state to wintty.h. --- include/decl.h | 6 ------ include/wintty.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/decl.h b/include/decl.h index 6c0f9721c..5ebaa326e 100644 --- a/include/decl.h +++ b/include/decl.h @@ -455,12 +455,6 @@ struct early_opt { boolean valallowed; }; -/* topline states */ -#define TOPLINE_EMPTY 0 /* empty */ -#define TOPLINE_NEED_MORE 1 /* non-empty, need --More-- */ -#define TOPLINE_NON_EMPTY 2 /* non-empty, no --More-- required */ -#define TOPLINE_SPECIAL_PROMPT 3 /* special prompt state */ - #undef E #endif /* DECL_H */ diff --git a/include/wintty.h b/include/wintty.h index 6994fc93f..e6388ec0d 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -50,6 +50,12 @@ struct WinDesc { #define WIN_STOP 1 /* for NHW_MESSAGE; stops output */ #define WIN_LOCKHISTORY 2 /* for NHW_MESSAGE; suppress history updates */ +/* topline states */ +#define TOPLINE_EMPTY 0 /* empty */ +#define TOPLINE_NEED_MORE 1 /* non-empty, need --More-- */ +#define TOPLINE_NON_EMPTY 2 /* non-empty, no --More-- required */ +#define TOPLINE_SPECIAL_PROMPT 3 /* special prompt state */ + /* descriptor for tty-based displays -- all the per-display data */ struct DisplayDesc { short rows, cols; /* width and height of tty display */ From 9801635f56804a195c2b1f5c6bec0e239c9c4935 Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 11 Jul 2019 20:46:19 -0700 Subject: [PATCH 050/296] Remove the remapping of snprintf to _snprintf when compiling with MSC. _snprintf and snprintf have one very important semantic difference. _snprintf does NOT add terminating null character when the buffer limit is reached while snprintf guarantees a terminating null character. It was a mistake to make this naming change hiding the fact that the semantics don't match what the developer might expect. --- include/ntconf.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/ntconf.h b/include/ntconf.h index 994615c2d..9d79006f0 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -146,14 +146,6 @@ extern void NDECL(getlock); #define strncmpi(a, b, c) strnicmp(a, b, c) #endif -#ifdef _MSC_VER -/* Visual Studio defines this in their own headers, which we don't use */ -#ifndef snprintf -#define snprintf _snprintf -#pragma warning( \ - disable : 4996) /* deprecation warning suggesting snprintf_s */ -#endif -#endif #include #include From 3e4a0759a37ec6fe62d026cdd02dadd0ec6f682d Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 11 Jul 2019 20:55:27 -0700 Subject: [PATCH 051/296] Modified nhassert_failed to call impossoible. --- sys/winnt/winnt.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index e9041262d..d54982975 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -478,18 +478,11 @@ char *buf; /* nhassert_failed is called when an nhassert's condition is false */ void nhassert_failed(const char * exp, const char * file, int line) { - char message[128]; - _snprintf(message, sizeof(message), - "NHASSERT(%s) in '%s' at line %d\n", exp, file, line); + char message[BUFSZ]; + snprintf(message, sizeof(message), + "NHASSERT(%s) in '%s' at line %d", exp, file, line); - if (IsDebuggerPresent()) { - OutputDebugStringA(message); - DebugBreak(); - } - - // strip off the newline - message[strlen(message) - 1] = '\0'; - error(message); + impossible(message); } void From 0f57f0e48ca6e6823fb238566d5faddd3cf0726b Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 11 Jul 2019 21:04:29 -0700 Subject: [PATCH 052/296] Fixed bug with inmore and toplin state management. When fuzzing, we would increment ttyDisplay->inmore but then prematurely exit more() leaving ttyDisplay->inmore set. Under various conditions, we can request to remember the topline when the topline had not yet been acknowledged leaving toplin state in an inappropriate state. --- win/tty/topl.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index d2a889cc9..bb79be26c 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -139,7 +139,7 @@ const char *str; putsyms(str); cl_end(); ttyDisplay->toplin = TOPLINE_NEED_MORE; - if (ttyDisplay->cury && otoplin != 3) + if (ttyDisplay->cury && otoplin != TOPLINE_SPECIAL_PROMPT) more(); } @@ -204,12 +204,15 @@ more() { struct WinDesc *cw = wins[WIN_MESSAGE]; - /* avoid recursion -- only happens from interrupts */ - if (ttyDisplay->inmore++) - return; if (iflags.debug_fuzzer) return; + /* avoid recursion -- only happens from interrupts */ + if (ttyDisplay->inmore) + return; + + ttyDisplay->inmore++; + if (ttyDisplay->toplin) { tty_curs(BASE_WINDOW, cw->curx + 1, cw->cury); if (cw->curx >= CO - 8) @@ -256,6 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { + nhassert(strlen(toplines) == cw->curx); Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; @@ -309,6 +313,7 @@ char c; if (ttyDisplay->curx == 0 && ttyDisplay->cury > 0) tty_curs(BASE_WINDOW, CO, (int) ttyDisplay->cury - 1); backsp(); + nhassert(ttyDisplay->curx > 0); ttyDisplay->curx--; cw->curx = ttyDisplay->curx; return; @@ -689,6 +694,13 @@ boolean restoring_msghist; } if (msg) { + /* Caller is asking us to remember a top line that needed more. + Should we call more? This can happen when the player has set + iflags.force_invmenu and they attempt to shoot with nothing in + the quiver. */ + if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) + ttyDisplay->toplin = TOPLINE_NON_EMPTY; + /* move most recent message to history, make this become most recent */ remember_topl(); Strcpy(toplines, msg); @@ -696,6 +708,9 @@ boolean restoring_msghist; dumplogmsg(toplines); #endif } else if (snapshot_mesgs) { + nhassert(ttyDisplay == NULL || + ttyDisplay->toplin != TOPLINE_NEED_MORE); + /* done putting arbitrary messages in; put the snapshot ones back */ for (idx = 0; snapshot_mesgs[idx]; ++idx) { remember_topl(); From 1db45c8016484114841f39ffe70c8d9cdd1ad92c Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 11 Jul 2019 20:58:20 -0700 Subject: [PATCH 053/296] Added assertions to check toplin state. --- win/tty/wintty.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 8ea315ab1..0422129fd 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2321,7 +2321,7 @@ boolean blocking; /* with ttys, all windows are blocking */ more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(window); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); } else ttyDisplay->toplin = TOPLINE_EMPTY; cw->curx = cw->cury = 0; @@ -2409,7 +2409,7 @@ winid window; case NHW_MESSAGE: if (ttyDisplay->toplin != TOPLINE_EMPTY) tty_display_nhwindow(WIN_MESSAGE, TRUE); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -3164,7 +3164,7 @@ const char *mesg; more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(WIN_MESSAGE); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); } /* normally means skip further messages, but in this case it means cancel the current prompt; any other messages should From 45a9c5eb14326521188457fe87a9d853b44a64ce Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 11 Jul 2019 21:23:12 -0700 Subject: [PATCH 054/296] Comment out nhassert() calls. --- win/tty/topl.c | 8 ++++---- win/tty/wintty.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index bb79be26c..14e9bc548 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -259,7 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - nhassert(strlen(toplines) == cw->curx); + /* nhassert(strlen(toplines) == cw->curx); */ Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; @@ -313,7 +313,7 @@ char c; if (ttyDisplay->curx == 0 && ttyDisplay->cury > 0) tty_curs(BASE_WINDOW, CO, (int) ttyDisplay->cury - 1); backsp(); - nhassert(ttyDisplay->curx > 0); + /* nhassert(ttyDisplay->curx > 0); */ ttyDisplay->curx--; cw->curx = ttyDisplay->curx; return; @@ -708,8 +708,8 @@ boolean restoring_msghist; dumplogmsg(toplines); #endif } else if (snapshot_mesgs) { - nhassert(ttyDisplay == NULL || - ttyDisplay->toplin != TOPLINE_NEED_MORE); + /* nhassert(ttyDisplay == NULL || + ttyDisplay->toplin != TOPLINE_NEED_MORE); */ /* done putting arbitrary messages in; put the snapshot ones back */ for (idx = 0; snapshot_mesgs[idx]; ++idx) { diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 0422129fd..8ea315ab1 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2321,7 +2321,7 @@ boolean blocking; /* with ttys, all windows are blocking */ more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(window); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } else ttyDisplay->toplin = TOPLINE_EMPTY; cw->curx = cw->cury = 0; @@ -2409,7 +2409,7 @@ winid window; case NHW_MESSAGE: if (ttyDisplay->toplin != TOPLINE_EMPTY) tty_display_nhwindow(WIN_MESSAGE, TRUE); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -3164,7 +3164,7 @@ const char *mesg; more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(WIN_MESSAGE); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } /* normally means skip further messages, but in this case it means cancel the current prompt; any other messages should From 0ca299acb3b52c90e65ad3ca3eb69ccfa8cceb97 Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 11 Jul 2019 22:01:39 -0700 Subject: [PATCH 055/296] Added nhassert to core. --- include/extern.h | 1 + include/global.h | 5 +++++ include/ntconf.h | 10 ---------- src/pline.c | 6 ++++++ sys/winnt/winnt.c | 10 ---------- win/tty/topl.c | 8 ++++---- win/tty/wintty.c | 6 +++--- 7 files changed, 19 insertions(+), 27 deletions(-) diff --git a/include/extern.h b/include/extern.h index 0761d224e..5812366f2 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1932,6 +1932,7 @@ E void VDECL(verbalize, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2); +E void FDECL(nhassert_failed, (const char *, const char *, int)); /* ### polyself.c ### */ diff --git a/include/global.h b/include/global.h index 6e0f96ebf..ada34523c 100644 --- a/include/global.h +++ b/include/global.h @@ -375,5 +375,10 @@ struct savefile_info { #define nethack_enter(argc, argv) ((void) 0) #endif +/* Supply nhassert macro if not supplied by port */ +#ifndef nhassert +#define nhassert(expression) (void)((!!(expression)) || \ + (nhassert_failed(#expression, __FILE__, __LINE__), 0)) +#endif #endif /* GLOBAL_H */ diff --git a/include/ntconf.h b/include/ntconf.h index 9d79006f0..62c269bab 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -267,16 +267,6 @@ extern int FDECL(set_win32_option, (const char *, const char *)); extern int FDECL(alternative_palette, (char *)); #endif -#ifdef NDEBUG -#define nhassert(expression) ((void)0) -#else -extern void FDECL(nhassert_failed, (const char * exp, const char * file, - int line)); - -#define nhassert(expression) (void)((!!(expression)) || \ - (nhassert_failed(#expression, __FILE__, __LINE__), 0)) -#endif - #define nethack_enter(argc, argv) nethack_enter_winnt() extern void FDECL(nethack_exit, (int)) NORETURN; extern boolean FDECL(file_exists, (const char *)); diff --git a/src/pline.c b/src/pline.c index d7db3f43d..535b75e95 100644 --- a/src/pline.c +++ b/src/pline.c @@ -582,4 +582,10 @@ VA_DECL(const char *, str) #endif } +/* nhassert_failed is called when an nhassert's condition is false */ +void nhassert_failed(const char * exp, const char * file, int line) +{ + impossible("NHASSERT(%s) in '%s' at line %d", exp, file, line); +} + /*pline.c*/ diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index d54982975..0e19e1f76 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -475,16 +475,6 @@ char *buf; } #endif /* RUNTIME_PORT_ID */ -/* nhassert_failed is called when an nhassert's condition is false */ -void nhassert_failed(const char * exp, const char * file, int line) -{ - char message[BUFSZ]; - snprintf(message, sizeof(message), - "NHASSERT(%s) in '%s' at line %d", exp, file, line); - - impossible(message); -} - void nethack_exit(code) int code; diff --git a/win/tty/topl.c b/win/tty/topl.c index 14e9bc548..bb79be26c 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -259,7 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - /* nhassert(strlen(toplines) == cw->curx); */ + nhassert(strlen(toplines) == cw->curx); Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; @@ -313,7 +313,7 @@ char c; if (ttyDisplay->curx == 0 && ttyDisplay->cury > 0) tty_curs(BASE_WINDOW, CO, (int) ttyDisplay->cury - 1); backsp(); - /* nhassert(ttyDisplay->curx > 0); */ + nhassert(ttyDisplay->curx > 0); ttyDisplay->curx--; cw->curx = ttyDisplay->curx; return; @@ -708,8 +708,8 @@ boolean restoring_msghist; dumplogmsg(toplines); #endif } else if (snapshot_mesgs) { - /* nhassert(ttyDisplay == NULL || - ttyDisplay->toplin != TOPLINE_NEED_MORE); */ + nhassert(ttyDisplay == NULL || + ttyDisplay->toplin != TOPLINE_NEED_MORE); /* done putting arbitrary messages in; put the snapshot ones back */ for (idx = 0; snapshot_mesgs[idx]; ++idx) { diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 8ea315ab1..0422129fd 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2321,7 +2321,7 @@ boolean blocking; /* with ttys, all windows are blocking */ more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(window); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); } else ttyDisplay->toplin = TOPLINE_EMPTY; cw->curx = cw->cury = 0; @@ -2409,7 +2409,7 @@ winid window; case NHW_MESSAGE: if (ttyDisplay->toplin != TOPLINE_EMPTY) tty_display_nhwindow(WIN_MESSAGE, TRUE); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -3164,7 +3164,7 @@ const char *mesg; more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(WIN_MESSAGE); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); } /* normally means skip further messages, but in this case it means cancel the current prompt; any other messages should From 0e8e5aac93e660a001dccb66df7320023aaa36de Mon Sep 17 00:00:00 2001 From: Bart House Date: Fri, 12 Jul 2019 18:37:33 -0700 Subject: [PATCH 056/296] Fixed sign/unsigned comparisions. --- src/teleport.c | 4 ++-- win/tty/topl.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/teleport.c b/src/teleport.c index 100a74d3b..0c8271845 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -1143,10 +1143,10 @@ struct monst *mtmp; sent out of his room (caller might resort to goodpos() if we report failure here, so this isn't full prevention) */ if (mtmp->isshk && inhishop(mtmp)) { - if (levl[x][y].roomno != ESHK(mtmp)->shoproom) + if (levl[x][y].roomno != (unsigned char) ESHK(mtmp)->shoproom) return FALSE; } else if (mtmp->ispriest && inhistemple(mtmp)) { - if (levl[x][y].roomno != EPRI(mtmp)->shroom) + if (levl[x][y].roomno != (unsigned char) EPRI(mtmp)->shroom) return FALSE; } /* current location is */ diff --git a/win/tty/topl.c b/win/tty/topl.c index bb79be26c..cfd17838d 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -259,7 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - nhassert(strlen(toplines) == cw->curx); + nhassert((long) strlen(toplines) == cw->curx); Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; From 2f3da35c6893d2a44e8281ae209f00d54eefa2f2 Mon Sep 17 00:00:00 2001 From: Bart House Date: Fri, 12 Jul 2019 18:40:34 -0700 Subject: [PATCH 057/296] Tweaks to nhassert implementation. Change to warnings on MSC build. --- include/extern.h | 2 +- include/global.h | 2 +- include/ntconf.h | 12 ++++++++++++ src/pline.c | 15 +++++++++++++-- sys/winnt/winnt.c | 17 +++++++++++++++++ 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/include/extern.h b/include/extern.h index 5812366f2..abea20a68 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1932,7 +1932,7 @@ E void VDECL(verbalize, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2); -E void FDECL(nhassert_failed, (const char *, const char *, int)); +E void FDECL(nhassert_failed, (const char *, int)); /* ### polyself.c ### */ diff --git a/include/global.h b/include/global.h index ada34523c..1bcc2ae5d 100644 --- a/include/global.h +++ b/include/global.h @@ -378,7 +378,7 @@ struct savefile_info { /* Supply nhassert macro if not supplied by port */ #ifndef nhassert #define nhassert(expression) (void)((!!(expression)) || \ - (nhassert_failed(#expression, __FILE__, __LINE__), 0)) + (nhassert_failed(__FILE__, __LINE__), 0)) #endif #endif /* GLOBAL_H */ diff --git a/include/ntconf.h b/include/ntconf.h index 62c269bab..0c76ed718 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -134,6 +134,8 @@ extern void NDECL(getlock); #ifndef HAS_STDINT_H #define HAS_STDINT_H /* force include of stdint.h in integer.h */ #endif +/* Turn on some additional warnings */ +#pragma warning(3:4389) #endif /* _MSC_VER */ /* The following is needed for prototypes of certain functions */ @@ -270,4 +272,14 @@ extern int FDECL(alternative_palette, (char *)); #define nethack_enter(argc, argv) nethack_enter_winnt() extern void FDECL(nethack_exit, (int)) NORETURN; extern boolean FDECL(file_exists, (const char *)); + +/* Override the default version of nhassert. The default version is unable + * to generate a string form of the expression due to the need to be + * compatible with compilers which do not support macro stringization (i.e. + * #x to turn x into its string form). + */ +extern void FDECL(nt_assert_failed, (const char *, const char *, int)); +#define nhassert(expression) (void)((!!(expression)) || \ + (nt_assert_failed(#expression, __FILE__, __LINE__), 0)) + #endif /* NTCONF_H */ diff --git a/src/pline.c b/src/pline.c index 535b75e95..91e825963 100644 --- a/src/pline.c +++ b/src/pline.c @@ -583,9 +583,20 @@ VA_DECL(const char *, str) } /* nhassert_failed is called when an nhassert's condition is false */ -void nhassert_failed(const char * exp, const char * file, int line) +void +nhassert_failed(filepath, line) + const char * filepath; + int line; { - impossible("NHASSERT(%s) in '%s' at line %d", exp, file, line); + const char * filename; + + /* attempt to get filename from path. TODO: we really need a port provided + * function to return a filename from a path */ + filename = strrchr(filepath, '/'); + filename = (filename == NULL ? strrchr(filepath, '\\') : filename); + filename = (filename == NULL ? filepath : filename + 1); + + impossible("nhassert failed in file '%s' at line %d", filename, line); } /*pline.c*/ diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 0e19e1f76..8d513c59e 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -708,6 +708,23 @@ sys_random_seed(VOID_ARGS) } return ourseed; } + +/* nt_assert_failed is called when an nhassert's condition is false */ +void +nt_assert_failed(expression, filepath, line) + const char * expression; + const char * filepath; + int line; +{ + const char * filename; + + /* get file name from path */ + filename = strrchr(filepath, '\\'); + filename = (filename == NULL ? filepath : filename + 1); + impossible("nhassert(%s) failed in file '%s' at line %d", + expression, filename, line); +} + #endif /* WIN32 */ /*winnt.c*/ From 638d9f936316bf8e68783e976b0cde7193ebca0e Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 13 Jul 2019 00:17:23 -0400 Subject: [PATCH 058/296] if prototype is declared static make function static to match Today, a compiler was encountered that considered it an error to have the prototype declared static and the function body not --- src/allmain.c | 2 +- src/apply.c | 6 +++--- src/botl.c | 4 ++-- src/cmd.c | 2 +- src/display.c | 2 +- src/hack.c | 4 ++-- src/isaac64.c | 2 ++ src/makemon.c | 2 +- src/mkmaze.c | 8 ++++---- src/mon.c | 4 ++-- src/objnam.c | 4 ++-- src/options.c | 4 ++-- src/pager.c | 22 +++++++++++----------- src/pickup.c | 2 +- src/questpgr.c | 2 +- src/shk.c | 2 +- util/makedefs.c | 4 ++-- win/tty/wintty.c | 2 +- 18 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/allmain.c b/src/allmain.c index 1ce8cad08..082447b3b 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -876,7 +876,7 @@ enum earlyarg e_arg; * optimization so that display output * can be debugged without buffering. */ -void +STATIC_OVL void debug_fields(opts) const char *opts; { diff --git a/src/apply.c b/src/apply.c index 879c6a3cb..5bc67850a 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1611,7 +1611,7 @@ int x,y; && is_valid_jump_pos(x, y, jumping_is_magic, FALSE)); } -void +STATIC_OVL void display_jump_positions(state) int state; { @@ -2870,7 +2870,7 @@ static const char cant_reach[] = "can't reach that spot from here."; /* find pos of monster in range, if only one monster */ -boolean +STATIC_OVL boolean find_poleable_mon(pos, min_range, max_range) coord *pos; int min_range, max_range; @@ -2926,7 +2926,7 @@ int x, y; && distu(x, y) <= polearm_range_max); } -void +STATIC_OVL void display_polearm_positions(state) int state; { diff --git a/src/botl.c b/src/botl.c index 06f0a01b5..4a856a211 100644 --- a/src/botl.c +++ b/src/botl.c @@ -561,7 +561,7 @@ static long bl_hilite_moves = 0L; static unsigned long cond_hilites[BL_ATTCLR_MAX]; static int now_or_before_idx = 0; /* 0..1 for array[2][] first index */ -void +STATIC_OVL void bot_via_windowport() { char buf[BUFSZ]; @@ -2812,7 +2812,7 @@ status_hilite_linestr_gather() } -char * +STATIC_OVL char * status_hilite2str(hl) struct hilite_s *hl; { diff --git a/src/cmd.c b/src/cmd.c index d577d8e91..8fd6d5f68 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2576,7 +2576,7 @@ int final; } /* attributes: intrinsics and the like, other non-obvious capabilities */ -void +STATIC_OVL void attributes_enlightenment(unused_mode, final) int unused_mode UNUSED; int final; diff --git a/src/display.c b/src/display.c index 8f7207ad9..70a008a0a 100644 --- a/src/display.c +++ b/src/display.c @@ -897,7 +897,7 @@ xchar x, y; } } -int +STATIC_OVL int tether_glyph(x, y) int x, y; { diff --git a/src/hack.c b/src/hack.c index 74a13af98..95e5ea06c 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1343,7 +1343,7 @@ domove() domove_attempting = 0L; } -void +STATIC_OVL void domove_core() { register struct monst *mtmp; @@ -1940,7 +1940,7 @@ domove_core() } } -void +STATIC_OVL void maybe_smudge_engr(x1,y1,x2,y2) int x1, y1, x2, y2; { diff --git a/src/isaac64.c b/src/isaac64.c index 9ccb0db55..4d19335a3 100644 --- a/src/isaac64.c +++ b/src/isaac64.c @@ -19,7 +19,9 @@ #define ISAAC64_MASK ((uint64_t)0xFFFFFFFFFFFFFFFFULL) #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +#if !defined(HAS_INLINE) #define HAS_INLINE +#endif #else # if (defined(__GNUC__) && __GNUC__ >= 2 && !defined(inline)) # define inline __inline__ diff --git a/src/makemon.c b/src/makemon.c index 0f731c353..2350e77a0 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1033,7 +1033,7 @@ newmextra() return mextra; } -boolean +STATIC_OVL boolean makemon_rnd_goodpos(mon, gpflags, cc) struct monst *mon; unsigned gpflags; diff --git a/src/mkmaze.c b/src/mkmaze.c index 2a11ba4ed..a9d0c1461 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -619,7 +619,7 @@ fixup_special() num_lregions = 0; } -void +STATIC_OVL void check_ransacked(s) char *s; { @@ -630,7 +630,7 @@ char *s; #define ORC_LEADER 1 static const char *orcfruit[] = { "paddle cactus", "dwarven root" }; -void +STATIC_OVL void migrate_orc(mtmp, mflags) struct monst *mtmp; unsigned long mflags; @@ -695,7 +695,7 @@ struct monst *mtmp; add_to_minv(mtmp, otmp); } } -void +STATIC_OVL void migr_booty_item(otyp, gang) int otyp; const char *gang; @@ -716,7 +716,7 @@ const char *gang; } } -void +STATIC_OVL void stolen_booty(VOID_ARGS) { char *gang, gang_name[BUFSZ]; diff --git a/src/mon.c b/src/mon.c index 2a8a7f350..862125289 100644 --- a/src/mon.c +++ b/src/mon.c @@ -45,7 +45,7 @@ const char *warnings[] = { #endif /* 0 */ -void +STATIC_OVL void sanity_check_single_mon(mtmp, chk_geno, msg) struct monst *mtmp; boolean chk_geno; @@ -2735,7 +2735,7 @@ struct monst *mtmp; return; } -void +STATIC_OVL void deal_with_overcrowding(mtmp) struct monst *mtmp; { diff --git a/src/objnam.c b/src/objnam.c index bb876dfd8..59b6397cd 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -417,7 +417,7 @@ struct obj *obj; return xname_flags(obj, CXN_NORMAL); } -char * +STATIC_OVL char * xname_flags(obj, cxn_flags) register struct obj *obj; unsigned cxn_flags; /* bitmask of CXN_xxx values */ @@ -2576,7 +2576,7 @@ const char *oldstr; return bp; } -boolean +STATIC_OVL boolean badman(basestr, to_plural) const char *basestr; boolean to_plural; /* true => makeplural, false => makesingular */ diff --git a/src/options.c b/src/options.c index 3155275ec..2f601df33 100644 --- a/src/options.c +++ b/src/options.c @@ -1602,7 +1602,7 @@ int typ; return (char *) 0; } -int +STATIC_OVL int query_msgtype() { winid tmpwin; @@ -1796,7 +1796,7 @@ const char *errmsg; return retval; } -boolean +STATIC_OVL boolean add_menu_coloring_parsed(str, c, a) char *str; int c, a; diff --git a/src/pager.c b/src/pager.c index 02c61f966..96abfef26 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1409,7 +1409,7 @@ static const char *suptext2[] = { (char *) 0, }; -void +STATIC_OVL void do_supplemental_info(name, pm, without_asking) char *name; struct permonst *pm; @@ -1885,61 +1885,61 @@ docontact(VOID_ARGS) destroy_nhwindow(cwin); } -void +STATIC_OVL void dispfile_help(VOID_ARGS) { display_file(HELP, TRUE); } -void +STATIC_OVL void dispfile_shelp(VOID_ARGS) { display_file(SHELP, TRUE); } -void +STATIC_OVL void dispfile_optionfile(VOID_ARGS) { display_file(OPTIONFILE, TRUE); } -void +STATIC_OVL void dispfile_license(VOID_ARGS) { display_file(LICENSE, TRUE); } -void +STATIC_OVL void dispfile_debughelp(VOID_ARGS) { display_file(DEBUGHELP, TRUE); } -void +STATIC_OVL void hmenu_doextversion(VOID_ARGS) { (void) doextversion(); } -void +STATIC_OVL void hmenu_dohistory(VOID_ARGS) { (void) dohistory(); } -void +STATIC_OVL void hmenu_dowhatis(VOID_ARGS) { (void) dowhatis(); } -void +STATIC_OVL void hmenu_dowhatdoes(VOID_ARGS) { (void) dowhatdoes(); } -void +STATIC_OVL void hmenu_doextlist(VOID_ARGS) { (void) doextlist(); diff --git a/src/pickup.c b/src/pickup.c index fe25f8a0f..e47d989da 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1710,7 +1710,7 @@ int x, y; return FALSE; } -int +STATIC_OVL int do_loot_cont(cobjp, cindex, ccount) struct obj **cobjp; int cindex, ccount; /* index of this container (1..N), number of them (N) */ diff --git a/src/questpgr.c b/src/questpgr.c index 7d58fd89a..5c04c6cdf 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -578,7 +578,7 @@ int how; putmsghistory(out_line, FALSE); } -boolean +STATIC_OVL boolean skip_pager(common) boolean common; { diff --git a/src/shk.c b/src/shk.c index 26e7b66a5..fa29b1f31 100644 --- a/src/shk.c +++ b/src/shk.c @@ -2725,7 +2725,7 @@ boolean ininv, dummy, silent; } } -void +STATIC_OVL void append_honorific(buf) char *buf; { diff --git a/util/makedefs.c b/util/makedefs.c index 42108cc79..073cbf95d 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -951,7 +951,7 @@ unsigned long old_rumor_offset; return rumor_offset; } -void +STATIC_OVL void do_rnd_access_file(fname) const char *fname; { @@ -1416,7 +1416,7 @@ do_date() return; } -boolean +STATIC_OVL boolean get_gitinfo(githash, gitbranch) char *githash, *gitbranch; { diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 0422129fd..63861d62b 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -4132,7 +4132,7 @@ boolean force_update; * must be updated because they need to change. * This is now done at an individual field case-by-case level. */ -boolean +STATIC_OVL boolean check_fields(forcefields, sz) boolean forcefields; int sz[3]; From 64cc11d9b413ffdd1fa118c2826764665b286490 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 13 Jul 2019 00:28:51 -0400 Subject: [PATCH 059/296] makedefs doesn't use STATIC_OVL macro --- util/makedefs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/makedefs.c b/util/makedefs.c index 073cbf95d..ac196f8e2 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -951,7 +951,7 @@ unsigned long old_rumor_offset; return rumor_offset; } -STATIC_OVL void +static void do_rnd_access_file(fname) const char *fname; { @@ -1416,7 +1416,7 @@ do_date() return; } -STATIC_OVL boolean +static boolean get_gitinfo(githash, gitbranch) char *githash, *gitbranch; { From f3ada8413792c5251f23fb53793c186ed2666d7f Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 13 Jul 2019 01:00:40 -0400 Subject: [PATCH 060/296] merge bit --- win/tty/topl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index 334900d5e..5cb888999 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -260,7 +260,7 @@ register const char *bp; && n0 + (int) strlen(g.toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { nhassert((long) strlen(g.toplines) == cw->curx); - Strcat(toplines, " "); + Strcat(g.toplines, " "); Strcat(g.toplines, bp); cw->curx += 2; if (!(cw->flags & WIN_STOP)) From d187955838c630a6806ec04862af358c8d6072d3 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 13 Jul 2019 01:05:53 -0400 Subject: [PATCH 061/296] another merge bit --- util/lev_main.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/util/lev_main.c b/util/lev_main.c index d540cb5fd..b3dbbce0a 100644 --- a/util/lev_main.c +++ b/util/lev_main.c @@ -1636,11 +1636,4 @@ short ospeed; #endif #endif /* STRICT_REF_DEF */ -/* nhassert_failed is called when an nhassert's condition is false */ -void nhassert_failed(const char * exp, const char * file, int line) -{ - fprintf(stderr, "NHASSERT(%s) in '%s' at line %d\n", exp, file, line); - exit(EXIT_FAILURE); -} - /*lev_main.c*/ From eb055c51520313f26e36f2c21cf8a6034a503919 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 13 Jul 2019 09:34:58 -0700 Subject: [PATCH 062/296] Fix build break due to introduction of nhassert(). --- src/decl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/decl.c b/src/decl.c index d24e9937a..ed16900d4 100644 --- a/src/decl.c +++ b/src/decl.c @@ -703,8 +703,16 @@ decl_globals_init() g.valuables[2].list = NULL; g.valuables[2].size = 0; - nhassert(g_init.magic == IVMAGIC); - nhassert(g_init.havestate == TRUE); + if (g_init.magic != IVMAGIC) { + printf("decl_globals_init: g_init.magic in unexpected state (%lx)\n", + g_init.magic); + exit(1); + } + + if (g_init.havestate != TRUE) { + printf("decl_globals_init: g_init..havestate not TRUE\n"); + exit(1); + } sfcap = default_sfinfo; sfrestinfo = default_sfinfo; From 90f5aa91b794ad333fc04693677d0a7a9d8ca18e Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 13 Jul 2019 09:52:56 -0700 Subject: [PATCH 063/296] Fix compiler warnings. --- src/dungeon.c | 3 ++- src/sp_lev.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dungeon.c b/src/dungeon.c index 27b748104..0e483a11d 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -2409,7 +2409,8 @@ recalc_mapseen() struct monst *mtmp; struct cemetery *bp, **bonesaddr; unsigned i, ridx; - int x, y, ltyp, count, atmp; + int x, y, ltyp, count; + unsigned int atmp; /* Should not happen in general, but possible if in the process * of being booted from the quest. The mapseen object gets diff --git a/src/sp_lev.c b/src/sp_lev.c index dbab1dfdc..b2206ae70 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3763,7 +3763,7 @@ struct opvar *mc; { int x, y; schar mapc; - xchar lit; + uchar lit; struct opvar *ret = selection_opvar((char *) 0); if (!ov || !mc || !ret) From c44ad5645d90267e7ed1d1a6c57acc1437dca10e Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 13 Jul 2019 10:53:53 -0700 Subject: [PATCH 064/296] Removing assertion that does not hold under all scenarios. When we save gamestate as part of making an insurance snapshot, we will save message history which will clear toplines but leaving window state in tack including the need for more. --- win/tty/topl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index cfd17838d..74331dece 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -259,7 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - nhassert((long) strlen(toplines) == cw->curx); + /* nhassert((long) strlen(toplines) == cw->curx); */ Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; From e665d3b85024e3a7580e80888a70b47d5ae9384c Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 13 Jul 2019 16:08:08 -0700 Subject: [PATCH 065/296] Adding ptr_array data structure. --- include/decl.h | 7 +++++++ include/extern.h | 2 ++ src/hacklib.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/include/decl.h b/include/decl.h index 5ebaa326e..834b14ab8 100644 --- a/include/decl.h +++ b/include/decl.h @@ -455,6 +455,13 @@ struct early_opt { boolean valallowed; }; +struct ptr_array { + size_t length; + size_t max_length; + void ** elements; +}; +typedef struct ptr_array ptr_array_t; + #undef E #endif /* DECL_H */ diff --git a/include/extern.h b/include/extern.h index abea20a68..d2ed2ff9e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -968,6 +968,8 @@ E void FDECL(strbuf_append, (strbuf_t *, const char *)); E void FDECL(strbuf_reserve, (strbuf_t *, int)); E void FDECL(strbuf_empty, (strbuf_t *)); E void FDECL(strbuf_nl_to_crlf, (strbuf_t *)); +E struct ptr_array * FDECL(ptr_array_new, (size_t length)); +E void FDECL(ptr_array_free, (struct ptr_array *)); /* ### invent.c ### */ diff --git a/src/hacklib.c b/src/hacklib.c index b97a78a65..9fe316517 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -1223,4 +1223,38 @@ strbuf_t *strbuf; } } +ptr_array_t * +ptr_array_new(max_length) + size_t max_length; +{ + size_t esize = max_length * sizeof(void *); + ptr_array_t * a = (ptr_array_t *) malloc(sizeof(ptr_array_t) + esize); + a->elements = (void **)(a + 1); + a->length = 0; + a->max_length = max_length; + memset(a->elements, 0, esize); + return a; +} + +void +ptr_array_free(a) + ptr_array_t * a; +{ + size_t i; + + nhassert(a->length <= a->max_length); + + for(i = 0; i < a->length; i++) + if(a->elements[i]) + free(a->elements[i]); + + for (i = a->length; i < a->max_length; i++) { + nhassert(a->elements[i] == NULL); + if(a->elements[i]) + free(a->elements[i]); + } + + free(a); +} + /*hacklib.c*/ From 1d0b8b4680512a85a045006b3adf7fe65100f1bd Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 13 Jul 2019 15:57:06 -0700 Subject: [PATCH 066/296] Re-worked tty_putmsgistory and tty_getmsghistory. When we were saving message history as part of a game save for insurance, we were calling remember_topl() and thus inappropriately changing topline state. This would cause us to mis-manage the topline in subsequent calls to update the topline. The code has been re-worked to fix the issue, reduce complexity and make the code clearer. --- win/tty/topl.c | 196 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/win/tty/topl.c b/win/tty/topl.c index 74331dece..b19bc0700 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -617,6 +617,7 @@ boolean purged; /* True: took history's pointers, False: just cloned them */ } } +#if 0 /* * This is called by the core save routines. * Each time we are called, we return one string from the @@ -724,6 +725,201 @@ boolean restoring_msghist; initd = FALSE; /* reset */ } } +#else +STATIC_OVL ptr_array_t * +get_message_history() +{ + char *mesg; + int i; + struct WinDesc *cw; + size_t max_length; + ptr_array_t * a; + + nhassert(WIN_MESSAGE != WIN_ERR); + nhassert(wins[WIN_MESSAGE] != NULL); + + /* paranoia (too early or too late panic save attempt?) */ + if (WIN_MESSAGE == WIN_ERR || !wins[WIN_MESSAGE]) + return NULL; + + cw = wins[WIN_MESSAGE]; + + max_length = cw->rows; + + if (*toplines) max_length++; + + a = ptr_array_new(max_length); + + nhassert(cw->maxrow <= cw->rows); + for (i = 0; i < cw->rows; ++i) { + mesg = cw->data[(i + cw->maxrow) % cw->rows]; + if (mesg && *mesg) + a->elements[a->length++] = strdup(mesg); + } + if (*toplines) + a->elements[a->length++] = strdup(toplines); + + return a; +} + +STATIC_OVL void +purge_message_history() +{ + int i; + struct WinDesc *cw; + + nhassert(WIN_MESSAGE != WIN_ERR); + nhassert(wins[WIN_MESSAGE] != NULL); + + cw = wins[WIN_MESSAGE]; + + *toplines = '\0'; + + for (i = 0; i < cw->rows; ++i) { + if (cw->data[i]) { + free(cw->data[i]); + cw->data[i] = (char *) 0; + cw->datlen[i] = 0; + } + } + + cw->maxcol = cw->maxrow = 0; +} + +/* + * This is called by the core save routines. + * Each time we are called, we return one string from the + * message history starting with the oldest message first. + * When none are left, we return a final null string. + * + * History is collected at the time of the first call. + * Any new messages issued after that point will not be + * included among the output of the subsequent calls. + */ +char * +tty_getmsghistory(init) +boolean init; +{ + static size_t nxtidx; + static ptr_array_t * saved_messages = NULL; + char *result = NULL; + + if (init) { + nhassert(saved_messages == NULL); + saved_messages = get_message_history(); + nxtidx = 0; + wins[WIN_MESSAGE]->flags |= WIN_LOCKHISTORY; + } + + if (saved_messages) { + if (nxtidx < saved_messages->length) + result = saved_messages->elements[nxtidx++]; + + if (result == NULL) { + ptr_array_free(saved_messages); + saved_messages = NULL; + wins[WIN_MESSAGE]->flags &= ~WIN_LOCKHISTORY; + } + } + return result; +} + +/* + * This is called by the core savefile restore routines. + * Each time we are called, we stuff the string into our message + * history recall buffer. The core will send the oldest message + * first (actually it sends them in the order they exist in the + * save file, but that is supposed to be the oldest first). + * These messages get pushed behind any which have been issued + * since this session with the program has been started, since + * they come from a previous session and logically precede + * anything (like "Restoring save file...") that's happened now. + * + * Called with a null pointer to finish up restoration. + * + * It's also called by the quest pager code when a block message + * has a one-line summary specified. We put that line directly + * into message history for ^P recall without having displayed it. + */ +void +tty_putmsghistory(msg, restoring_msghist) +const char *msg; +boolean restoring_msghist; +{ + static boolean initd = FALSE; + static ptr_array_t * saved_messages = NULL; + size_t i; +#ifdef DUMPLOG + extern unsigned saved_pline_index; /* pline.c */ +#endif + + nhassert(!(wins[WIN_MESSAGE]->flags & WIN_LOCKHISTORY)); + + if (restoring_msghist && !initd) { + /* we're restoring history from the previous session, but new + messages have already been issued this session ("Restoring...", + for instance); collect current history (ie, those new messages), + and also clear it out so that nothing will be present when the + restored ones are being put into place */ + nhassert(saved_messages == NULL); + saved_messages = get_message_history(); + purge_message_history(); + initd = TRUE; +#ifdef DUMPLOG + /* this suffices; there's no need to scrub saved_pline[] pointers */ + saved_pline_index = 0; +#endif + } + + if (msg) { + /* Caller is asking us to remember a top line that needed more. + Should we call more? This can happen when the player has set + iflags.force_invmenu and they attempt to shoot with nothing in + the quiver. */ + if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) + ttyDisplay->toplin = TOPLINE_NON_EMPTY; + + /* move most recent message to history, make this become most recent */ + remember_topl(); + Strcpy(toplines, msg); +#ifdef DUMPLOG + dumplogmsg(toplines); +#endif + return; + } + + /* tty_putmsghistory() is called with msg==NULL to indidate that + * we are finished restoring the message history. If we saved + * some message history when we started, its time now to appened + * those saved messages. + * + * We don't otherwise expect to get called with msg==NULL. + * + */ + nhassert(restoring_msghist && initd); + + if (initd && restoring_msghist) { + if (saved_messages) { + nhassert(ttyDisplay == NULL || + ttyDisplay->toplin != TOPLINE_NEED_MORE); + + for (i = 0; ilength; i++) { + const char * mesg = saved_messages->elements[i]; + remember_topl(); + nhassert(mesg); + Strcpy(toplines, mesg); +#ifdef DUMPLOG + dumplogmsg(toplines); +#endif + } + ptr_array_free(saved_messages); + saved_messages = NULL; + } + initd = FALSE; + } + +} +#endif #endif /* TTY_GRAPHICS */ From 5d2872dd4f24fb76f29bf34f6f950394910d6d33 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 13 Jul 2019 16:00:14 -0700 Subject: [PATCH 067/296] Add stopping in the debugger when nhassert() is hit in the windows port. When stopping in the debugger after having called impossible, the windowing state will have been modified since the assertion was hit. This made examining state that caused the nhassert to fire no longer possible. To avoid this issue, we now detect the debugger and stop in the debugger prior to impossible. --- sys/winnt/winnt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 8d513c59e..39978cab4 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -718,9 +718,19 @@ nt_assert_failed(expression, filepath, line) { const char * filename; - /* get file name from path */ filename = strrchr(filepath, '\\'); filename = (filename == NULL ? filepath : filename + 1); + + if (IsDebuggerPresent()) { + char message[BUFSIZ]; + snprintf(message, sizeof(message), + "nhassert(%s) failed in file '%s' at line %d", + expression, filename, line); + OutputDebugStringA(message); + DebugBreak(); + } + + /* get file name from path */ impossible("nhassert(%s) failed in file '%s' at line %d", expression, filename, line); } From aa95e20ca7cbb2a90f8076f04410886c0733dc74 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 13 Jul 2019 16:23:37 -0700 Subject: [PATCH 068/296] Removed the older version of tty_putmsghistory and tty_getmsghistory. --- win/tty/topl.c | 110 ------------------------------------------------- 1 file changed, 110 deletions(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index b19bc0700..db151265f 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -617,115 +617,6 @@ boolean purged; /* True: took history's pointers, False: just cloned them */ } } -#if 0 -/* - * This is called by the core save routines. - * Each time we are called, we return one string from the - * message history starting with the oldest message first. - * When none are left, we return a final null string. - * - * History is collected at the time of the first call. - * Any new messages issued after that point will not be - * included among the output of the subsequent calls. - */ -char * -tty_getmsghistory(init) -boolean init; -{ - static int nxtidx; - char *nextmesg; - char *result = 0; - - if (init) { - msghistory_snapshot(FALSE); - nxtidx = 0; - } - - if (snapshot_mesgs) { - nextmesg = snapshot_mesgs[nxtidx++]; - if (nextmesg) { - result = (char *) nextmesg; - } else { - free_msghistory_snapshot(FALSE); - } - } - return result; -} - -/* - * This is called by the core savefile restore routines. - * Each time we are called, we stuff the string into our message - * history recall buffer. The core will send the oldest message - * first (actually it sends them in the order they exist in the - * save file, but that is supposed to be the oldest first). - * These messages get pushed behind any which have been issued - * since this session with the program has been started, since - * they come from a previous session and logically precede - * anything (like "Restoring save file...") that's happened now. - * - * Called with a null pointer to finish up restoration. - * - * It's also called by the quest pager code when a block message - * has a one-line summary specified. We put that line directly - * into message history for ^P recall without having displayed it. - */ -void -tty_putmsghistory(msg, restoring_msghist) -const char *msg; -boolean restoring_msghist; -{ - static boolean initd = FALSE; - int idx; -#ifdef DUMPLOG - extern unsigned saved_pline_index; /* pline.c */ -#endif - - if (restoring_msghist && !initd) { - /* we're restoring history from the previous session, but new - messages have already been issued this session ("Restoring...", - for instance); collect current history (ie, those new messages), - and also clear it out so that nothing will be present when the - restored ones are being put into place */ - msghistory_snapshot(TRUE); - initd = TRUE; -#ifdef DUMPLOG - /* this suffices; there's no need to scrub saved_pline[] pointers */ - saved_pline_index = 0; -#endif - } - - if (msg) { - /* Caller is asking us to remember a top line that needed more. - Should we call more? This can happen when the player has set - iflags.force_invmenu and they attempt to shoot with nothing in - the quiver. */ - if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) - ttyDisplay->toplin = TOPLINE_NON_EMPTY; - - /* move most recent message to history, make this become most recent */ - remember_topl(); - Strcpy(toplines, msg); -#ifdef DUMPLOG - dumplogmsg(toplines); -#endif - } else if (snapshot_mesgs) { - nhassert(ttyDisplay == NULL || - ttyDisplay->toplin != TOPLINE_NEED_MORE); - - /* done putting arbitrary messages in; put the snapshot ones back */ - for (idx = 0; snapshot_mesgs[idx]; ++idx) { - remember_topl(); - Strcpy(toplines, snapshot_mesgs[idx]); -#ifdef DUMPLOG - dumplogmsg(toplines); -#endif - } - /* now release the snapshot */ - free_msghistory_snapshot(TRUE); - initd = FALSE; /* reset */ - } -} -#else STATIC_OVL ptr_array_t * get_message_history() { @@ -919,7 +810,6 @@ boolean restoring_msghist; } } -#endif #endif /* TTY_GRAPHICS */ From 435f1c46267a194e44f0b75c7348be5a900d8ede Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 00:20:09 -0700 Subject: [PATCH 069/296] Fuzzer improvements. phase_of_moon and friday_13th determined using rn2() instead of local time if fuzzing. Don't reseed using init_random() if fuzzing. Allow set_random to be called outside of hacklib. rn2_on_display_rng uses rn2 if fuzzing so that we have a single source of random that we can ensure is reproducible. Implement rul() that returns a random unsigned long. Fix bug in fuzzer handling of ntposkey which would cause us to use unitialized values for x and y. Added command line arguments to allow auto starting and stopping of fuzzer. Add a logging facility for the fuzzer to use to record activity. Added some scripts used to automate fuzzer testing on windows. --- include/decl.h | 4 + include/extern.h | 9 ++ include/flag.h | 4 + src/allmain.c | 131 ++++++++++++++++++++++++++ src/hacklib.c | 12 ++- src/restore.c | 2 + src/rnd.c | 29 +++++- src/save.c | 14 ++- sys/winnt/nttty.c | 10 +- sys/winnt/windmain.c | 19 +++- win/win32/scripts/fuzzer/clean.bat | 8 ++ win/win32/scripts/fuzzer/longtest.bat | 23 +++++ win/win32/scripts/fuzzer/restore.bat | 7 ++ win/win32/scripts/fuzzer/runtill.bat | 73 ++++++++++++++ 14 files changed, 337 insertions(+), 8 deletions(-) create mode 100644 win/win32/scripts/fuzzer/clean.bat create mode 100644 win/win32/scripts/fuzzer/longtest.bat create mode 100644 win/win32/scripts/fuzzer/restore.bat create mode 100644 win/win32/scripts/fuzzer/runtill.bat diff --git a/include/decl.h b/include/decl.h index 834b14ab8..711ba614e 100644 --- a/include/decl.h +++ b/include/decl.h @@ -462,6 +462,10 @@ struct ptr_array { }; typedef struct ptr_array ptr_array_t; +/* logging verbosity levels */ +#define LOG_MINIMAL 0 +#define LOG_VERBOSE 1 + #undef E #endif /* DECL_H */ diff --git a/include/extern.h b/include/extern.h index d2ed2ff9e..3c74bfda0 100644 --- a/include/extern.h +++ b/include/extern.h @@ -27,6 +27,13 @@ E void NDECL(newgame); E void FDECL(welcome, (BOOLEAN_P)); E time_t NDECL(get_realtime); E int FDECL(argcheck, (int, char **, enum earlyarg)); +E void NDECL(fuzzer_start); +E void NDECL(fuzzer_stop); +E void NDECL(fuzzer_toggle); +E void VDECL(fuzzer_log, (int, const char *, ...)) PRINTF_F(2, 3); +E void NDECL(fuzzer_check); +E void NDECL(fuzzer_auto_start); +E boolean FDECL(fuzzer_msg_history, (const char *)); /* ### apply.c ### */ @@ -950,6 +957,7 @@ E boolean FDECL(fuzzymatch, (const char *, const char *, const char *, BOOLEAN_P)); E void FDECL(init_random, (int FDECL((*fn), (int)))); E void FDECL(reseed_random, (int FDECL((*fn), (int)))); +E void FDECL(set_random, (unsigned long, int FDECL((*fn), (int)))); E time_t NDECL(getnow); E int NDECL(getyear); #if 0 @@ -2161,6 +2169,7 @@ E int FDECL(rnd, (int)); E int FDECL(d, (int, int)); E int FDECL(rne, (int)); E int FDECL(rnz, (int)); +E unsigned long NDECL(rul); /* ### role.c ### */ diff --git a/include/flag.h b/include/flag.h index 3ea3ada26..50f76c457 100644 --- a/include/flag.h +++ b/include/flag.h @@ -447,6 +447,10 @@ struct instance_flags { chosen_windowport[], but do not switch to it in the midst of options processing */ boolean obsolete; /* obsolete options can point at this, it isn't used */ + boolean fuzzer_auto_start; /* start fuzzer automatically */ + int fuzzer_stop_and_save; /* move when fuzzer stops and saves game */ + boolean fuzzer_saving; /* fuzzer is saving game */ + int verbose_logging_start; /* move when verbose fuzzer logging starts */ }; /* diff --git a/src/allmain.c b/src/allmain.c index 082447b3b..cde2ef9a2 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -436,6 +436,8 @@ boolean resuming; #ifdef MAIL ckmailstatus(); #endif + fuzzer_check(); + rhack((char *) 0); } if (u.utotype) /* change dungeon level */ @@ -583,6 +585,8 @@ newgame() { int i; + fuzzer_auto_start(); + #ifdef MFLOPPY gameDiskPrompt(); #endif @@ -922,4 +926,131 @@ const char *opts; #endif return; } + +static FILE * g_fuzzer_log_file = NULL; +static int g_fuzzer_log_level = LOG_MINIMAL; + +/* fuzzer_start() starts the fuzzer opening the fuzzer log file */ +void +fuzzer_start() +{ + if (!iflags.debug_fuzzer) { + const char * fq_replay; + + iflags.debug_fuzzer = TRUE; + iflags.fuzzer_auto_start = FALSE; + + nhassert(g_fuzzer_log_file == NULL); + fq_replay = fqname("fuzzer.log", SAVEPREFIX, 0); + + g_fuzzer_log_file = fopen(fq_replay, "w"); + } +} + +/* fuzzer_stop() stops the fuzzer and close the fuzzer log file */ +void +fuzzer_stop() +{ + if (iflags.debug_fuzzer) { + if(g_fuzzer_log_file != NULL) { + fclose(g_fuzzer_log_file); + g_fuzzer_log_file = NULL; + } + } +} + +/* fuzzer_toggle() toggles fuzzer state */ +void +fuzzer_toggle() +{ + if (iflags.debug_fuzzer) + fuzzer_stop(); + else + fuzzer_start(); +} + +/* fuzzer_log() is used to place messages in the file 'fuzzer.log'. This + * log is the primary tool for monitoring fuzzer activity and tracking down + * issues that the fuzzer is able to reproduce. + */ +void +fuzzer_log +VA_DECL2(int, level, const char *, str) +{ + VA_START(str); + VA_INIT(str, char *); + + if (!g_fuzzer_log_file) + return; + + if (iflags.verbose_logging_start != 0 && moves >= iflags.verbose_logging_start) + g_fuzzer_log_level = LOG_VERBOSE; + + if (level <= g_fuzzer_log_level) + Vfprintf(g_fuzzer_log_file, str, VA_ARGS); + + VA_END(); +} + +/* fuzzer_check() is called prior to rhack(0) to allow the fuzzer to + * check if it should stop and to allow it to reseed the game. + */ +void +fuzzer_check() +{ + if (iflags.debug_fuzzer) + { + if (moves >= iflags.fuzzer_stop_and_save) { + iflags.fuzzer_saving = TRUE; + dosave0(); + exit_nhwindows("Goodbye from the fuzzer..."); + fuzzer_stop(); + nh_terminate(EXIT_SUCCESS); + } + + unsigned long seed = rul(); + set_random(seed, rn2); + fuzzer_log(LOG_MINIMAL, "SEED:%ld:%lu\n", moves, seed); + + } +} + +/* fuzzer_auto_start is called when creating a new game to allow + * the fuzzer to start itself. + */ +void +fuzzer_auto_start() +{ + if (iflags.fuzzer_auto_start) { + nhassert(!iflags.debug_fuzzer); + fuzzer_start(); + unsigned long seed = rul(); + set_random(seed, rn2); + fuzzer_log(LOG_MINIMAL, "START:%ld:%lu\n", moves, seed); + } +} + +/* fuzzer_msg_history is called during save file recovery to allow + * the fuzzer to snoop the messages being recovered. The fuzzer + * saves a seed as a message in save files and this is the mechanism + * used to recover that seed if the fuzzer is being auto started. + */ +boolean +fuzzer_msg_history(msg) + const char * msg; +{ + long saved_moves; + unsigned long saved_seed; + if (sscanf(msg, "SEED:%ld:%lu", &saved_moves, &saved_seed) == 2) { + nhassert(saved_moves == moves); + if (iflags.fuzzer_auto_start) { + fuzzer_start(); + set_random(saved_seed, rn2); + fuzzer_log(LOG_MINIMAL, "START:%ld:%lu\n", moves, saved_seed); + } + return TRUE; + } + + return FALSE; +} /*allmain.c*/ diff --git a/src/hacklib.c b/src/hacklib.c index 9fe316517..1f43325df 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -854,7 +854,7 @@ STATIC_DCL struct tm *NDECL(getlt); /* Sets the seed for the random number generator */ #ifdef USE_ISAAC64 -static void +void set_random(seed, fn) unsigned long seed; int FDECL((*fn), (int)); @@ -865,7 +865,7 @@ int FDECL((*fn), (int)); #else /* USE_ISAAC64 */ /*ARGSUSED*/ -static void +void set_random(seed, fn) unsigned long seed; int FDECL((*fn), (int)) UNUSED; @@ -917,7 +917,7 @@ int FDECL((*fn), (int)); { /* only reseed if we are certain that the seed generation is unguessable * by the players. */ - if (has_strong_rngseed) + if (has_strong_rngseed && !iflags.debug_fuzzer) init_random(fn); } @@ -1108,6 +1108,9 @@ phase_of_the_moon() /* 0-7, with 0: new, 4: full */ register struct tm *lt = getlt(); register int epact, diy, goldn; + if(iflags.debug_fuzzer) + return rn2(8); + diy = lt->tm_yday; goldn = (lt->tm_year % 19) + 1; epact = (11 * goldn + 18) % 30; @@ -1122,6 +1125,9 @@ friday_13th() { register struct tm *lt = getlt(); + if(iflags.debug_fuzzer) + return rn2(30); + /* tm_wday (day of week; 0==Sunday) == 5 => Friday */ return (boolean) (lt->tm_wday == 5 && lt->tm_mday == 13); } diff --git a/src/restore.c b/src/restore.c index b6126a227..7d1f6d894 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1231,6 +1231,8 @@ register int fd; panic("restore_msghistory: msg too big (%d)", msgsize); mread(fd, (genericptr_t) msg, msgsize); msg[msgsize] = '\0'; + if(fuzzer_msg_history(msg)) + continue; putmsghistory(msg, TRUE); ++msgcount; } diff --git a/src/rnd.c b/src/rnd.c index 0ca649fbb..5473be949 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -56,10 +56,21 @@ int FDECL((*fn), (int)); (int) sizeof seed); } +unsigned long +rul() +{ + unsigned long value; + + value = (unsigned long) isaac64_next_uint64(&rnglist[CORE].rng_state); + fuzzer_log(LOG_VERBOSE, "RANDOM:%llu\n", value); + + return value; +} + static int RND(int x) { - return (isaac64_next_uint64(&rnglist[CORE].rng_state) % x); + return (rul() % x); } /* 0 <= rn2(x) < x, but on a different sequence from the "main" rn2; @@ -69,6 +80,8 @@ int rn2_on_display_rng(x) register int x; { + if (iflags.debug_fuzzer) + return rn2(x); return (isaac64_next_uint64(&rnglist[DISP].rng_state) % x); } @@ -94,6 +107,20 @@ register int x; seed *= 2739110765; return (int)((seed >> 16) % (unsigned)x); } + +unsigned long +rul() +{ +#if defined(LINT) && defined(UNIX) + return (unsigned long) rand(); +#else /* LINT */ +#if defined(UNIX) || defined(RANDOM) + return (unsigned long) Rand(); +#else + return (unsigned long) (Rand() >> 3); +#endif /* defined(UNIX) || defined(RANDOM) */ +#endif /* LINT */ +} #endif /* USE_ISAAC64 */ /* 0 <= rn2(x) < x */ diff --git a/src/save.c b/src/save.c index e0af4b8d2..e931eae76 100644 --- a/src/save.c +++ b/src/save.c @@ -139,7 +139,7 @@ dosave0() return 0; #endif - HUP if (iflags.window_inited) { + HUP if (!iflags.debug_fuzzer && iflags.window_inited) { nh_uncompress(fq_save); fd = open_savefile(); if (fd > 0) { @@ -1238,6 +1238,18 @@ int fd, mode; bwrite(fd, (genericptr_t) msg, msglen); ++msgcount; } + /* If the fuzzer is stopping and saving, save a seed as a message. + In 3.7, we will modify the save file format and save the seed + directly in the saved game state. */ + if (iflags.fuzzer_saving) { + char message[BUFSIZ]; + unsigned long seed = rul(); + sprintf(message, "SEED:%ld:%lu", moves, seed); + fuzzer_log(LOG_MINIMAL, "STOP:%ld:%lu\n", moves, seed); + msglen = strlen(message); + bwrite(fd, (genericptr_t) &msglen, sizeof msglen); + bwrite(fd, (genericptr_t) message, msglen); + } bwrite(fd, (genericptr_t) &minusone, sizeof (int)); } debugpline1("Stored %d messages into savefile.", msgcount); diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index a8000bc05..4cca4dcbd 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -475,8 +475,14 @@ int *x, *y, *mod; coord cc; DWORD count; really_move_cursor(); - if (iflags.debug_fuzzer) - return randomkey(); + if (iflags.debug_fuzzer) { + int poskey = randomkey(); + if (poskey == 0) { + *x = rn2(console.width); + *y = rn2(console.height); + } + return poskey; + } ch = (program_state.done_hup) ? '\033' : keyboard_handler.pCheckInput( diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index b2bb18e79..d1712ffe4 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -336,7 +336,7 @@ attempt_restore: resuming = TRUE; /* not starting new game */ if (discover) You("are in non-scoring discovery mode."); - if (discover || wizard) { + if ((discover || wizard) && !iflags.fuzzer_auto_start) { if (yn("Do you want to keep the save file?") == 'n') (void) delete_savefile(); else { @@ -461,6 +461,23 @@ char *argv[]; case 'X': discover = TRUE, wizard = FALSE; break; + case 'F': + { + iflags.fuzzer_auto_start = 1; + + if (argc > 1 && argv[1][0] != '-') { + argc--; + argv++; + iflags.fuzzer_stop_and_save = atoi(*argv); + + if (argc > 1 && argv[1][0] != '-') { + argc--; + argv++; + iflags.verbose_logging_start = atoi(*argv); + } + } + } + break; #ifdef NEWS case 'n': iflags.news = FALSE; diff --git a/win/win32/scripts/fuzzer/clean.bat b/win/win32/scripts/fuzzer/clean.bat new file mode 100644 index 000000000..a02c48739 --- /dev/null +++ b/win/win32/scripts/fuzzer/clean.bat @@ -0,0 +1,8 @@ +set BIN_DIR=..\..\..\..\bin\Debug\Win32 + +set FUZZER_LOG=%BIN_DIR%\fuzzer.log +set FUZZER_DIR=%BIN_DIR%\fuzzer + +if exist %BIN_DIR%\%USERNAME%* del %BIN_DIR%\%USERNAME%* +if exist %FUZZER_LOG% del %FUZZER_LOG% + diff --git a/win/win32/scripts/fuzzer/longtest.bat b/win/win32/scripts/fuzzer/longtest.bat new file mode 100644 index 000000000..e5e8d1529 --- /dev/null +++ b/win/win32/scripts/fuzzer/longtest.bat @@ -0,0 +1,23 @@ +echo off + +SETLOCAL ENABLEEXTENSIONS +SETLOCAL ENABLEDELAYEDEXPANSION + +set STEP_SIZE=5000 +set FINAL_MOVE=500000 +set START_MOVE=5000 + +for /L %%i in (%START_MOVE%, %STEP_SIZE%, %FINAL_MOVE%) do ( + + call runtill.bat %%i + + if ERRORLEVEL 1 ( + echo FAILED getting running to %%i. + exit /b 1 + ) + +) + +echo SUCCESS. + + diff --git a/win/win32/scripts/fuzzer/restore.bat b/win/win32/scripts/fuzzer/restore.bat new file mode 100644 index 000000000..9752fed96 --- /dev/null +++ b/win/win32/scripts/fuzzer/restore.bat @@ -0,0 +1,7 @@ +call clean.bat + +set BIN_DIR=..\..\..\..\bin\Debug\Win32 +set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game +set FUZZER_DIR=%BIN_DIR%\fuzzer + +copy %FUZZER_DIR%\%SAVED_GAME% %BIN_DIR%\%SAVED_GAME% diff --git a/win/win32/scripts/fuzzer/runtill.bat b/win/win32/scripts/fuzzer/runtill.bat new file mode 100644 index 000000000..ebb5aa4b6 --- /dev/null +++ b/win/win32/scripts/fuzzer/runtill.bat @@ -0,0 +1,73 @@ +REM +REM runtill target_move +REM +echo off + +SETLOCAL ENABLEEXTENSIONS +SETLOCAL ENABLEDELAYEDEXPANSION + +set TARGET_MOVE=%1 + +if %TARGET_MOVE% == "" ( + echo Usage:runtill target_move + goto :eof +) + +set BIN_DIR=..\..\..\..\bin\Debug\Win32 +set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game +set LOG_FILE=%BIN_DIR%\runtil.log +set FUZZER_LOG=%BIN_DIR%\fuzzer.log +set FUZZER_DIR=%BIN_DIR%\fuzzer +set BASELINE=%FUZZER_DIR%\fuzzer.log + +if not exist %FUZZER_DIR% mkdir %FUZZER_DIR% + +call clean.bat + +if not exist %FUZZER_DIR%\%SAVED_GAME% ( + %BIN_DIR%\nethack -D -F 0 + + copy %BIN_DIR%\%SAVED_GAME% %FUZZER_DIR% +) + +call restore.bat + +%BIN_DIR%\nethack -D -F %TARGET_MOVE% + +move %BIN_DIR%\*.snap %BIN_DIR%\snapshots +copy %FUZZER_LOG% %BASELINE% + +for /f "tokens=2,3 delims=: usebackq" %%i in (`findstr /c:START %BASELINE%`) do ( + set START_SEED=%%j + set START_MOVE=%%i +) + +for /f "tokens=2,3 delims=: usebackq" %%i in (`findstr /c:STOP %BASELINE%`) do ( + set STOP_SEED=%%j + set STOP_MOVE=%%i +) + +if !STOP_MOVE! LSS %TARGET_MOVE% ( + cls + echo FAILED: Failed to reach target move. !STOP_MOVE! is not GTE %TARGET_MOVE%. + exit /b 1 +) + +call restore.bat + +%BIN_DIR%\nethack -D -F %TARGET_MOVE% + +fc %FUZZER_LOG% %BASELINE% + +if ERRORLEVEL 1 ( + cls + echo FAILED: Unable to reproduce same timeline + exit /b 1 +) + +del /q %FUZZER_DIR%\%SAVED_GAME% + +copy %BIN_DIR%\%SAVED_GAME% %FUZZER_DIR% + +echo !START_MOVE! to !STOP_MOVE!. +echo SUCCESS. From d33160d069c00e26de902e48c2bfda2de2eeeb3d Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 02:00:21 -0700 Subject: [PATCH 070/296] Fix build issue on linux. --- src/allmain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/allmain.c b/src/allmain.c index cde2ef9a2..957c47a44 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -4,7 +4,7 @@ /* NetHack may be freely redistributed. See license for details. */ /* various code that was replicated in *main.c */ - +#define NEED_VARARGS #include "hack.h" #include From 1e47fe61b99634cf87578c933d22a5510d817c30 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 14 Jul 2019 12:17:47 -0400 Subject: [PATCH 071/296] stale code --- win/share/tile2bmp.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/win/share/tile2bmp.c b/win/share/tile2bmp.c index 522cee762..636cf1396 100644 --- a/win/share/tile2bmp.c +++ b/win/share/tile2bmp.c @@ -363,10 +363,3 @@ pixel (*pixels)[TILE_X]; } } } - -/* nhassert_failed is called when an nhassert's condition is false */ -void nhassert_failed(const char * exp, const char * file, int line) -{ - Fprintf(stderr, "NHASSERT(%s) in '%s' at line %d\n", exp, file, line); - exit(EXIT_FAILURE); -} From cd375064ddbf70770a934820e37b796c4623a145 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 12:13:19 -0700 Subject: [PATCH 072/296] Tweaks to fuzzer scripts. --- win/win32/scripts/fuzzer/longtest.bat | 13 +++++++++++++ win/win32/scripts/fuzzer/runtill.bat | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/win/win32/scripts/fuzzer/longtest.bat b/win/win32/scripts/fuzzer/longtest.bat index e5e8d1529..64b6286bd 100644 --- a/win/win32/scripts/fuzzer/longtest.bat +++ b/win/win32/scripts/fuzzer/longtest.bat @@ -7,6 +7,19 @@ set STEP_SIZE=5000 set FINAL_MOVE=500000 set START_MOVE=5000 +set BIN_DIR=..\..\..\..\bin\Debug\Win32 +set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game +set LOG_FILE=%BIN_DIR%\runtil.log +set FUZZER_LOG=%BIN_DIR%\fuzzer.log +set FUZZER_DIR=%BIN_DIR%\fuzzer +set SAVE_DIR=%FUZZER_DIR%\save +set BASELINE=%FUZZER_DIR%\fuzzer.log + +if exist %FUZZER_DIR% rmdir /s /q %FUZZER_DIR% + +mkdir %FUZZER_DIR% +mkdir %SAVE_DIR% + for /L %%i in (%START_MOVE%, %STEP_SIZE%, %FINAL_MOVE%) do ( call runtill.bat %%i diff --git a/win/win32/scripts/fuzzer/runtill.bat b/win/win32/scripts/fuzzer/runtill.bat index ebb5aa4b6..cdbd954f3 100644 --- a/win/win32/scripts/fuzzer/runtill.bat +++ b/win/win32/scripts/fuzzer/runtill.bat @@ -18,9 +18,11 @@ set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game set LOG_FILE=%BIN_DIR%\runtil.log set FUZZER_LOG=%BIN_DIR%\fuzzer.log set FUZZER_DIR=%BIN_DIR%\fuzzer +set SAVE_DIR=%FUZZER_DIR%\save set BASELINE=%FUZZER_DIR%\fuzzer.log if not exist %FUZZER_DIR% mkdir %FUZZER_DIR% +if not exist %SAVE_DIR% mkdir %SAVE_DIR% call clean.bat @@ -28,6 +30,7 @@ if not exist %FUZZER_DIR%\%SAVED_GAME% ( %BIN_DIR%\nethack -D -F 0 copy %BIN_DIR%\%SAVED_GAME% %FUZZER_DIR% + copy %BIN_DIR%\%SAVED_GAME% %SAVE_DIR%\0.save ) call restore.bat @@ -68,6 +71,7 @@ if ERRORLEVEL 1 ( del /q %FUZZER_DIR%\%SAVED_GAME% copy %BIN_DIR%\%SAVED_GAME% %FUZZER_DIR% +copy %BIN_DIR%\%SAVED_GAME% %SAVE_DIR%\!STOP_MOVE!.save echo !START_MOVE! to !STOP_MOVE!. echo SUCCESS. From b5b2f6fc7494f92454e9565e5e6f60e38a9d7bd3 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 13:39:58 -0700 Subject: [PATCH 073/296] Tweaks to fuzzer batch scripts. --- sys/winnt/windmain.c | 7 +++++++ win/win32/scripts/fuzzer/longtest.bat | 12 +----------- win/win32/scripts/fuzzer/restore.bat | 5 +---- win/win32/scripts/fuzzer/runtill.bat | 11 ++--------- win/win32/scripts/fuzzer/setenv.bat | 13 +++++++++++++ 5 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 win/win32/scripts/fuzzer/setenv.bat diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index ce1781193..91baad75b 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -471,6 +471,11 @@ char *argv[]; argv++; iflags.fuzzer_stop_and_save = atoi(*argv); + /* turn off getreturn_enabled so that game does not + * prompt for input when exiting + */ + getreturn_enabled = FALSE; + if (argc > 1 && argv[1][0] != '-') { argc--; argv++; @@ -800,7 +805,9 @@ getlock() { register int fd, c, ci, ct, ern; int fcmask = FCMASK; +#ifndef SELF_RECOVER char tbuf[BUFSZ]; +#endif const char *fq_lock; #define OOPS_BUFSZ 512 char oops[OOPS_BUFSZ]; diff --git a/win/win32/scripts/fuzzer/longtest.bat b/win/win32/scripts/fuzzer/longtest.bat index 64b6286bd..d1e1586e7 100644 --- a/win/win32/scripts/fuzzer/longtest.bat +++ b/win/win32/scripts/fuzzer/longtest.bat @@ -3,17 +3,7 @@ echo off SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION -set STEP_SIZE=5000 -set FINAL_MOVE=500000 -set START_MOVE=5000 - -set BIN_DIR=..\..\..\..\bin\Debug\Win32 -set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game -set LOG_FILE=%BIN_DIR%\runtil.log -set FUZZER_LOG=%BIN_DIR%\fuzzer.log -set FUZZER_DIR=%BIN_DIR%\fuzzer -set SAVE_DIR=%FUZZER_DIR%\save -set BASELINE=%FUZZER_DIR%\fuzzer.log +call setenv.bat if exist %FUZZER_DIR% rmdir /s /q %FUZZER_DIR% diff --git a/win/win32/scripts/fuzzer/restore.bat b/win/win32/scripts/fuzzer/restore.bat index 9752fed96..b411ea857 100644 --- a/win/win32/scripts/fuzzer/restore.bat +++ b/win/win32/scripts/fuzzer/restore.bat @@ -1,7 +1,4 @@ call clean.bat - -set BIN_DIR=..\..\..\..\bin\Debug\Win32 -set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game -set FUZZER_DIR=%BIN_DIR%\fuzzer +call setenv.bat copy %FUZZER_DIR%\%SAVED_GAME% %BIN_DIR%\%SAVED_GAME% diff --git a/win/win32/scripts/fuzzer/runtill.bat b/win/win32/scripts/fuzzer/runtill.bat index cdbd954f3..e67ddfd17 100644 --- a/win/win32/scripts/fuzzer/runtill.bat +++ b/win/win32/scripts/fuzzer/runtill.bat @@ -1,7 +1,7 @@ REM REM runtill target_move REM -echo off +echo on SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION @@ -13,13 +13,7 @@ if %TARGET_MOVE% == "" ( goto :eof ) -set BIN_DIR=..\..\..\..\bin\Debug\Win32 -set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game -set LOG_FILE=%BIN_DIR%\runtil.log -set FUZZER_LOG=%BIN_DIR%\fuzzer.log -set FUZZER_DIR=%BIN_DIR%\fuzzer -set SAVE_DIR=%FUZZER_DIR%\save -set BASELINE=%FUZZER_DIR%\fuzzer.log +call setenv.bat if not exist %FUZZER_DIR% mkdir %FUZZER_DIR% if not exist %SAVE_DIR% mkdir %SAVE_DIR% @@ -37,7 +31,6 @@ call restore.bat %BIN_DIR%\nethack -D -F %TARGET_MOVE% -move %BIN_DIR%\*.snap %BIN_DIR%\snapshots copy %FUZZER_LOG% %BASELINE% for /f "tokens=2,3 delims=: usebackq" %%i in (`findstr /c:START %BASELINE%`) do ( diff --git a/win/win32/scripts/fuzzer/setenv.bat b/win/win32/scripts/fuzzer/setenv.bat new file mode 100644 index 000000000..3b3807371 --- /dev/null +++ b/win/win32/scripts/fuzzer/setenv.bat @@ -0,0 +1,13 @@ +echo on + +set STEP_SIZE=5000 +set FINAL_MOVE=500000 +set START_MOVE=5000 + +set BIN_DIR=..\..\..\..\bin\Debug\Win32 +set SAVED_GAME=wizard.NetHack-saved-game +set LOG_FILE=%BIN_DIR%\runtil.log +set FUZZER_LOG=%BIN_DIR%\fuzzer.log +set FUZZER_DIR=%BIN_DIR%\fuzzer +set SAVE_DIR=%FUZZER_DIR%\save +set BASELINE=%FUZZER_DIR%\fuzzer.log From cc1219b5a8bae222a6ba6a0c755419c9ca200a79 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 14:02:05 -0700 Subject: [PATCH 074/296] Revert type change of lit which would break code. Cast lit (which will be 1) to unsigned int to remove warning. --- src/sp_lev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sp_lev.c b/src/sp_lev.c index b2206ae70..ba9d75c72 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3763,7 +3763,7 @@ struct opvar *mc; { int x, y; schar mapc; - uchar lit; + xchar lit; struct opvar *ret = selection_opvar((char *) 0); if (!ov || !mc || !ret) @@ -3783,7 +3783,7 @@ struct opvar *mc; break; case 0: case 1: - if (levl[x][y].lit == lit) + if (levl[x][y].lit == (unsigned int) lit) selection_setpoint(x, y, ret, 1); break; } From 0d34f43830c129d8f675102957dfc637a39ae5b5 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 14 Jul 2019 17:24:58 -0400 Subject: [PATCH 075/296] remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR from core --- include/artilist.h | 2 +- include/hack.h | 21 --- src/allmain.c | 16 +-- src/apply.c | 137 ++++++++++--------- src/artifact.c | 46 +++---- src/attrib.c | 20 +-- src/ball.c | 20 +-- src/bones.c | 16 +-- src/botl.c | 154 +++++++++++----------- src/cmd.c | 238 ++++++++++++++++----------------- src/dbridge.c | 52 ++++---- src/detect.c | 56 ++++---- src/dig.c | 28 ++-- src/display.c | 56 ++++---- src/dlb.c | 52 ++++---- src/do.c | 36 ++--- src/do_name.c | 52 ++++---- src/do_wear.c | 90 ++++++------- src/dog.c | 4 +- src/dogmove.c | 44 +++---- src/dokick.c | 32 ++--- src/dothrow.c | 42 +++--- src/dungeon.c | 118 ++++++++--------- src/eat.c | 139 ++++++++++--------- src/end.c | 70 +++++----- src/engrave.c | 6 +- src/exper.c | 4 +- src/extralev.c | 12 +- src/files.c | 92 ++++++------- src/fountain.c | 20 +-- src/hack.c | 44 +++---- src/hacklib.c | 4 +- src/invent.c | 100 +++++++------- src/light.c | 10 +- src/lock.c | 20 +-- src/mail.c | 16 +-- src/makemon.c | 36 ++--- src/mcastu.c | 32 ++--- src/mhitm.c | 34 ++--- src/mhitu.c | 46 +++---- src/mklev.c | 82 ++++++------ src/mkmap.c | 40 +++--- src/mkmaze.c | 68 +++++----- src/mkobj.c | 50 +++---- src/mkroom.c | 44 +++---- src/mon.c | 64 ++++----- src/monmove.c | 28 ++-- src/mplayer.c | 12 +- src/mthrowu.c | 18 +-- src/muse.c | 62 ++++----- src/music.c | 28 ++-- src/o_init.c | 24 ++-- src/objnam.c | 64 ++++----- src/options.c | 142 ++++++++++---------- src/pager.c | 84 ++++++------ src/pickup.c | 108 +++++++-------- src/polyself.c | 28 ++-- src/potion.c | 20 +-- src/pray.c | 62 ++++----- src/priest.c | 8 +- src/quest.c | 40 +++--- src/questpgr.c | 52 ++++---- src/read.c | 66 +++++----- src/rect.c | 4 +- src/region.c | 4 +- src/restore.c | 78 +++++------ src/rip.c | 4 +- src/role.c | 16 +-- src/rumors.c | 12 +- src/save.c | 68 +++++----- src/sfstruct.c | 4 +- src/shk.c | 170 ++++++++++++------------ src/shknam.c | 28 ++-- src/sounds.c | 16 +-- src/sp_lev.c | 322 ++++++++++++++++++++++----------------------- src/spell.c | 72 +++++----- src/steal.c | 8 +- src/steed.c | 8 +- src/teleport.c | 20 +-- src/timeout.c | 72 +++++----- src/topten.c | 64 ++++----- src/track.c | 4 +- src/trap.c | 110 ++++++++-------- src/u_init.c | 16 +-- src/uhitm.c | 64 ++++----- src/vault.c | 40 +++--- src/version.c | 4 +- src/vision.c | 72 +++++----- src/weapon.c | 30 ++--- src/wield.c | 8 +- src/windows.c | 54 ++++---- src/wizard.c | 28 ++-- src/worm.c | 16 +-- src/worn.c | 12 +- src/write.c | 12 +- src/zap.c | 58 ++++---- 96 files changed, 2339 insertions(+), 2370 deletions(-) diff --git a/include/artilist.h b/include/artilist.h index 8948e521a..26320b080 100644 --- a/include/artilist.h +++ b/include/artilist.h @@ -31,7 +31,7 @@ static const char *artifact_names[] = { #define STUN(a,b) {0,AD_STUN,a,b} /* magical attack */ /* clang-format on */ -STATIC_OVL NEARDATA struct artifact artilist[] = { +static NEARDATA struct artifact artilist[] = { #endif /* MAKEDEFS_C */ /* Artifact cost rationale: diff --git a/include/hack.h b/include/hack.h index d1f02b0b0..369519479 100644 --- a/include/hack.h +++ b/include/hack.h @@ -541,27 +541,6 @@ enum bodypart_types { #define getlogin() ((char *) 0) #endif /* MICRO */ -#if defined(OVERLAY) -#define USE_OVLx -#define STATIC_DCL extern -#define STATIC_OVL -#define STATIC_VAR - -#else /* !OVERLAY */ - -#define STATIC_DCL static -#define STATIC_OVL static -#define STATIC_VAR static - -#endif /* OVERLAY */ - -/* Macro for a few items that are only static if we're not overlaid.... */ -#if defined(USE_TRAMPOLI) || defined(USE_OVLx) -#define STATIC_PTR -#else -#define STATIC_PTR static -#endif - /* The function argument to qsort() requires a particular * calling convention under WINCE which is not the default * in that environment. diff --git a/src/allmain.c b/src/allmain.c index 761017e31..06721616f 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -13,11 +13,11 @@ #endif #ifdef POSITIONBAR -STATIC_DCL void NDECL(do_positionbar); +static void NDECL(do_positionbar); #endif -STATIC_DCL void FDECL(regen_hp, (int)); -STATIC_DCL void FDECL(interrupt_multi, (const char *)); -STATIC_DCL void FDECL(debug_fields, (const char *)); +static void FDECL(regen_hp, (int)); +static void FDECL(interrupt_multi, (const char *)); +static void FDECL(debug_fields, (const char *)); void early_init() @@ -465,7 +465,7 @@ boolean resuming; } /* maybe recover some lost health (or lose some when an eel out of water) */ -STATIC_OVL void +static void regen_hp(wtcap) int wtcap; { @@ -698,7 +698,7 @@ boolean new_game; /* false => restoring an old game */ } #ifdef POSITIONBAR -STATIC_DCL void +static void do_positionbar() { static char pbar[COLNO]; @@ -753,7 +753,7 @@ do_positionbar() } #endif -STATIC_DCL void +static void interrupt_multi(msg) const char *msg; { @@ -885,7 +885,7 @@ enum earlyarg e_arg; * optimization so that display output * can be debugged without buffering. */ -STATIC_OVL void +static void debug_fields(opts) const char *opts; { diff --git a/src/apply.c b/src/apply.c index 79f259002..c2b6d759d 100644 --- a/src/apply.c +++ b/src/apply.c @@ -5,46 +5,46 @@ #include "hack.h" -STATIC_DCL int FDECL(use_camera, (struct obj *)); -STATIC_DCL int FDECL(use_towel, (struct obj *)); -STATIC_DCL boolean FDECL(its_dead, (int, int, int *)); -STATIC_DCL int FDECL(use_stethoscope, (struct obj *)); -STATIC_DCL void FDECL(use_whistle, (struct obj *)); -STATIC_DCL void FDECL(use_magic_whistle, (struct obj *)); -STATIC_DCL int FDECL(use_leash, (struct obj *)); -STATIC_DCL int FDECL(use_mirror, (struct obj *)); -STATIC_DCL void FDECL(use_bell, (struct obj **)); -STATIC_DCL void FDECL(use_candelabrum, (struct obj *)); -STATIC_DCL void FDECL(use_candle, (struct obj **)); -STATIC_DCL void FDECL(use_lamp, (struct obj *)); -STATIC_DCL void FDECL(light_cocktail, (struct obj **)); -STATIC_PTR void FDECL(display_jump_positions, (int)); -STATIC_DCL void FDECL(use_tinning_kit, (struct obj *)); -STATIC_DCL void FDECL(use_figurine, (struct obj **)); -STATIC_DCL void FDECL(use_grease, (struct obj *)); -STATIC_DCL void FDECL(use_trap, (struct obj *)); -STATIC_DCL void FDECL(use_stone, (struct obj *)); -STATIC_PTR int NDECL(set_trap); /* occupation callback */ -STATIC_DCL int FDECL(use_whip, (struct obj *)); -STATIC_PTR void FDECL(display_polearm_positions, (int)); -STATIC_DCL int FDECL(use_pole, (struct obj *)); -STATIC_DCL int FDECL(use_cream_pie, (struct obj *)); -STATIC_DCL int FDECL(use_grapple, (struct obj *)); -STATIC_DCL int FDECL(do_break_wand, (struct obj *)); -STATIC_DCL boolean FDECL(figurine_location_checks, (struct obj *, +static int FDECL(use_camera, (struct obj *)); +static int FDECL(use_towel, (struct obj *)); +static boolean FDECL(its_dead, (int, int, int *)); +static int FDECL(use_stethoscope, (struct obj *)); +static void FDECL(use_whistle, (struct obj *)); +static void FDECL(use_magic_whistle, (struct obj *)); +static int FDECL(use_leash, (struct obj *)); +static int FDECL(use_mirror, (struct obj *)); +static void FDECL(use_bell, (struct obj **)); +static void FDECL(use_candelabrum, (struct obj *)); +static void FDECL(use_candle, (struct obj **)); +static void FDECL(use_lamp, (struct obj *)); +static void FDECL(light_cocktail, (struct obj **)); +static void FDECL(display_jump_positions, (int)); +static void FDECL(use_tinning_kit, (struct obj *)); +static void FDECL(use_figurine, (struct obj **)); +static void FDECL(use_grease, (struct obj *)); +static void FDECL(use_trap, (struct obj *)); +static void FDECL(use_stone, (struct obj *)); +static int NDECL(set_trap); /* occupation callback */ +static int FDECL(use_whip, (struct obj *)); +static void FDECL(display_polearm_positions, (int)); +static int FDECL(use_pole, (struct obj *)); +static int FDECL(use_cream_pie, (struct obj *)); +static int FDECL(use_grapple, (struct obj *)); +static int FDECL(do_break_wand, (struct obj *)); +static boolean FDECL(figurine_location_checks, (struct obj *, coord *, BOOLEAN_P)); -STATIC_DCL void FDECL(add_class, (char *, CHAR_P)); -STATIC_DCL void FDECL(setapplyclasses, (char *)); -STATIC_PTR boolean FDECL(check_jump, (genericptr_t, int, int)); -STATIC_DCL boolean FDECL(is_valid_jump_pos, (int, int, int, BOOLEAN_P)); -STATIC_DCL boolean FDECL(get_valid_jump_position, (int, int)); -STATIC_DCL boolean FDECL(get_valid_polearm_position, (int, int)); -STATIC_DCL boolean FDECL(find_poleable_mon, (coord *, int, int)); +static void FDECL(add_class, (char *, CHAR_P)); +static void FDECL(setapplyclasses, (char *)); +static boolean FDECL(check_jump, (genericptr_t, int, int)); +static boolean FDECL(is_valid_jump_pos, (int, int, int, BOOLEAN_P)); +static boolean FDECL(get_valid_jump_position, (int, int)); +static boolean FDECL(get_valid_polearm_position, (int, int)); +static boolean FDECL(find_poleable_mon, (coord *, int, int)); static const char no_elbow_room[] = "don't have enough elbow-room to maneuver."; -STATIC_OVL int +static int use_camera(obj) struct obj *obj; { @@ -82,7 +82,7 @@ struct obj *obj; return 1; } -STATIC_OVL int +static int use_towel(obj) struct obj *obj; { @@ -168,7 +168,7 @@ struct obj *obj; } /* maybe give a stethoscope message based on floor objects */ -STATIC_OVL boolean +static boolean its_dead(rx, ry, resp) int rx, ry, *resp; { @@ -290,7 +290,7 @@ static const char hollow_str[] = "a hollow sound. This must be a secret %s!"; not take any time; however, unless it did, the stethoscope would be almost useless. As a compromise, one use per turn is free, another uses up the turn; this makes curse status have a tangible effect. */ -STATIC_OVL int +static int use_stethoscope(obj) register struct obj *obj; { @@ -425,7 +425,7 @@ register struct obj *obj; static const char whistle_str[] = "produce a %s whistling sound."; -STATIC_OVL void +static void use_whistle(obj) struct obj *obj; { @@ -445,7 +445,7 @@ struct obj *obj; } } -STATIC_OVL void +static void use_magic_whistle(obj) struct obj *obj; { @@ -578,7 +578,7 @@ struct monst *mtmp; } /* ARGSUSED */ -STATIC_OVL int +static int use_leash(obj) struct obj *obj; { @@ -802,7 +802,7 @@ beautiful() static const char look_str[] = "look %s."; -STATIC_OVL int +static int use_mirror(obj) struct obj *obj; { @@ -982,7 +982,7 @@ struct obj *obj; return 1; } -STATIC_OVL void +static void use_bell(optr) struct obj **optr; { @@ -1099,7 +1099,7 @@ struct obj **optr; wake_nearby(); } -STATIC_OVL void +static void use_candelabrum(obj) register struct obj *obj; { @@ -1152,7 +1152,7 @@ register struct obj *obj; begin_burn(obj, FALSE); } -STATIC_OVL void +static void use_candle(optr) struct obj **optr; { @@ -1309,7 +1309,7 @@ struct obj *obj; return FALSE; } -STATIC_OVL void +static void use_lamp(obj) struct obj *obj; { @@ -1362,7 +1362,7 @@ struct obj *obj; } } -STATIC_OVL void +static void light_cocktail(optr) struct obj **optr; { @@ -1485,7 +1485,7 @@ enum jump_trajectory { }; /* callback routine for walk_path() */ -STATIC_PTR boolean +static boolean check_jump(arg, x, y) genericptr arg; int x, y; @@ -1518,7 +1518,7 @@ int x, y; return TRUE; } -STATIC_OVL boolean +static boolean is_valid_jump_pos(x, y, magic, showmsg) int x, y, magic; boolean showmsg; @@ -1586,7 +1586,7 @@ boolean showmsg; return TRUE; } -STATIC_OVL boolean +static boolean get_valid_jump_position(x,y) int x,y; { @@ -1595,7 +1595,7 @@ int x,y; && is_valid_jump_pos(x, y, g.jumping_is_magic, FALSE)); } -STATIC_OVL void +static void display_jump_positions(state) int state; { @@ -1792,7 +1792,7 @@ struct obj *corpse; return 1; } -STATIC_OVL void +static void use_tinning_kit(obj) struct obj *obj; { @@ -2168,7 +2168,7 @@ long timeout; newsym(cc.x, cc.y); } -STATIC_OVL boolean +static boolean figurine_location_checks(obj, cc, quietly) struct obj *obj; coord *cc; @@ -2204,7 +2204,7 @@ boolean quietly; return TRUE; } -STATIC_OVL void +static void use_figurine(optr) struct obj **optr; { @@ -2246,7 +2246,7 @@ struct obj **optr; static NEARDATA const char lubricables[] = { ALL_CLASSES, ALLOW_NONE, 0 }; -STATIC_OVL void +static void use_grease(obj) struct obj *obj; { @@ -2297,7 +2297,7 @@ struct obj *obj; } /* touchstones - by Ken Arnold */ -STATIC_OVL void +static void use_stone(tstone) struct obj *tstone; { @@ -2433,7 +2433,7 @@ reset_trapset() } /* Place a landmine/bear trap. Helge Hafting */ -STATIC_OVL void +static void use_trap(otmp) struct obj *otmp; { @@ -2533,8 +2533,7 @@ struct obj *otmp; return; } -STATIC_PTR -int +static int set_trap() { struct obj *otmp = g.trapinfo.tobj; @@ -2575,7 +2574,7 @@ set_trap() return 0; } -STATIC_OVL int +static int use_whip(obj) struct obj *obj; { @@ -2848,7 +2847,7 @@ static const char cant_reach[] = "can't reach that spot from here."; /* find pos of monster in range, if only one monster */ -STATIC_OVL boolean +static boolean find_poleable_mon(pos, min_range, max_range) coord *pos; int min_range, max_range; @@ -2892,7 +2891,7 @@ int min_range, max_range; return TRUE; } -STATIC_OVL boolean +static boolean get_valid_polearm_position(x, y) int x, y; { @@ -2901,7 +2900,7 @@ int x, y; && distu(x, y) <= g.polearm_range_max); } -STATIC_OVL void +static void display_polearm_positions(state) int state; { @@ -2924,7 +2923,7 @@ int state; } /* Distance attacks by pole-weapons */ -STATIC_OVL int +static int use_pole(obj) struct obj *obj; { @@ -3041,7 +3040,7 @@ struct obj *obj; return 1; } -STATIC_OVL int +static int use_cream_pie(obj) struct obj *obj; { @@ -3079,7 +3078,7 @@ struct obj *obj; return 0; } -STATIC_OVL int +static int use_grapple(obj) struct obj *obj; { @@ -3229,7 +3228,7 @@ struct obj *obj; #define BY_OBJECT ((struct monst *) 0) /* return 1 if the wand is broken, hence some time elapsed */ -STATIC_OVL int +static int do_break_wand(obj) struct obj *obj; { @@ -3454,7 +3453,7 @@ discard_broken_wand: return 1; } -STATIC_OVL void +static void add_class(cl, class) char *cl; char class; @@ -3469,7 +3468,7 @@ char class; static const char tools[] = { TOOL_CLASS, WEAPON_CLASS, WAND_CLASS, 0 }; /* augment tools[] if various items are carried */ -STATIC_OVL void +static void setapplyclasses(class_list) char class_list[]; { diff --git a/src/artifact.c b/src/artifact.c index 03df78062..966ab70ca 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -19,17 +19,17 @@ #define get_artifact(o) \ (((o) && (o)->oartifact) ? &artilist[(int) (o)->oartifact] : 0) -STATIC_DCL boolean FDECL(bane_applies, (const struct artifact *, +static boolean FDECL(bane_applies, (const struct artifact *, struct monst *)); -STATIC_DCL int FDECL(spec_applies, (const struct artifact *, struct monst *)); -STATIC_DCL int FDECL(arti_invoke, (struct obj *)); -STATIC_DCL boolean FDECL(Mb_hit, (struct monst * magr, struct monst *mdef, +static int FDECL(spec_applies, (const struct artifact *, struct monst *)); +static int FDECL(arti_invoke, (struct obj *)); +static boolean FDECL(Mb_hit, (struct monst * magr, struct monst *mdef, struct obj *, int *, int, BOOLEAN_P, char *)); -STATIC_DCL unsigned long FDECL(abil_to_spfx, (long *)); -STATIC_DCL uchar FDECL(abil_to_adtyp, (long *)); -STATIC_DCL int FDECL(glow_strength, (int)); -STATIC_DCL boolean FDECL(untouchable, (struct obj *, BOOLEAN_P)); -STATIC_DCL int FDECL(count_surround_traps, (int, int)); +static unsigned long FDECL(abil_to_spfx, (long *)); +static uchar FDECL(abil_to_adtyp, (long *)); +static int FDECL(glow_strength, (int)); +static boolean FDECL(untouchable, (struct obj *, BOOLEAN_P)); +static int FDECL(count_surround_traps, (int, int)); /* The amount added to the victim's total hit points to insure that the victim will be killed even after damage bonus/penalty adjustments. @@ -41,11 +41,11 @@ STATIC_DCL int FDECL(count_surround_traps, (int, int)); of hit points that will fit in a 15 bit integer. */ #define FATAL_DAMAGE_MODIFIER 200 -STATIC_DCL void NDECL(hack_artifacts); -STATIC_DCL boolean FDECL(attacks, (int, struct obj *)); +static void NDECL(hack_artifacts); +static boolean FDECL(attacks, (int, struct obj *)); /* handle some special cases; must be called after u_init() */ -STATIC_OVL void +static void hack_artifacts() { struct artifact *art; @@ -418,7 +418,7 @@ const char *name; return FALSE; } -STATIC_OVL boolean +static boolean attacks(adtyp, otmp) int adtyp; struct obj *otmp; @@ -649,7 +649,7 @@ long wp_mask; /* touch_artifact()'s return value isn't sufficient to tell whether it dished out damage, and tracking changes to u.uhp, u.mh, Lifesaved when trying to avoid second wounding is too cumbersome */ -STATIC_VAR boolean touch_blasted; /* for retouch_object() */ +static boolean touch_blasted; /* for retouch_object() */ /* * creature (usually hero) tries to touch (pick up or wield) an artifact obj. @@ -747,7 +747,7 @@ int dtyp; || weap->cary.adtyp == dtyp); } -STATIC_OVL boolean +static boolean bane_applies(oart, mon) const struct artifact *oart; struct monst *mon; @@ -764,7 +764,7 @@ struct monst *mon; } /* decide whether an artifact's special attacks apply against mtmp */ -STATIC_OVL int +static int spec_applies(weap, mtmp) register const struct artifact *weap; struct monst *mtmp; @@ -973,7 +973,7 @@ static const char *const mb_verb[2][NUM_MB_INDICES] = { }; /* called when someone is being hit by Magicbane */ -STATIC_OVL boolean +static boolean Mb_hit(magr, mdef, mb, dmgptr, dieroll, vis, hittee) struct monst *magr, *mdef; /* attacker and defender */ struct obj *mb; /* Magicbane */ @@ -1427,7 +1427,7 @@ doinvoke() return arti_invoke(obj); } -STATIC_OVL int +static int arti_invoke(obj) struct obj *obj; { @@ -1752,7 +1752,7 @@ struct obj *otmp; return (100L * (long) objects[otmp->otyp].oc_cost); } -STATIC_OVL uchar +static uchar abil_to_adtyp(abil) long *abil; { @@ -1777,7 +1777,7 @@ long *abil; return 0; } -STATIC_OVL unsigned long +static unsigned long abil_to_spfx(abil) long *abil; { @@ -1874,7 +1874,7 @@ static const char *glow_verbs[] = { }; /* relative strength that Sting is glowing (0..3), to select verb */ -STATIC_OVL int +static int glow_strength(count) int count; { @@ -2007,7 +2007,7 @@ boolean loseit; /* whether to drop it if hero can longer touch it */ something via being carried or which has an #invoke effect currently in operation undergoes a touch test; if it fails, it will be unworn/unwielded and revoked but not dropped */ -STATIC_OVL boolean +static boolean untouchable(obj, drop_untouchable) struct obj *obj; boolean drop_untouchable; @@ -2114,7 +2114,7 @@ int dropflag; /* 0==don't drop, 1==drop all, 2==drop weapon */ clear_bypasses(); /* reset upon final exit */ } -STATIC_OVL int +static int count_surround_traps(x, y) int x, y; { diff --git a/src/attrib.c b/src/attrib.c index b37c6320a..a50d93eb0 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -103,11 +103,11 @@ static const struct innate { hum_abil[] = { { 0, 0, 0, 0 } }; -STATIC_DCL void NDECL(exerper); -STATIC_DCL void FDECL(postadjabil, (long *)); -STATIC_DCL const struct innate *FDECL(role_abil, (int)); -STATIC_DCL const struct innate *FDECL(check_innate_abil, (long *, long)); -STATIC_DCL int FDECL(innately, (long *)); +static void NDECL(exerper); +static void FDECL(postadjabil, (long *)); +static const struct innate *FDECL(role_abil, (int)); +static const struct innate *FDECL(check_innate_abil, (long *, long)); +static int FDECL(innately, (long *)); /* adjust an attribute; return TRUE if change is made, FALSE otherwise */ boolean @@ -443,7 +443,7 @@ boolean inc_or_dec; (void) encumber_msg(); } -STATIC_OVL void +static void exerper() { if (!(g.moves % 10)) { @@ -683,7 +683,7 @@ redist_attr() (void) encumber_msg(); } -STATIC_OVL +static void postadjabil(ability) long *ability; @@ -694,7 +694,7 @@ long *ability; see_monsters(); } -STATIC_OVL const struct innate * +static const struct innate * role_abil(r) int r; { @@ -724,7 +724,7 @@ int r; return roleabils[i].abil; } -STATIC_OVL const struct innate * +static const struct innate * check_innate_abil(ability, frommask) long *ability; long frommask; @@ -772,7 +772,7 @@ long frommask; #define FROM_LYCN 6 /* check whether particular ability has been obtained via innate attribute */ -STATIC_OVL int +static int innately(ability) long *ability; { diff --git a/src/ball.c b/src/ball.c index 77fa5ecf0..e7ab564d4 100644 --- a/src/ball.c +++ b/src/ball.c @@ -8,11 +8,11 @@ #include "hack.h" -STATIC_DCL int NDECL(bc_order); -STATIC_DCL void NDECL(litter); -STATIC_OVL void NDECL(placebc_core); -STATIC_OVL void NDECL(unplacebc_core); -STATIC_DCL boolean FDECL(check_restriction, (int)); +static int NDECL(bc_order); +static void NDECL(litter); +static void NDECL(placebc_core); +static void NDECL(unplacebc_core); +static boolean FDECL(check_restriction, (int)); static int bcrestriction = 0; #ifdef BREADCRUMBS @@ -114,7 +114,7 @@ ballfall() * * Should not be called while swallowed except on waterlevel. */ -STATIC_OVL void +static void placebc_core() { if (!uchain || !uball) { @@ -141,7 +141,7 @@ placebc_core() bcrestriction = 0; } -STATIC_OVL void +static void unplacebc_core() { if (u.uswallow) { @@ -173,7 +173,7 @@ unplacebc_core() u.bc_felt = 0; /* feel nothing */ } -STATIC_OVL boolean +static boolean check_restriction(restriction) int restriction; { @@ -362,7 +362,7 @@ int linenum; * Return the stacking of the hero's ball & chain. This assumes that the * hero is being punished. */ -STATIC_OVL int +static int bc_order() { struct obj *obj; @@ -977,7 +977,7 @@ xchar x, y; } /* ball&chain cause hero to randomly lose stuff from inventory */ -STATIC_OVL void +static void litter() { struct obj *otmp, *nextobj = 0; diff --git a/src/bones.c b/src/bones.c index 0d9e28b37..0359b386e 100644 --- a/src/bones.c +++ b/src/bones.c @@ -12,12 +12,12 @@ extern long bytes_counted; #endif -STATIC_DCL boolean FDECL(no_bones_level, (d_level *)); -STATIC_DCL void FDECL(goodfruit, (int)); -STATIC_DCL void FDECL(resetobjs, (struct obj *, BOOLEAN_P)); -STATIC_DCL boolean FDECL(fixuporacle, (struct monst *)); +static boolean FDECL(no_bones_level, (d_level *)); +static void FDECL(goodfruit, (int)); +static void FDECL(resetobjs, (struct obj *, BOOLEAN_P)); +static boolean FDECL(fixuporacle, (struct monst *)); -STATIC_OVL boolean +static boolean no_bones_level(lev) d_level *lev; { @@ -42,7 +42,7 @@ d_level *lev; * ID is positive instead of negative). This way, when we later save the * chain of fruit types, we know to only save the types that exist. */ -STATIC_OVL void +static void goodfruit(id) int id; { @@ -52,7 +52,7 @@ int id; f->fid = id; } -STATIC_OVL void +static void resetobjs(ochain, restore) struct obj *ochain; boolean restore; @@ -252,7 +252,7 @@ int x, y; /* possibly restore oracle's room and/or put her back inside it; returns False if she's on the wrong level and should be removed, True otherwise */ -STATIC_OVL boolean +static boolean fixuporacle(oracle) struct monst *oracle; { diff --git a/src/botl.c b/src/botl.c index 79601bbbe..5dd6747a4 100644 --- a/src/botl.c +++ b/src/botl.c @@ -13,9 +13,9 @@ extern const char *hu_stat[]; /* defined in eat.c */ const char *const enc_stat[] = { "", "Burdened", "Stressed", "Strained", "Overtaxed", "Overloaded" }; -STATIC_DCL const char *NDECL(rank); -STATIC_DCL void NDECL(bot_via_windowport); -STATIC_DCL void NDECL(stat_update_time); +static const char *NDECL(rank); +static void NDECL(bot_via_windowport); +static void NDECL(stat_update_time); static char * get_strength_str() @@ -309,7 +309,7 @@ boolean female; return "Player"; } -STATIC_OVL const char * +static const char * rank() { return rank_of(u.ulevel, Role_switch, flags.female); @@ -414,49 +414,49 @@ char *buf; #ifdef STATUS_HILITES #endif /* STATUS_HILITES */ -STATIC_DCL boolean FDECL(eval_notify_windowport_field, (int, boolean *, int)); -STATIC_DCL void FDECL(evaluate_and_notify_windowport, (boolean *, int)); -STATIC_DCL void NDECL(init_blstats); -STATIC_DCL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *)); -STATIC_DCL char *FDECL(anything_to_s, (char *, anything *, int)); -STATIC_DCL int FDECL(percentage, (struct istat_s *, struct istat_s *)); -STATIC_DCL int NDECL(exp_percentage); +static boolean FDECL(eval_notify_windowport_field, (int, boolean *, int)); +static void FDECL(evaluate_and_notify_windowport, (boolean *, int)); +static void NDECL(init_blstats); +static int FDECL(compare_blstats, (struct istat_s *, struct istat_s *)); +static char *FDECL(anything_to_s, (char *, anything *, int)); +static int FDECL(percentage, (struct istat_s *, struct istat_s *)); +static int NDECL(exp_percentage); #ifdef STATUS_HILITES -STATIC_DCL void FDECL(s_to_anything, (anything *, char *, int)); -STATIC_DCL enum statusfields FDECL(fldname_to_bl_indx, (const char *)); -STATIC_DCL boolean FDECL(hilite_reset_needed, (struct istat_s *, long)); -STATIC_DCL boolean FDECL(noneoftheabove, (const char *)); -STATIC_DCL struct hilite_s *FDECL(get_hilite, (int, int, genericptr_t, +static void FDECL(s_to_anything, (anything *, char *, int)); +static enum statusfields FDECL(fldname_to_bl_indx, (const char *)); +static boolean FDECL(hilite_reset_needed, (struct istat_s *, long)); +static boolean FDECL(noneoftheabove, (const char *)); +static struct hilite_s *FDECL(get_hilite, (int, int, genericptr_t, int, int, int *)); -STATIC_DCL void FDECL(split_clridx, (int, int *, int *)); -STATIC_DCL boolean FDECL(is_ltgt_percentnumber, (const char *)); -STATIC_DCL boolean FDECL(has_ltgt_percentnumber, (const char *)); -STATIC_DCL int FDECL(splitsubfields, (char *, char ***, int)); -STATIC_DCL boolean FDECL(is_fld_arrayvalues, (const char *, +static void FDECL(split_clridx, (int, int *, int *)); +static boolean FDECL(is_ltgt_percentnumber, (const char *)); +static boolean FDECL(has_ltgt_percentnumber, (const char *)); +static int FDECL(splitsubfields, (char *, char ***, int)); +static boolean FDECL(is_fld_arrayvalues, (const char *, const char *const *, int, int, int *)); -STATIC_DCL int FDECL(query_arrayvalue, (const char *, const char *const *, +static int FDECL(query_arrayvalue, (const char *, const char *const *, int, int)); -STATIC_DCL void FDECL(status_hilite_add_threshold, (int, struct hilite_s *)); -STATIC_DCL boolean FDECL(parse_status_hl2, (char (*)[QBUFSZ], BOOLEAN_P)); -STATIC_DCL char *FDECL(conditionbitmask2str, (unsigned long)); -STATIC_DCL unsigned long FDECL(match_str2conditionbitmask, (const char *)); -STATIC_DCL unsigned long FDECL(str2conditionbitmask, (char *)); -STATIC_DCL boolean FDECL(parse_condition, (char (*)[QBUFSZ], int)); -STATIC_DCL char *FDECL(hlattr2attrname, (int, char *, int)); -STATIC_DCL void FDECL(status_hilite_linestr_add, (int, struct hilite_s *, +static void FDECL(status_hilite_add_threshold, (int, struct hilite_s *)); +static boolean FDECL(parse_status_hl2, (char (*)[QBUFSZ], BOOLEAN_P)); +static char *FDECL(conditionbitmask2str, (unsigned long)); +static unsigned long FDECL(match_str2conditionbitmask, (const char *)); +static unsigned long FDECL(str2conditionbitmask, (char *)); +static boolean FDECL(parse_condition, (char (*)[QBUFSZ], int)); +static char *FDECL(hlattr2attrname, (int, char *, int)); +static void FDECL(status_hilite_linestr_add, (int, struct hilite_s *, unsigned long, const char *)); -STATIC_DCL void NDECL(status_hilite_linestr_done); -STATIC_DCL int FDECL(status_hilite_linestr_countfield, (int)); -STATIC_DCL void NDECL(status_hilite_linestr_gather_conditions); -STATIC_DCL void NDECL(status_hilite_linestr_gather); -STATIC_DCL char *FDECL(status_hilite2str, (struct hilite_s *)); -STATIC_DCL int NDECL(status_hilite_menu_choose_field); -STATIC_DCL int FDECL(status_hilite_menu_choose_behavior, (int)); -STATIC_DCL int FDECL(status_hilite_menu_choose_updownboth, (int, const char *, +static void NDECL(status_hilite_linestr_done); +static int FDECL(status_hilite_linestr_countfield, (int)); +static void NDECL(status_hilite_linestr_gather_conditions); +static void NDECL(status_hilite_linestr_gather); +static char *FDECL(status_hilite2str, (struct hilite_s *)); +static int NDECL(status_hilite_menu_choose_field); +static int FDECL(status_hilite_menu_choose_behavior, (int)); +static int FDECL(status_hilite_menu_choose_updownboth, (int, const char *, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL boolean FDECL(status_hilite_menu_add, (int)); +static boolean FDECL(status_hilite_menu_add, (int)); #define has_hilite(i) (g.blstats[0][(i)].thresholds) /* TH_UPDOWN encompasses specific 'up' and 'down' also general 'changed' */ #define Is_Temp_Hilite(rule) ((rule) && (rule)->behavior == BL_TH_UPDOWN) @@ -479,7 +479,7 @@ STATIC_DCL boolean FDECL(status_hilite_menu_add, (int)); /* If entries are added to this, botl.h will require updating too. 'max' value of BL_EXP gets special handling since the percentage involved isn't a direct 100*current/maximum calculation. */ -STATIC_VAR struct istat_s initblstats[MAXBLSTATS] = { +static struct istat_s initblstats[MAXBLSTATS] = { INIT_BLSTAT("title", "%s", ANY_STR, MAXVALWIDTH, BL_TITLE), INIT_BLSTAT("strength", " St:%s", ANY_INT, 10, BL_STR), INIT_BLSTAT("dexterity", " Dx:%s", ANY_INT, 10, BL_DX), @@ -520,7 +520,7 @@ STATIC_VAR struct istat_s initblstats[MAXBLSTATS] = { * without STATUS_HILITES. */ -STATIC_OVL void +static void bot_via_windowport() { char buf[BUFSZ]; @@ -702,7 +702,7 @@ bot_via_windowport() } /* update just the status lines' 'time' field */ -STATIC_OVL void +static void stat_update_time() { int idx = g.now_or_before_idx; /* no 0/1 toggle */ @@ -719,7 +719,7 @@ stat_update_time() return; } -STATIC_OVL boolean +static boolean eval_notify_windowport_field(fld, valsetlist, idx) int fld, idx; boolean *valsetlist; @@ -832,7 +832,7 @@ boolean *valsetlist; return updated; } -STATIC_OVL void +static void evaluate_and_notify_windowport(valsetlist, idx) int idx; boolean *valsetlist; @@ -957,7 +957,7 @@ status_finish() } } -STATIC_OVL void +static void init_blstats() { static boolean initalready = FALSE; @@ -1006,7 +1006,7 @@ init_blstats() * - for strings, 0 = stayed the same, 1 = changed * */ -STATIC_OVL int +static int compare_blstats(bl1, bl2) struct istat_s *bl1, *bl2; { @@ -1079,7 +1079,7 @@ struct istat_s *bl1, *bl2; return result; } -STATIC_OVL char * +static char * anything_to_s(buf, a, anytype) char *buf; anything *a; @@ -1126,7 +1126,7 @@ int anytype; } #ifdef STATUS_HILITES -STATIC_OVL void +static void s_to_anything(a, buf, anytype) anything *a; char *buf; @@ -1175,7 +1175,7 @@ int anytype; } #endif /* STATUS_HILITES */ -STATIC_OVL int +static int percentage(bl, maxbl) struct istat_s *bl, *maxbl; { @@ -1242,7 +1242,7 @@ struct istat_s *bl, *maxbl; /* percentage for both xp (level) and exp (points) is the percentage for (curr_exp - this_level_start) in (next_level_start - this_level_start) */ -STATIC_OVL int +static int exp_percentage() { int res = 0; @@ -1390,7 +1390,7 @@ static const char threshold_value[] = "hilite_status threshold ", /* field name to bottom line index */ -STATIC_OVL enum statusfields +static enum statusfields fldname_to_bl_indx(name) const char *name; { @@ -1429,7 +1429,7 @@ const char *name; return (nmatches == 1) ? fld : BL_FLUSH; } -STATIC_OVL boolean +static boolean hilite_reset_needed(bl_p, augmented_time) struct istat_s *bl_p; long augmented_time; /* no longer augmented; it once encoded fractional @@ -1507,7 +1507,7 @@ reset_status_hilites() /* test whether the text from a title rule matches the string for title-while-polymorphed in the 'textmatch' menu */ -STATIC_OVL boolean +static boolean noneoftheabove(hl_text) const char *hl_text; { @@ -1536,7 +1536,7 @@ const char *hl_text; * Get back: * pointer to rule that applies; Null if no rule does. */ -STATIC_OVL struct hilite_s * +static struct hilite_s * get_hilite(idx, fldidx, vp, chg, pc, colorptr) int idx, fldidx, chg, pc; genericptr_t vp; @@ -1728,7 +1728,7 @@ int *colorptr; return rule; } -STATIC_OVL void +static void split_clridx(idx, coloridx, attrib) int idx; int *coloridx, *attrib; @@ -1804,7 +1804,7 @@ boolean from_configfile; } /* is str in the format of "[<>]?=?[-+]?[0-9]+%?" regex */ -STATIC_OVL boolean +static boolean is_ltgt_percentnumber(str) const char *str; { @@ -1826,7 +1826,7 @@ const char *str; } /* does str only contain "<>=-+0-9%" chars */ -STATIC_OVL boolean +static boolean has_ltgt_percentnumber(str) const char *str; { @@ -1844,7 +1844,7 @@ const char *str; * returns number of strings, or -1 if more than maxsf or MAX_SUBFIELDS */ #define MAX_SUBFIELDS 16 -STATIC_OVL int +static int splitsubfields(str, sfarr, maxsf) char *str; char ***sfarr; @@ -1888,7 +1888,7 @@ int maxsf; } #undef MAX_SUBFIELDS -STATIC_OVL boolean +static boolean is_fld_arrayvalues(str, arr, arrmin, arrmax, retidx) const char *str; const char *const *arr; @@ -1905,7 +1905,7 @@ int *retidx; return FALSE; } -STATIC_OVL int +static int query_arrayvalue(querystr, arr, arrmin, arrmax) const char *querystr; const char *const *arr; @@ -1939,7 +1939,7 @@ int arrmin, arrmax; return ret; } -STATIC_OVL void +static void status_hilite_add_threshold(fld, hilite) int fld; struct hilite_s *hilite; @@ -1964,7 +1964,7 @@ struct hilite_s *hilite; } -STATIC_OVL boolean +static boolean parse_status_hl2(s, from_configfile) char (*s)[QBUFSZ]; boolean from_configfile; @@ -2314,7 +2314,7 @@ query_conditions() return ret; } -STATIC_OVL char * +static char * conditionbitmask2str(ul) unsigned long ul; { @@ -2345,7 +2345,7 @@ unsigned long ul; return buf; } -STATIC_OVL unsigned long +static unsigned long match_str2conditionbitmask(str) const char *str; { @@ -2384,7 +2384,7 @@ const char *str; return mask; } -STATIC_OVL unsigned long +static unsigned long str2conditionbitmask(str) char *str; { @@ -2409,7 +2409,7 @@ char *str; return conditions_bitmask; } -STATIC_OVL boolean +static boolean parse_condition(s, sidx) char (*s)[QBUFSZ]; int sidx; @@ -2550,7 +2550,7 @@ clear_status_hilites() } } -STATIC_OVL char * +static char * hlattr2attrname(attrib, buf, bufsz) int attrib, bufsz; char *buf; @@ -2597,7 +2597,7 @@ struct _status_hilite_line_str { static struct _status_hilite_line_str *status_hilite_str = 0; static int status_hilite_str_id = 0; -STATIC_OVL void +static void status_hilite_linestr_add(fld, hl, mask, str) int fld; struct hilite_s *hl; @@ -2628,7 +2628,7 @@ const char *str; } } -STATIC_OVL void +static void status_hilite_linestr_done() { struct _status_hilite_line_str *nxt, *tmp = status_hilite_str; @@ -2642,7 +2642,7 @@ status_hilite_linestr_done() status_hilite_str_id = 0; } -STATIC_OVL int +static int status_hilite_linestr_countfield(fld) int fld; { @@ -2669,7 +2669,7 @@ count_status_hilites(VOID_ARGS) return count; } -STATIC_OVL void +static void status_hilite_linestr_gather_conditions() { int i; @@ -2749,7 +2749,7 @@ status_hilite_linestr_gather_conditions() } } -STATIC_OVL void +static void status_hilite_linestr_gather() { int i; @@ -2769,7 +2769,7 @@ status_hilite_linestr_gather() } -STATIC_OVL char * +static char * status_hilite2str(hl) struct hilite_s *hl; { @@ -2848,7 +2848,7 @@ struct hilite_s *hl; return buf; } -STATIC_OVL int +static int status_hilite_menu_choose_field() { winid tmpwin; @@ -2882,7 +2882,7 @@ status_hilite_menu_choose_field() return fld; } -STATIC_OVL int +static int status_hilite_menu_choose_behavior(fld) int fld; { @@ -2974,7 +2974,7 @@ int fld; return beh; } -STATIC_OVL int +static int status_hilite_menu_choose_updownboth(fld, str, ltok, gtok) int fld; const char *str; @@ -3052,7 +3052,7 @@ boolean ltok, gtok; return ret; } -STATIC_OVL boolean +static boolean status_hilite_menu_add(origfld) int origfld; { diff --git a/src/cmd.c b/src/cmd.c index e3206bda3..7fdfedd08 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -27,7 +27,7 @@ #define unmeta(c) (0x7f & (c)) #ifdef ALTMETA -STATIC_VAR boolean alt_esc = FALSE; +static boolean alt_esc = FALSE; #endif extern const char *hu_stat[]; /* hunger status from eat.c */ @@ -129,79 +129,79 @@ extern int NDECL(doorganize); /**/ static int NDECL((*timed_occ_fn)); -STATIC_PTR int NDECL(dosuspend_core); -STATIC_PTR int NDECL(dosh_core); -STATIC_PTR int NDECL(doherecmdmenu); -STATIC_PTR int NDECL(dotherecmdmenu); -STATIC_PTR int NDECL(doprev_message); -STATIC_PTR int NDECL(timed_occupation); -STATIC_PTR int NDECL(doextcmd); -STATIC_PTR int NDECL(dotravel); -STATIC_PTR int NDECL(doterrain); -STATIC_PTR int NDECL(wiz_wish); -STATIC_PTR int NDECL(wiz_identify); -STATIC_PTR int NDECL(wiz_intrinsic); -STATIC_PTR int NDECL(wiz_map); -STATIC_PTR int NDECL(wiz_makemap); -STATIC_PTR int NDECL(wiz_genesis); -STATIC_PTR int NDECL(wiz_where); -STATIC_PTR int NDECL(wiz_detect); -STATIC_PTR int NDECL(wiz_panic); -STATIC_PTR int NDECL(wiz_polyself); -STATIC_PTR int NDECL(wiz_level_tele); -STATIC_PTR int NDECL(wiz_level_change); -STATIC_PTR int NDECL(wiz_show_seenv); -STATIC_PTR int NDECL(wiz_show_vision); -STATIC_PTR int NDECL(wiz_smell); -STATIC_PTR int NDECL(wiz_intrinsic); -STATIC_PTR int NDECL(wiz_show_wmodes); -STATIC_DCL void NDECL(wiz_map_levltyp); -STATIC_DCL void NDECL(wiz_levltyp_legend); +static int NDECL(dosuspend_core); +static int NDECL(dosh_core); +static int NDECL(doherecmdmenu); +static int NDECL(dotherecmdmenu); +static int NDECL(doprev_message); +static int NDECL(timed_occupation); +static int NDECL(doextcmd); +static int NDECL(dotravel); +static int NDECL(doterrain); +static int NDECL(wiz_wish); +static int NDECL(wiz_identify); +static int NDECL(wiz_intrinsic); +static int NDECL(wiz_map); +static int NDECL(wiz_makemap); +static int NDECL(wiz_genesis); +static int NDECL(wiz_where); +static int NDECL(wiz_detect); +static int NDECL(wiz_panic); +static int NDECL(wiz_polyself); +static int NDECL(wiz_level_tele); +static int NDECL(wiz_level_change); +static int NDECL(wiz_show_seenv); +static int NDECL(wiz_show_vision); +static int NDECL(wiz_smell); +static int NDECL(wiz_intrinsic); +static int NDECL(wiz_show_wmodes); +static void NDECL(wiz_map_levltyp); +static void NDECL(wiz_levltyp_legend); #if defined(__BORLANDC__) && !defined(_WIN32) extern void FDECL(show_borlandc_stats, (winid)); #endif #ifdef DEBUG_MIGRATING_MONS -STATIC_PTR int NDECL(wiz_migrate_mons); +static int NDECL(wiz_migrate_mons); #endif -STATIC_DCL int FDECL(size_monst, (struct monst *, BOOLEAN_P)); -STATIC_DCL int FDECL(size_obj, (struct obj *)); -STATIC_DCL void FDECL(count_obj, (struct obj *, long *, long *, +static int FDECL(size_monst, (struct monst *, BOOLEAN_P)); +static int FDECL(size_obj, (struct obj *)); +static void FDECL(count_obj, (struct obj *, long *, long *, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL void FDECL(obj_chain, (winid, const char *, struct obj *, +static void FDECL(obj_chain, (winid, const char *, struct obj *, BOOLEAN_P, long *, long *)); -STATIC_DCL void FDECL(mon_invent_chain, (winid, const char *, struct monst *, +static void FDECL(mon_invent_chain, (winid, const char *, struct monst *, long *, long *)); -STATIC_DCL void FDECL(mon_chain, (winid, const char *, struct monst *, +static void FDECL(mon_chain, (winid, const char *, struct monst *, BOOLEAN_P, long *, long *)); -STATIC_DCL void FDECL(contained_stats, (winid, const char *, long *, long *)); -STATIC_DCL void FDECL(misc_stats, (winid, long *, long *)); -STATIC_PTR int NDECL(wiz_show_stats); -STATIC_DCL boolean FDECL(accept_menu_prefix, (int NDECL((*)))); -STATIC_PTR int NDECL(wiz_rumor_check); -STATIC_PTR int NDECL(doattributes); +static void FDECL(contained_stats, (winid, const char *, long *, long *)); +static void FDECL(misc_stats, (winid, long *, long *)); +static int NDECL(wiz_show_stats); +static boolean FDECL(accept_menu_prefix, (int NDECL((*)))); +static int NDECL(wiz_rumor_check); +static int NDECL(doattributes); -STATIC_DCL void FDECL(enlght_out, (const char *)); -STATIC_DCL void FDECL(enlght_line, (const char *, const char *, const char *, +static void FDECL(enlght_out, (const char *)); +static void FDECL(enlght_line, (const char *, const char *, const char *, const char *)); -STATIC_DCL char *FDECL(enlght_combatinc, (const char *, int, int, char *)); -STATIC_DCL void FDECL(enlght_halfdmg, (int, int)); -STATIC_DCL boolean NDECL(walking_on_water); -STATIC_DCL boolean FDECL(cause_known, (int)); -STATIC_DCL char *FDECL(attrval, (int, int, char *)); -STATIC_DCL void FDECL(background_enlightenment, (int, int)); -STATIC_DCL void FDECL(basics_enlightenment, (int, int)); -STATIC_DCL void FDECL(characteristics_enlightenment, (int, int)); -STATIC_DCL void FDECL(one_characteristic, (int, int, int)); -STATIC_DCL void FDECL(status_enlightenment, (int, int)); -STATIC_DCL void FDECL(attributes_enlightenment, (int, int)); +static char *FDECL(enlght_combatinc, (const char *, int, int, char *)); +static void FDECL(enlght_halfdmg, (int, int)); +static boolean NDECL(walking_on_water); +static boolean FDECL(cause_known, (int)); +static char *FDECL(attrval, (int, int, char *)); +static void FDECL(background_enlightenment, (int, int)); +static void FDECL(basics_enlightenment, (int, int)); +static void FDECL(characteristics_enlightenment, (int, int)); +static void FDECL(one_characteristic, (int, int, int)); +static void FDECL(status_enlightenment, (int, int)); +static void FDECL(attributes_enlightenment, (int, int)); -STATIC_DCL void FDECL(add_herecmd_menuitem, (winid, int NDECL((*)), +static void FDECL(add_herecmd_menuitem, (winid, int NDECL((*)), const char *)); -STATIC_DCL char FDECL(here_cmd_menu, (BOOLEAN_P)); -STATIC_DCL char FDECL(there_cmd_menu, (BOOLEAN_P, int, int)); -STATIC_DCL char *NDECL(parse); -STATIC_DCL void FDECL(show_direction_keys, (winid, CHAR_P, BOOLEAN_P)); -STATIC_DCL boolean FDECL(help_dir, (CHAR_P, int, const char *)); +static char FDECL(here_cmd_menu, (BOOLEAN_P)); +static char FDECL(there_cmd_menu, (BOOLEAN_P, int, int)); +static char *NDECL(parse); +static void FDECL(show_direction_keys, (winid, CHAR_P, BOOLEAN_P)); +static boolean FDECL(help_dir, (CHAR_P, int, const char *)); static const char *readchar_queue = ""; /* for rejecting attempts to use wizard mode commands */ @@ -209,14 +209,14 @@ static const char unavailcmd[] = "Unavailable command '%s'."; /* for rejecting #if !SHELL, !SUSPEND */ static const char cmdnotavail[] = "'%s' command not available."; -STATIC_PTR int +static int doprev_message(VOID_ARGS) { return nh_doprev_message(); } /* Count down by decrementing multi */ -STATIC_PTR int +static int timed_occupation(VOID_ARGS) { (*timed_occ_fn)(); @@ -266,9 +266,9 @@ int xtime; return; } -STATIC_DCL char NDECL(popch); +static char NDECL(popch); -STATIC_OVL char +static char popch() { /* If occupied, return '\0', letting tgetch know a character should @@ -325,7 +325,7 @@ char ch; } /* here after # - now read a full-word command */ -STATIC_PTR int +static int doextcmd(VOID_ARGS) { int idx, retval; @@ -750,7 +750,7 @@ enter_explore_mode(VOID_ARGS) } /* ^W command - wish for something */ -STATIC_PTR int +static int wiz_wish(VOID_ARGS) /* Unlimited wishes for debug mode by Paul Polderman */ { if (wizard) { @@ -766,7 +766,7 @@ wiz_wish(VOID_ARGS) /* Unlimited wishes for debug mode by Paul Polderman */ } /* ^I command - reveal and optionally identify hero's inventory */ -STATIC_PTR int +static int wiz_identify(VOID_ARGS) { if (wizard) { @@ -786,7 +786,7 @@ wiz_identify(VOID_ARGS) } /* #wizmakemap - discard current dungeon level and replace with a new one */ -STATIC_PTR int +static int wiz_makemap(VOID_ARGS) { NHFILE tmpnhfp; @@ -877,7 +877,7 @@ wiz_makemap(VOID_ARGS) } /* ^F command - reveal the level map and any traps on it */ -STATIC_PTR int +static int wiz_map(VOID_ARGS) { if (wizard) { @@ -898,7 +898,7 @@ wiz_map(VOID_ARGS) } /* ^G command - generate monster(s); a count prefix will be honored */ -STATIC_PTR int +static int wiz_genesis(VOID_ARGS) { if (wizard) @@ -909,7 +909,7 @@ wiz_genesis(VOID_ARGS) } /* ^O command - display dungeon layout */ -STATIC_PTR int +static int wiz_where(VOID_ARGS) { if (wizard) @@ -920,7 +920,7 @@ wiz_where(VOID_ARGS) } /* ^E command - detect unseen (secret doors, traps, hidden monsters) */ -STATIC_PTR int +static int wiz_detect(VOID_ARGS) { if (wizard) @@ -931,7 +931,7 @@ wiz_detect(VOID_ARGS) } /* ^V command - level teleport */ -STATIC_PTR int +static int wiz_level_tele(VOID_ARGS) { if (wizard) @@ -942,7 +942,7 @@ wiz_level_tele(VOID_ARGS) } /* #levelchange command - adjust hero's experience level */ -STATIC_PTR int +static int wiz_level_change(VOID_ARGS) { char buf[BUFSZ] = DUMMY; @@ -986,7 +986,7 @@ wiz_level_change(VOID_ARGS) } /* #panic command - test program's panic handling */ -STATIC_PTR int +static int wiz_panic(VOID_ARGS) { if (iflags.debug_fuzzer) { @@ -1001,7 +1001,7 @@ wiz_panic(VOID_ARGS) } /* #polyself command - change hero's form */ -STATIC_PTR int +static int wiz_polyself(VOID_ARGS) { polyself(1); @@ -1009,7 +1009,7 @@ wiz_polyself(VOID_ARGS) } /* #seenv command */ -STATIC_PTR int +static int wiz_show_seenv(VOID_ARGS) { winid win; @@ -1053,7 +1053,7 @@ wiz_show_seenv(VOID_ARGS) } /* #vision command */ -STATIC_PTR int +static int wiz_show_vision(VOID_ARGS) { winid win; @@ -1091,7 +1091,7 @@ wiz_show_vision(VOID_ARGS) } /* #wmode command */ -STATIC_PTR int +static int wiz_show_wmodes(VOID_ARGS) { winid win; @@ -1127,7 +1127,7 @@ wiz_show_wmodes(VOID_ARGS) } /* wizard mode variant of #terrain; internal levl[][].typ values in base-36 */ -STATIC_OVL void +static void wiz_map_levltyp(VOID_ARGS) { winid win; @@ -1290,7 +1290,7 @@ static const char *levltyp[] = { }; /* explanation of base-36 output from wiz_map_levltyp() */ -STATIC_OVL void +static void wiz_levltyp_legend(VOID_ARGS) { winid win; @@ -1330,7 +1330,7 @@ wiz_levltyp_legend(VOID_ARGS) } /* #wizsmell command - test usmellmon(). */ -STATIC_PTR int +static int wiz_smell(VOID_ARGS) { int ans = 0; @@ -1370,7 +1370,7 @@ wiz_smell(VOID_ARGS) } /* #wizinstrinsic command to set some intrinsics for testing */ -STATIC_PTR int +static int wiz_intrinsic(VOID_ARGS) { if (wizard) { @@ -1498,7 +1498,7 @@ wiz_intrinsic(VOID_ARGS) } /* #wizrumorcheck command - verify each rumor access */ -STATIC_PTR int +static int wiz_rumor_check(VOID_ARGS) { rumor_check(); @@ -1506,7 +1506,7 @@ wiz_rumor_check(VOID_ARGS) } /* #terrain command -- show known map, inspired by crawl's '|' command */ -STATIC_PTR int +static int doterrain(VOID_ARGS) { winid men; @@ -1679,7 +1679,7 @@ char *outbuf; } /* report half physical or half spell damage */ -STATIC_OVL void +static void enlght_halfdmg(category, final) int category; int final; @@ -1704,7 +1704,7 @@ int final; } /* is hero actively using water walking capability on water (or lava)? */ -STATIC_OVL boolean +static boolean walking_on_water() { if (u.uinwater || Levitation || Flying) @@ -1716,7 +1716,7 @@ walking_on_water() /* check whether hero is wearing something that player definitely knows confers the target property; item must have been seen and its type discovered but it doesn't necessarily have to be fully identified */ -STATIC_OVL boolean +static boolean cause_known(propindx) int propindx; /* index of a property which can be conveyed by worn item */ { @@ -1736,7 +1736,7 @@ int propindx; /* index of a property which can be conveyed by worn item */ } /* format a characteristic value, accommodating Strength's strangeness */ -STATIC_OVL char * +static char * attrval(attrindx, attrvalue, resultbuf) int attrindx, attrvalue; char resultbuf[]; /* should be at least [7] to hold "18/100\0" */ @@ -1811,7 +1811,7 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */ /*ARGSUSED*/ /* display role, race, alignment and such to en_win */ -STATIC_OVL void +static void background_enlightenment(unused_mode, final) int unused_mode UNUSED; int final; @@ -2061,7 +2061,7 @@ int final; /* hit points, energy points, armor class -- essential information which doesn't fit very well in other categories */ /*ARGSUSED*/ -STATIC_OVL void +static void basics_enlightenment(mode, final) int mode UNUSED; int final; @@ -2143,7 +2143,7 @@ int final; } /* characteristics: expanded version of bottom line strength, dexterity, &c */ -STATIC_OVL void +static void characteristics_enlightenment(mode, final) int mode; int final; @@ -2164,7 +2164,7 @@ int final; } /* display one attribute value for characteristics_enlightenment() */ -STATIC_OVL void +static void one_characteristic(mode, final, attrindx) int mode, final, attrindx; { @@ -2259,7 +2259,7 @@ int mode, final, attrindx; } /* status: selected obvious capabilities, assorted troubles */ -STATIC_OVL void +static void status_enlightenment(mode, final) int mode; int final; @@ -2571,7 +2571,7 @@ int final; } /* attributes: intrinsics and the like, other non-obvious capabilities */ -STATIC_OVL void +static void attributes_enlightenment(unused_mode, final) int unused_mode UNUSED; int final; @@ -3016,14 +3016,14 @@ int final; } #if 0 /* no longer used */ -STATIC_DCL boolean NDECL(minimal_enlightenment); +static boolean NDECL(minimal_enlightenment); /* * Courtesy function for non-debug, non-explorer mode players * to help refresh them about who/what they are. * Returns FALSE if menu cancelled (dismissed with ESC), TRUE otherwise. */ -STATIC_OVL boolean +static boolean minimal_enlightenment() { winid tmpwin; @@ -3129,7 +3129,7 @@ minimal_enlightenment() #endif /*0*/ /* ^X command */ -STATIC_PTR int +static int doattributes(VOID_ARGS) { int mode = BASICENLIGHTENMENT; @@ -3826,7 +3826,7 @@ static const char template[] = "%-27s %4ld %6ld"; static const char stats_hdr[] = " count bytes"; static const char stats_sep[] = "--------------------------- ----- -------"; -STATIC_OVL int +static int size_obj(otmp) struct obj *otmp; { @@ -3848,7 +3848,7 @@ struct obj *otmp; return sz; } -STATIC_OVL void +static void count_obj(chain, total_count, total_size, top, recurse) struct obj *chain; long *total_count; @@ -3871,7 +3871,7 @@ boolean recurse; *total_size += size; } -STATIC_OVL void +static void obj_chain(win, src, chain, force, total_count, total_size) winid win; const char *src; @@ -3893,7 +3893,7 @@ long *total_size; } } -STATIC_OVL void +static void mon_invent_chain(win, src, chain, total_count, total_size) winid win; const char *src; @@ -3916,7 +3916,7 @@ long *total_size; } } -STATIC_OVL void +static void contained_stats(win, src, total_count, total_size) winid win; const char *src; @@ -3946,7 +3946,7 @@ long *total_size; } } -STATIC_OVL int +static int size_monst(mtmp, incl_wsegs) struct monst *mtmp; boolean incl_wsegs; @@ -3975,7 +3975,7 @@ boolean incl_wsegs; return sz; } -STATIC_OVL void +static void mon_chain(win, src, chain, force, total_count, total_size) winid win; const char *src; @@ -4003,7 +4003,7 @@ long *total_size; } } -STATIC_OVL void +static void misc_stats(win, total_count, total_size) winid win; long *total_count; @@ -4558,7 +4558,7 @@ boolean initial; } /* non-movement commands which accept 'm' prefix to request menu operation */ -STATIC_OVL boolean +static boolean accept_menu_prefix(cmd_func) int NDECL((*cmd_func)); { @@ -5064,7 +5064,7 @@ retry: return 1; } -STATIC_OVL void +static void show_direction_keys(win, centerchar, nodiag) winid win; /* should specify a window which is using a fixed-width font... */ char centerchar; /* '.' or '@' or ' ' */ @@ -5103,7 +5103,7 @@ boolean nodiag; /* explain choices if player has asked for getdir() help or has given an invalid direction after a prefix key ('F', 'g', 'm', &c), which might be bogus but could be up, down, or self when not applicable */ -STATIC_OVL boolean +static boolean help_dir(sym, spkey, msg) char sym; int spkey; /* NHKF_ code for prefix key, if one was used, or for ESC */ @@ -5285,7 +5285,7 @@ register int x, y; } /* #herecmdmenu command */ -STATIC_PTR int +static int doherecmdmenu(VOID_ARGS) { char ch = here_cmd_menu(TRUE); @@ -5294,7 +5294,7 @@ doherecmdmenu(VOID_ARGS) } /* #therecmdmenu command, a way to test there_cmd_menu without mouse */ -STATIC_PTR int +static int dotherecmdmenu(VOID_ARGS) { char ch; @@ -5310,7 +5310,7 @@ dotherecmdmenu(VOID_ARGS) return ch ? 1 : 0; } -STATIC_OVL void +static void add_herecmd_menuitem(win, func, text) winid win; int NDECL((*func)); @@ -5326,7 +5326,7 @@ const char *text; } } -STATIC_OVL char +static char there_cmd_menu(doit, x, y) boolean doit; int x, y; @@ -5429,7 +5429,7 @@ int x, y; return ch; } -STATIC_OVL char +static char here_cmd_menu(doit) boolean doit; { @@ -5724,7 +5724,7 @@ boolean historical; /* whether to include in message history: True => yes */ } -STATIC_OVL char * +static char * parse() { #ifdef LINT /* static char in_line[COLNO]; */ @@ -5913,7 +5913,7 @@ readchar() } /* '_' command, #travel, via keyboard rather than mouse click */ -STATIC_PTR int +static int dotravel(VOID_ARGS) { static char cmd[2]; @@ -6042,7 +6042,7 @@ const char *prompt; } /* ^Z command, #suspend */ -STATIC_PTR int +static int dosuspend_core(VOID_ARGS) { #ifdef SUSPEND @@ -6057,7 +6057,7 @@ dosuspend_core(VOID_ARGS) } /* '!' command, #shell */ -STATIC_PTR int +static int dosh_core(VOID_ARGS) { #ifdef SHELL diff --git a/src/dbridge.c b/src/dbridge.c index 62842c808..02a54c2d5 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -19,19 +19,19 @@ #include "hack.h" -STATIC_DCL void FDECL(get_wall_for_db, (int *, int *)); -STATIC_DCL struct entity *FDECL(e_at, (int, int)); -STATIC_DCL void FDECL(m_to_e, (struct monst *, int, int, struct entity *)); -STATIC_DCL void FDECL(u_to_e, (struct entity *)); -STATIC_DCL void FDECL(set_entity, (int, int, struct entity *)); -STATIC_DCL const char *FDECL(e_nam, (struct entity *)); -STATIC_DCL const char *FDECL(E_phrase, (struct entity *, const char *)); -STATIC_DCL boolean FDECL(e_survives_at, (struct entity *, int, int)); -STATIC_DCL void FDECL(e_died, (struct entity *, int, int)); -STATIC_DCL boolean FDECL(automiss, (struct entity *)); -STATIC_DCL boolean FDECL(e_missed, (struct entity *, BOOLEAN_P)); -STATIC_DCL boolean FDECL(e_jumps, (struct entity *)); -STATIC_DCL void FDECL(do_entity, (struct entity *)); +static void FDECL(get_wall_for_db, (int *, int *)); +static struct entity *FDECL(e_at, (int, int)); +static void FDECL(m_to_e, (struct monst *, int, int, struct entity *)); +static void FDECL(u_to_e, (struct entity *)); +static void FDECL(set_entity, (int, int, struct entity *)); +static const char *FDECL(e_nam, (struct entity *)); +static const char *FDECL(E_phrase, (struct entity *, const char *)); +static boolean FDECL(e_survives_at, (struct entity *, int, int)); +static void FDECL(e_died, (struct entity *, int, int)); +static boolean FDECL(automiss, (struct entity *)); +static boolean FDECL(e_missed, (struct entity *, BOOLEAN_P)); +static boolean FDECL(e_jumps, (struct entity *)); +static void FDECL(do_entity, (struct entity *)); boolean is_pool(x, y) @@ -205,7 +205,7 @@ int *x, *y; /* * Find the drawbridge wall associated with a drawbridge. */ -STATIC_OVL void +static void get_wall_for_db(x, y) int *x, *y; { @@ -282,7 +282,7 @@ boolean flag; return TRUE; } -STATIC_OVL +static struct entity * e_at(x, y) int x, y; @@ -301,7 +301,7 @@ int x, y; : &(g.occupants[entitycnt]); } -STATIC_OVL void +static void m_to_e(mtmp, x, y, etmp) struct monst *mtmp; int x, y; @@ -319,7 +319,7 @@ struct entity *etmp; etmp->edata = (struct permonst *) 0; } -STATIC_OVL void +static void u_to_e(etmp) struct entity *etmp; { @@ -329,7 +329,7 @@ struct entity *etmp; etmp->edata = g.youmonst.data; } -STATIC_OVL void +static void set_entity(x, y, etmp) int x, y; struct entity *etmp; @@ -353,7 +353,7 @@ struct entity *etmp; /* #define e_strg(etmp, func) (is_u(etmp)? (char *)0 : func(etmp->emon)) */ -STATIC_OVL const char * +static const char * e_nam(etmp) struct entity *etmp; { @@ -364,7 +364,7 @@ struct entity *etmp; * Generates capitalized entity name, makes 2nd -> 3rd person conversion on * verb, where necessary. */ -STATIC_OVL const char * +static const char * E_phrase(etmp, verb) struct entity *etmp; const char *verb; @@ -385,7 +385,7 @@ const char *verb; /* * Simple-minded "can it be here?" routine */ -STATIC_OVL boolean +static boolean e_survives_at(etmp, x, y) struct entity *etmp; int x, y; @@ -409,7 +409,7 @@ int x, y; return TRUE; } -STATIC_OVL void +static void e_died(etmp, xkill_flags, how) struct entity *etmp; int xkill_flags, how; @@ -473,7 +473,7 @@ int xkill_flags, how; /* * These are never directly affected by a bridge or portcullis. */ -STATIC_OVL boolean +static boolean automiss(etmp) struct entity *etmp; { @@ -484,7 +484,7 @@ struct entity *etmp; /* * Does falling drawbridge or portcullis miss etmp? */ -STATIC_OVL boolean +static boolean e_missed(etmp, chunks) struct entity *etmp; boolean chunks; @@ -521,7 +521,7 @@ boolean chunks; /* * Can etmp jump from death? */ -STATIC_OVL boolean +static boolean e_jumps(etmp) struct entity *etmp; { @@ -545,7 +545,7 @@ struct entity *etmp; return (tmp >= rnd(10)) ? TRUE : FALSE; } -STATIC_OVL void +static void do_entity(etmp) struct entity *etmp; { diff --git a/src/detect.c b/src/detect.c index 934ccc055..4ceca787b 100644 --- a/src/detect.c +++ b/src/detect.c @@ -11,25 +11,25 @@ #include "hack.h" #include "artifact.h" -STATIC_DCL boolean NDECL(unconstrain_map); -STATIC_DCL void NDECL(reconstrain_map); -STATIC_DCL void FDECL(browse_map, (int, const char *)); -STATIC_DCL void FDECL(map_monst, (struct monst *, BOOLEAN_P)); -STATIC_DCL void FDECL(do_dknown_of, (struct obj *)); -STATIC_DCL boolean FDECL(check_map_spot, (int, int, CHAR_P, unsigned)); -STATIC_DCL boolean FDECL(clear_stale_map, (CHAR_P, unsigned)); -STATIC_DCL void FDECL(sense_trap, (struct trap *, XCHAR_P, XCHAR_P, int)); -STATIC_DCL int FDECL(detect_obj_traps, (struct obj *, BOOLEAN_P, int)); -STATIC_DCL void FDECL(show_map_spot, (int, int)); -STATIC_PTR void FDECL(findone, (int, int, genericptr_t)); -STATIC_PTR void FDECL(openone, (int, int, genericptr_t)); -STATIC_DCL int FDECL(mfind0, (struct monst *, BOOLEAN_P)); -STATIC_DCL int FDECL(reveal_terrain_getglyph, (int, int, int, +static boolean NDECL(unconstrain_map); +static void NDECL(reconstrain_map); +static void FDECL(browse_map, (int, const char *)); +static void FDECL(map_monst, (struct monst *, BOOLEAN_P)); +static void FDECL(do_dknown_of, (struct obj *)); +static boolean FDECL(check_map_spot, (int, int, CHAR_P, unsigned)); +static boolean FDECL(clear_stale_map, (CHAR_P, unsigned)); +static void FDECL(sense_trap, (struct trap *, XCHAR_P, XCHAR_P, int)); +static int FDECL(detect_obj_traps, (struct obj *, BOOLEAN_P, int)); +static void FDECL(show_map_spot, (int, int)); +static void FDECL(findone, (int, int, genericptr_t)); +static void FDECL(openone, (int, int, genericptr_t)); +static int FDECL(mfind0, (struct monst *, BOOLEAN_P)); +static int FDECL(reveal_terrain_getglyph, (int, int, int, unsigned, int, int)); /* bring hero out from underwater or underground or being engulfed; return True iff any change occurred */ -STATIC_OVL boolean +static boolean unconstrain_map() { boolean res = u.uinwater || u.uburied || u.uswallow; @@ -43,7 +43,7 @@ unconstrain_map() } /* put hero back underwater or underground or engulfed */ -STATIC_OVL void +static void reconstrain_map() { u.uinwater = iflags.save_uinwater, iflags.save_uinwater = 0; @@ -52,7 +52,7 @@ reconstrain_map() } /* use getpos()'s 'autodescribe' to view whatever is currently shown on map */ -STATIC_DCL void +static void browse_map(ter_typ, ter_explain) int ter_typ; const char *ter_explain; @@ -70,7 +70,7 @@ const char *ter_explain; } /* extracted from monster_detection() so can be shared by do_vicinity_map() */ -STATIC_DCL void +static void map_monst(mtmp, showtail) struct monst *mtmp; boolean showtail; @@ -207,7 +207,7 @@ unsigned material; return (struct obj *) 0; } -STATIC_OVL void +static void do_dknown_of(obj) struct obj *obj; { @@ -221,7 +221,7 @@ struct obj *obj; } /* Check whether the location has an outdated object displayed on it. */ -STATIC_OVL boolean +static boolean check_map_spot(x, y, oclass, material) int x, y; char oclass; @@ -278,7 +278,7 @@ unsigned material; * reappear after the detection has completed. Return true if noticeable * change occurs. */ -STATIC_OVL boolean +static boolean clear_stale_map(oclass, material) char oclass; unsigned material; @@ -850,7 +850,7 @@ int mclass; /* monster class, 0 for all */ return 0; } -STATIC_OVL void +static void sense_trap(trap, x, y, src_cursed) struct trap *trap; xchar x, y; @@ -893,7 +893,7 @@ int src_cursed; /* check a list of objects for chest traps; return 1 if found at , 2 if found at some other spot, 3 if both, 0 otherwise; optionally update the map to show where such traps were found */ -STATIC_OVL int +static int detect_obj_traps(objlist, show_them, how) struct obj *objlist; boolean show_them; @@ -1231,7 +1231,7 @@ struct obj **optr; return; } -STATIC_OVL void +static void show_map_spot(x, y) register int x, y; { @@ -1443,7 +1443,7 @@ struct rm *lev; /* find something at one location; it should find all somethings there since it is used for magical detection rather than physical searching */ -STATIC_PTR void +static void findone(zx, zy, num) int zx, zy; genericptr_t num; @@ -1499,7 +1499,7 @@ genericptr_t num; } } -STATIC_PTR void +static void openone(zx, zy, num) int zx, zy; genericptr_t num; @@ -1634,7 +1634,7 @@ struct trap *trap; } } -STATIC_OVL int +static int mfind0(mtmp, via_warning) struct monst *mtmp; boolean via_warning; @@ -1822,7 +1822,7 @@ sokoban_detect() } } -STATIC_DCL int +static int reveal_terrain_getglyph(x, y, full, swallowed, default_glyph, which_subset) int x, y, full; unsigned swallowed; diff --git a/src/dig.c b/src/dig.c index 681ec2bdd..6bd239195 100644 --- a/src/dig.c +++ b/src/dig.c @@ -5,14 +5,14 @@ #include "hack.h" -STATIC_DCL boolean NDECL(rm_waslit); -STATIC_DCL void FDECL(mkcavepos, +static boolean NDECL(rm_waslit); +static void FDECL(mkcavepos, (XCHAR_P, XCHAR_P, int, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL void FDECL(mkcavearea, (BOOLEAN_P)); -STATIC_DCL int NDECL(dig); -STATIC_DCL void FDECL(dig_up_grave, (coord *)); -STATIC_DCL int FDECL(adj_pit_checks, (coord *, char *)); -STATIC_DCL void FDECL(pit_flow, (struct trap *, SCHAR_P)); +static void FDECL(mkcavearea, (BOOLEAN_P)); +static int NDECL(dig); +static void FDECL(dig_up_grave, (coord *)); +static int FDECL(adj_pit_checks, (coord *, char *)); +static void FDECL(pit_flow, (struct trap *, SCHAR_P)); /* Indices returned by dig_typ() */ enum dig_types { @@ -24,7 +24,7 @@ enum dig_types { DIGTYP_TREE }; -STATIC_OVL boolean +static boolean rm_waslit() { register xchar x, y; @@ -42,7 +42,7 @@ rm_waslit() * boulders in the name of a nice effect. Vision will get fixed up again * immediately after the effect is complete. */ -STATIC_OVL void +static void mkcavepos(x, y, dist, waslit, rockit) xchar x, y; int dist; @@ -85,7 +85,7 @@ boolean waslit, rockit; feel_newsym(x, y); } -STATIC_OVL void +static void mkcavearea(rockit) register boolean rockit; { @@ -235,7 +235,7 @@ int x, y; return TRUE; } -STATIC_OVL int +static int dig(VOID_ARGS) { register struct rm *lev; @@ -893,7 +893,7 @@ coord *cc; return FALSE; } -STATIC_OVL void +static void dig_up_grave(cc) coord *cc; { @@ -1593,7 +1593,7 @@ zap_dig() * you're zapping a wand of digging laterally while * down in the pit. */ -STATIC_OVL int +static int adj_pit_checks(cc, msg) coord *cc; char *msg; @@ -1684,7 +1684,7 @@ char *msg; /* * Ensure that all conjoined pits fill up. */ -STATIC_OVL void +static void pit_flow(trap, filltyp) struct trap *trap; schar filltyp; diff --git a/src/display.c b/src/display.c index 61c94a2d9..0513d35b7 100644 --- a/src/display.c +++ b/src/display.c @@ -123,27 +123,27 @@ */ #include "hack.h" -STATIC_DCL void FDECL(display_monster, +static void FDECL(display_monster, (XCHAR_P, XCHAR_P, struct monst *, int, XCHAR_P)); -STATIC_DCL int FDECL(swallow_to_glyph, (int, int)); -STATIC_DCL void FDECL(display_warning, (struct monst *)); +static int FDECL(swallow_to_glyph, (int, int)); +static void FDECL(display_warning, (struct monst *)); -STATIC_DCL int FDECL(check_pos, (int, int, int)); -STATIC_DCL int FDECL(get_bk_glyph, (XCHAR_P, XCHAR_P)); -STATIC_DCL int FDECL(tether_glyph, (int, int)); +static int FDECL(check_pos, (int, int, int)); +static int FDECL(get_bk_glyph, (XCHAR_P, XCHAR_P)); +static int FDECL(tether_glyph, (int, int)); /*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */ #ifdef WA_VERBOSE -STATIC_DCL boolean FDECL(more_than_one, (int, int, int, int, int)); +static boolean FDECL(more_than_one, (int, int, int, int, int)); #endif -STATIC_DCL int FDECL(set_twall, (int, int, int, int, int, int, int, int)); -STATIC_DCL int FDECL(set_wall, (int, int, int)); -STATIC_DCL int FDECL(set_corn, (int, int, int, int, int, int, int, int)); -STATIC_DCL int FDECL(set_crosswall, (int, int)); -STATIC_DCL void FDECL(set_seenv, (struct rm *, int, int, int, int)); -STATIC_DCL void FDECL(t_warn, (struct rm *)); -STATIC_DCL int FDECL(wall_angle, (struct rm *)); +static int FDECL(set_twall, (int, int, int, int, int, int, int, int)); +static int FDECL(set_wall, (int, int, int)); +static int FDECL(set_corn, (int, int, int, int, int, int, int, int)); +static int FDECL(set_crosswall, (int, int)); +static void FDECL(set_seenv, (struct rm *, int, int, int, int)); +static void FDECL(t_warn, (struct rm *)); +static int FDECL(wall_angle, (struct rm *)); #define remember_topology(x, y) (g.lastseentyp[x][y] = levl[x][y].typ) @@ -376,7 +376,7 @@ int x, y, show; * a worm tail. * */ -STATIC_OVL void +static void display_monster(x, y, mon, sightflags, worm_tail) register xchar x, y; /* display position */ register struct monst *mon; /* monster to display */ @@ -490,7 +490,7 @@ xchar worm_tail; /* mon is actually a worm tail */ * * Do not call for worm tails. */ -STATIC_OVL void +static void display_warning(mon) register struct monst *mon; { @@ -897,7 +897,7 @@ xchar x, y; } } -STATIC_OVL int +static int tether_glyph(x, y) int x, y; { @@ -1800,7 +1800,7 @@ xchar x, y; * If you don't want a patchwork monster while hallucinating, decide on * a random monster in swallowed() and don't use what_mon() here. */ -STATIC_OVL int +static int swallow_to_glyph(mnum, loc) int mnum; int loc; @@ -1866,7 +1866,7 @@ xchar x, y; * than current data from the map.] */ -STATIC_OVL int +static int get_bk_glyph(x, y) xchar x, y; { @@ -1967,7 +1967,7 @@ int x, y, a, b, c, dd; * * Things that are ambiguous: lava */ -STATIC_OVL int +static int check_pos(x, y, which) int x, y, which; { @@ -1984,7 +1984,7 @@ int x, y, which; /* Return TRUE if more than one is non-zero. */ /*ARGSUSED*/ #ifdef WA_VERBOSE -STATIC_OVL boolean +static boolean more_than_one(x, y, a, b, c) int x, y, a, b, c; { @@ -2000,7 +2000,7 @@ int x, y, a, b, c; #endif /* Return the wall mode for a T wall. */ -STATIC_OVL int +static int set_twall(x0, y0, x1, y1, x2, y2, x3, y3) int x0, y0; /* used #if WA_VERBOSE */ int x1, y1, x2, y2, x3, y3; @@ -2025,7 +2025,7 @@ int x1, y1, x2, y2, x3, y3; } /* Return wall mode for a horizontal or vertical wall. */ -STATIC_OVL int +static int set_wall(x, y, horiz) int x, y, horiz; { @@ -2047,7 +2047,7 @@ int x, y, horiz; } /* Return a wall mode for a corner wall. (x4,y4) is the "inner" position. */ -STATIC_OVL int +static int set_corn(x1, y1, x2, y2, x3, y3, x4, y4) int x1, y1, x2, y2, x3, y3, x4, y4; { @@ -2076,7 +2076,7 @@ int x1, y1, x2, y2, x3, y3, x4, y4; } /* Return mode for a crosswall. */ -STATIC_OVL int +static int set_crosswall(x, y) int x, y; { @@ -2199,7 +2199,7 @@ unsigned char seenv_matrix[3][3] = { { SV2, SV1, SV0 }, #define sign(z) ((z) < 0 ? -1 : ((z) > 0 ? 1 : 0)) /* Set the seen vector of lev as if seen from (x0,y0) to (x,y). */ -STATIC_OVL void +static void set_seenv(lev, x0, y0, x, y) struct rm *lev; int x0, y0, x, y; /* from, to */ @@ -2278,7 +2278,7 @@ static const int cross_matrix[4][6] = { }; /* Print out a T wall warning and all interesting info. */ -STATIC_OVL void +static void t_warn(lev) struct rm *lev; { @@ -2311,7 +2311,7 @@ struct rm *lev; * draw diagrams. See rm.h for more details on the wall modes and * seen vector (SV). */ -STATIC_OVL int +static int wall_angle(lev) struct rm *lev; { diff --git a/src/dlb.c b/src/dlb.c index 12cf3cd21..6bad04fb1 100644 --- a/src/dlb.c +++ b/src/dlb.c @@ -14,14 +14,6 @@ #define DATAPREFIX 4 /* see decl.h */ -#if defined(OVERLAY) -#define STATIC_DCL extern -#define STATIC_OVL -#else /* !OVERLAY */ -#define STATIC_DCL static -#define STATIC_OVL static -#endif /* OVERLAY */ - #ifdef DLB /* * Data librarian. Present a STDIO-like interface to NetHack while @@ -68,18 +60,18 @@ extern FILE *FDECL(fopen_datafile, (const char *, const char *, int)); #define MAX_LIBS 4 static library dlb_libs[MAX_LIBS]; -STATIC_DCL boolean FDECL(readlibdir, (library * lp)); -STATIC_DCL boolean FDECL(find_file, (const char *name, library **lib, +static boolean FDECL(readlibdir, (library * lp)); +static boolean FDECL(find_file, (const char *name, library **lib, long *startp, long *sizep)); -STATIC_DCL boolean NDECL(lib_dlb_init); -STATIC_DCL void NDECL(lib_dlb_cleanup); -STATIC_DCL boolean FDECL(lib_dlb_fopen, (dlb *, const char *, const char *)); -STATIC_DCL int FDECL(lib_dlb_fclose, (dlb *)); -STATIC_DCL int FDECL(lib_dlb_fread, (char *, int, int, dlb *)); -STATIC_DCL int FDECL(lib_dlb_fseek, (dlb *, long, int)); -STATIC_DCL char *FDECL(lib_dlb_fgets, (char *, int, dlb *)); -STATIC_DCL int FDECL(lib_dlb_fgetc, (dlb *)); -STATIC_DCL long FDECL(lib_dlb_ftell, (dlb *)); +static boolean NDECL(lib_dlb_init); +static void NDECL(lib_dlb_cleanup); +static boolean FDECL(lib_dlb_fopen, (dlb *, const char *, const char *)); +static int FDECL(lib_dlb_fclose, (dlb *)); +static int FDECL(lib_dlb_fread, (char *, int, int, dlb *)); +static int FDECL(lib_dlb_fseek, (dlb *, long, int)); +static char *FDECL(lib_dlb_fgets, (char *, int, dlb *)); +static int FDECL(lib_dlb_fgetc, (dlb *)); +static long FDECL(lib_dlb_ftell, (dlb *)); /* not static because shared with dlb_main.c */ boolean FDECL(open_library, (const char *lib_name, library *lp)); @@ -130,7 +122,7 @@ extern char *FDECL(eos, (char *)); * * Return TRUE on success, FALSE on failure. */ -STATIC_OVL boolean +static boolean readlibdir(lp) library *lp; /* library pointer to fill in */ { @@ -179,7 +171,7 @@ library *lp; /* library pointer to fill in */ * Look for the file in our directory structure. Return 1 if successful, * 0 if not found. Fill in the size and starting position. */ -STATIC_OVL boolean +static boolean find_file(name, lib, startp, sizep) const char *name; library **lib; @@ -242,7 +234,7 @@ library *lp; * Open the library file once using stdio. Keep it open, but * keep track of the file position. */ -STATIC_OVL boolean +static boolean lib_dlb_init(VOID_ARGS) { /* zero out array */ @@ -262,7 +254,7 @@ lib_dlb_init(VOID_ARGS) return TRUE; } -STATIC_OVL void +static void lib_dlb_cleanup(VOID_ARGS) { int i; @@ -284,7 +276,7 @@ const char *lf; #endif /*ARGSUSED*/ -STATIC_OVL boolean +static boolean lib_dlb_fopen(dp, name, mode) dlb *dp; const char *name; @@ -306,7 +298,7 @@ const char *mode UNUSED; } /*ARGUSED*/ -STATIC_OVL int +static int lib_dlb_fclose(dp) dlb *dp UNUSED; { @@ -314,7 +306,7 @@ dlb *dp UNUSED; return 0; } -STATIC_OVL int +static int lib_dlb_fread(buf, size, quan, dp) char *buf; int size, quan; @@ -342,7 +334,7 @@ dlb *dp; return nread; } -STATIC_OVL int +static int lib_dlb_fseek(dp, pos, whence) dlb *dp; long pos; @@ -370,7 +362,7 @@ int whence; return 0; } -STATIC_OVL char * +static char * lib_dlb_fgets(buf, len, dp) char *buf; int len; @@ -405,7 +397,7 @@ dlb *dp; return buf; } -STATIC_OVL int +static int lib_dlb_fgetc(dp) dlb *dp; { @@ -416,7 +408,7 @@ dlb *dp; return (int) c; } -STATIC_OVL long +static long lib_dlb_ftell(dp) dlb *dp; { diff --git a/src/do.c b/src/do.c index 95fbcc1a6..f1a515c61 100644 --- a/src/do.c +++ b/src/do.c @@ -8,15 +8,15 @@ #include "hack.h" #include "lev.h" -STATIC_DCL void FDECL(trycall, (struct obj *)); -STATIC_DCL void NDECL(polymorph_sink); -STATIC_DCL boolean NDECL(teleport_sink); -STATIC_DCL void FDECL(dosinkring, (struct obj *)); -STATIC_PTR int FDECL(drop, (struct obj *)); -STATIC_PTR int NDECL(wipeoff); -STATIC_DCL int FDECL(menu_drop, (int)); -STATIC_DCL NHFILE *NDECL(currentlevel_rewrite); -STATIC_DCL void NDECL(final_level); +static void FDECL(trycall, (struct obj *)); +static void NDECL(polymorph_sink); +static boolean NDECL(teleport_sink); +static void FDECL(dosinkring, (struct obj *)); +static int FDECL(drop, (struct obj *)); +static int NDECL(wipeoff); +static int FDECL(menu_drop, (int)); +static NHFILE *NDECL(currentlevel_rewrite); +static void NDECL(final_level); /* static boolean FDECL(badspot, (XCHAR_P,XCHAR_P)); */ static NEARDATA const char drop_types[] = { ALLOW_COUNT, COIN_CLASS, @@ -292,7 +292,7 @@ register struct obj *obj; } } -STATIC_OVL void +static void trycall(obj) register struct obj *obj; { @@ -302,7 +302,7 @@ register struct obj *obj; /* Transforms the sink at the player's position into a fountain, throne, altar or grave. */ -STATIC_DCL void +static void polymorph_sink() { uchar sym = S_sink; @@ -354,7 +354,7 @@ polymorph_sink() /* Teleports the sink at the player's position; return True if sink teleported. */ -STATIC_DCL boolean +static boolean teleport_sink() { int cx, cy; @@ -385,7 +385,7 @@ teleport_sink() } /* obj is a ring being dropped over a kitchen sink */ -STATIC_OVL void +static void dosinkring(obj) register struct obj *obj; { @@ -589,7 +589,7 @@ const char *word; return TRUE; } -STATIC_PTR int +static int drop(obj) register struct obj *obj; { @@ -810,7 +810,7 @@ doddrop() } /* Drop things from the hero's inventory, using a menu. */ -STATIC_OVL int +static int menu_drop(retry) int retry; { @@ -1114,7 +1114,7 @@ doup() } /* check that we can write out the current level */ -STATIC_OVL NHFILE * +static NHFILE * currentlevel_rewrite() { NHFILE *nhfp; @@ -1683,7 +1683,7 @@ boolean at_stairs, falling, portal; (void) pickup(1); } -STATIC_OVL void +static void final_level() { struct monst *mtmp; @@ -1908,7 +1908,7 @@ donull() return 1; /* Do nothing, but let other things happen */ } -STATIC_PTR int +static int wipeoff(VOID_ARGS) { if (u.ucreamed < 4) diff --git a/src/do_name.c b/src/do_name.c index 0200cbba5..9917dac23 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -5,26 +5,26 @@ #include "hack.h" -STATIC_DCL char *NDECL(nextmbuf); -STATIC_DCL void FDECL(getpos_help, (BOOLEAN_P, const char *)); -STATIC_DCL int FDECL(CFDECLSPEC cmp_coord_distu, (const void *, const void *)); -STATIC_DCL boolean FDECL(gather_locs_interesting, (int, int, int)); -STATIC_DCL void FDECL(gather_locs, (coord **, int *, int)); -STATIC_DCL int FDECL(gloc_filter_floodfill_matcharea, (int, int)); -STATIC_DCL void FDECL(auto_describe, (int, int)); -STATIC_DCL void NDECL(do_mname); -STATIC_DCL boolean FDECL(alreadynamed, (struct monst *, char *, char *)); -STATIC_DCL void FDECL(do_oname, (struct obj *)); -STATIC_PTR char *FDECL(docall_xname, (struct obj *)); -STATIC_DCL void NDECL(namefloorobj); -STATIC_DCL char *FDECL(bogusmon, (char *,char *)); +static char *NDECL(nextmbuf); +static void FDECL(getpos_help, (BOOLEAN_P, const char *)); +static int FDECL(CFDECLSPEC cmp_coord_distu, (const void *, const void *)); +static boolean FDECL(gather_locs_interesting, (int, int, int)); +static void FDECL(gather_locs, (coord **, int *, int)); +static int FDECL(gloc_filter_floodfill_matcharea, (int, int)); +static void FDECL(auto_describe, (int, int)); +static void NDECL(do_mname); +static boolean FDECL(alreadynamed, (struct monst *, char *, char *)); +static void FDECL(do_oname, (struct obj *)); +static char *FDECL(docall_xname, (struct obj *)); +static void NDECL(namefloorobj); +static char *FDECL(bogusmon, (char *,char *)); extern const char what_is_an_unknown_object[]; /* from pager.c */ #define NUMMBUF 5 /* manage a pool of BUFSZ buffers, so callers don't have to */ -STATIC_OVL char * +static char * nextmbuf() { static char NEARDATA bufs[NUMMBUF][BUFSZ]; @@ -87,7 +87,7 @@ int gloc; } /* the response for '?' help request in getpos() */ -STATIC_OVL void +static void getpos_help(force, goal) boolean force; const char *goal; @@ -216,7 +216,7 @@ const char *goal; destroy_nhwindow(tmpwin); } -STATIC_OVL int +static int cmp_coord_distu(a, b) const void *a; const void *b; @@ -272,7 +272,7 @@ int glyph; return 0; } -STATIC_OVL int +static int gloc_filter_floodfill_matcharea(x, y) int x, y; { @@ -332,7 +332,7 @@ gloc_filter_done() } } -STATIC_OVL boolean +static boolean gather_locs_interesting(x, y, gloc) int x, y, gloc; { @@ -404,7 +404,7 @@ int x, y, gloc; } /* gather locations for monsters or objects shown on the map */ -STATIC_OVL void +static void gather_locs(arr_p, cnt_p, gloc) coord **arr_p; int *cnt_p; @@ -531,7 +531,7 @@ char *outbuf, cmode; return outbuf; } -STATIC_OVL void +static void auto_describe(cx, cy) int cx, cy; { @@ -1083,7 +1083,7 @@ const char *name; /* check whether user-supplied name matches or nearly matches an unnameable monster's name; if so, give an alternate reject message for do_mname() */ -STATIC_OVL boolean +static boolean alreadynamed(mtmp, monnambuf, usrbuf) struct monst *mtmp; char *monnambuf, *usrbuf; @@ -1113,7 +1113,7 @@ char *monnambuf, *usrbuf; } /* allow player to assign a name to some chosen monster */ -STATIC_OVL void +static void do_mname() { char buf[BUFSZ], monnambuf[BUFSZ], qbuf[QBUFSZ]; @@ -1197,7 +1197,7 @@ do_mname() * used with extreme care. Applying a name to an object no longer * allocates a replacement object, so that old risk is gone. */ -STATIC_OVL +static void do_oname(obj) register struct obj *obj; @@ -1427,7 +1427,7 @@ docallcmd() } /* for use by safe_qbuf() */ -STATIC_PTR char * +static char * docall_xname(obj) struct obj *obj; { @@ -1507,7 +1507,7 @@ struct obj *obj; } } -STATIC_OVL void +static void namefloorobj() { coord cc; @@ -1974,7 +1974,7 @@ struct monst *mon, *other_mon; } /* fake monsters used to be in a hard-coded array, now in a data file */ -STATIC_OVL char * +static char * bogusmon(buf, code) char *buf, *code; { diff --git a/src/do_wear.c b/src/do_wear.c index 20702cb87..9f9a4c405 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -20,29 +20,29 @@ static NEARDATA const long takeoff_order[] = { WORN_SHIRT, WORN_BOOTS, W_SWAPWEP, W_QUIVER, 0L }; -STATIC_DCL void FDECL(on_msg, (struct obj *)); -STATIC_DCL void FDECL(toggle_stealth, (struct obj *, long, BOOLEAN_P)); -STATIC_DCL void FDECL(toggle_displacement, (struct obj *, long, BOOLEAN_P)); -STATIC_PTR int NDECL(Armor_on); +static void FDECL(on_msg, (struct obj *)); +static void FDECL(toggle_stealth, (struct obj *, long, BOOLEAN_P)); +static void FDECL(toggle_displacement, (struct obj *, long, BOOLEAN_P)); +static int NDECL(Armor_on); /* int NDECL(Boots_on); -- moved to extern.h */ -STATIC_PTR int NDECL(Cloak_on); -STATIC_PTR int NDECL(Helmet_on); -STATIC_PTR int NDECL(Gloves_on); -STATIC_DCL void FDECL(wielding_corpse, (struct obj *, BOOLEAN_P)); -STATIC_PTR int NDECL(Shield_on); -STATIC_PTR int NDECL(Shirt_on); -STATIC_DCL void NDECL(Amulet_on); -STATIC_DCL void FDECL(learnring, (struct obj *, BOOLEAN_P)); -STATIC_DCL void FDECL(Ring_off_or_gone, (struct obj *, BOOLEAN_P)); -STATIC_PTR int FDECL(select_off, (struct obj *)); -STATIC_DCL struct obj *NDECL(do_takeoff); -STATIC_PTR int NDECL(take_off); -STATIC_DCL int FDECL(menu_remarm, (int)); -STATIC_DCL void FDECL(count_worn_stuff, (struct obj **, BOOLEAN_P)); -STATIC_PTR int FDECL(armor_or_accessory_off, (struct obj *)); -STATIC_PTR int FDECL(accessory_or_armor_on, (struct obj *)); -STATIC_DCL void FDECL(already_wearing, (const char *)); -STATIC_DCL void FDECL(already_wearing2, (const char *, const char *)); +static int NDECL(Cloak_on); +static int NDECL(Helmet_on); +static int NDECL(Gloves_on); +static void FDECL(wielding_corpse, (struct obj *, BOOLEAN_P)); +static int NDECL(Shield_on); +static int NDECL(Shirt_on); +static void NDECL(Amulet_on); +static void FDECL(learnring, (struct obj *, BOOLEAN_P)); +static void FDECL(Ring_off_or_gone, (struct obj *, BOOLEAN_P)); +static int FDECL(select_off, (struct obj *)); +static struct obj *NDECL(do_takeoff); +static int NDECL(take_off); +static int FDECL(menu_remarm, (int)); +static void FDECL(count_worn_stuff, (struct obj **, BOOLEAN_P)); +static int FDECL(armor_or_accessory_off, (struct obj *)); +static int FDECL(accessory_or_armor_on, (struct obj *)); +static void FDECL(already_wearing, (const char *)); +static void FDECL(already_wearing2, (const char *, const char *)); void off_msg(otmp) @@ -53,7 +53,7 @@ struct obj *otmp; } /* for items that involve no delay */ -STATIC_OVL void +static void on_msg(otmp) struct obj *otmp; { @@ -73,7 +73,7 @@ struct obj *otmp; /* putting on or taking off an item which confers stealth; give feedback and discover it iff stealth state is changing */ -STATIC_OVL +static void toggle_stealth(obj, oldprop, on) struct obj *obj; @@ -107,7 +107,7 @@ boolean on; /* putting on or taking off an item which confers displacement; give feedback and discover it iff displacement state is changing *and* hero is able to see self (or sense monsters) */ -STATIC_OVL +static void toggle_displacement(obj, oldprop, on) struct obj *obj; @@ -257,7 +257,7 @@ Boots_off(VOID_ARGS) return 0; } -STATIC_PTR int +static int Cloak_on(VOID_ARGS) { long oldprop = @@ -362,7 +362,7 @@ Cloak_off(VOID_ARGS) return 0; } -STATIC_PTR +static int Helmet_on(VOID_ARGS) { @@ -472,7 +472,7 @@ Helmet_off(VOID_ARGS) return 0; } -STATIC_PTR +static int Gloves_on(VOID_ARGS) { @@ -500,7 +500,7 @@ Gloves_on(VOID_ARGS) return 0; } -STATIC_OVL void +static void wielding_corpse(obj, voluntary) struct obj *obj; boolean voluntary; /* taking gloves off on purpose? */ @@ -568,7 +568,7 @@ Gloves_off(VOID_ARGS) return 0; } -STATIC_PTR int +static int Shield_on(VOID_ARGS) { /* no shield currently requires special handling when put on, but we @@ -615,7 +615,7 @@ Shield_off(VOID_ARGS) return 0; } -STATIC_PTR int +static int Shirt_on(VOID_ARGS) { /* no shirt currently requires special handling when put on, but we @@ -650,7 +650,7 @@ Shirt_off(VOID_ARGS) return 0; } -STATIC_PTR +static int Armor_on(VOID_ARGS) { @@ -687,7 +687,7 @@ Armor_gone() return 0; } -STATIC_OVL void +static void Amulet_on() { /* make sure amulet isn't wielded; can't use remove_worn_item() @@ -812,7 +812,7 @@ Amulet_off() } /* handle ring discovery; comparable to learnwand() */ -STATIC_OVL void +static void learnring(ring, observed) struct obj *ring; boolean observed; @@ -961,7 +961,7 @@ register struct obj *obj; } } -STATIC_OVL void +static void Ring_off_or_gone(obj, gone) register struct obj *obj; boolean gone; @@ -1361,10 +1361,10 @@ static NEARDATA const char clothes[] = { static NEARDATA const char accessories[] = { RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, ARMOR_CLASS, 0 }; -STATIC_VAR NEARDATA int Narmorpieces, Naccessories; +static NEARDATA int Narmorpieces, Naccessories; /* assign values to Narmorpieces and Naccessories */ -STATIC_OVL void +static void count_worn_stuff(which, accessorizing) struct obj **which; /* caller wants this when count is 1 */ boolean accessorizing; @@ -1402,7 +1402,7 @@ boolean accessorizing; /* take off one piece or armor or one accessory; shared by dotakeoff('T') and doremring('R') */ -STATIC_OVL int +static int armor_or_accessory_off(obj) struct obj *obj; { @@ -1586,14 +1586,14 @@ struct obj *otmp; return 1; } -STATIC_OVL void +static void already_wearing(cc) const char *cc; { You("are already wearing %s%c", cc, (cc == c_that_) ? '!' : '.'); } -STATIC_OVL void +static void already_wearing2(cc1, cc2) const char *cc1, *cc2; { @@ -1782,7 +1782,7 @@ boolean noisy; return !err; } -STATIC_OVL int +static int accessory_or_armor_on(obj) struct obj *obj; { @@ -2217,7 +2217,7 @@ unchanger() return 0; } -STATIC_PTR +static int select_off(otmp) register struct obj *otmp; @@ -2340,7 +2340,7 @@ register struct obj *otmp; return 0; } -STATIC_OVL struct obj * +static struct obj * do_takeoff() { struct obj *otmp = (struct obj *) 0; @@ -2412,7 +2412,7 @@ do_takeoff() } /* occupation callback for 'A' */ -STATIC_PTR +static int take_off(VOID_ARGS) { @@ -2550,7 +2550,7 @@ doddoremarm() return 0; } -STATIC_OVL int +static int menu_remarm(retry) int retry; { diff --git a/src/dog.c b/src/dog.c index 280043bfc..a5946eb76 100644 --- a/src/dog.c +++ b/src/dog.c @@ -5,7 +5,7 @@ #include "hack.h" -STATIC_DCL int NDECL(pet_type); +static int NDECL(pet_type); void newedog(mtmp) @@ -53,7 +53,7 @@ register struct monst *mtmp; EDOG(mtmp)->killed_by_u = 0; } -STATIC_OVL int +static int pet_type() { if (g.urole.petnum != NON_PM) diff --git a/src/dogmove.c b/src/dogmove.c index 44d7bc89c..e74c0a418 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -7,17 +7,17 @@ #include "mfndpos.h" -STATIC_DCL boolean FDECL(dog_hunger, (struct monst *, struct edog *)); -STATIC_DCL int FDECL(dog_invent, (struct monst *, struct edog *, int)); -STATIC_DCL int FDECL(dog_goal, (struct monst *, struct edog *, int, int, int)); -STATIC_DCL struct monst *FDECL(find_targ, (struct monst *, int, int, int)); -STATIC_OVL int FDECL(find_friends, (struct monst *, struct monst *, int)); -STATIC_DCL struct monst *FDECL(best_target, (struct monst *)); -STATIC_DCL long FDECL(score_targ, (struct monst *, struct monst *)); -STATIC_DCL boolean FDECL(can_reach_location, (struct monst *, XCHAR_P, +static boolean FDECL(dog_hunger, (struct monst *, struct edog *)); +static int FDECL(dog_invent, (struct monst *, struct edog *, int)); +static int FDECL(dog_goal, (struct monst *, struct edog *, int, int, int)); +static struct monst *FDECL(find_targ, (struct monst *, int, int, int)); +static int FDECL(find_friends, (struct monst *, struct monst *, int)); +static struct monst *FDECL(best_target, (struct monst *)); +static long FDECL(score_targ, (struct monst *, struct monst *)); +static boolean FDECL(can_reach_location, (struct monst *, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -STATIC_DCL boolean FDECL(could_reach_item, (struct monst *, XCHAR_P, XCHAR_P)); -STATIC_DCL void FDECL(quickmimic, (struct monst *)); +static boolean FDECL(could_reach_item, (struct monst *, XCHAR_P, XCHAR_P)); +static void FDECL(quickmimic, (struct monst *)); /* pick a carried item for pet to drop */ struct obj * @@ -121,7 +121,7 @@ static NEARDATA const char nofetch[] = { BALL_CLASS, CHAIN_CLASS, ROCK_CLASS, 0 }; -STATIC_PTR void FDECL(wantdoor, (int, int, genericptr_t)); +static void FDECL(wantdoor, (int, int, genericptr_t)); boolean cursed_object_at(x, y) @@ -355,7 +355,7 @@ boolean devour; } /* hunger effects -- returns TRUE on starvation */ -STATIC_OVL boolean +static boolean dog_hunger(mtmp, edog) struct monst *mtmp; struct edog *edog; @@ -401,7 +401,7 @@ struct edog *edog; /* do something with object (drop, pick up, eat) at current position * returns 1 if object eaten (since that counts as dog's move), 2 if died */ -STATIC_OVL int +static int dog_invent(mtmp, edog, udist) register struct monst *mtmp; register struct edog *edog; @@ -474,7 +474,7 @@ int udist; /* set dog's goal -- gtyp, gx, gy; returns -1/0/1 (dog's desire to approach player) or -2 (abort move) */ -STATIC_OVL int +static int dog_goal(mtmp, edog, after, udist, whappr) register struct monst *mtmp; struct edog *edog; @@ -618,7 +618,7 @@ int after, udist, whappr; return appr; } -STATIC_OVL struct monst * +static struct monst * find_targ(mtmp, dx, dy, maxdist) register struct monst *mtmp; int dx, dy; @@ -661,7 +661,7 @@ int maxdist; return targ; } -STATIC_OVL int +static int find_friends(mtmp, mtarg, maxdist) struct monst *mtmp, *mtarg; int maxdist; @@ -707,7 +707,7 @@ int maxdist; return 0; } -STATIC_OVL long +static long score_targ(mtmp, mtarg) struct monst *mtmp, *mtarg; { @@ -808,7 +808,7 @@ struct monst *mtmp, *mtarg; return score; } -STATIC_OVL struct monst * +static struct monst * best_target(mtmp) struct monst *mtmp; /* Pet */ { @@ -1268,7 +1268,7 @@ int after; /* this is extra fast monster movement */ } /* check if a monster could pick up objects from a location */ -STATIC_OVL boolean +static boolean could_reach_item(mon, nx, ny) struct monst *mon; xchar nx, ny; @@ -1287,7 +1287,7 @@ xchar nx, ny; * Since the maximum food distance is 5, this should never be more than 5 * calls deep. */ -STATIC_OVL boolean +static boolean can_reach_location(mon, mx, my, fx, fy) struct monst *mon; xchar mx, my, fx, fy; @@ -1323,7 +1323,7 @@ xchar mx, my, fx, fy; } /* do_clear_area client */ -STATIC_PTR void +static void wantdoor(x, y, distance) int x, y; genericptr_t distance; @@ -1369,7 +1369,7 @@ struct monst *mtmp; } } -STATIC_OVL void +static void quickmimic(mtmp) struct monst *mtmp; { diff --git a/src/dokick.c b/src/dokick.c index 6f22ec511..7e89ddb8b 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -11,20 +11,20 @@ /* g.kickedobj (decl.c) tracks a kicked object until placed or destroyed */ -STATIC_DCL void FDECL(kickdmg, (struct monst *, BOOLEAN_P)); -STATIC_DCL boolean FDECL(maybe_kick_monster, (struct monst *, +static void FDECL(kickdmg, (struct monst *, BOOLEAN_P)); +static boolean FDECL(maybe_kick_monster, (struct monst *, XCHAR_P, XCHAR_P)); -STATIC_DCL void FDECL(kick_monster, (struct monst *, XCHAR_P, XCHAR_P)); -STATIC_DCL int FDECL(kick_object, (XCHAR_P, XCHAR_P, char *)); -STATIC_DCL int FDECL(really_kick_object, (XCHAR_P, XCHAR_P)); -STATIC_DCL char *FDECL(kickstr, (char *, const char *)); -STATIC_DCL void FDECL(otransit_msg, (struct obj *, BOOLEAN_P, long)); -STATIC_DCL void FDECL(drop_to, (coord *, SCHAR_P)); +static void FDECL(kick_monster, (struct monst *, XCHAR_P, XCHAR_P)); +static int FDECL(kick_object, (XCHAR_P, XCHAR_P, char *)); +static int FDECL(really_kick_object, (XCHAR_P, XCHAR_P)); +static char *FDECL(kickstr, (char *, const char *)); +static void FDECL(otransit_msg, (struct obj *, BOOLEAN_P, long)); +static void FDECL(drop_to, (coord *, SCHAR_P)); static const char kick_passes_thru[] = "kick passes harmlessly through"; /* kicking damage when not poly'd into a form with a kick attack */ -STATIC_OVL void +static void kickdmg(mon, clumsy) struct monst *mon; boolean clumsy; @@ -117,7 +117,7 @@ boolean clumsy; use_skill(kick_skill, 1); } -STATIC_OVL boolean +static boolean maybe_kick_monster(mon, x, y) struct monst *mon; xchar x, y; @@ -139,7 +139,7 @@ xchar x, y; return (boolean) (mon != 0); } -STATIC_OVL void +static void kick_monster(mon, x, y) struct monst *mon; xchar x, y; @@ -453,7 +453,7 @@ xchar x, y; /* coordinates where object was before the impact, not after */ } /* jacket around really_kick_object */ -STATIC_OVL int +static int kick_object(x, y, kickobjnam) xchar x, y; char *kickobjnam; @@ -473,7 +473,7 @@ char *kickobjnam; } /* guts of kick_object */ -STATIC_OVL int +static int really_kick_object(x, y) xchar x, y; { @@ -720,7 +720,7 @@ xchar x, y; } /* cause of death if kicking kills kicker */ -STATIC_OVL char * +static char * kickstr(buf, kickobjnam) char *buf; const char *kickobjnam; @@ -1322,7 +1322,7 @@ dokick() return 1; } -STATIC_OVL void +static void drop_to(cc, loc) coord *cc; schar loc; @@ -1733,7 +1733,7 @@ unsigned long deliverflags; } } -STATIC_OVL void +static void otransit_msg(otmp, nodrop, num) register struct obj *otmp; register boolean nodrop; diff --git a/src/dothrow.c b/src/dothrow.c index 6ac0c521b..ec3a6ff63 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -7,18 +7,18 @@ #include "hack.h" -STATIC_DCL int FDECL(throw_obj, (struct obj *, int)); -STATIC_DCL boolean FDECL(ok_to_throw, (int *)); -STATIC_DCL void NDECL(autoquiver); -STATIC_DCL int FDECL(gem_accept, (struct monst *, struct obj *)); -STATIC_DCL void FDECL(tmiss, (struct obj *, struct monst *, BOOLEAN_P)); -STATIC_DCL int FDECL(throw_gold, (struct obj *)); -STATIC_DCL void FDECL(check_shop_obj, (struct obj *, XCHAR_P, XCHAR_P, +static int FDECL(throw_obj, (struct obj *, int)); +static boolean FDECL(ok_to_throw, (int *)); +static void NDECL(autoquiver); +static int FDECL(gem_accept, (struct monst *, struct obj *)); +static void FDECL(tmiss, (struct obj *, struct monst *, BOOLEAN_P)); +static int FDECL(throw_gold, (struct obj *)); +static void FDECL(check_shop_obj, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); -STATIC_DCL void FDECL(breakmsg, (struct obj *, BOOLEAN_P)); -STATIC_DCL boolean FDECL(toss_up, (struct obj *, BOOLEAN_P)); -STATIC_DCL void FDECL(sho_obj_return_to_u, (struct obj * obj)); -STATIC_DCL boolean FDECL(mhurtle_step, (genericptr_t, int, int)); +static void FDECL(breakmsg, (struct obj *, BOOLEAN_P)); +static boolean FDECL(toss_up, (struct obj *, BOOLEAN_P)); +static void FDECL(sho_obj_return_to_u, (struct obj * obj)); +static boolean FDECL(mhurtle_step, (genericptr_t, int, int)); static NEARDATA const char toss_objs[] = { ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, WEAPON_CLASS, 0 }; @@ -29,7 +29,7 @@ static NEARDATA const char bullets[] = { ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, /* g.thrownobj (decl.c) tracks an object until it lands */ /* Throw the selected object, asking for direction */ -STATIC_OVL int +static int throw_obj(obj, shotlimit) struct obj *obj; int shotlimit; @@ -232,7 +232,7 @@ int shotlimit; } /* common to dothrow() and dofire() */ -STATIC_OVL boolean +static boolean ok_to_throw(shotlimit_p) int *shotlimit_p; /* (see dothrow()) */ { @@ -767,7 +767,7 @@ int x, y; return TRUE; } -STATIC_OVL boolean +static boolean mhurtle_step(arg, x, y) genericptr_t arg; int x, y; @@ -888,7 +888,7 @@ int dx, dy, range; return; } -STATIC_OVL void +static void check_shop_obj(obj, x, y, broken) struct obj *obj; xchar x, y; @@ -927,7 +927,7 @@ boolean broken; * * Returns FALSE if the object is gone. */ -STATIC_OVL boolean +static boolean toss_up(obj, hitsroof) struct obj *obj; boolean hitsroof; @@ -1069,7 +1069,7 @@ struct obj *obj; } /* the currently thrown object is returning to you (not for boomerangs) */ -STATIC_OVL void +static void sho_obj_return_to_u(obj) struct obj *obj; { @@ -1475,7 +1475,7 @@ boolean mon_notices; } /* thrown object misses target monster */ -STATIC_OVL void +static void tmiss(obj, mon, maybe_wakeup) struct obj *obj; struct monst *mon; @@ -1786,7 +1786,7 @@ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */ return 0; } -STATIC_OVL int +static int gem_accept(mon, obj) register struct monst *mon; register struct obj *obj; @@ -2061,7 +2061,7 @@ struct obj *obj; } } -STATIC_OVL void +static void breakmsg(obj, in_view) struct obj *obj; boolean in_view; @@ -2103,7 +2103,7 @@ boolean in_view; } } -STATIC_OVL int +static int throw_gold(obj) struct obj *obj; { diff --git a/src/dungeon.c b/src/dungeon.c index cf292a8a0..42b507740 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -36,47 +36,47 @@ struct lchoice { }; static void FDECL(Fread, (genericptr_t, int, int, dlb *)); -STATIC_DCL xchar FDECL(dname_to_dnum, (const char *)); -STATIC_DCL int FDECL(find_branch, (const char *, struct proto_dungeon *)); -STATIC_DCL xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *)); -STATIC_DCL int FDECL(level_range, (XCHAR_P, int, int, int, +static xchar FDECL(dname_to_dnum, (const char *)); +static int FDECL(find_branch, (const char *, struct proto_dungeon *)); +static xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *)); +static int FDECL(level_range, (XCHAR_P, int, int, int, struct proto_dungeon *, int *)); -STATIC_DCL xchar FDECL(parent_dlevel, (const char *, struct proto_dungeon *)); -STATIC_DCL int FDECL(correct_branch_type, (struct tmpbranch *)); -STATIC_DCL branch *FDECL(add_branch, (int, int, struct proto_dungeon *)); -STATIC_DCL void FDECL(add_level, (s_level *)); -STATIC_DCL void FDECL(init_level, (int, int, struct proto_dungeon *)); -STATIC_DCL int FDECL(possible_places, (int, boolean *, +static xchar FDECL(parent_dlevel, (const char *, struct proto_dungeon *)); +static int FDECL(correct_branch_type, (struct tmpbranch *)); +static branch *FDECL(add_branch, (int, int, struct proto_dungeon *)); +static void FDECL(add_level, (s_level *)); +static void FDECL(init_level, (int, int, struct proto_dungeon *)); +static int FDECL(possible_places, (int, boolean *, struct proto_dungeon *)); -STATIC_DCL xchar FDECL(pick_level, (boolean *, int)); -STATIC_DCL boolean FDECL(place_level, (int, struct proto_dungeon *)); -STATIC_DCL boolean FDECL(unplaced_floater, (struct dungeon *)); -STATIC_DCL boolean FDECL(unreachable_level, (d_level *, BOOLEAN_P)); -STATIC_DCL void FDECL(tport_menu, (winid, char *, struct lchoice *, d_level *, +static xchar FDECL(pick_level, (boolean *, int)); +static boolean FDECL(place_level, (int, struct proto_dungeon *)); +static boolean FDECL(unplaced_floater, (struct dungeon *)); +static boolean FDECL(unreachable_level, (d_level *, BOOLEAN_P)); +static void FDECL(tport_menu, (winid, char *, struct lchoice *, d_level *, BOOLEAN_P)); -STATIC_DCL const char *FDECL(br_string, (int)); -STATIC_DCL char FDECL(chr_u_on_lvl, (d_level *)); -STATIC_DCL void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P, +static const char *FDECL(br_string, (int)); +static char FDECL(chr_u_on_lvl, (d_level *)); +static void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P, struct lchoice *)); /* SAVE2018 */ -STATIC_DCL mapseen *FDECL(load_mapseen, (NHFILE *)); -STATIC_DCL void FDECL(save_mapseen, (NHFILE *, mapseen *)); -STATIC_DCL mapseen *FDECL(find_mapseen, (d_level *)); -STATIC_DCL mapseen *FDECL(find_mapseen_by_str, (const char *)); -STATIC_DCL void FDECL(print_mapseen, (winid, mapseen *, int, int, BOOLEAN_P)); -STATIC_DCL boolean FDECL(interest_mapseen, (mapseen *)); -STATIC_DCL void FDECL(traverse_mapseenchn, (BOOLEAN_P, winid, +static mapseen *FDECL(load_mapseen, (NHFILE *)); +static void FDECL(save_mapseen, (NHFILE *, mapseen *)); +static mapseen *FDECL(find_mapseen, (d_level *)); +static mapseen *FDECL(find_mapseen_by_str, (const char *)); +static void FDECL(print_mapseen, (winid, mapseen *, int, int, BOOLEAN_P)); +static boolean FDECL(interest_mapseen, (mapseen *)); +static void FDECL(traverse_mapseenchn, (BOOLEAN_P, winid, int, int, int *)); -STATIC_DCL const char *FDECL(seen_string, (XCHAR_P, const char *)); -STATIC_DCL const char *FDECL(br_string2, (branch *)); -STATIC_DCL const char *FDECL(shop_string, (int)); -STATIC_DCL char *FDECL(tunesuffix, (mapseen *, char *)); +static const char *FDECL(seen_string, (XCHAR_P, const char *)); +static const char *FDECL(br_string2, (branch *)); +static const char *FDECL(shop_string, (int)); +static char *FDECL(tunesuffix, (mapseen *, char *)); #ifdef DEBUG #define DD g.dungeons[i] -STATIC_DCL void NDECL(dumpit); +static void NDECL(dumpit); -STATIC_OVL void +static void dumpit() { int i; @@ -310,7 +310,7 @@ dlb *stream; } } -STATIC_OVL xchar +static xchar dname_to_dnum(s) const char *s; { @@ -337,7 +337,7 @@ const char *s; } /* Find the branch that links the named dungeon. */ -STATIC_OVL int +static int find_branch(s, pd) const char *s; /* dungeon name */ struct proto_dungeon *pd; @@ -370,7 +370,7 @@ struct proto_dungeon *pd; * Find the "parent" by searching the prototype branch list for the branch * listing, then figuring out to which dungeon it belongs. */ -STATIC_OVL xchar +static xchar parent_dnum(s, pd) const char *s; /* dungeon name */ struct proto_dungeon *pd; @@ -402,7 +402,7 @@ struct proto_dungeon *pd; * a negative random component means from the (adjusted) base to the * end of the dungeon. */ -STATIC_OVL int +static int level_range(dgn, base, randc, chain, pd, adjusted_base) xchar dgn; int base, randc, chain; @@ -437,7 +437,7 @@ int *adjusted_base; return 1; } -STATIC_OVL xchar +static xchar parent_dlevel(s, pd) const char *s; struct proto_dungeon *pd; @@ -464,7 +464,7 @@ struct proto_dungeon *pd; } /* Convert from the temporary branch type to the dungeon branch type. */ -STATIC_OVL int +static int correct_branch_type(tbr) struct tmpbranch *tbr; { @@ -538,7 +538,7 @@ boolean extract_first; } /* Add a dungeon branch to the branch list. */ -STATIC_OVL branch * +static branch * add_branch(dgn, child_entry_level, pd) int dgn; int child_entry_level; @@ -570,7 +570,7 @@ struct proto_dungeon *pd; * level that has a dungeon number less than the dungeon number of the * last entry. */ -STATIC_OVL void +static void add_level(new_lev) s_level *new_lev; { @@ -592,7 +592,7 @@ s_level *new_lev; } } -STATIC_OVL void +static void init_level(dgn, proto_index, pd) int dgn, proto_index; struct proto_dungeon *pd; @@ -626,7 +626,7 @@ struct proto_dungeon *pd; new_level->next = (s_level *) 0; } -STATIC_OVL int +static int possible_places(idx, map, pd) int idx; /* prototype index */ boolean *map; /* array MAXLEVEL+1 in length */ @@ -658,7 +658,7 @@ struct proto_dungeon *pd; } /* Pick the nth TRUE entry in the given boolean array. */ -STATIC_OVL xchar +static xchar pick_level(map, nth) boolean *map; /* an array MAXLEVEL+1 in size */ int nth; @@ -690,7 +690,7 @@ int d; * all possible places have been tried. If all possible places have * been exhausted, return false. */ -STATIC_OVL boolean +static boolean place_level(proto_index, pd) int proto_index; struct proto_dungeon *pd; @@ -1780,7 +1780,7 @@ const char *nam; return lev; } -STATIC_OVL boolean +static boolean unplaced_floater(dptr) struct dungeon *dptr; { @@ -1796,7 +1796,7 @@ struct dungeon *dptr; return FALSE; } -STATIC_OVL boolean +static boolean unreachable_level(lvl_p, unplaced) d_level *lvl_p; boolean unplaced; @@ -1847,7 +1847,7 @@ boolean unreachable; } /* Convert a branch type to a string usable by print_dungeon(). */ -STATIC_OVL const char * +static const char * br_string(type) int type; { @@ -1864,7 +1864,7 @@ int type; return " (unknown)"; } -STATIC_OVL char +static char chr_u_on_lvl(dlev) d_level *dlev; { @@ -1872,7 +1872,7 @@ d_level *dlev; } /* Print all child branches between the lower and upper bounds. */ -STATIC_OVL void +static void print_branch(win, dnum, lower_bound, upper_bound, bymenu, lchoices_p) winid win; int dnum; @@ -2157,7 +2157,7 @@ donamelevel() } /* find the particular mapseen object in the chain; may return null */ -STATIC_OVL mapseen * +static mapseen * find_mapseen(lev) d_level *lev; { @@ -2170,7 +2170,7 @@ d_level *lev; return mptr; } -STATIC_OVL mapseen * +static mapseen * find_mapseen_by_str(s) const char *s; { @@ -2247,7 +2247,7 @@ int ledger_num; } } -STATIC_OVL void +static void save_mapseen(nhfp, mptr) NHFILE *nhfp; mapseen *mptr; @@ -2295,7 +2295,7 @@ mapseen *mptr; savecemetery(nhfp, &mptr->final_resting_place); } -STATIC_OVL mapseen * +static mapseen * load_mapseen(nhfp) NHFILE *nhfp; { @@ -2469,7 +2469,7 @@ d_level *lev; /* || (feat).water || (feat).ice || (feat).lava */ /* returns true if this level has something interesting to print out */ -STATIC_OVL boolean +static boolean interest_mapseen(mptr) mapseen *mptr; { @@ -2868,7 +2868,7 @@ int reason; /* how hero died; used when disclosing end-of-game level */ } /* display endgame levels or non-endgame levels, not both */ -STATIC_OVL void +static void traverse_mapseenchn(viewendgame, win, why, reason, lastdun_p) boolean viewendgame; winid win; @@ -2890,7 +2890,7 @@ int why, reason, *lastdun_p; } } -STATIC_OVL const char * +static const char * seen_string(x, obj) xchar x; const char *obj; @@ -2912,7 +2912,7 @@ const char *obj; } /* better br_string */ -STATIC_OVL const char * +static const char * br_string2(br) branch *br; { @@ -2967,7 +2967,7 @@ int indx; return outbuf; } -STATIC_OVL const char * +static const char * shop_string(rtype) int rtype; { @@ -3019,7 +3019,7 @@ int rtype; /* if player knows about the mastermind tune, append it to Castle annotation; if drawbridge has been destroyed, flags.castletune will be zero */ -STATIC_OVL char * +static char * tunesuffix(mptr, outbuf) mapseen *mptr; char *outbuf; @@ -3060,7 +3060,7 @@ char *outbuf; Sprintf(eos(buf), "%s%s", COMMA, (nam)); \ } while (0) -STATIC_OVL void +static void print_mapseen(win, mptr, final, how, printdun) winid win; mapseen *mptr; diff --git a/src/eat.c b/src/eat.c index cafbf8f0a..23ee9f721 100644 --- a/src/eat.c +++ b/src/eat.c @@ -5,39 +5,39 @@ #include "hack.h" -STATIC_PTR int NDECL(eatmdone); -STATIC_PTR int NDECL(eatfood); -STATIC_PTR struct obj *FDECL(costly_tin, (int)); -STATIC_PTR int NDECL(opentin); -STATIC_PTR int NDECL(unfaint); +static int NDECL(eatmdone); +static int NDECL(eatfood); +static struct obj *FDECL(costly_tin, (int)); +static int NDECL(opentin); +static int NDECL(unfaint); -STATIC_DCL const char *FDECL(food_xname, (struct obj *, BOOLEAN_P)); -STATIC_DCL void FDECL(choke, (struct obj *)); -STATIC_DCL void NDECL(recalc_wt); -STATIC_DCL unsigned FDECL(obj_nutrition, (struct obj *)); -STATIC_DCL struct obj *FDECL(touchfood, (struct obj *)); -STATIC_DCL void NDECL(do_reset_eat); -STATIC_DCL void FDECL(done_eating, (BOOLEAN_P)); -STATIC_DCL void FDECL(cprefx, (int)); -STATIC_DCL int FDECL(intrinsic_possible, (int, struct permonst *)); -STATIC_DCL void FDECL(givit, (int, struct permonst *)); -STATIC_DCL void FDECL(cpostfx, (int)); -STATIC_DCL void FDECL(consume_tin, (const char *)); -STATIC_DCL void FDECL(start_tin, (struct obj *)); -STATIC_DCL int FDECL(eatcorpse, (struct obj *)); -STATIC_DCL void FDECL(start_eating, (struct obj *, BOOLEAN_P)); -STATIC_DCL void FDECL(fprefx, (struct obj *)); -STATIC_DCL void FDECL(fpostfx, (struct obj *)); -STATIC_DCL int NDECL(bite); -STATIC_DCL int FDECL(edibility_prompts, (struct obj *)); -STATIC_DCL int FDECL(rottenfood, (struct obj *)); -STATIC_DCL void NDECL(eatspecial); -STATIC_DCL int FDECL(bounded_increase, (int, int, int)); -STATIC_DCL void FDECL(accessory_has_effect, (struct obj *)); -STATIC_DCL void FDECL(eataccessory, (struct obj *)); -STATIC_DCL const char *FDECL(foodword, (struct obj *)); -STATIC_DCL int FDECL(tin_variety, (struct obj *, BOOLEAN_P)); -STATIC_DCL boolean FDECL(maybe_cannibal, (int, BOOLEAN_P)); +static const char *FDECL(food_xname, (struct obj *, BOOLEAN_P)); +static void FDECL(choke, (struct obj *)); +static void NDECL(recalc_wt); +static unsigned FDECL(obj_nutrition, (struct obj *)); +static struct obj *FDECL(touchfood, (struct obj *)); +static void NDECL(do_reset_eat); +static void FDECL(done_eating, (BOOLEAN_P)); +static void FDECL(cprefx, (int)); +static int FDECL(intrinsic_possible, (int, struct permonst *)); +static void FDECL(givit, (int, struct permonst *)); +static void FDECL(cpostfx, (int)); +static void FDECL(consume_tin, (const char *)); +static void FDECL(start_tin, (struct obj *)); +static int FDECL(eatcorpse, (struct obj *)); +static void FDECL(start_eating, (struct obj *, BOOLEAN_P)); +static void FDECL(fprefx, (struct obj *)); +static void FDECL(fpostfx, (struct obj *)); +static int NDECL(bite); +static int FDECL(edibility_prompts, (struct obj *)); +static int FDECL(rottenfood, (struct obj *)); +static void NDECL(eatspecial); +static int FDECL(bounded_increase, (int, int, int)); +static void FDECL(accessory_has_effect, (struct obj *)); +static void FDECL(eataccessory, (struct obj *)); +static const char *FDECL(foodword, (struct obj *)); +static int FDECL(tin_variety, (struct obj *, BOOLEAN_P)); +static boolean FDECL(maybe_cannibal, (int, BOOLEAN_P)); /* also used to see if you're allowed to eat cats and dogs */ #define CANNIBAL_ALLOWED() (Role_if(PM_CAVEMAN) || Race_if(PM_ORC)) @@ -55,12 +55,12 @@ STATIC_DCL boolean FDECL(maybe_cannibal, (int, BOOLEAN_P)); #define nonrotting_food(otyp) \ ((otyp) == LEMBAS_WAFER || (otyp) == CRAM_RATION) -STATIC_OVL NEARDATA const char comestibles[] = { FOOD_CLASS, 0 }; -STATIC_OVL NEARDATA const char offerfodder[] = { FOOD_CLASS, AMULET_CLASS, +static NEARDATA const char comestibles[] = { FOOD_CLASS, 0 }; +static NEARDATA const char offerfodder[] = { FOOD_CLASS, AMULET_CLASS, 0 }; /* Gold must come first for getobj(). */ -STATIC_OVL NEARDATA const char allobj[] = { +static NEARDATA const char allobj[] = { COIN_CLASS, WEAPON_CLASS, ARMOR_CLASS, POTION_CLASS, SCROLL_CLASS, WAND_CLASS, RING_CLASS, AMULET_CLASS, FOOD_CLASS, TOOL_CLASS, GEM_CLASS, ROCK_CLASS, @@ -145,7 +145,7 @@ static const struct { #define TTSZ SIZE(tintxts) /* called after mimicing is over */ -STATIC_PTR int +static int eatmdone(VOID_ARGS) { /* release `eatmbuf' */ @@ -198,7 +198,7 @@ eatmupdate() } /* ``[the(] singular(food, xname) [)]'' */ -STATIC_OVL const char * +static const char * food_xname(food, the_pfx) struct obj *food; boolean the_pfx; @@ -228,7 +228,7 @@ boolean the_pfx; * * To a full belly all food is bad. (It.) */ -STATIC_OVL void +static void choke(food) struct obj *food; { @@ -276,7 +276,7 @@ struct obj *food; } /* modify object wt. depending on time spent consuming it */ -STATIC_OVL void +static void recalc_wt() { struct obj *piece = g.context.victual.piece; @@ -306,7 +306,7 @@ reset_eat() } /* base nutrition of a food-class object */ -STATIC_OVL unsigned +static unsigned obj_nutrition(otmp) struct obj *otmp; { @@ -331,7 +331,7 @@ struct obj *otmp; return nut; } -STATIC_OVL struct obj * +static struct obj * touchfood(otmp) struct obj *otmp; { @@ -397,7 +397,7 @@ struct obj *old_obj, *new_obj; } } -STATIC_OVL void +static void do_reset_eat() { debugpline0("do_reset_eat..."); @@ -420,7 +420,7 @@ do_reset_eat() } /* called each move during eating process */ -STATIC_PTR int +static int eatfood(VOID_ARGS) { if (!g.context.victual.piece @@ -443,7 +443,7 @@ eatfood(VOID_ARGS) } } -STATIC_OVL void +static void done_eating(message) boolean message; { @@ -632,7 +632,7 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */ } /* eating a corpse or egg of one's own species is usually naughty */ -STATIC_OVL boolean +static boolean maybe_cannibal(pm, allowmsg) int pm; boolean allowmsg; @@ -667,7 +667,7 @@ boolean allowmsg; return FALSE; } -STATIC_OVL void +static void cprefx(pm) register int pm; { @@ -758,7 +758,7 @@ fix_petrification() */ /* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */ -STATIC_OVL int +static int intrinsic_possible(type, ptr) int type; register struct permonst *ptr; @@ -822,7 +822,7 @@ register struct permonst *ptr; /* givit() tries to give you an intrinsic based on the monster's level * and what type of intrinsic it is trying to give you. */ -STATIC_OVL void +static void givit(type, ptr) int type; register struct permonst *ptr; @@ -935,7 +935,7 @@ register struct permonst *ptr; } /* called after completely consuming a corpse */ -STATIC_OVL void +static void cpostfx(pm) int pm; { @@ -1162,7 +1162,7 @@ violated_vegetarian() /* common code to check and possibly charge for 1 g.context.tin.tin, * will split() g.context.tin.tin if necessary */ -STATIC_PTR struct obj * +static struct obj * costly_tin(alter_type) int alter_type; /* COST_xxx */ { @@ -1268,7 +1268,7 @@ int forcetype; obj->spe = -(r + 1); /* offset by 1 to allow index 0 */ } -STATIC_OVL int +static int tin_variety(obj, disp) struct obj *obj; boolean disp; /* we're just displaying so leave things alone */ @@ -1293,7 +1293,7 @@ boolean disp; /* we're just displaying so leave things alone */ return r; } -STATIC_OVL void +static void consume_tin(mesg) const char *mesg; { @@ -1428,7 +1428,7 @@ const char *mesg; } /* called during each move whilst opening a tin */ -STATIC_PTR int +static int opentin(VOID_ARGS) { /* perhaps it was stolen (although that should cause interruption) */ @@ -1447,7 +1447,7 @@ opentin(VOID_ARGS) } /* called when starting to open a tin */ -STATIC_OVL void +static void start_tin(otmp) struct obj *otmp; { @@ -1538,7 +1538,7 @@ Hear_again(VOID_ARGS) } /* called on the "first bite" of rotten food */ -STATIC_OVL int +static int rottenfood(obj) struct obj *obj; { @@ -1580,7 +1580,7 @@ struct obj *obj; } /* called when a corpse is selected as food */ -STATIC_OVL int +static int eatcorpse(otmp) struct obj *otmp; { @@ -1719,7 +1719,7 @@ struct obj *otmp; } /* called as you start to eat */ -STATIC_OVL void +static void start_eating(otmp, already_partly_eaten) struct obj *otmp; boolean already_partly_eaten; @@ -1782,7 +1782,7 @@ boolean already_partly_eaten; * Messages should use present tense since multi-turn food won't be * finishing at the time they're issued. */ -STATIC_OVL void +static void fprefx(otmp) struct obj *otmp; { @@ -1890,7 +1890,7 @@ struct obj *otmp; } /* increment a combat intrinsic with limits on its growth */ -STATIC_OVL int +static int bounded_increase(old, inc, typ) int old, inc, typ; { @@ -1928,7 +1928,7 @@ int old, inc, typ; return old + inc; } -STATIC_OVL void +static void accessory_has_effect(otmp) struct obj *otmp; { @@ -1936,7 +1936,7 @@ struct obj *otmp; (otmp->oclass == RING_CLASS) ? "ring" : "amulet"); } -STATIC_OVL void +static void eataccessory(otmp) struct obj *otmp; { @@ -2081,7 +2081,7 @@ struct obj *otmp; } /* called after eating non-food */ -STATIC_OVL void +static void eatspecial() { struct obj *otmp = g.context.victual.piece; @@ -2166,7 +2166,7 @@ static const char *foodwords[] = { "plastic", "glass", "rich food", "stone" }; -STATIC_OVL const char * +static const char * foodword(otmp) struct obj *otmp; { @@ -2179,7 +2179,7 @@ struct obj *otmp; } /* called after consuming (non-corpse) food */ -STATIC_OVL void +static void fpostfx(otmp) struct obj *otmp; { @@ -2267,9 +2267,9 @@ struct obj *otmp; /* intended for eating a spellbook while polymorphed, but not used; "leather" applied to appearance, not composition, and has been changed to "leathery" to reflect that */ -STATIC_DCL boolean FDECL(leather_cover, (struct obj *)); +static boolean FDECL(leather_cover, (struct obj *)); -STATIC_OVL boolean +static boolean leather_cover(otmp) struct obj *otmp; { @@ -2288,7 +2288,7 @@ struct obj *otmp; * return 1 if the food was dangerous and you chose to stop. * return 2 if the food was dangerous and you chose to eat it anyway. */ -STATIC_OVL int +static int edibility_prompts(otmp) struct obj *otmp; { @@ -2754,7 +2754,7 @@ struct obj *obj; /* Take a single bite from a piece of food, checking for choking and * modifying usedtime. Returns 1 if they choked and survived, 0 otherwise. */ -STATIC_OVL int +static int bite() { if (g.context.victual.canchoke && u.uhunger >= 2000) { @@ -2895,8 +2895,7 @@ int num; newuhs(FALSE); } -STATIC_PTR -int +static int unfaint(VOID_ARGS) { (void) Hear_again(); diff --git a/src/end.c b/src/end.c index 7cfbe16ab..fa758fe43 100644 --- a/src/end.c +++ b/src/end.c @@ -22,29 +22,29 @@ #define nowrap_add(a, b) (a = ((a + b) < 0 ? LONG_MAX : (a + b))) #ifndef NO_SIGNAL -STATIC_PTR void FDECL(done_intr, (int)); +static void FDECL(done_intr, (int)); #if defined(UNIX) || defined(VMS) || defined(__EMX__) static void FDECL(done_hangup, (int)); #endif #endif -STATIC_DCL void FDECL(disclose, (int, BOOLEAN_P)); -STATIC_DCL void FDECL(get_valuables, (struct obj *)); -STATIC_DCL void FDECL(sort_valuables, (struct valuable_data *, int)); -STATIC_DCL void NDECL(done_object_cleanup); -STATIC_DCL void FDECL(artifact_score, (struct obj *, BOOLEAN_P, winid)); -STATIC_DCL void FDECL(really_done, (int)) NORETURN; -STATIC_DCL void FDECL(savelife, (int)); -STATIC_PTR int FDECL(CFDECLSPEC vanqsort_cmp, (const genericptr, +static void FDECL(disclose, (int, BOOLEAN_P)); +static void FDECL(get_valuables, (struct obj *)); +static void FDECL(sort_valuables, (struct valuable_data *, int)); +static void NDECL(done_object_cleanup); +static void FDECL(artifact_score, (struct obj *, BOOLEAN_P, winid)); +static void FDECL(really_done, (int)) NORETURN; +static void FDECL(savelife, (int)); +static int FDECL(CFDECLSPEC vanqsort_cmp, (const genericptr, const genericptr)); -STATIC_DCL int NDECL(set_vanq_order); -STATIC_DCL void FDECL(list_vanquished, (CHAR_P, BOOLEAN_P)); -STATIC_DCL void FDECL(list_genocided, (CHAR_P, BOOLEAN_P)); -STATIC_DCL boolean FDECL(should_query_disclose_option, (int, char *)); +static int NDECL(set_vanq_order); +static void FDECL(list_vanquished, (CHAR_P, BOOLEAN_P)); +static void FDECL(list_genocided, (CHAR_P, BOOLEAN_P)); +static boolean FDECL(should_query_disclose_option, (int, char *)); #ifdef DUMPLOG -STATIC_DCL void NDECL(dump_plines); +static void NDECL(dump_plines); #endif -STATIC_DCL void FDECL(dump_everything, (int, time_t)); -STATIC_DCL int NDECL(num_extinct); +static void FDECL(dump_everything, (int, time_t)); +static int NDECL(num_extinct); #if defined(__BEOS__) || defined(MICRO) || defined(OS2) || defined(WIN32) extern void FDECL(nethack_exit, (int)); @@ -366,7 +366,7 @@ done2() #ifndef NO_SIGNAL /*ARGSUSED*/ -STATIC_PTR void +static void done_intr(sig_unused) /* called as signal() handler, so sent at least 1 arg */ int sig_unused UNUSED; { @@ -526,7 +526,7 @@ static const struct { /* clear away while-helpless when the cause of death caused that helplessness (ie, "petrified by while getting stoned") */ -STATIC_DCL void +static void fixup_death(how) int how; { @@ -627,7 +627,7 @@ VA_DECL(const char *, str) really_done(PANICKED); } -STATIC_OVL boolean +static boolean should_query_disclose_option(category, defquery) int category; char *defquery; @@ -671,7 +671,7 @@ char *defquery; } #ifdef DUMPLOG -STATIC_OVL void +static void dump_plines() { int i, j; @@ -694,7 +694,7 @@ dump_plines() #endif /*ARGSUSED*/ -STATIC_OVL void +static void dump_everything(how, when) int how; time_t when; /* date+time at end of game */ @@ -764,7 +764,7 @@ time_t when; /* date+time at end of game */ #endif } -STATIC_OVL void +static void disclose(how, taken) int how; boolean taken; @@ -838,7 +838,7 @@ boolean taken; } /* try to get the player back in a viable state after being killed */ -STATIC_OVL void +static void savelife(how) int how; { @@ -886,7 +886,7 @@ int how; * Get valuables from the given list. Revised code: the list always remains * intact. */ -STATIC_OVL void +static void get_valuables(list) struct obj *list; /* inventory or container contents */ { @@ -921,7 +921,7 @@ struct obj *list; /* inventory or container contents */ * Sort collected valuables, most frequent to least. We could just * as easily use qsort, but we don't care about efficiency here. */ -STATIC_OVL void +static void sort_valuables(list, size) struct valuable_data list[]; int size; /* max value is less than 20 */ @@ -950,11 +950,11 @@ int size; /* max value is less than 20 */ * odds_and_ends() was used for 3.6.0 and 3.6.1. * Schroedinger's Cat is handled differently starting with 3.6.2. */ -STATIC_DCL boolean FDECL(odds_and_ends, (struct obj *, int)); +static boolean FDECL(odds_and_ends, (struct obj *, int)); #define CAT_CHECK 2 -STATIC_OVL boolean +static boolean odds_and_ends(list, what) struct obj *list; int what; @@ -977,7 +977,7 @@ int what; #endif /* deal with some objects which may be in an abnormal state at end of game */ -STATIC_OVL void +static void done_object_cleanup() { int ox, oy; @@ -1033,7 +1033,7 @@ done_object_cleanup() } /* called twice; first to calculate total, then to list relevant items */ -STATIC_OVL void +static void artifact_score(list, counting, endwin) struct obj *list; boolean counting; /* true => add up points; false => display them */ @@ -1178,7 +1178,7 @@ int how; } /* separated from done() in order to specify the __noreturn__ attribute */ -STATIC_OVL void +static void really_done(how) int how; { @@ -1720,7 +1720,7 @@ static const char *vanqorders[NUM_VANQ_ORDER_MODES] = { "by count, low to high, by internal index within tied count", }; -STATIC_PTR int CFDECLSPEC +static int CFDECLSPEC vanqsort_cmp(vptr1, vptr2) const genericptr vptr1; const genericptr vptr2; @@ -1801,7 +1801,7 @@ const genericptr vptr2; } /* returns -1 if cancelled via ESC */ -STATIC_OVL int +static int set_vanq_order() { winid tmpwin; @@ -1846,7 +1846,7 @@ dovanquished() #define UniqCritterIndx(mndx) ((mons[mndx].geno & G_UNIQ) \ && mndx != PM_HIGH_PRIEST) -STATIC_OVL void +static void list_vanquished(defquery, ask) char defquery; boolean ask; @@ -1994,7 +1994,7 @@ num_genocides() return n; } -STATIC_OVL int +static int num_extinct() { int i, n = 0; @@ -2008,7 +2008,7 @@ num_extinct() return n; } -STATIC_OVL void +static void list_genocided(defquery, ask) char defquery; boolean ask; diff --git a/src/engrave.c b/src/engrave.c index 682619816..4e5413526 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -8,8 +8,8 @@ #include "sfproto.h" -STATIC_VAR NEARDATA struct engr *head_engr; -STATIC_DCL const char *NDECL(blengr); +static NEARDATA struct engr *head_engr; +static const char *NDECL(blengr); char * random_engraving(outbuf) @@ -1343,7 +1343,7 @@ static const char blind_writing[][21] = { 0x69, 0x76, 0x6b, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, }; -STATIC_OVL const char * +static const char * blengr(VOID_ARGS) { return blind_writing[rn2(SIZE(blind_writing))]; diff --git a/src/exper.c b/src/exper.c index 1ed80805b..ab5a84348 100644 --- a/src/exper.c +++ b/src/exper.c @@ -8,7 +8,7 @@ #include #endif -STATIC_DCL int FDECL(enermod, (int)); +static int FDECL(enermod, (int)); long newuexp(lev) @@ -23,7 +23,7 @@ int lev; return (10000000L * ((long) (lev - 19))); } -STATIC_OVL int +static int enermod(en) int en; { diff --git a/src/extralev.c b/src/extralev.c index 7ea88e787..b3a19504d 100644 --- a/src/extralev.c +++ b/src/extralev.c @@ -13,11 +13,11 @@ #define LEFT 4 #define RIGHT 8 -STATIC_DCL void FDECL(roguejoin, (int, int, int, int, int)); -STATIC_DCL void FDECL(roguecorr, (int, int, int)); -STATIC_DCL void FDECL(miniwalk, (int, int)); +static void FDECL(roguejoin, (int, int, int, int, int)); +static void FDECL(roguecorr, (int, int, int)); +static void FDECL(miniwalk, (int, int)); -STATIC_OVL +static void roguejoin(x1, y1, x2, y2, horiz) int x1, y1, x2, y2; @@ -43,7 +43,7 @@ int horiz; } } -STATIC_OVL +static void roguecorr(x, y, dir) int x, y, dir; @@ -139,7 +139,7 @@ int x, y, dir; } /* Modified walkfrom() from mkmaze.c */ -STATIC_OVL +static void miniwalk(x, y) int x, y; diff --git a/src/files.c b/src/files.c index 65a69e09a..0aed6a08a 100644 --- a/src/files.c +++ b/src/files.c @@ -84,8 +84,8 @@ static char fqn_filename_buffer[FQN_NUMBUF][FQN_MAX_FILENAME]; #include #endif -STATIC_DCL FILE *NDECL(fopen_wizkit_file); -STATIC_DCL void FDECL(wizkit_addinv, (struct obj *)); +static FILE *NDECL(fopen_wizkit_file); +static void FDECL(wizkit_addinv, (struct obj *)); #ifdef AMIGA extern char PATH[]; /* see sys/amiga/amidos.c */ @@ -127,47 +127,47 @@ extern char *sounddir; #endif #ifdef SELECTSAVED -STATIC_PTR int FDECL(CFDECLSPEC strcmp_wrap, (const void *, const void *)); +static int FDECL(CFDECLSPEC strcmp_wrap, (const void *, const void *)); #endif -STATIC_DCL char *FDECL(set_bonesfile_name, (char *, d_level *)); -STATIC_DCL char *NDECL(set_bonestemp_name); +static char *FDECL(set_bonesfile_name, (char *, d_level *)); +static char *NDECL(set_bonestemp_name); #ifdef COMPRESS -STATIC_DCL void FDECL(redirect, (const char *, const char *, FILE *, +static void FDECL(redirect, (const char *, const char *, FILE *, BOOLEAN_P)); #endif #if defined(COMPRESS) || defined(ZLIB_COMP) -STATIC_DCL void FDECL(docompress_file, (const char *, BOOLEAN_P)); +static void FDECL(docompress_file, (const char *, BOOLEAN_P)); #endif #if defined(ZLIB_COMP) -STATIC_DCL boolean FDECL(make_compressed_name, (const char *, char *)); +static boolean FDECL(make_compressed_name, (const char *, char *)); #endif #ifndef USE_FCNTL -STATIC_DCL char *FDECL(make_lockname, (const char *, char *)); +static char *FDECL(make_lockname, (const char *, char *)); #endif -STATIC_DCL void FDECL(set_configfile_name, (const char *)); -STATIC_DCL FILE *FDECL(fopen_config_file, (const char *, int)); -STATIC_DCL int FDECL(get_uchars, (char *, uchar *, BOOLEAN_P, +static void FDECL(set_configfile_name, (const char *)); +static FILE *FDECL(fopen_config_file, (const char *, int)); +static int FDECL(get_uchars, (char *, uchar *, BOOLEAN_P, int, const char *)); boolean FDECL(proc_wizkit_line, (char *)); boolean FDECL(parse_config_line, (char *)); -STATIC_DCL boolean FDECL(parse_conf_file, (FILE *, boolean (*proc)(char *))); -STATIC_DCL FILE *NDECL(fopen_sym_file); +static boolean FDECL(parse_conf_file, (FILE *, boolean (*proc)(char *))); +static FILE *NDECL(fopen_sym_file); boolean FDECL(proc_symset_line, (char *)); -STATIC_DCL void FDECL(set_symhandling, (char *, int)); +static void FDECL(set_symhandling, (char *, int)); #ifdef NOCWD_ASSUMPTIONS -STATIC_DCL void FDECL(adjust_prefix, (char *, int)); +static void FDECL(adjust_prefix, (char *, int)); #endif -STATIC_DCL boolean FDECL(config_error_nextline, (const char *)); -STATIC_DCL void NDECL(free_config_sections); -STATIC_DCL char *FDECL(choose_random_part, (char *, CHAR_P)); -STATIC_DCL boolean FDECL(is_config_section, (const char *)); -STATIC_DCL boolean FDECL(handle_config_section, (char *)); -STATIC_DCL void FDECL(parseformat, (int *, char *)); +static boolean FDECL(config_error_nextline, (const char *)); +static void NDECL(free_config_sections); +static char *FDECL(choose_random_part, (char *, CHAR_P)); +static boolean FDECL(is_config_section, (const char *)); +static boolean FDECL(handle_config_section, (char *)); +static void FDECL(parseformat, (int *, char *)); #ifdef SELF_RECOVER -STATIC_DCL boolean FDECL(copy_bytes, (int, int)); +static boolean FDECL(copy_bytes, (int, int)); #endif -STATIC_DCL NHFILE *FDECL(viable_nhfile, (NHFILE *)); +static NHFILE *FDECL(viable_nhfile, (NHFILE *)); /* * fname_encode() @@ -697,7 +697,7 @@ clearlocks() #if defined(SELECTSAVED) /* qsort comparison routine */ -STATIC_OVL int CFDECLSPEC +static int CFDECLSPEC strcmp_wrap(p, q) const void *p; const void *q; @@ -732,7 +732,7 @@ int fd; /* set up "file" to be file name for retrieving bones, and return a * bonesid to be read/written in the bones file. */ -STATIC_OVL char * +static char * set_bonesfile_name(file, lev) char *file; d_level *lev; @@ -795,7 +795,7 @@ d_level *lev; * (we are not reading or writing level files while writing bones files, so * the same array may be used instead of copying.) */ -STATIC_OVL char * +static char * set_bonestemp_name() { char *tf; @@ -1478,7 +1478,7 @@ char **saved; #ifdef COMPRESS -STATIC_OVL void +static void redirect(filename, mode, stream, uncomp) const char *filename, *mode; FILE *stream; @@ -1498,7 +1498,7 @@ boolean uncomp; * * cf. child() in unixunix.c. */ -STATIC_OVL void +static void docompress_file(filename, uncomp) const char *filename; boolean uncomp; @@ -1683,7 +1683,7 @@ const char *filename UNUSED_if_not_COMPRESS; } #ifdef ZLIB_COMP /* RLC 09 Mar 1999: Support internal ZLIB */ -STATIC_OVL boolean +static boolean make_compressed_name(filename, cfn) const char *filename; char *cfn; @@ -1716,7 +1716,7 @@ char *cfn; #endif /* SHORT_FILENAMES */ } -STATIC_OVL void +static void docompress_file(filename, uncomp) const char *filename; boolean uncomp; @@ -1856,7 +1856,7 @@ struct flock sflock; /* for unlocking, same as above */ #define HUP if (!g.program_state.done_hup) #ifndef USE_FCNTL -STATIC_OVL char * +static char * make_lockname(filename, lockname) const char *filename; char *lockname; @@ -2136,7 +2136,7 @@ const char *backward_compat_configfile = "nethack.cnf"; /* remember the name of the file we're accessing; if may be used in option reject messages */ -STATIC_OVL void +static void set_configfile_name(fname) const char *fname; { @@ -2148,7 +2148,7 @@ const char *fname; #define fopenp fopen #endif -STATIC_OVL FILE * +static FILE * fopen_config_file(filename, src) const char *filename; int src; @@ -2291,7 +2291,7 @@ int src; * NOTE: zeros are inserted unless modlist is TRUE, in which case the list * location is unchanged. Callers must handle zeros if modlist is FALSE. */ -STATIC_OVL int +static int get_uchars(bufp, list, modlist, size, name) char *bufp; /* current pointer */ uchar *list; /* return list */ @@ -2352,7 +2352,7 @@ const char *name; /* name of option for error message */ } #ifdef NOCWD_ASSUMPTIONS -STATIC_OVL void +static void adjust_prefix(bufp, prefixid) char *bufp; int prefixid; @@ -2373,7 +2373,7 @@ int prefixid; #endif /* Choose at random one of the sep separated parts from str. Mangles str. */ -STATIC_OVL char * +static char * choose_random_part(str,sep) char *str; char sep; @@ -2413,7 +2413,7 @@ char sep; return (char *) 0; } -STATIC_OVL void +static void free_config_sections() { if (g.config_section_chosen) { @@ -2426,7 +2426,7 @@ free_config_sections() } } -STATIC_OVL boolean +static boolean is_config_section(str) const char *str; { @@ -2435,7 +2435,7 @@ const char *str; return (a && *str == '[' && *(a+1) == '\0' && (int)(a - str) > 0); } -STATIC_OVL boolean +static boolean handle_config_section(buf) char *buf; { @@ -2998,7 +2998,7 @@ boolean secure; config_error_data = tmp; } -STATIC_OVL boolean +static boolean config_error_nextline(line) const char *line; { @@ -3099,7 +3099,7 @@ int src; return rv; } -STATIC_OVL FILE * +static FILE * fopen_wizkit_file() { FILE *fp; @@ -3171,7 +3171,7 @@ fopen_wizkit_file() } /* add to hero's inventory if there's room, otherwise put item on floor */ -STATIC_DCL void +static void wizkit_addinv(obj) struct obj *obj; { @@ -3242,7 +3242,7 @@ read_wizkit() * * Continued lines are merged together with one space in between. */ -STATIC_OVL boolean +static boolean parse_conf_file(fp, proc) FILE *fp; boolean FDECL((*proc), (char *)); @@ -3377,7 +3377,7 @@ boolean FDECL((*proc), (char *)); extern const char *known_handling[]; /* drawing.c */ extern const char *known_restrictions[]; /* drawing.c */ -STATIC_OVL +static FILE * fopen_sym_file() { @@ -3616,7 +3616,7 @@ int which_set; return 1; } -STATIC_OVL void +static void set_symhandling(handling, which_set) char *handling; int which_set; diff --git a/src/fountain.c b/src/fountain.c index 68fe47e5e..d01966119 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -6,11 +6,11 @@ #include "hack.h" -STATIC_DCL void NDECL(dowatersnakes); -STATIC_DCL void NDECL(dowaterdemon); -STATIC_DCL void NDECL(dowaternymph); -STATIC_PTR void FDECL(gush, (int, int, genericptr_t)); -STATIC_DCL void NDECL(dofindgem); +static void NDECL(dowatersnakes); +static void NDECL(dowaterdemon); +static void NDECL(dowaternymph); +static void FDECL(gush, (int, int, genericptr_t)); +static void NDECL(dofindgem); /* used when trying to dip in or drink from fountain or sink or pool while levitating above it, or when trying to move downwards in that state */ @@ -30,7 +30,7 @@ const char *what; } /* Fountain of snakes! */ -STATIC_OVL void +static void dowatersnakes() { register int num = rn1(5, 2); @@ -52,7 +52,7 @@ dowatersnakes() } /* Water demon */ -STATIC_OVL void +static void dowaterdemon() { struct monst *mtmp; @@ -80,7 +80,7 @@ dowaterdemon() } /* Water Nymph */ -STATIC_OVL void +static void dowaternymph() { register struct monst *mtmp; @@ -117,7 +117,7 @@ int drinking; } } -STATIC_PTR void +static void gush(x, y, poolcnt) int x, y; genericptr_t poolcnt; @@ -149,7 +149,7 @@ genericptr_t poolcnt; } /* Find a gem in the sparkling waters. */ -STATIC_OVL void +static void dofindgem() { if (!Blind) diff --git a/src/hack.c b/src/hack.c index 8bd90c8d1..1c1e29391 100644 --- a/src/hack.c +++ b/src/hack.c @@ -7,17 +7,17 @@ /* #define DEBUG */ /* uncomment for debugging */ -STATIC_DCL void NDECL(maybe_wail); -STATIC_DCL int NDECL(moverock); -STATIC_DCL int FDECL(still_chewing, (XCHAR_P, XCHAR_P)); -STATIC_DCL void NDECL(dosinkfall); -STATIC_DCL boolean FDECL(findtravelpath, (int)); -STATIC_DCL boolean FDECL(trapmove, (int, int, struct trap *)); -STATIC_DCL struct monst *FDECL(monstinroom, (struct permonst *, int)); -STATIC_DCL boolean FDECL(doorless_door, (int, int)); -STATIC_DCL void FDECL(move_update, (BOOLEAN_P)); -STATIC_DCL void FDECL(maybe_smudge_engr, (int, int, int, int)); -STATIC_DCL void NDECL(domove_core); +static void NDECL(maybe_wail); +static int NDECL(moverock); +static int FDECL(still_chewing, (XCHAR_P, XCHAR_P)); +static void NDECL(dosinkfall); +static boolean FDECL(findtravelpath, (int)); +static boolean FDECL(trapmove, (int, int, struct trap *)); +static struct monst *FDECL(monstinroom, (struct permonst *, int)); +static boolean FDECL(doorless_door, (int, int)); +static void FDECL(move_update, (BOOLEAN_P)); +static void FDECL(maybe_smudge_engr, (int, int, int, int)); +static void NDECL(domove_core); #define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE) @@ -99,7 +99,7 @@ const char *msg; return revived; } -STATIC_OVL int +static int moverock() { register xchar rx, ry, sx, sy; @@ -366,7 +366,7 @@ moverock() * Chew on a wall, door, or boulder. [What about statues?] * Returns TRUE if still eating, FALSE when done. */ -STATIC_OVL int +static int still_chewing(x, y) xchar x, y; { @@ -531,7 +531,7 @@ register xchar ox, oy; static NEARDATA const char fell_on_sink[] = "fell onto a sink"; -STATIC_OVL void +static void dosinkfall() { register struct obj *obj; @@ -908,7 +908,7 @@ int mode; * inaccessible locations as valid intermediate path points. * Returns TRUE if a path was found. */ -STATIC_OVL boolean +static boolean findtravelpath(mode) int mode; { @@ -1173,7 +1173,7 @@ int x,y; /* try to escape being stuck in a trapped state by walking out of it; return true iff moving should continue to intended destination (all failures and most successful escapes leave hero at original spot) */ -STATIC_OVL boolean +static boolean trapmove(x, y, desttrap) int x, y; /* targetted destination, */ struct trap *desttrap; /* nonnull if another trap at */ @@ -1341,7 +1341,7 @@ domove() g.domove_attempting = 0L; } -STATIC_OVL void +static void domove_core() { register struct monst *mtmp; @@ -1939,7 +1939,7 @@ domove_core() } } -STATIC_OVL void +static void maybe_smudge_engr(x1,y1,x2,y2) int x1, y1, x2, y2; { @@ -2267,7 +2267,7 @@ boolean pick; } /* returns first matching monster */ -STATIC_OVL struct monst * +static struct monst * monstinroom(mdat, roomno) struct permonst *mdat; int roomno; @@ -2378,7 +2378,7 @@ register int x, y; return !has_subrooms; } -STATIC_OVL void +static void move_update(newlev) register boolean newlev; { @@ -2810,7 +2810,7 @@ lookaround() } /* check for a doorway which lacks its door (NODOOR or BROKEN) */ -STATIC_OVL boolean +static boolean doorless_door(x, y) int x, y; { @@ -2925,7 +2925,7 @@ const char *msg_override; } } -STATIC_OVL void +static void maybe_wail() { static short powers[] = { TELEPORT, SEE_INVIS, POISON_RES, COLD_RES, diff --git a/src/hacklib.c b/src/hacklib.c index d8d05c638..ef3e0df0f 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -849,7 +849,7 @@ boolean caseblind; && !defined(_DCC) && !defined(__GNUC__) extern struct tm *FDECL(localtime, (time_t *)); #endif -STATIC_DCL struct tm *NDECL(getlt); +static struct tm *NDECL(getlt); /* Sets the seed for the random number generator */ #ifdef USE_ISAAC64 @@ -930,7 +930,7 @@ getnow() return datetime; } -STATIC_OVL struct tm * +static struct tm * getlt() { time_t date = getnow(); diff --git a/src/invent.c b/src/invent.c index c9d5019f0..4bf1ce934 100644 --- a/src/invent.c +++ b/src/invent.c @@ -13,31 +13,31 @@ #define CONTAINED_SYM '>' /* designator for inside a container */ #define HANDS_SYM '-' -STATIC_DCL void FDECL(loot_classify, (Loot *, struct obj *)); -STATIC_DCL char *FDECL(loot_xname, (struct obj *)); -STATIC_DCL int FDECL(CFDECLSPEC sortloot_cmp, (const genericptr, +static void FDECL(loot_classify, (Loot *, struct obj *)); +static char *FDECL(loot_xname, (struct obj *)); +static int FDECL(CFDECLSPEC sortloot_cmp, (const genericptr, const genericptr)); -STATIC_DCL void NDECL(reorder_invent); -STATIC_DCL void FDECL(noarmor, (BOOLEAN_P)); -STATIC_DCL void FDECL(invdisp_nothing, (const char *, const char *)); -STATIC_DCL boolean FDECL(worn_wield_only, (struct obj *)); -STATIC_DCL boolean FDECL(only_here, (struct obj *)); -STATIC_DCL void FDECL(compactify, (char *)); -STATIC_DCL boolean FDECL(taking_off, (const char *)); -STATIC_DCL boolean FDECL(putting_on, (const char *)); -STATIC_PTR int FDECL(ckvalidcat, (struct obj *)); -STATIC_PTR int FDECL(ckunpaid, (struct obj *)); -STATIC_PTR char *FDECL(safeq_xprname, (struct obj *)); -STATIC_PTR char *FDECL(safeq_shortxprname, (struct obj *)); -STATIC_DCL char FDECL(display_pickinv, (const char *, const char *, +static void NDECL(reorder_invent); +static void FDECL(noarmor, (BOOLEAN_P)); +static void FDECL(invdisp_nothing, (const char *, const char *)); +static boolean FDECL(worn_wield_only, (struct obj *)); +static boolean FDECL(only_here, (struct obj *)); +static void FDECL(compactify, (char *)); +static boolean FDECL(taking_off, (const char *)); +static boolean FDECL(putting_on, (const char *)); +static int FDECL(ckvalidcat, (struct obj *)); +static int FDECL(ckunpaid, (struct obj *)); +static char *FDECL(safeq_xprname, (struct obj *)); +static char *FDECL(safeq_shortxprname, (struct obj *)); +static char FDECL(display_pickinv, (const char *, const char *, const char *, BOOLEAN_P, long *)); -STATIC_DCL char FDECL(display_used_invlets, (CHAR_P)); -STATIC_DCL boolean FDECL(this_type_only, (struct obj *)); -STATIC_DCL void NDECL(dounpaid); -STATIC_DCL struct obj *FDECL(find_unpaid, (struct obj *, struct obj **)); -STATIC_DCL void FDECL(menu_identify, (int)); -STATIC_DCL boolean FDECL(tool_in_use, (struct obj *)); -STATIC_DCL char FDECL(obj_to_let, (struct obj *)); +static char FDECL(display_used_invlets, (CHAR_P)); +static boolean FDECL(this_type_only, (struct obj *)); +static void NDECL(dounpaid); +static struct obj *FDECL(find_unpaid, (struct obj *, struct obj **)); +static void FDECL(menu_identify, (int)); +static boolean FDECL(tool_in_use, (struct obj *)); +static char FDECL(obj_to_let, (struct obj *)); /* wizards can wish for venom, which will become an invisible inventory * item without this. putting it in inv_order would mean venom would @@ -51,7 +51,7 @@ STATIC_DCL char FDECL(obj_to_let, (struct obj *)); static const char venom_inv[] = { VENOM_CLASS, 0 }; /* (constant) */ /* sortloot() classification; called at most once [per sort] for each object */ -STATIC_OVL void +static void loot_classify(sort_item, obj) Loot *sort_item; struct obj *obj; @@ -209,7 +209,7 @@ struct obj *obj; } /* sortloot() formatting routine; for alphabetizing, not shown to user */ -STATIC_OVL char * +static char * loot_xname(obj) struct obj *obj; { @@ -293,7 +293,7 @@ struct obj *obj; } /* qsort comparison routine for sortloot() */ -STATIC_OVL int CFDECLSPEC +static int CFDECLSPEC sortloot_cmp(vptr1, vptr2) const genericptr vptr1; const genericptr vptr2; @@ -620,7 +620,7 @@ register struct obj *otmp; #define inv_rank(o) ((o)->invlet ^ 040) /* sort the inventory; used by addinv() and doorganize() */ -STATIC_OVL void +static void reorder_invent() { struct obj *otmp, *prev, *next; @@ -1344,7 +1344,7 @@ register int x, y; } /* compact a string of inventory letters by dashing runs of letters */ -STATIC_OVL void +static void compactify(buf) register char *buf; { @@ -1391,7 +1391,7 @@ struct obj *obj; } /* match the prompt for either 'T' or 'R' command */ -STATIC_OVL boolean +static boolean taking_off(action) const char *action; { @@ -1399,7 +1399,7 @@ const char *action; } /* match the prompt for either 'W' or 'P' command */ -STATIC_OVL boolean +static boolean putting_on(action) const char *action; { @@ -1856,7 +1856,7 @@ struct obj *otmp; pline(silly_thing_to, word); } -STATIC_PTR int +static int ckvalidcat(otmp) struct obj *otmp; { @@ -1864,7 +1864,7 @@ struct obj *otmp; return (int) allow_category(otmp); } -STATIC_PTR int +static int ckunpaid(otmp) struct obj *otmp; { @@ -1888,13 +1888,13 @@ struct obj *otmp; } /* extra xprname() input that askchain() can't pass through safe_qbuf() */ -STATIC_VAR struct xprnctx { +static struct xprnctx { char let; boolean dot; } safeq_xprn_ctx; /* safe_qbuf() -> short_oname() callback */ -STATIC_PTR char * +static char * safeq_xprname(obj) struct obj *obj; { @@ -1903,7 +1903,7 @@ struct obj *obj; } /* alternate safe_qbuf() -> short_oname() callback */ -STATIC_PTR char * +static char * safeq_shortxprname(obj) struct obj *obj; { @@ -2281,7 +2281,7 @@ struct obj *otmp; } /* menu of unidentified objects; select and identify up to id_limit of them */ -STATIC_OVL void +static void menu_identify(id_limit) int id_limit; { @@ -2394,7 +2394,7 @@ learn_unseen_invent() } /* should of course only be called for things in invent */ -STATIC_OVL char +static char obj_to_let(obj) struct obj *obj; { @@ -2484,7 +2484,7 @@ ddoinv() * next unpaid object is returned. This routine recursively follows * containers. */ -STATIC_OVL struct obj * +static struct obj * find_unpaid(list, last_found) struct obj *list, **last_found; { @@ -2522,7 +2522,7 @@ free_pickinv_cache() * inventory and return a count as well as a letter. If out_cnt is not null, * any count returned from the menu selection is placed here. */ -STATIC_OVL char +static char display_pickinv(lets, xtra_choice, query, want_reply, out_cnt) register const char *lets; const char *xtra_choice; /* "fingers", pick hands rather than an object */ @@ -2774,7 +2774,7 @@ boolean want_reply; * Show what is current using inventory letters. * */ -STATIC_OVL char +static char display_used_invlets(avoidlet) char avoidlet; { @@ -2959,7 +2959,7 @@ boolean nested, /* include contents of any nested containers */ return count; } -STATIC_OVL void +static void dounpaid() { winid win; @@ -3061,7 +3061,7 @@ dounpaid() } -STATIC_OVL boolean +static boolean this_type_only(obj) struct obj *obj; { @@ -3701,7 +3701,7 @@ doprwep() } /* caller is responsible for checking !wearing_armor() */ -STATIC_OVL void +static void noarmor(report_uskin) boolean report_uskin; { @@ -3790,7 +3790,7 @@ dopramulet() return 0; } -STATIC_OVL boolean +static boolean tool_in_use(obj) struct obj *obj; { @@ -3873,13 +3873,13 @@ long numused; * Conversion from a class to a string for printing. * This must match the object class order. */ -STATIC_VAR NEARDATA const char *names[] = { +static NEARDATA const char *names[] = { 0, "Illegal objects", "Weapons", "Armor", "Rings", "Amulets", "Tools", "Comestibles", "Potions", "Scrolls", "Spellbooks", "Wands", "Coins", "Gems/Stones", "Boulders/Statues", "Iron balls", "Chains", "Venoms" }; -STATIC_VAR NEARDATA const char oth_symbols[] = { CONTAINED_SYM, '\0' }; -STATIC_VAR NEARDATA const char *oth_names[] = { "Bagged/Boxed items" }; +static NEARDATA const char oth_symbols[] = { CONTAINED_SYM, '\0' }; +static NEARDATA const char *oth_names[] = { "Bagged/Boxed items" }; char * let_to_name(let, unpaid, showsym) @@ -4239,7 +4239,7 @@ doorganize() /* inventory organizer by Del Lamb */ } /* common to display_minventory and display_cinventory */ -STATIC_OVL void +static void invdisp_nothing(hdr, txt) const char *hdr, *txt; { @@ -4262,7 +4262,7 @@ const char *hdr, *txt; } /* query_objlist callback: return things that are worn or wielded */ -STATIC_OVL boolean +static boolean worn_wield_only(obj) struct obj *obj; { @@ -4375,7 +4375,7 @@ register struct obj *obj; } -STATIC_OVL boolean +static boolean only_here(obj) struct obj *obj; { diff --git a/src/light.c b/src/light.c index f4c8dcd60..328a69f1c 100644 --- a/src/light.c +++ b/src/light.c @@ -45,8 +45,8 @@ #define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */ /* SAVE2018 */ -STATIC_DCL void FDECL(write_ls, (NHFILE *, light_source *)); -STATIC_DCL int FDECL(maybe_write_ls, (NHFILE *, int, BOOLEAN_P)); +static void FDECL(write_ls, (NHFILE *, light_source *)); +static int FDECL(maybe_write_ls, (NHFILE *, int, BOOLEAN_P)); /* imported from vision.c, for small circles */ extern char circle_data[]; @@ -453,7 +453,7 @@ boolean ghostly; * sources that would be written. If write_it is true, actually write * the light source out. */ -STATIC_OVL int +static int maybe_write_ls(nhfp, range, write_it) NHFILE *nhfp; int range; @@ -520,14 +520,14 @@ light_sources_sanity_check() /* SAVE2018 */ #if 0 -STATIC_OVL void +static void write_ls(fd, ls) int fd; light_source *ls; #endif /* 0 */ /* Write a light source structure to disk. */ -STATIC_OVL void +static void write_ls(nhfp, ls) NHFILE *nhfp; light_source *ls; diff --git a/src/lock.c b/src/lock.c index 6dbc39287..1ebb9cdac 100644 --- a/src/lock.c +++ b/src/lock.c @@ -6,12 +6,12 @@ #include "hack.h" /* occupation callbacks */ -STATIC_PTR int NDECL(picklock); -STATIC_PTR int NDECL(forcelock); +static int NDECL(picklock); +static int NDECL(forcelock); -STATIC_DCL const char *NDECL(lock_action); -STATIC_DCL boolean FDECL(obstructed, (int, int, BOOLEAN_P)); -STATIC_DCL void FDECL(chest_shatter_msg, (struct obj *)); +static const char *NDECL(lock_action); +static boolean FDECL(obstructed, (int, int, BOOLEAN_P)); +static void FDECL(chest_shatter_msg, (struct obj *)); boolean picking_lock(x, y) @@ -35,7 +35,7 @@ int x, y; } /* produce an occupation string appropriate for the current activity */ -STATIC_OVL const char * +static const char * lock_action() { /* "unlocking"+2 == "locking" */ @@ -65,7 +65,7 @@ lock_action() } /* try to open/close a lock */ -STATIC_PTR int +static int picklock(VOID_ARGS) { if (g.xlock.box) { @@ -211,7 +211,7 @@ boolean destroyit; } /* try to force a locked chest */ -STATIC_PTR int +static int forcelock(VOID_ARGS) { if ((g.xlock.box->ox != u.ux) || (g.xlock.box->oy != u.uy)) @@ -729,7 +729,7 @@ int x, y; return 1; } -STATIC_OVL boolean +static boolean obstructed(x, y, quietly) register int x, y; boolean quietly; @@ -1061,7 +1061,7 @@ int x, y; return res; } -STATIC_OVL void +static void chest_shatter_msg(otmp) struct obj *otmp; { diff --git a/src/mail.c b/src/mail.c index 292ca3409..141823b55 100644 --- a/src/mail.c +++ b/src/mail.c @@ -36,10 +36,10 @@ * random intervals. */ -STATIC_DCL boolean FDECL(md_start, (coord *)); -STATIC_DCL boolean FDECL(md_stop, (coord *, coord *)); -STATIC_DCL boolean FDECL(md_rush, (struct monst *, int, int)); -STATIC_DCL void FDECL(newmail, (struct mail_info *)); +static boolean FDECL(md_start, (coord *)); +static boolean FDECL(md_stop, (coord *, coord *)); +static boolean FDECL(md_rush, (struct monst *, int, int)); +static void FDECL(newmail, (struct mail_info *)); #if !defined(UNIX) && !defined(VMS) int mustgetmail = -1; @@ -138,7 +138,7 @@ getmailstatus() * Pick coordinates for a starting position for the mail daemon. Called * from newmail() and newphone(). */ -STATIC_OVL boolean +static boolean md_start(startp) coord *startp; { @@ -238,7 +238,7 @@ coord *startp; * enexto(). Use enexto() as a last resort because enexto() chooses * its point randomly, which is not what we want. */ -STATIC_OVL boolean +static boolean md_stop(stopp, startp) coord *stopp; /* stopping position (we fill it in) */ coord *startp; /* starting position (read only) */ @@ -279,7 +279,7 @@ static NEARDATA const char *mail_text[] = { "Gangway!", "Look out!", * FALSE if the md gets stuck in a position where there is a monster. Return * TRUE otherwise. */ -STATIC_OVL boolean +static boolean md_rush(md, tx, ty) struct monst *md; register int tx, ty; /* destination of mail daemon */ @@ -382,7 +382,7 @@ register int tx, ty; /* destination of mail daemon */ /* Deliver a scroll of mail. */ /*ARGSUSED*/ -STATIC_OVL void +static void newmail(info) struct mail_info *info; { diff --git a/src/makemon.c b/src/makemon.c index 726b671d3..f38864433 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -14,15 +14,15 @@ (mptr->mlet == S_HUMAN && Role_if(role_pm) \ && (mptr->msound == MS_LEADER || mptr->msound == MS_NEMESIS)) -STATIC_DCL boolean FDECL(uncommon, (int)); -STATIC_DCL int FDECL(align_shift, (struct permonst *)); -STATIC_DCL boolean FDECL(mk_gen_ok, (int, int, int)); -STATIC_DCL boolean FDECL(wrong_elem_type, (struct permonst *)); -STATIC_DCL void FDECL(m_initgrp, (struct monst *, int, int, int, int)); -STATIC_DCL void FDECL(m_initthrow, (struct monst *, int, int)); -STATIC_DCL void FDECL(m_initweap, (struct monst *)); -STATIC_DCL void FDECL(m_initinv, (struct monst *)); -STATIC_DCL boolean FDECL(makemon_rnd_goodpos, (struct monst *, +static boolean FDECL(uncommon, (int)); +static int FDECL(align_shift, (struct permonst *)); +static boolean FDECL(mk_gen_ok, (int, int, int)); +static boolean FDECL(wrong_elem_type, (struct permonst *)); +static void FDECL(m_initgrp, (struct monst *, int, int, int, int)); +static void FDECL(m_initthrow, (struct monst *, int, int)); +static void FDECL(m_initweap, (struct monst *)); +static void FDECL(m_initinv, (struct monst *)); +static boolean FDECL(makemon_rnd_goodpos, (struct monst *, unsigned, coord *)); #define m_initsgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 3, mmf) @@ -51,7 +51,7 @@ struct permonst *ptr; /* * Return true if the given monster cannot exist on this elemental level. */ -STATIC_OVL boolean +static boolean wrong_elem_type(ptr) struct permonst *ptr; { @@ -75,7 +75,7 @@ struct permonst *ptr; } /* make a group just like mtmp */ -STATIC_OVL void +static void m_initgrp(mtmp, x, y, n, mmflags) struct monst *mtmp; int x, y, n, mmflags; @@ -143,7 +143,7 @@ int x, y, n, mmflags; } } -STATIC_OVL +static void m_initthrow(mtmp, otyp, oquan) struct monst *mtmp; @@ -159,7 +159,7 @@ int otyp, oquan; (void) mpickobj(mtmp, otmp); } -STATIC_OVL void +static void m_initweap(mtmp) register struct monst *mtmp; { @@ -575,7 +575,7 @@ long amount; add_to_minv(mtmp, gold); } -STATIC_OVL void +static void m_initinv(mtmp) register struct monst *mtmp; { @@ -1033,7 +1033,7 @@ newmextra() return mextra; } -STATIC_OVL boolean +static boolean makemon_rnd_goodpos(mon, gpflags, cc) struct monst *mon; unsigned gpflags; @@ -1465,7 +1465,7 @@ boolean neverask; return known; } -STATIC_OVL boolean +static boolean uncommon(mndx) int mndx; { @@ -1484,7 +1484,7 @@ int mndx; * comparing the dungeon alignment and monster alignment. * return an integer in the range of 0-5. */ -STATIC_OVL int +static int align_shift(ptr) register struct permonst *ptr; { @@ -1614,7 +1614,7 @@ int mndx; /* particular species that can no longer be created */ } /* decide whether it's ok to generate a candidate monster by mkclass() */ -STATIC_OVL boolean +static boolean mk_gen_ok(mndx, mvflagsmask, genomask) int mndx, mvflagsmask, genomask; { diff --git a/src/mcastu.c b/src/mcastu.c index 9978742cd..5766f061c 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -35,20 +35,20 @@ enum mcast_cleric_spells { CLC_GEYSER }; -STATIC_DCL void FDECL(cursetxt, (struct monst *, BOOLEAN_P)); -STATIC_DCL int FDECL(choose_magic_spell, (int)); -STATIC_DCL int FDECL(choose_clerical_spell, (int)); -STATIC_DCL int FDECL(m_cure_self, (struct monst *, int)); -STATIC_DCL void FDECL(cast_wizard_spell, (struct monst *, int, int)); -STATIC_DCL void FDECL(cast_cleric_spell, (struct monst *, int, int)); -STATIC_DCL boolean FDECL(is_undirected_spell, (unsigned int, int)); -STATIC_DCL boolean +static void FDECL(cursetxt, (struct monst *, BOOLEAN_P)); +static int FDECL(choose_magic_spell, (int)); +static int FDECL(choose_clerical_spell, (int)); +static int FDECL(m_cure_self, (struct monst *, int)); +static void FDECL(cast_wizard_spell, (struct monst *, int, int)); +static void FDECL(cast_cleric_spell, (struct monst *, int, int)); +static boolean FDECL(is_undirected_spell, (unsigned int, int)); +static boolean FDECL(spell_would_be_useless, (struct monst *, unsigned int, int)); extern const char *const flash_types[]; /* from zap.c */ /* feedback when frustrated monster couldn't cast a spell */ -STATIC_OVL +static void cursetxt(mtmp, undirected) struct monst *mtmp; @@ -78,7 +78,7 @@ boolean undirected; /* convert a level based random selection into a specific mage spell; inappropriate choices will be screened out by spell_would_be_useless() */ -STATIC_OVL int +static int choose_magic_spell(spellval) int spellval; { @@ -133,7 +133,7 @@ int spellval; } /* convert a level based random selection into a specific cleric spell */ -STATIC_OVL int +static int choose_clerical_spell(spellnum) int spellnum; { @@ -337,7 +337,7 @@ boolean foundyou; return (ret); } -STATIC_OVL int +static int m_cure_self(mtmp, dmg) struct monst *mtmp; int dmg; @@ -362,7 +362,7 @@ int dmg; If you modify either of these, be sure to change is_undirected_spell() and spell_would_be_useless(). */ -STATIC_OVL +static void cast_wizard_spell(mtmp, dmg, spellnum) struct monst *mtmp; @@ -519,7 +519,7 @@ int spellnum; mdamageu(mtmp, dmg); } -STATIC_OVL +static void cast_cleric_spell(mtmp, dmg, spellnum) struct monst *mtmp; @@ -731,7 +731,7 @@ int spellnum; mdamageu(mtmp, dmg); } -STATIC_DCL +static boolean is_undirected_spell(adtyp, spellnum) unsigned int adtyp; @@ -762,7 +762,7 @@ int spellnum; } /* Some spells are useless under some circumstances. */ -STATIC_DCL +static boolean spell_would_be_useless(mtmp, adtyp, spellnum) struct monst *mtmp; diff --git a/src/mhitm.c b/src/mhitm.c index 4ec135520..7420cc1ab 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -9,26 +9,26 @@ static const char brief_feeling[] = "have a %s feeling for a moment, then it passes."; -STATIC_DCL int FDECL(hitmm, (struct monst *, struct monst *, +static int FDECL(hitmm, (struct monst *, struct monst *, struct attack *)); -STATIC_DCL int FDECL(gazemm, (struct monst *, struct monst *, +static int FDECL(gazemm, (struct monst *, struct monst *, struct attack *)); -STATIC_DCL int FDECL(gulpmm, (struct monst *, struct monst *, +static int FDECL(gulpmm, (struct monst *, struct monst *, struct attack *)); -STATIC_DCL int FDECL(explmm, (struct monst *, struct monst *, +static int FDECL(explmm, (struct monst *, struct monst *, struct attack *)); -STATIC_DCL int FDECL(mdamagem, (struct monst *, struct monst *, +static int FDECL(mdamagem, (struct monst *, struct monst *, struct attack *)); -STATIC_DCL void FDECL(mswingsm, (struct monst *, struct monst *, +static void FDECL(mswingsm, (struct monst *, struct monst *, struct obj *)); -STATIC_DCL void FDECL(noises, (struct monst *, struct attack *)); -STATIC_DCL void FDECL(missmm, (struct monst *, struct monst *, +static void FDECL(noises, (struct monst *, struct attack *)); +static void FDECL(missmm, (struct monst *, struct monst *, struct attack *)); -STATIC_DCL int FDECL(passivemm, (struct monst *, struct monst *, +static int FDECL(passivemm, (struct monst *, struct monst *, BOOLEAN_P, int)); -STATIC_OVL void +static void noises(magr, mattk) register struct monst *magr; register struct attack *mattk; @@ -44,7 +44,7 @@ register struct attack *mattk; } } -STATIC_OVL +static void missmm(magr, mdef, mattk) register struct monst *magr, *mdef; @@ -496,7 +496,7 @@ register struct monst *magr, *mdef; } /* Returns the result of mdamagem(). */ -STATIC_OVL int +static int hitmm(magr, mdef, mattk) register struct monst *magr, *mdef; struct attack *mattk; @@ -556,7 +556,7 @@ struct attack *mattk; } /* Returns the same values as mdamagem(). */ -STATIC_OVL int +static int gazemm(magr, mdef, mattk) register struct monst *magr, *mdef; struct attack *mattk; @@ -642,7 +642,7 @@ struct monst *magr, *mdef; } /* Returns the same values as mattackm(). */ -STATIC_OVL int +static int gulpmm(magr, mdef, mattk) register struct monst *magr, *mdef; register struct attack *mattk; @@ -730,7 +730,7 @@ register struct attack *mattk; return status; } -STATIC_OVL int +static int explmm(magr, mdef, mattk) struct monst *magr, *mdef; struct attack *mattk; @@ -1471,7 +1471,7 @@ struct obj *obj; (void) erode_obj(obj, (char *) 0, dmgtyp, EF_GREASE | EF_VERBOSE); } -STATIC_OVL void +static void mswingsm(magr, mdef, otemp) struct monst *magr, *mdef; struct obj *otemp; @@ -1488,7 +1488,7 @@ struct obj *otemp; * Passive responses by defenders. Does not replicate responses already * handled above. Returns same values as mattackm. */ -STATIC_OVL int +static int passivemm(magr, mdef, mhit, mdead) register struct monst *magr, *mdef; boolean mhit; diff --git a/src/mhitu.c b/src/mhitu.c index c4527a26c..b063ba367 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -6,23 +6,23 @@ #include "hack.h" #include "artifact.h" -STATIC_VAR NEARDATA struct obj *mon_currwep = (struct obj *) 0; +static NEARDATA struct obj *mon_currwep = (struct obj *) 0; -STATIC_DCL boolean FDECL(u_slip_free, (struct monst *, struct attack *)); -STATIC_DCL int FDECL(passiveum, (struct permonst *, struct monst *, +static boolean FDECL(u_slip_free, (struct monst *, struct attack *)); +static int FDECL(passiveum, (struct permonst *, struct monst *, struct attack *)); -STATIC_DCL void FDECL(mayberem, (struct monst *, const char *, +static void FDECL(mayberem, (struct monst *, const char *, struct obj *, const char *)); -STATIC_DCL boolean FDECL(diseasemu, (struct permonst *)); -STATIC_DCL int FDECL(hitmu, (struct monst *, struct attack *)); -STATIC_DCL int FDECL(gulpmu, (struct monst *, struct attack *)); -STATIC_DCL int FDECL(explmu, (struct monst *, struct attack *, BOOLEAN_P)); -STATIC_DCL void FDECL(missmu, (struct monst *, BOOLEAN_P, struct attack *)); -STATIC_DCL void FDECL(mswings, (struct monst *, struct obj *)); -STATIC_DCL void FDECL(wildmiss, (struct monst *, struct attack *)); -STATIC_DCL void FDECL(hitmsg, (struct monst *, struct attack *)); +static boolean FDECL(diseasemu, (struct permonst *)); +static int FDECL(hitmu, (struct monst *, struct attack *)); +static int FDECL(gulpmu, (struct monst *, struct attack *)); +static int FDECL(explmu, (struct monst *, struct attack *, BOOLEAN_P)); +static void FDECL(missmu, (struct monst *, BOOLEAN_P, struct attack *)); +static void FDECL(mswings, (struct monst *, struct obj *)); +static void FDECL(wildmiss, (struct monst *, struct attack *)); +static void FDECL(hitmsg, (struct monst *, struct attack *)); -STATIC_OVL void +static void hitmsg(mtmp, mattk) struct monst *mtmp; struct attack *mattk; @@ -73,7 +73,7 @@ struct attack *mattk; } /* monster missed you */ -STATIC_OVL void +static void missmu(mtmp, nearmiss, mattk) struct monst *mtmp; boolean nearmiss; @@ -92,7 +92,7 @@ struct attack *mattk; } /* monster swings obj */ -STATIC_OVL void +static void mswings(mtmp, otemp) struct monst *mtmp; struct obj *otemp; @@ -135,7 +135,7 @@ u_slow_down() } /* monster attacked your displaced image */ -STATIC_OVL void +static void wildmiss(mtmp, mattk) struct monst *mtmp; struct attack *mattk; @@ -809,7 +809,7 @@ register struct monst *mtmp; return 0; } -STATIC_OVL boolean +static boolean diseasemu(mdat) struct permonst *mdat; { @@ -824,7 +824,7 @@ struct permonst *mdat; } /* check whether slippery clothing protects from hug or wrap attack */ -STATIC_OVL boolean +static boolean u_slip_free(mtmp, mattk) struct monst *mtmp; struct attack *mattk; @@ -913,7 +913,7 @@ struct monst *mon; * 3 if the monster lives but teleported/paralyzed, so it can't keep * attacking you */ -STATIC_OVL int +static int hitmu(mtmp, mattk) register struct monst *mtmp; register struct attack *mattk; @@ -1772,7 +1772,7 @@ gulp_blnd_check() } /* monster swallows you, or damage if u.uswallow */ -STATIC_OVL int +static int gulpmu(mtmp, mattk) struct monst *mtmp; struct attack *mattk; @@ -2023,7 +2023,7 @@ struct attack *mattk; } /* monster explodes in your face */ -STATIC_OVL int +static int explmu(mtmp, mattk, ufound) struct monst *mtmp; struct attack *mattk; @@ -2713,7 +2713,7 @@ struct monst *mon; return 1; } -STATIC_OVL void +static void mayberem(mon, seducer, obj, str) struct monst *mon; const char *seducer; /* only used for alternate message */ @@ -2766,7 +2766,7 @@ const char *str; * to know whether hero reverted in order to decide whether passive * damage applies. */ -STATIC_OVL int +static int passiveum(olduasmon, mtmp, mattk) struct permonst *olduasmon; struct monst *mtmp; diff --git a/src/mklev.c b/src/mklev.c index 9bf6882df..57ee19a63 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -9,31 +9,31 @@ /* croom->lx etc are schar (width <= int), so % arith ensures that */ /* conversion of result to int is reasonable */ -STATIC_DCL void FDECL(mkfount, (int, struct mkroom *)); -STATIC_DCL void FDECL(mksink, (struct mkroom *)); -STATIC_DCL void FDECL(mkaltar, (struct mkroom *)); -STATIC_DCL void FDECL(mkgrave, (struct mkroom *)); -STATIC_DCL void NDECL(makevtele); -STATIC_DCL void NDECL(clear_level_structures); -STATIC_DCL void NDECL(makelevel); -STATIC_DCL boolean FDECL(bydoor, (XCHAR_P, XCHAR_P)); -STATIC_DCL struct mkroom *FDECL(find_branch_room, (coord *)); -STATIC_DCL struct mkroom *FDECL(pos_to_room, (XCHAR_P, XCHAR_P)); -STATIC_DCL boolean FDECL(place_niche, (struct mkroom *, int *, int *, int *)); -STATIC_DCL void FDECL(makeniche, (int)); -STATIC_DCL void NDECL(make_niches); -STATIC_PTR int FDECL(CFDECLSPEC do_comp, (const genericptr, +static void FDECL(mkfount, (int, struct mkroom *)); +static void FDECL(mksink, (struct mkroom *)); +static void FDECL(mkaltar, (struct mkroom *)); +static void FDECL(mkgrave, (struct mkroom *)); +static void NDECL(makevtele); +static void NDECL(clear_level_structures); +static void NDECL(makelevel); +static boolean FDECL(bydoor, (XCHAR_P, XCHAR_P)); +static struct mkroom *FDECL(find_branch_room, (coord *)); +static struct mkroom *FDECL(pos_to_room, (XCHAR_P, XCHAR_P)); +static boolean FDECL(place_niche, (struct mkroom *, int *, int *, int *)); +static void FDECL(makeniche, (int)); +static void NDECL(make_niches); +static int FDECL(CFDECLSPEC do_comp, (const genericptr, const genericptr)); -STATIC_DCL void FDECL(dosdoor, (XCHAR_P, XCHAR_P, struct mkroom *, int)); -STATIC_DCL void FDECL(join, (int, int, BOOLEAN_P)); -STATIC_DCL void FDECL(do_room_or_subroom, (struct mkroom *, int, int, +static void FDECL(dosdoor, (XCHAR_P, XCHAR_P, struct mkroom *, int)); +static void FDECL(join, (int, int, BOOLEAN_P)); +static void FDECL(do_room_or_subroom, (struct mkroom *, int, int, int, int, BOOLEAN_P, SCHAR_P, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL void NDECL(makerooms); -STATIC_DCL void FDECL(finddpos, (coord *, XCHAR_P, XCHAR_P, +static void NDECL(makerooms); +static void FDECL(finddpos, (coord *, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -STATIC_DCL void FDECL(mkinvpos, (XCHAR_P, XCHAR_P, int)); -STATIC_DCL void FDECL(mk_knox_portal, (XCHAR_P, XCHAR_P)); +static void FDECL(mkinvpos, (XCHAR_P, XCHAR_P, int)); +static void FDECL(mk_knox_portal, (XCHAR_P, XCHAR_P)); #define create_vault() create_room(-1, -1, 2, 2, -1, -1, VAULT, TRUE) #define init_vault() g.vault_x = -1 @@ -41,7 +41,7 @@ STATIC_DCL void FDECL(mk_knox_portal, (XCHAR_P, XCHAR_P)); /* Args must be (const genericptr) so that qsort will always be happy. */ -STATIC_PTR int CFDECLSPEC +static int CFDECLSPEC do_comp(vx, vy) const genericptr vx; const genericptr vy; @@ -63,7 +63,7 @@ const genericptr vy; #endif /* LINT */ } -STATIC_OVL void +static void finddpos(cc, xl, yl, xh, yh) coord *cc; xchar xl, yl, xh, yh; @@ -105,7 +105,7 @@ sort_rooms() #undef CAST_nroom } -STATIC_OVL void +static void do_room_or_subroom(croom, lowx, lowy, hix, hiy, lit, rtype, special, is_room) register struct mkroom *croom; int lowx, lowy; @@ -217,7 +217,7 @@ boolean special; g.nsubroom++; } -STATIC_OVL void +static void makerooms() { boolean tried_vault = FALSE; @@ -238,7 +238,7 @@ makerooms() return; } -STATIC_OVL void +static void join(a, b, nxcor) register int a, b; boolean nxcor; @@ -378,7 +378,7 @@ register struct mkroom *aroom; g.doors[aroom->fdoor].y = y; } -STATIC_OVL void +static void dosdoor(x, y, aroom, type) register xchar x, y; struct mkroom *aroom; @@ -445,7 +445,7 @@ int type; add_door(x, y, aroom); } -STATIC_OVL boolean +static boolean place_niche(aroom, dy, xx, yy) register struct mkroom *aroom; int *dy, *xx, *yy; @@ -478,7 +478,7 @@ static NEARDATA const char *trap_engravings[TRAPNUM] = { (char *) 0, (char *) 0, (char *) 0, (char *) 0, (char *) 0, }; -STATIC_OVL void +static void makeniche(trap_type) int trap_type; { @@ -543,7 +543,7 @@ int trap_type; } } -STATIC_OVL void +static void make_niches() { int ct = rnd((g.nroom >> 1) + 1), dep = depth(&u.uz); @@ -562,7 +562,7 @@ make_niches() } } -STATIC_OVL void +static void makevtele() { makeniche(TELEP_TRAP); @@ -573,7 +573,7 @@ makevtele() * special) but it's easier to put it all in one place than make sure * each type initializes what it needs to separately. */ -STATIC_OVL void +static void clear_level_structures() { static struct rm zerorm = { cmap_to_glyph(S_stone), @@ -644,7 +644,7 @@ clear_level_structures() clear_regions(); } -STATIC_OVL void +static void makelevel() { register struct mkroom *croom, *troom; @@ -1096,7 +1096,7 @@ struct mkroom *croom; } /* Find an unused room for a branch location. */ -STATIC_OVL struct mkroom * +static struct mkroom * find_branch_room(mp) coord *mp; { @@ -1127,7 +1127,7 @@ coord *mp; } /* Find the room for (x,y). Return null if not in a room. */ -STATIC_OVL struct mkroom * +static struct mkroom * pos_to_room(x, y) xchar x, y; { @@ -1201,7 +1201,7 @@ xchar x, y; /* location */ g.made_branch = TRUE; } -STATIC_OVL boolean +static boolean bydoor(x, y) register xchar x, y; { @@ -1562,7 +1562,7 @@ struct mkroom *croom; levl[x][y].ladder = up ? LA_UP : LA_DOWN; } -STATIC_OVL void +static void mkfount(mazeflag, croom) int mazeflag; struct mkroom *croom; @@ -1588,7 +1588,7 @@ struct mkroom *croom; g.level.flags.nfountains++; } -STATIC_OVL void +static void mksink(croom) struct mkroom *croom; { @@ -1608,7 +1608,7 @@ struct mkroom *croom; g.level.flags.nsinks++; } -STATIC_OVL void +static void mkaltar(croom) struct mkroom *croom; { @@ -1759,7 +1759,7 @@ mkinvokearea() /* Change level topology. Boulders in the vicinity are eliminated. * Temporarily overrides vision in the name of a nice effect. */ -STATIC_OVL void +static void mkinvpos(x, y, dist) xchar x, y; int dist; @@ -1856,7 +1856,7 @@ int dist; * * Ludios will remain isolated until the branch is corrected by this function. */ -STATIC_OVL void +static void mk_knox_portal(x, y) xchar x, y; { diff --git a/src/mkmap.c b/src/mkmap.c index 59eec1949..868e93f36 100644 --- a/src/mkmap.c +++ b/src/mkmap.c @@ -8,20 +8,20 @@ #define HEIGHT (ROWNO - 1) #define WIDTH (COLNO - 2) -STATIC_DCL void FDECL(init_map, (SCHAR_P)); -STATIC_DCL void FDECL(init_fill, (SCHAR_P, SCHAR_P)); -STATIC_DCL schar FDECL(get_map, (int, int, SCHAR_P)); -STATIC_DCL void FDECL(pass_one, (SCHAR_P, SCHAR_P)); -STATIC_DCL void FDECL(pass_two, (SCHAR_P, SCHAR_P)); -STATIC_DCL void FDECL(pass_three, (SCHAR_P, SCHAR_P)); -STATIC_DCL void NDECL(wallify_map); -STATIC_DCL void FDECL(join_map, (SCHAR_P, SCHAR_P)); -STATIC_DCL void FDECL(finish_map, +static void FDECL(init_map, (SCHAR_P)); +static void FDECL(init_fill, (SCHAR_P, SCHAR_P)); +static schar FDECL(get_map, (int, int, SCHAR_P)); +static void FDECL(pass_one, (SCHAR_P, SCHAR_P)); +static void FDECL(pass_two, (SCHAR_P, SCHAR_P)); +static void FDECL(pass_three, (SCHAR_P, SCHAR_P)); +static void NDECL(wallify_map); +static void FDECL(join_map, (SCHAR_P, SCHAR_P)); +static void FDECL(finish_map, (SCHAR_P, SCHAR_P, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL void FDECL(remove_room, (unsigned)); +static void FDECL(remove_room, (unsigned)); void FDECL(mkmap, (lev_init *)); -STATIC_OVL void +static void init_map(bg_typ) schar bg_typ; { @@ -32,7 +32,7 @@ schar bg_typ; levl[i][j].typ = bg_typ; } -STATIC_OVL void +static void init_fill(bg_typ, fg_typ) schar bg_typ, fg_typ; { @@ -51,7 +51,7 @@ schar bg_typ, fg_typ; } } -STATIC_OVL schar +static schar get_map(col, row, bg_typ) int col, row; schar bg_typ; @@ -64,7 +64,7 @@ schar bg_typ; static const int dirs[16] = { -1, -1 /**/, -1, 0 /**/, -1, 1 /**/, 0, -1 /**/, 0, 1 /**/, 1, -1 /**/, 1, 0 /**/, 1, 1 }; -STATIC_OVL void +static void pass_one(bg_typ, fg_typ) schar bg_typ, fg_typ; { @@ -98,7 +98,7 @@ schar bg_typ, fg_typ; #define new_loc(i, j) *(g.new_locations + ((j) * (WIDTH + 1)) + (i)) -STATIC_OVL void +static void pass_two(bg_typ, fg_typ) schar bg_typ, fg_typ; { @@ -122,7 +122,7 @@ schar bg_typ, fg_typ; levl[i][j].typ = new_loc(i, j); } -STATIC_OVL void +static void pass_three(bg_typ, fg_typ) schar bg_typ, fg_typ; { @@ -246,7 +246,7 @@ boolean anyroom; * If we have drawn a map without walls, this allows us to * auto-magically wallify it. Taken from lev_main.c. */ -STATIC_OVL void +static void wallify_map() { int x, y, xx, yy; @@ -265,7 +265,7 @@ wallify_map() } } -STATIC_OVL void +static void join_map(bg_typ, fg_typ) schar bg_typ, fg_typ; { @@ -338,7 +338,7 @@ joinm: } } -STATIC_OVL void +static void finish_map(fg_typ, bg_typ, lit, walled, icedpools) schar fg_typ, bg_typ; boolean lit, walled, icedpools; @@ -411,7 +411,7 @@ int lx, ly, hx, hy; * level structure contents corresponding to roomno have already been reset. * Currently handles only the removal of rooms that have no subrooms. */ -STATIC_OVL void +static void remove_room(roomno) unsigned roomno; { diff --git a/src/mkmaze.c b/src/mkmaze.c index 2761bb062..29b043113 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -9,22 +9,22 @@ #include "sfproto.h" -STATIC_DCL int FDECL(iswall, (int, int)); -STATIC_DCL int FDECL(iswall_or_stone, (int, int)); -STATIC_DCL boolean FDECL(is_solid, (int, int)); -STATIC_DCL int FDECL(extend_spine, (int[3][3], int, int, int)); -STATIC_DCL boolean FDECL(okay, (int, int, int)); -STATIC_DCL void FDECL(maze0xy, (coord *)); -STATIC_DCL boolean FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P, +static int FDECL(iswall, (int, int)); +static int FDECL(iswall_or_stone, (int, int)); +static boolean FDECL(is_solid, (int, int)); +static int FDECL(extend_spine, (int[3][3], int, int, int)); +static boolean FDECL(okay, (int, int, int)); +static void FDECL(maze0xy, (coord *)); +static boolean FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, BOOLEAN_P, d_level *)); -STATIC_DCL void NDECL(baalz_fixup); -STATIC_DCL void NDECL(setup_waterlevel); -STATIC_DCL void NDECL(unsetup_waterlevel); -STATIC_DCL void FDECL(check_ransacked, (char *)); -STATIC_DCL void FDECL(migr_booty_item, (int, const char *)); -STATIC_DCL void FDECL(migrate_orc, (struct monst *, unsigned long)); -STATIC_DCL void NDECL(stolen_booty); +static void NDECL(baalz_fixup); +static void NDECL(setup_waterlevel); +static void NDECL(unsetup_waterlevel); +static void FDECL(check_ransacked, (char *)); +static void FDECL(migr_booty_item, (int, const char *)); +static void FDECL(migrate_orc, (struct monst *, unsigned long)); +static void NDECL(stolen_booty); /* adjust a coordinate one step in the specified direction */ #define mz_move(X, Y, dir) \ @@ -38,7 +38,7 @@ STATIC_DCL void NDECL(stolen_booty); } \ } while (0) -STATIC_OVL int +static int iswall(x, y) int x, y; { @@ -51,7 +51,7 @@ int x, y; || type == SDOOR || type == IRONBARS); } -STATIC_OVL int +static int iswall_or_stone(x, y) int x, y; { @@ -63,7 +63,7 @@ int x, y; } /* return TRUE if out of bounds, wall or rock */ -STATIC_OVL boolean +static boolean is_solid(x, y) int x, y; { @@ -88,7 +88,7 @@ int x, y; * W x W This would extend a spine from x down. * . W W */ -STATIC_OVL int +static int extend_spine(locale, wall_there, dx, dy) int locale[3][3]; int wall_there, dx, dy; @@ -224,7 +224,7 @@ int x1, y1, x2, y2; fix_wall_spines(x1, y1, x2, y2); } -STATIC_OVL boolean +static boolean okay(x, y, dir) int x, y; int dir; @@ -238,7 +238,7 @@ int dir; } /* find random starting point for maze generation */ -STATIC_OVL void +static void maze0xy(cc) coord *cc; { @@ -314,7 +314,7 @@ d_level *lev; impossible("Couldn't place lregion type %d!", rtype); } -STATIC_OVL boolean +static boolean put_lregion_here(x, y, nlx, nly, nhx, nhy, rtype, oneshot, lev) xchar x, y; xchar nlx, nly, nhx, nhy; @@ -371,7 +371,7 @@ d_level *lev; /* fix up Baalzebub's lair, which depicts a level-sized beetle; its legs are walls within solid rock--regular wallification classifies them as superfluous and gets rid of them */ -STATIC_OVL void +static void baalz_fixup() { struct monst *mtmp; @@ -615,7 +615,7 @@ fixup_special() g.num_lregions = 0; } -STATIC_OVL void +static void check_ransacked(s) char *s; { @@ -626,7 +626,7 @@ char *s; #define ORC_LEADER 1 static const char *orcfruit[] = { "paddle cactus", "dwarven root" }; -STATIC_OVL void +static void migrate_orc(mtmp, mflags) struct monst *mtmp; unsigned long mflags; @@ -691,7 +691,7 @@ struct monst *mtmp; add_to_minv(mtmp, otmp); } } -STATIC_OVL void +static void migr_booty_item(otyp, gang) int otyp; const char *gang; @@ -712,7 +712,7 @@ const char *gang; } } -STATIC_OVL void +static void stolen_booty(VOID_ARGS) { char *gang, gang_name[BUFSZ]; @@ -1377,9 +1377,9 @@ fumaroles() #define gbxmax (g.xmax - 1) #define gbymax (g.ymax - 1) -STATIC_DCL void NDECL(set_wportal); -STATIC_DCL void FDECL(mk_bubble, (int, int, int)); -STATIC_DCL void FDECL(mv_bubble, (struct bubble *, int, int, BOOLEAN_P)); +static void NDECL(set_wportal); +static void FDECL(mk_bubble, (int, int, int)); +static void FDECL(mv_bubble, (struct bubble *, int, int, BOOLEAN_P)); void movebubbles() @@ -1680,7 +1680,7 @@ xchar x, y; return hliquid("water"); } -STATIC_OVL void +static void set_wportal() { /* there better be only one magic portal on water level... */ @@ -1690,7 +1690,7 @@ set_wportal() impossible("set_wportal(): no portal!"); } -STATIC_OVL void +static void setup_waterlevel() { int x, y, xskip, yskip, typ, glyph; @@ -1737,7 +1737,7 @@ setup_waterlevel() mk_bubble(x, y, rn2(7)); } -STATIC_OVL void +static void unsetup_waterlevel() { struct bubble *b, *bb; @@ -1750,7 +1750,7 @@ unsetup_waterlevel() g.bbubbles = g.ebubbles = (struct bubble *) 0; } -STATIC_OVL void +static void mk_bubble(x, y, n) int x, y, n; { @@ -1814,7 +1814,7 @@ int x, y, n; * in the immediate neighborhood of one, he/she may get sucked inside. * This property also makes leaving a bubble slightly difficult. */ -STATIC_OVL void +static void mv_bubble(b, dx, dy, ini) struct bubble *b; int dx, dy; diff --git a/src/mkobj.c b/src/mkobj.c index c6168568e..f8ef49c75 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -5,21 +5,21 @@ #include "hack.h" -STATIC_DCL void FDECL(mkbox_cnts, (struct obj *)); -STATIC_DCL unsigned FDECL(nextoid, (struct obj *, struct obj *)); -STATIC_DCL void FDECL(maybe_adjust_light, (struct obj *, int)); -STATIC_DCL void FDECL(obj_timer_checks, (struct obj *, +static void FDECL(mkbox_cnts, (struct obj *)); +static unsigned FDECL(nextoid, (struct obj *, struct obj *)); +static void FDECL(maybe_adjust_light, (struct obj *, int)); +static void FDECL(obj_timer_checks, (struct obj *, XCHAR_P, XCHAR_P, int)); -STATIC_DCL void FDECL(container_weight, (struct obj *)); -STATIC_DCL struct obj *FDECL(save_mtraits, (struct obj *, struct monst *)); -STATIC_DCL void FDECL(objlist_sanity, (struct obj *, int, const char *)); -STATIC_DCL void FDECL(mon_obj_sanity, (struct monst *, const char *)); -STATIC_DCL const char *FDECL(where_name, (struct obj *)); -STATIC_DCL void FDECL(insane_object, (struct obj *, const char *, +static void FDECL(container_weight, (struct obj *)); +static struct obj *FDECL(save_mtraits, (struct obj *, struct monst *)); +static void FDECL(objlist_sanity, (struct obj *, int, const char *)); +static void FDECL(mon_obj_sanity, (struct monst *, const char *)); +static const char *FDECL(where_name, (struct obj *)); +static void FDECL(insane_object, (struct obj *, const char *, const char *, struct monst *)); -STATIC_DCL void FDECL(check_contained, (struct obj *, const char *)); -STATIC_DCL void FDECL(check_glob, (struct obj *, const char *)); -STATIC_DCL void FDECL(sanity_check_worn, (struct obj *)); +static void FDECL(check_contained, (struct obj *, const char *)); +static void FDECL(check_glob, (struct obj *, const char *)); +static void FDECL(sanity_check_worn, (struct obj *)); struct icp { int iprob; /* probability of an item type */ @@ -272,7 +272,7 @@ boolean artif; return mksobj(i, TRUE, artif); } -STATIC_OVL void +static void mkbox_cnts(box) struct obj *box; { @@ -468,7 +468,7 @@ long num; /* when splitting a stack that has o_id-based shop prices, pick an o_id value for the new stack that will maintain the same price */ -STATIC_OVL unsigned +static unsigned nextoid(oldobj, newobj) struct obj *oldobj, *newobj; { @@ -1222,7 +1222,7 @@ struct obj *body; (void) start_timer(when, TIMER_OBJECT, action, obj_to_any(body)); } -STATIC_OVL void +static void maybe_adjust_light(obj, old_range) struct obj *obj; int old_range; @@ -1836,7 +1836,7 @@ struct obj *otmp; return retval; } -STATIC_OVL void +static void obj_timer_checks(otmp, x, y, force) struct obj *otmp; xchar x, y; @@ -2131,7 +2131,7 @@ struct obj *obj; } /* Recalculate the weight of this container and all of _its_ containers. */ -STATIC_OVL void +static void container_weight(container) struct obj *container; { @@ -2331,7 +2331,7 @@ obj_sanity_check() } /* sanity check for objects on specified list (fobj, &c) */ -STATIC_OVL void +static void objlist_sanity(objlist, wheretype, mesg) struct obj *objlist; int wheretype; @@ -2383,7 +2383,7 @@ const char *mesg; } /* sanity check for objects carried by all monsters in specified list */ -STATIC_OVL void +static void mon_obj_sanity(monlist, mesg) struct monst *monlist; const char *mesg; @@ -2419,7 +2419,7 @@ static const char *obj_state_names[NOBJ_STATES] = { "free", "floor", "minvent", "migrating", "buried", "onbill" }; -STATIC_OVL const char * +static const char * where_name(obj) struct obj *obj; { @@ -2436,7 +2436,7 @@ struct obj *obj; return obj_state_names[where]; } -STATIC_OVL void +static void insane_object(obj, fmt, mesg, mon) struct obj *obj; const char *fmt, *mesg; @@ -2464,7 +2464,7 @@ struct monst *mon; } /* obj sanity check: check objects inside container */ -STATIC_OVL void +static void check_contained(container, mesg) struct obj *container; const char *mesg; @@ -2512,7 +2512,7 @@ const char *mesg; } /* called when 'obj->globby' is set so we don't recheck it here */ -STATIC_OVL void +static void check_glob(obj, mesg) struct obj *obj; const char *mesg; @@ -2535,7 +2535,7 @@ const char *mesg; } /* check an object in hero's or monster's inventory which has worn mask set */ -STATIC_OVL void +static void sanity_check_worn(obj) struct obj *obj; { diff --git a/src/mkroom.c b/src/mkroom.c index 4ed3d1348..05eb9550b 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -19,24 +19,24 @@ #include "sfproto.h" -STATIC_DCL boolean FDECL(isbig, (struct mkroom *)); -STATIC_DCL struct mkroom *FDECL(pick_room, (BOOLEAN_P)); -STATIC_DCL void NDECL(mkshop), FDECL(mkzoo, (int)), NDECL(mkswamp); -STATIC_DCL void NDECL(mktemple); -STATIC_DCL coord *FDECL(shrine_pos, (int)); -STATIC_DCL struct permonst *NDECL(morguemon); -STATIC_DCL struct permonst *NDECL(squadmon); +static boolean FDECL(isbig, (struct mkroom *)); +static struct mkroom *FDECL(pick_room, (BOOLEAN_P)); +static void NDECL(mkshop), FDECL(mkzoo, (int)), NDECL(mkswamp); +static void NDECL(mktemple); +static coord *FDECL(shrine_pos, (int)); +static struct permonst *NDECL(morguemon); +static struct permonst *NDECL(squadmon); /* SAVE2018 */ -/* STATIC_DCL void FDECL(save_room, (int,struct mkroom *)); */ -/* STATIC_DCL void FDECL(rest_room, (int,struct mkroom *)); */ -STATIC_DCL void FDECL(save_room, (NHFILE *, struct mkroom *)); -STATIC_DCL void FDECL(rest_room, (NHFILE *, struct mkroom *)); +/* static void FDECL(save_room, (int,struct mkroom *)); */ +/* static void FDECL(rest_room, (int,struct mkroom *)); */ +static void FDECL(save_room, (NHFILE *, struct mkroom *)); +static void FDECL(rest_room, (NHFILE *, struct mkroom *)); #define sq(x) ((x) * (x)) extern const struct shclass shtypes[]; /* defined in shknam.c */ -STATIC_OVL boolean +static boolean isbig(sroom) register struct mkroom *sroom; { @@ -90,7 +90,7 @@ int roomtype; } } -STATIC_OVL void +static void mkshop() { register struct mkroom *sroom; @@ -208,7 +208,7 @@ gottype: } /* pick an unused room, preferably with only one door */ -STATIC_OVL struct mkroom * +static struct mkroom * pick_room(strict) register boolean strict; { @@ -233,7 +233,7 @@ register boolean strict; return (struct mkroom *) 0; } -STATIC_OVL void +static void mkzoo(type) int type; { @@ -461,7 +461,7 @@ int mm_flags; g.level.flags.graveyard = TRUE; /* reduced chance for undead corpse */ } -STATIC_OVL struct permonst * +static struct permonst * morguemon() { register int i = rn2(100), hd = rn2(level_difficulty()); @@ -513,7 +513,7 @@ antholemon() : &mons[mtyp]); } -STATIC_OVL void +static void mkswamp() /* Michiel Huisjes & Fred de Wilde */ { register struct mkroom *sroom; @@ -551,7 +551,7 @@ mkswamp() /* Michiel Huisjes & Fred de Wilde */ } } -STATIC_OVL coord * +static coord * shrine_pos(roomno) int roomno; { @@ -573,7 +573,7 @@ int roomno; return &buf; } -STATIC_OVL void +static void mktemple() { register struct mkroom *sroom; @@ -773,7 +773,7 @@ static const struct { { PM_CAPTAIN, 1 } }; /* return soldier types. */ -STATIC_OVL struct permonst * +static struct permonst * squadmon() { int sel_prob, i, cpro, mndx; @@ -800,7 +800,7 @@ gotone: * save_room : A recursive function that saves a room and its subrooms * (if any). */ -STATIC_OVL void +static void save_room(nhfp, r) NHFILE *nhfp; struct mkroom *r; @@ -839,7 +839,7 @@ NHFILE *nhfp; save_room(nhfp, &g.rooms[i]); } -STATIC_OVL void +static void rest_room(nhfp, r) NHFILE *nhfp; struct mkroom *r; diff --git a/src/mon.c b/src/mon.c index c65972a86..b04fb07c0 100644 --- a/src/mon.c +++ b/src/mon.c @@ -12,23 +12,23 @@ #include "mfndpos.h" #include -STATIC_DCL void FDECL(sanity_check_single_mon, (struct monst *, BOOLEAN_P, +static void FDECL(sanity_check_single_mon, (struct monst *, BOOLEAN_P, const char *)); -STATIC_DCL boolean FDECL(restrap, (struct monst *)); -STATIC_DCL long FDECL(mm_aggression, (struct monst *, struct monst *)); -STATIC_DCL long FDECL(mm_displacement, (struct monst *, struct monst *)); -STATIC_DCL int NDECL(pick_animal); -STATIC_DCL void FDECL(kill_eggs, (struct obj *)); -STATIC_DCL int FDECL(pickvampshape, (struct monst *)); -STATIC_DCL boolean FDECL(isspecmon, (struct monst *)); -STATIC_DCL boolean FDECL(validspecmon, (struct monst *, int)); -STATIC_DCL struct permonst *FDECL(accept_newcham_form, (struct monst *, int)); -STATIC_DCL struct obj *FDECL(make_corpse, (struct monst *, unsigned)); -STATIC_DCL void FDECL(m_detach, (struct monst *, struct permonst *)); -STATIC_DCL void FDECL(lifesaved_monster, (struct monst *)); -STATIC_DCL void FDECL(migrate_mon, (struct monst *, XCHAR_P, XCHAR_P)); -STATIC_DCL boolean FDECL(ok_to_obliterate, (struct monst *)); -STATIC_DCL void FDECL(deal_with_overcrowding, (struct monst *)); +static boolean FDECL(restrap, (struct monst *)); +static long FDECL(mm_aggression, (struct monst *, struct monst *)); +static long FDECL(mm_displacement, (struct monst *, struct monst *)); +static int NDECL(pick_animal); +static void FDECL(kill_eggs, (struct obj *)); +static int FDECL(pickvampshape, (struct monst *)); +static boolean FDECL(isspecmon, (struct monst *)); +static boolean FDECL(validspecmon, (struct monst *, int)); +static struct permonst *FDECL(accept_newcham_form, (struct monst *, int)); +static struct obj *FDECL(make_corpse, (struct monst *, unsigned)); +static void FDECL(m_detach, (struct monst *, struct permonst *)); +static void FDECL(lifesaved_monster, (struct monst *)); +static void FDECL(migrate_mon, (struct monst *, XCHAR_P, XCHAR_P)); +static boolean FDECL(ok_to_obliterate, (struct monst *)); +static void FDECL(deal_with_overcrowding, (struct monst *)); /* note: duplicated in dog.c */ #define LEVEL_SPECIFIC_NOCORPSE(mdat) \ @@ -43,7 +43,7 @@ const char *warnings[] = { #endif /* 0 */ -STATIC_OVL void +static void sanity_check_single_mon(mtmp, chk_geno, msg) struct monst *mtmp; boolean chk_geno; @@ -291,7 +291,7 @@ int mndx; * G_NOCORPSE set in order to prevent wishing for one, finding tins of one, * etc.... */ -STATIC_OVL struct obj * +static struct obj * make_corpse(mtmp, corpseflags) register struct monst *mtmp; unsigned corpseflags; @@ -1550,7 +1550,7 @@ nexttry: /* eels prefer the water, but if there is no water nearby, in the absence of Conflict. There is no provision for targetting other monsters; just hand to hand fighting when they happen to be next to each other. */ -STATIC_OVL long +static long mm_aggression(magr, mdef) struct monst *magr, /* monster that is currently deciding where to move */ *mdef; /* another monster which is next to it */ @@ -1567,7 +1567,7 @@ struct monst *magr, /* monster that is currently deciding where to move */ } /* Monster displacing another monster out of the way */ -STATIC_OVL long +static long mm_displacement(magr, mdef) struct monst *magr, /* monster that is currently deciding where to move */ *mdef; /* another monster which is next to it */ @@ -1816,7 +1816,7 @@ struct monst *mon; } /* remove effects of mtmp from other data structures */ -STATIC_OVL void +static void m_detach(mtmp, mptr) struct monst *mtmp; struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */ @@ -1872,7 +1872,7 @@ struct monst *mon; return (struct obj *) 0; } -STATIC_OVL void +static void lifesaved_monster(mtmp) struct monst *mtmp; { @@ -2601,7 +2601,7 @@ struct monst *mtmp; migrate_mon(mtmp, target_lev, xyloc); } -STATIC_OVL void +static void migrate_mon(mtmp, target_lev, xyloc) struct monst *mtmp; xchar target_lev, xyloc; @@ -2612,7 +2612,7 @@ xchar target_lev, xyloc; mtmp->mstate |= MON_MIGRATING; } -STATIC_OVL boolean +static boolean ok_to_obliterate(mtmp) struct monst *mtmp; { @@ -2733,7 +2733,7 @@ struct monst *mtmp; return; } -STATIC_OVL void +static void deal_with_overcrowding(mtmp) struct monst *mtmp; { @@ -3150,7 +3150,7 @@ struct monst *mon; } /* unwatched hiders may hide again; if so, returns True */ -STATIC_OVL boolean +static boolean restrap(mtmp) register struct monst *mtmp; { @@ -3260,7 +3260,7 @@ boolean construct; } } -STATIC_OVL int +static int pick_animal() { int res; @@ -3339,7 +3339,7 @@ int shiftflags; } } -STATIC_OVL int +static int pickvampshape(mon) struct monst *mon; { @@ -3369,7 +3369,7 @@ struct monst *mon; } /* nonshapechangers who warrant special polymorph handling */ -STATIC_OVL boolean +static boolean isspecmon(mon) struct monst *mon; { @@ -3380,7 +3380,7 @@ struct monst *mon; /* restrict certain special monsters (shopkeepers, aligned priests, vault guards) to forms that allow them to behave sensibly (catching gold, speaking?) so that they don't need too much extra code */ -STATIC_OVL boolean +static boolean validspecmon(mon, mndx) struct monst *mon; int mndx; @@ -3603,7 +3603,7 @@ struct monst *mon; } /* this used to be inline within newcham() but monpolycontrol needs it too */ -STATIC_OVL struct permonst * +static struct permonst * accept_newcham_form(mon, mndx) struct monst *mon; int mndx; @@ -3946,7 +3946,7 @@ boolean egg; } /* kill off any eggs of genocided monsters */ -STATIC_OVL void +static void kill_eggs(obj_list) struct obj *obj_list; { diff --git a/src/monmove.c b/src/monmove.c index ef749a96f..0e805492c 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -7,13 +7,13 @@ #include "mfndpos.h" #include "artifact.h" -STATIC_DCL void FDECL(watch_on_duty, (struct monst *)); -STATIC_DCL int FDECL(disturb, (struct monst *)); -STATIC_DCL void FDECL(release_hero, (struct monst *)); -STATIC_DCL void FDECL(distfleeck, (struct monst *, int *, int *, int *)); -STATIC_DCL int FDECL(m_arrival, (struct monst *)); -STATIC_DCL boolean FDECL(stuff_prevents_passage, (struct monst *)); -STATIC_DCL int FDECL(vamp_shift, (struct monst *, struct permonst *, +static void FDECL(watch_on_duty, (struct monst *)); +static int FDECL(disturb, (struct monst *)); +static void FDECL(release_hero, (struct monst *)); +static void FDECL(distfleeck, (struct monst *, int *, int *, int *)); +static int FDECL(m_arrival, (struct monst *)); +static boolean FDECL(stuff_prevents_passage, (struct monst *)); +static int FDECL(vamp_shift, (struct monst *, struct permonst *, BOOLEAN_P)); /* True if mtmp died */ @@ -76,7 +76,7 @@ const char *shout; } } -STATIC_OVL void +static void watch_on_duty(mtmp) register struct monst *mtmp; { @@ -203,7 +203,7 @@ boolean digest_meal; * Possibly awaken the given monster. Return a 1 if the monster has been * jolted awake. */ -STATIC_OVL int +static int disturb(mtmp) register struct monst *mtmp; { @@ -238,7 +238,7 @@ register struct monst *mtmp; } /* ungrab/expel held/swallowed hero */ -STATIC_OVL void +static void release_hero(mon) struct monst *mon; { @@ -351,7 +351,7 @@ boolean fleemsg; memset(mtmp->mtrack, 0, sizeof(mtmp->mtrack)); } -STATIC_OVL void +static void distfleeck(mtmp, inrange, nearby, scared) register struct monst *mtmp; int *inrange, *nearby, *scared; @@ -392,7 +392,7 @@ int *inrange, *nearby, *scared; /* perform a special one-time action for a monster; returns -1 if nothing special happened, 0 if monster uses up its turn, 1 if monster is killed */ -STATIC_OVL int +static int m_arrival(mon) struct monst *mon; { @@ -1680,7 +1680,7 @@ xchar x, y; * Inventory prevents passage under door. * Used by can_ooze() and can_fog(). */ -STATIC_OVL boolean +static boolean stuff_prevents_passage(mtmp) struct monst *mtmp; { @@ -1738,7 +1738,7 @@ struct monst *mtmp; return FALSE; } -STATIC_OVL int +static int vamp_shift(mon, ptr, domsg) struct monst *mon; struct permonst *ptr; diff --git a/src/mplayer.c b/src/mplayer.c index 5955b2915..13a44ed35 100644 --- a/src/mplayer.c +++ b/src/mplayer.c @@ -4,9 +4,9 @@ #include "hack.h" -STATIC_DCL const char *NDECL(dev_name); -STATIC_DCL void FDECL(get_mplname, (struct monst *, char *)); -STATIC_DCL void FDECL(mk_mplayer_armor, (struct monst *, SHORT_P)); +static const char *NDECL(dev_name); +static void FDECL(get_mplname, (struct monst *, char *)); +static void FDECL(mk_mplayer_armor, (struct monst *, SHORT_P)); /* These are the names of those who * contributed to the development of NetHack 3.2/3.3/3.4/3.6. @@ -40,7 +40,7 @@ static const char *developers[] = { }; /* return a randomly chosen developer name */ -STATIC_OVL const char * +static const char * dev_name() { register int i, m = 0, n = SIZE(developers); @@ -67,7 +67,7 @@ dev_name() return (developers[i]); } -STATIC_OVL void +static void get_mplname(mtmp, nam) register struct monst *mtmp; char *nam; @@ -92,7 +92,7 @@ char *nam; (boolean) mtmp->female)); } -STATIC_OVL void +static void mk_mplayer_armor(mon, typ) struct monst *mon; short typ; diff --git a/src/mthrowu.c b/src/mthrowu.c index aa01fc7a7..c2538ab5c 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -5,10 +5,10 @@ #include "hack.h" -STATIC_DCL int FDECL(monmulti, (struct monst *, struct obj *, struct obj *)); -STATIC_DCL void FDECL(monshoot, (struct monst *, struct obj *, struct obj *)); -STATIC_DCL int FDECL(drop_throw, (struct obj *, BOOLEAN_P, int, int)); -STATIC_DCL boolean FDECL(m_lined_up, (struct monst *, struct monst *)); +static int FDECL(monmulti, (struct monst *, struct obj *, struct obj *)); +static void FDECL(monshoot, (struct monst *, struct obj *, struct obj *)); +static int FDECL(drop_throw, (struct obj *, BOOLEAN_P, int, int)); +static boolean FDECL(m_lined_up, (struct monst *, struct monst *)); #define URETREATING(x, y) \ (distmin(u.ux, u.uy, x, y) > distmin(u.ux0, u.uy0, x, y)) @@ -20,7 +20,7 @@ STATIC_DCL boolean FDECL(m_lined_up, (struct monst *, struct monst *)); /* * Keep consistent with breath weapons in zap.c, and AD_* in monattk.h. */ -STATIC_OVL NEARDATA const char *breathwep[] = { +static NEARDATA const char *breathwep[] = { "fragments", "fire", "frost", "sleep gas", "a disintegration blast", "lightning", "poison gas", "acid", "strange breath #8", "strange breath #9" @@ -102,7 +102,7 @@ const char *name; /* if null, then format `*objp' */ * dothrow.c (for consistency). --KAA * Returns 0 if object still exists (not destroyed). */ -STATIC_OVL int +static int drop_throw(obj, ohit, x, y) register struct obj *obj; boolean ohit; @@ -146,7 +146,7 @@ int x, y; /* calculate multishot volley count for mtmp throwing otmp (if not ammo) or shooting otmp with mwep (if otmp is ammo and mwep appropriate launcher) */ -STATIC_OVL int +static int monmulti(mtmp, otmp, mwep) struct monst *mtmp; struct obj *otmp, *mwep; @@ -231,7 +231,7 @@ struct obj *otmp, *mwep; } /* mtmp throws otmp, or shoots otmp with mwep, at hero or at monster mtarg */ -STATIC_OVL void +static void monshoot(mtmp, otmp, mwep) struct monst *mtmp; struct obj *otmp, *mwep; @@ -1048,7 +1048,7 @@ int boulderhandling; /* 0=block, 1=ignore, 2=conditionally block */ return FALSE; } -STATIC_OVL boolean +static boolean m_lined_up(mtarg, mtmp) struct monst *mtarg, *mtmp; { diff --git a/src/muse.c b/src/muse.c index d1ee5472a..dfef522c9 100644 --- a/src/muse.c +++ b/src/muse.c @@ -14,33 +14,33 @@ * are confused don't know not to read scrolls, etc.... */ -STATIC_DCL struct permonst *FDECL(muse_newcham_mon, (struct monst *)); -STATIC_DCL int FDECL(precheck, (struct monst *, struct obj *)); -STATIC_DCL void FDECL(mzapwand, (struct monst *, struct obj *, BOOLEAN_P)); -STATIC_DCL void FDECL(mplayhorn, (struct monst *, struct obj *, BOOLEAN_P)); -STATIC_DCL void FDECL(mreadmsg, (struct monst *, struct obj *)); -STATIC_DCL void FDECL(mquaffmsg, (struct monst *, struct obj *)); -STATIC_DCL boolean FDECL(m_use_healing, (struct monst *)); -STATIC_PTR int FDECL(mbhitm, (struct monst *, struct obj *)); -STATIC_DCL void FDECL(mbhit, (struct monst *, int, +static struct permonst *FDECL(muse_newcham_mon, (struct monst *)); +static int FDECL(precheck, (struct monst *, struct obj *)); +static void FDECL(mzapwand, (struct monst *, struct obj *, BOOLEAN_P)); +static void FDECL(mplayhorn, (struct monst *, struct obj *, BOOLEAN_P)); +static void FDECL(mreadmsg, (struct monst *, struct obj *)); +static void FDECL(mquaffmsg, (struct monst *, struct obj *)); +static boolean FDECL(m_use_healing, (struct monst *)); +static int FDECL(mbhitm, (struct monst *, struct obj *)); +static void FDECL(mbhit, (struct monst *, int, int FDECL((*), (MONST_P, OBJ_P)), int FDECL((*), (OBJ_P, OBJ_P)), struct obj *)); -STATIC_DCL void FDECL(you_aggravate, (struct monst *)); -STATIC_DCL void FDECL(mon_consume_unstone, (struct monst *, struct obj *, +static void FDECL(you_aggravate, (struct monst *)); +static void FDECL(mon_consume_unstone, (struct monst *, struct obj *, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL boolean FDECL(cures_stoning, (struct monst *, struct obj *, +static boolean FDECL(cures_stoning, (struct monst *, struct obj *, BOOLEAN_P)); -STATIC_DCL boolean FDECL(mcould_eat_tin, (struct monst *)); -STATIC_DCL boolean FDECL(muse_unslime, (struct monst *, struct obj *, +static boolean FDECL(mcould_eat_tin, (struct monst *)); +static boolean FDECL(muse_unslime, (struct monst *, struct obj *, struct trap *, BOOLEAN_P)); -STATIC_DCL int FDECL(cures_sliming, (struct monst *, struct obj *)); -STATIC_DCL boolean FDECL(green_mon, (struct monst *)); +static int FDECL(cures_sliming, (struct monst *, struct obj *)); +static boolean FDECL(green_mon, (struct monst *)); /* Any preliminary checks which may result in the monster being unable to use * the item. Returns 0 if nothing happened, 2 if the monster can't do * anything (i.e. it teleported) and 1 if it's dead. */ -STATIC_OVL int +static int precheck(mon, obj) struct monst *mon; struct obj *obj; @@ -147,7 +147,7 @@ struct obj *obj; /* when a monster zaps a wand give a message, deduct a charge, and if it isn't directly seen, remove hero's memory of the number of charges */ -STATIC_OVL void +static void mzapwand(mtmp, otmp, self) struct monst *mtmp; struct obj *otmp; @@ -171,7 +171,7 @@ boolean self; } /* similar to mzapwand() but for magical horns (only instrument mons play) */ -STATIC_OVL void +static void mplayhorn(mtmp, otmp, self) struct monst *mtmp; struct obj *otmp; @@ -196,7 +196,7 @@ boolean self; otmp->spe -= 1; /* use a charge */ } -STATIC_OVL void +static void mreadmsg(mtmp, otmp) struct monst *mtmp; struct obj *otmp; @@ -237,7 +237,7 @@ struct obj *otmp; vismon ? mon_nam(mtmp) : mhe(mtmp)); } -STATIC_OVL void +static void mquaffmsg(mtmp, otmp) struct monst *mtmp; struct obj *otmp; @@ -280,7 +280,7 @@ struct obj *otmp; * that if you polymorph into one you teleport at will. */ -STATIC_OVL boolean +static boolean m_use_healing(mtmp) struct monst *mtmp; { @@ -1209,7 +1209,7 @@ struct monst *mtmp; #undef nomore } -STATIC_PTR +static int mbhitm(mtmp, otmp) register struct monst *mtmp; @@ -1291,7 +1291,7 @@ register struct obj *otmp; * zapping you, so we need a special function for it. (Unless someone wants * to merge the two functions...) */ -STATIC_OVL void +static void mbhit(mon, range, fhitm, fhito, obj) struct monst *mon; /* monster shooting the wand */ register int range; /* direction and range */ @@ -1964,7 +1964,7 @@ struct monst *mtmp; return 0; } -STATIC_OVL void +static void you_aggravate(mtmp) struct monst *mtmp; { @@ -2215,7 +2215,7 @@ boolean by_you; return FALSE; } -STATIC_OVL void +static void mon_consume_unstone(mon, obj, by_you, stoning) struct monst *mon; struct obj *obj; @@ -2295,7 +2295,7 @@ boolean stoning; /* True: stop petrification, False: cure stun && confusion */ } /* decide whether obj can cure petrification; also used when picking up */ -STATIC_OVL boolean +static boolean cures_stoning(mon, obj, tinok) struct monst *mon; struct obj *obj; @@ -2312,7 +2312,7 @@ boolean tinok; || slimeproof(mon->data)))); } -STATIC_OVL boolean +static boolean mcould_eat_tin(mon) struct monst *mon; { @@ -2418,7 +2418,7 @@ boolean by_you; } /* mon uses an item--selected by caller--to burn away incipient slime */ -STATIC_OVL boolean +static boolean muse_unslime(mon, obj, trap, by_you) struct monst *mon; struct obj *obj; @@ -2527,7 +2527,7 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */ } /* decide whether obj can be used to cure green slime */ -STATIC_OVL int +static int cures_sliming(mon, obj) struct monst *mon; struct obj *obj; @@ -2544,7 +2544,7 @@ struct obj *obj; /* TRUE if monster appears to be green; for active TEXTCOLOR, we go by the display color, otherwise we just pick things that seem plausibly green (which doesn't necessarily match the TEXTCOLOR categorization) */ -STATIC_OVL boolean +static boolean green_mon(mon) struct monst *mon; { diff --git a/src/music.c b/src/music.c index dff1cd270..f1bf9c724 100644 --- a/src/music.c +++ b/src/music.c @@ -28,19 +28,19 @@ #include "hack.h" -STATIC_DCL void FDECL(awaken_monsters, (int)); -STATIC_DCL void FDECL(put_monsters_to_sleep, (int)); -STATIC_DCL void FDECL(charm_snakes, (int)); -STATIC_DCL void FDECL(calm_nymphs, (int)); -STATIC_DCL void FDECL(charm_monsters, (int)); -STATIC_DCL void FDECL(do_earthquake, (int)); -STATIC_DCL int FDECL(do_improvisation, (struct obj *)); +static void FDECL(awaken_monsters, (int)); +static void FDECL(put_monsters_to_sleep, (int)); +static void FDECL(charm_snakes, (int)); +static void FDECL(calm_nymphs, (int)); +static void FDECL(charm_monsters, (int)); +static void FDECL(do_earthquake, (int)); +static int FDECL(do_improvisation, (struct obj *)); /* * Wake every monster in range... */ -STATIC_OVL void +static void awaken_monsters(distance) int distance; { @@ -71,7 +71,7 @@ int distance; * Make monsters fall asleep. Note that they may resist the spell. */ -STATIC_OVL void +static void put_monsters_to_sleep(distance) int distance; { @@ -92,7 +92,7 @@ int distance; * Charm snakes in range. Note that the snakes are NOT tamed. */ -STATIC_OVL void +static void charm_snakes(distance) int distance; { @@ -127,7 +127,7 @@ int distance; * Calm nymphs in range. */ -STATIC_OVL void +static void calm_nymphs(distance) int distance; { @@ -193,7 +193,7 @@ struct monst *bugler; /* monster that played instrument */ /* Charm monsters in range. Note that they may resist the spell. * If swallowed, range is reduced to 0. */ -STATIC_OVL void +static void charm_monsters(distance) int distance; { @@ -219,7 +219,7 @@ int distance; /* Generate earthquake :-) of desired force. * That is: create random chasms (pits). */ -STATIC_OVL void +static void do_earthquake(force) int force; { @@ -447,7 +447,7 @@ const char *beats[] = { /* * The player is trying to extract something from his/her instrument. */ -STATIC_OVL int +static int do_improvisation(instr) struct obj *instr; { diff --git a/src/o_init.c b/src/o_init.c index df6714eb4..35b268c17 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -8,14 +8,14 @@ #include "sfproto.h" -STATIC_DCL void FDECL(setgemprobs, (d_level *)); -STATIC_DCL void FDECL(shuffle, (int, int, BOOLEAN_P)); -STATIC_DCL void NDECL(shuffle_all); -STATIC_DCL boolean FDECL(interesting_to_discover, (int)); -STATIC_DCL char *FDECL(oclass_to_name, (CHAR_P, char *)); +static void FDECL(setgemprobs, (d_level *)); +static void FDECL(shuffle, (int, int, BOOLEAN_P)); +static void NDECL(shuffle_all); +static boolean FDECL(interesting_to_discover, (int)); +static char *FDECL(oclass_to_name, (CHAR_P, char *)); #ifdef USE_TILES -STATIC_DCL void NDECL(shuffle_tiles); +static void NDECL(shuffle_tiles); extern short glyph2tile[]; /* from tile.c */ /* Shuffle tile assignments to match descriptions, so a red potion isn't @@ -27,7 +27,7 @@ extern short glyph2tile[]; /* from tile.c */ * is restored. So might as well do that the first time instead of writing * another routine. */ -STATIC_OVL void +static void shuffle_tiles() { int i; @@ -41,7 +41,7 @@ shuffle_tiles() } #endif /* USE_TILES */ -STATIC_OVL void +static void setgemprobs(dlev) d_level *dlev; { @@ -68,7 +68,7 @@ d_level *dlev; } /* shuffle descriptions on objects o_low to o_high */ -STATIC_OVL void +static void shuffle(o_low, o_high, domaterial) int o_low, o_high; boolean domaterial; @@ -238,7 +238,7 @@ int *lo_p, *hi_p; /* output: range that item belongs among */ } /* randomize object descriptions */ -STATIC_OVL void +static void shuffle_all() { /* entire classes; obj_shuffle_range() handles their exceptions */ @@ -441,7 +441,7 @@ register int oindx; } } -STATIC_OVL boolean +static boolean interesting_to_discover(i) register int i; { @@ -517,7 +517,7 @@ dodiscovered() /* free after Robert Viduya */ } /* lower case let_to_name() output, which differs from def_oc_syms[].name */ -STATIC_OVL char * +static char * oclass_to_name(oclass, buf) char oclass; char *buf; diff --git a/src/objnam.c b/src/objnam.c index d9afce858..aef37c6fa 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -10,21 +10,21 @@ #define SCHAR_LIM 127 #define NUMOBUF 12 -STATIC_DCL char *FDECL(strprepend, (char *, const char *)); -STATIC_DCL short FDECL(rnd_otyp_by_wpnskill, (SCHAR_P)); -STATIC_DCL short FDECL(rnd_otyp_by_namedesc, (const char *, CHAR_P, int)); -STATIC_DCL boolean FDECL(wishymatch, (const char *, const char *, BOOLEAN_P)); -STATIC_DCL char *NDECL(nextobuf); -STATIC_DCL void FDECL(releaseobuf, (char *)); -STATIC_DCL char *FDECL(minimal_xname, (struct obj *)); -STATIC_DCL void FDECL(add_erosion_words, (struct obj *, char *)); -STATIC_DCL char *FDECL(doname_base, (struct obj *obj, unsigned)); -STATIC_DCL boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P, +static char *FDECL(strprepend, (char *, const char *)); +static short FDECL(rnd_otyp_by_wpnskill, (SCHAR_P)); +static short FDECL(rnd_otyp_by_namedesc, (const char *, CHAR_P, int)); +static boolean FDECL(wishymatch, (const char *, const char *, BOOLEAN_P)); +static char *NDECL(nextobuf); +static void FDECL(releaseobuf, (char *)); +static char *FDECL(minimal_xname, (struct obj *)); +static void FDECL(add_erosion_words, (struct obj *, char *)); +static char *FDECL(doname_base, (struct obj *obj, unsigned)); +static boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P, const char *const *)); -STATIC_DCL char *FDECL(singplur_compound, (char *)); -STATIC_DCL char *FDECL(xname_flags, (struct obj *, unsigned)); -STATIC_DCL boolean FDECL(badman, (const char *, BOOLEAN_P)); -STATIC_DCL char *FDECL(globwt, (struct obj *, char *, boolean *)); +static char *FDECL(singplur_compound, (char *)); +static char *FDECL(xname_flags, (struct obj *, unsigned)); +static boolean FDECL(badman, (const char *, BOOLEAN_P)); +static char *FDECL(globwt, (struct obj *, char *, boolean *)); struct Jitem { int item; @@ -44,7 +44,7 @@ struct Jitem { && typ != SAPPHIRE && typ != BLACK_OPAL && typ != EMERALD \ && typ != OPAL))) -STATIC_OVL struct Jitem Japanese_items[] = { { SHORT_SWORD, "wakizashi" }, +static struct Jitem Japanese_items[] = { { SHORT_SWORD, "wakizashi" }, { BROADSWORD, "ninja-to" }, { FLAIL, "nunchaku" }, { GLAIVE, "naginata" }, @@ -58,9 +58,9 @@ STATIC_OVL struct Jitem Japanese_items[] = { { SHORT_SWORD, "wakizashi" }, { POT_BOOZE, "sake" }, { 0, "" } }; -STATIC_DCL const char *FDECL(Japanese_item_name, (int i)); +static const char *FDECL(Japanese_item_name, (int i)); -STATIC_OVL char * +static char * strprepend(s, pref) register char *s; register const char *pref; @@ -80,7 +80,7 @@ register const char *pref; static char NEARDATA obufs[NUMOBUF][BUFSZ]; static int obufidx = 0; -STATIC_OVL char * +static char * nextobuf() { obufidx = (obufidx + 1) % NUMOBUF; @@ -88,7 +88,7 @@ nextobuf() } /* put the most recently allocated buffer back if possible */ -STATIC_OVL void +static void releaseobuf(bufp) char *bufp; { @@ -411,7 +411,7 @@ struct obj *obj; return xname_flags(obj, CXN_NORMAL); } -STATIC_OVL char * +static char * xname_flags(obj, cxn_flags) register struct obj *obj; unsigned cxn_flags; /* bitmask of CXN_xxx values */ @@ -740,7 +740,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ brown potion -- if oc_name_known not set potion of object detection -- if discovered */ -STATIC_OVL char * +static char * minimal_xname(obj) struct obj *obj; { @@ -841,7 +841,7 @@ struct permonst *ptr; return uniq; } -STATIC_OVL void +static void add_erosion_words(obj, prefix) struct obj *obj; char *prefix; @@ -919,7 +919,7 @@ struct obj *obj; #define DONAME_WITH_PRICE 1 #define DONAME_VAGUE_QUAN 2 -STATIC_OVL char * +static char * doname_base(obj, doname_flags) struct obj *obj; unsigned doname_flags; @@ -2168,7 +2168,7 @@ static const char *const as_is[] = { }; /* singularize/pluralize decisions common to both makesingular & makeplural */ -STATIC_OVL boolean +static boolean singplur_lookup(basestr, endstring, to_plural, alt_as_is) char *basestr, *endstring; /* base string, pointer to eos(string) */ boolean to_plural; /* true => makeplural, false => makesingular */ @@ -2239,7 +2239,7 @@ const char *const *alt_as_is; /* another set like as_is[] */ } /* searches for common compounds, ex. lump of royal jelly */ -STATIC_OVL char * +static char * singplur_compound(str) char *str; { @@ -2570,7 +2570,7 @@ const char *oldstr; return bp; } -STATIC_OVL boolean +static boolean badman(basestr, to_plural) const char *basestr; boolean to_plural; /* true => makeplural, false => makesingular */ @@ -2619,7 +2619,7 @@ boolean to_plural; /* true => makeplural, false => makesingular */ } /* compare user string against object name string using fuzzy matching */ -STATIC_OVL boolean +static boolean wishymatch(u_str, o_str, retry_inverted) const char *u_str; /* from user, so might be variant spelling */ const char *o_str; /* from objects[], so is in canonical form */ @@ -2718,7 +2718,7 @@ struct o_range { }; /* wishable subranges of objects */ -STATIC_OVL NEARDATA const struct o_range o_ranges[] = { +static NEARDATA const struct o_range o_ranges[] = { { "bag", TOOL_CLASS, SACK, BAG_OF_TRICKS }, { "lamp", TOOL_CLASS, OIL_LAMP, MAGIC_LAMP }, { "candle", TOOL_CLASS, TALLOW_CANDLE, WAX_CANDLE }, @@ -2791,7 +2791,7 @@ static const struct alt_spellings { { (const char *) 0, 0 }, }; -STATIC_OVL short +static short rnd_otyp_by_wpnskill(skill) schar skill; { @@ -2815,7 +2815,7 @@ schar skill; return otyp; } -STATIC_OVL short +static short rnd_otyp_by_namedesc(name, oclass, xtra_prob) const char *name; char oclass; @@ -4083,7 +4083,7 @@ int first, last; return 0; } -STATIC_OVL const char * +static const char * Japanese_item_name(i) int i; { @@ -4253,7 +4253,7 @@ const char *lastR; return qbuf; } -STATIC_OVL char * +static char * globwt(otmp, buf, weightformatted_p) struct obj *otmp; char *buf; diff --git a/src/options.c b/src/options.c index ae7a4338d..08e7c2617 100644 --- a/src/options.c +++ b/src/options.c @@ -527,48 +527,48 @@ static const menu_cmd_t default_menu_cmd_info[] = { { "menu_search", MENU_SEARCH, "Search and toggle matching items" }, }; -STATIC_DCL void FDECL(nmcpy, (char *, const char *, int)); -STATIC_DCL void FDECL(escapes, (const char *, char *)); -STATIC_DCL void FDECL(rejectoption, (const char *)); -STATIC_DCL char *FDECL(string_for_opt, (char *, BOOLEAN_P)); -STATIC_DCL char *FDECL(string_for_env_opt, (const char *, char *, BOOLEAN_P)); -STATIC_DCL void FDECL(bad_negation, (const char *, BOOLEAN_P)); -STATIC_DCL int FDECL(change_inv_order, (char *)); -STATIC_DCL boolean FDECL(warning_opts, (char *, const char *)); -STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *)); -STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int)); -STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int)); +static void FDECL(nmcpy, (char *, const char *, int)); +static void FDECL(escapes, (const char *, char *)); +static void FDECL(rejectoption, (const char *)); +static char *FDECL(string_for_opt, (char *, BOOLEAN_P)); +static char *FDECL(string_for_env_opt, (const char *, char *, BOOLEAN_P)); +static void FDECL(bad_negation, (const char *, BOOLEAN_P)); +static int FDECL(change_inv_order, (char *)); +static boolean FDECL(warning_opts, (char *, const char *)); +static int FDECL(feature_alert_opts, (char *, const char *)); +static boolean FDECL(duplicate_opt_detection, (const char *, int)); +static void FDECL(complain_about_duplicate, (const char *, int)); -STATIC_DCL const char *FDECL(attr2attrname, (int)); -STATIC_DCL const char * FDECL(msgtype2name, (int)); -STATIC_DCL int NDECL(query_msgtype); -STATIC_DCL boolean FDECL(msgtype_add, (int, char *)); -STATIC_DCL void FDECL(free_one_msgtype, (int)); -STATIC_DCL int NDECL(msgtype_count); -STATIC_DCL boolean FDECL(test_regex_pattern, (const char *, const char *)); -STATIC_DCL boolean FDECL(add_menu_coloring_parsed, (char *, int, int)); -STATIC_DCL void FDECL(free_one_menu_coloring, (int)); -STATIC_DCL int NDECL(count_menucolors); -STATIC_DCL boolean FDECL(parse_role_opts, (BOOLEAN_P, const char *, +static const char *FDECL(attr2attrname, (int)); +static const char * FDECL(msgtype2name, (int)); +static int NDECL(query_msgtype); +static boolean FDECL(msgtype_add, (int, char *)); +static void FDECL(free_one_msgtype, (int)); +static int NDECL(msgtype_count); +static boolean FDECL(test_regex_pattern, (const char *, const char *)); +static boolean FDECL(add_menu_coloring_parsed, (char *, int, int)); +static void FDECL(free_one_menu_coloring, (int)); +static int NDECL(count_menucolors); +static boolean FDECL(parse_role_opts, (BOOLEAN_P, const char *, char *, char **)); -STATIC_DCL void FDECL(doset_add_menu, (winid, const char *, int)); -STATIC_DCL void FDECL(opts_add_others, (winid, const char *, int, +static void FDECL(doset_add_menu, (winid, const char *, int)); +static void FDECL(opts_add_others, (winid, const char *, int, char *, int)); -STATIC_DCL int FDECL(handle_add_list_remove, (const char *, int)); -STATIC_DCL boolean FDECL(special_handling, (const char *, +static int FDECL(handle_add_list_remove, (const char *, int)); +static boolean FDECL(special_handling, (const char *, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL const char *FDECL(get_compopt_value, (const char *, char *)); -STATIC_DCL void FDECL(remove_autopickup_exception, +static const char *FDECL(get_compopt_value, (const char *, char *)); +static void FDECL(remove_autopickup_exception, (struct autopickup_exception *)); -STATIC_DCL int FDECL(count_ape_maps, (int *, int *)); +static int FDECL(count_ape_maps, (int *, int *)); -STATIC_DCL boolean FDECL(is_wc_option, (const char *)); -STATIC_DCL boolean FDECL(wc_supported, (const char *)); -STATIC_DCL boolean FDECL(is_wc2_option, (const char *)); -STATIC_DCL boolean FDECL(wc2_supported, (const char *)); -STATIC_DCL void FDECL(wc_set_font_name, (int, char *)); -STATIC_DCL int FDECL(wc_set_window_colors, (char *)); +static boolean FDECL(is_wc_option, (const char *)); +static boolean FDECL(wc_supported, (const char *)); +static boolean FDECL(is_wc2_option, (const char *)); +static boolean FDECL(wc2_supported, (const char *)); +static void FDECL(wc_set_font_name, (int, char *)); +static int FDECL(wc_set_window_colors, (char *)); void reglyph_darkroom() @@ -885,7 +885,7 @@ initoptions_finish() /* copy up to maxlen-1 characters; 'dest' must be able to hold maxlen; treat comma as alternate end of 'src' */ -STATIC_OVL void +static void nmcpy(dest, src, maxlen) char *dest; const char *src; @@ -923,7 +923,7 @@ int maxlen; * an appropriate digit will also fall through to \ and yield 'X' * or 'O', plus stop if the non-digit is end-of-string. */ -STATIC_OVL void +static void escapes(cp, tp) const char *cp; char *tp; @@ -996,7 +996,7 @@ char *tp; *tp = '\0'; } -STATIC_OVL void +static void rejectoption(optname) const char *optname; { @@ -1027,7 +1027,7 @@ OPTIONS=gender */ -STATIC_OVL char * +static char * string_for_opt(opts, val_optional) char *opts; boolean val_optional; @@ -1047,7 +1047,7 @@ boolean val_optional; return colon; } -STATIC_OVL char * +static char * string_for_env_opt(optname, opts, val_optional) const char *optname; char *opts; @@ -1060,7 +1060,7 @@ boolean val_optional; return string_for_opt(opts, val_optional); } -STATIC_OVL void +static void bad_negation(optname, with_parameter) const char *optname; boolean with_parameter; @@ -1078,7 +1078,7 @@ boolean with_parameter; * This routine returns 1 unless there is a duplicate or bad char in * the string. */ -STATIC_OVL int +static int change_inv_order(op) char *op; { @@ -1126,7 +1126,7 @@ char *op; return retval; } -STATIC_OVL boolean +static boolean warning_opts(opts, optype) register char *opts; const char *optype; @@ -1159,7 +1159,7 @@ register uchar *graph_chars; g.warnsyms[i] = graph_chars[i]; } -STATIC_OVL int +static int feature_alert_opts(op, optn) char *op; const char *optn; @@ -1223,7 +1223,7 @@ int on_or_off; } } -STATIC_OVL boolean +static boolean duplicate_opt_detection(opts, iscompound) const char *opts; int iscompound; /* 0 == boolean option, 1 == compound */ @@ -1257,7 +1257,7 @@ int iscompound; /* 0 == boolean option, 1 == compound */ return FALSE; } -STATIC_OVL void +static void complain_about_duplicate(opts, iscompound) const char *opts; int iscompound; /* 0 == boolean option, 1 == compound */ @@ -1275,7 +1275,7 @@ int iscompound; /* 0 == boolean option, 1 == compound */ } /* paranoia[] - used by parseoptions() and special_handling() */ -STATIC_VAR const struct paranoia_opts { +static const struct paranoia_opts { int flagmask; /* which paranoid option */ const char *argname; /* primary name */ int argMinLen; /* minimum number of letters to match */ @@ -1399,7 +1399,7 @@ char *str; return c; } -STATIC_OVL const char * +static const char * attr2attrname(attr) int attr; { @@ -1565,7 +1565,7 @@ static const struct { { "norep", MSGTYP_NOREP, "Do not repeat the message" } }; -STATIC_OVL const char * +static const char * msgtype2name(typ) int typ; { @@ -1577,7 +1577,7 @@ int typ; return (char *) 0; } -STATIC_OVL int +static int query_msgtype() { winid tmpwin; @@ -1605,7 +1605,7 @@ query_msgtype() return -1; } -STATIC_OVL boolean +static boolean msgtype_add(typ, pattern) int typ; char *pattern; @@ -1642,7 +1642,7 @@ msgtype_free() g.plinemsg_types = (struct plinemsg_type *) 0; } -STATIC_OVL void +static void free_one_msgtype(idx) int idx; /* 0 .. */ { @@ -1705,7 +1705,7 @@ int hide_mask; } } -STATIC_OVL int +static int msgtype_count(VOID_ARGS) { int c = 0; @@ -1744,7 +1744,7 @@ char *str; return FALSE; } -STATIC_OVL boolean +static boolean test_regex_pattern(str, errmsg) const char *str; const char *errmsg; @@ -1771,7 +1771,7 @@ const char *errmsg; return retval; } -STATIC_OVL boolean +static boolean add_menu_coloring_parsed(str, c, a) char *str; int c, a; @@ -1875,7 +1875,7 @@ free_menu_coloring() } } -STATIC_OVL void +static void free_one_menu_coloring(idx) int idx; /* 0 .. */ { @@ -1901,7 +1901,7 @@ int idx; /* 0 .. */ } } -STATIC_OVL int +static int count_menucolors(VOID_ARGS) { struct menucoloring *tmp; @@ -1912,7 +1912,7 @@ count_menucolors(VOID_ARGS) return count; } -STATIC_OVL boolean +static boolean parse_role_opts(negated, fullname, opts, opp) boolean negated; const char *fullname; @@ -4282,7 +4282,7 @@ static char fmtstr_doset_tab[] = "%s\t[%s]"; static char n_currently_set[] = "(%d currently set)"; /* doset('O' command) menu entries for compound options */ -STATIC_OVL void +static void doset_add_menu(win, option, indexoffset) winid win; /* window to add to */ const char *option; /* option name */ @@ -4322,7 +4322,7 @@ int indexoffset; /* value to add to index in compopt[], or zero add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); } -STATIC_OVL void +static void opts_add_others(win, name, id, bufx, nset) winid win; const char *name; @@ -4582,7 +4582,7 @@ doset() /* changing options via menu by Per Liboriussen */ } /* common to msg-types, menu-colors, autopickup-exceptions */ -STATIC_OVL int +static int handle_add_list_remove(optname, numtotal) const char *optname; int numtotal; @@ -4629,7 +4629,7 @@ int numtotal; return opt_idx; } -STATIC_OVL boolean +static boolean special_handling(optname, setinitial, setfromfile) const char *optname; boolean setinitial, setfromfile; @@ -5416,7 +5416,7 @@ boolean setinitial, setfromfile; /* This is ugly. We have all the option names in the compopt[] array, but we need to look at each option individually to get the value. */ -STATIC_OVL const char * +static const char * get_compopt_value(optname, buf) const char *optname; char *buf; @@ -5862,7 +5862,7 @@ const char *mapping; return 1; } -STATIC_OVL void +static void remove_autopickup_exception(whichape) struct autopickup_exception *whichape; { @@ -5887,7 +5887,7 @@ struct autopickup_exception *whichape; } } -STATIC_OVL int +static int count_ape_maps(leave, grab) int *leave, *grab; { @@ -6535,7 +6535,7 @@ int status; } } -STATIC_OVL boolean +static boolean is_wc_option(optnam) const char *optnam; { @@ -6549,7 +6549,7 @@ const char *optnam; return FALSE; } -STATIC_OVL boolean +static boolean wc_supported(optnam) const char *optnam; { @@ -6593,7 +6593,7 @@ int status; } } -STATIC_OVL boolean +static boolean is_wc2_option(optnam) const char *optnam; { @@ -6607,7 +6607,7 @@ const char *optnam; return FALSE; } -STATIC_OVL boolean +static boolean wc2_supported(optnam) const char *optnam; { @@ -6621,7 +6621,7 @@ const char *optnam; return FALSE; } -STATIC_OVL void +static void wc_set_font_name(opttype, fontname) int opttype; char *fontname; @@ -6657,7 +6657,7 @@ char *fontname; return; } -STATIC_OVL int +static int wc_set_window_colors(op) char *op; { diff --git a/src/pager.c b/src/pager.c index c98dff5bb..8dac57eb4 100644 --- a/src/pager.c +++ b/src/pager.c @@ -9,35 +9,35 @@ #include "hack.h" #include "dlb.h" -STATIC_DCL boolean FDECL(is_swallow_sym, (int)); -STATIC_DCL int FDECL(append_str, (char *, const char *)); -STATIC_DCL void FDECL(look_at_object, (char *, int, int, int)); -STATIC_DCL void FDECL(look_at_monster, (char *, char *, +static boolean FDECL(is_swallow_sym, (int)); +static int FDECL(append_str, (char *, const char *)); +static void FDECL(look_at_object, (char *, int, int, int)); +static void FDECL(look_at_monster, (char *, char *, struct monst *, int, int)); -STATIC_DCL struct permonst *FDECL(lookat, (int, int, char *, char *)); -STATIC_DCL void FDECL(checkfile, (char *, struct permonst *, +static struct permonst *FDECL(lookat, (int, int, char *, char *)); +static void FDECL(checkfile, (char *, struct permonst *, BOOLEAN_P, BOOLEAN_P, char *)); -STATIC_DCL void FDECL(look_all, (BOOLEAN_P,BOOLEAN_P)); -STATIC_DCL void FDECL(do_supplemental_info, (char *, struct permonst *, +static void FDECL(look_all, (BOOLEAN_P,BOOLEAN_P)); +static void FDECL(do_supplemental_info, (char *, struct permonst *, BOOLEAN_P)); -STATIC_DCL void NDECL(whatdoes_help); -STATIC_DCL void NDECL(docontact); -STATIC_DCL void NDECL(dispfile_help); -STATIC_DCL void NDECL(dispfile_shelp); -STATIC_DCL void NDECL(dispfile_optionfile); -STATIC_DCL void NDECL(dispfile_license); -STATIC_DCL void NDECL(dispfile_debughelp); -STATIC_DCL void NDECL(hmenu_doextversion); -STATIC_DCL void NDECL(hmenu_dohistory); -STATIC_DCL void NDECL(hmenu_dowhatis); -STATIC_DCL void NDECL(hmenu_dowhatdoes); -STATIC_DCL void NDECL(hmenu_doextlist); +static void NDECL(whatdoes_help); +static void NDECL(docontact); +static void NDECL(dispfile_help); +static void NDECL(dispfile_shelp); +static void NDECL(dispfile_optionfile); +static void NDECL(dispfile_license); +static void NDECL(dispfile_debughelp); +static void NDECL(hmenu_doextversion); +static void NDECL(hmenu_dohistory); +static void NDECL(hmenu_dowhatis); +static void NDECL(hmenu_dowhatdoes); +static void NDECL(hmenu_doextlist); #ifdef PORT_HELP extern void NDECL(port_help); #endif /* Returns "true" for characters that could represent a monster's stomach. */ -STATIC_OVL boolean +static boolean is_swallow_sym(c) int c; { @@ -54,7 +54,7 @@ int c; * a substring of buf. Return 1 if the string was appended, 0 otherwise. * It is expected that buf is of size BUFSZ. */ -STATIC_OVL int +static int append_str(buf, new_str) char *buf; const char *new_str; @@ -224,7 +224,7 @@ struct obj **obj_p; return fakeobj; /* when True, caller needs to dealloc *obj_p */ } -STATIC_OVL void +static void look_at_object(buf, x, y, glyph) char *buf; /* output buffer */ int x, y, glyph; @@ -259,7 +259,7 @@ int x, y, glyph; return; } -STATIC_OVL void +static void look_at_monster(buf, monbuf, mtmp, x, y) char *buf, *monbuf; /* buf: output, monbuf: optional output */ struct monst *mtmp; @@ -384,7 +384,7 @@ int x, y; * Return the name of the glyph found at (x,y). * If not hallucinating and the glyph is a monster, also monster data. */ -STATIC_OVL struct permonst * +static struct permonst * lookat(x, y, buf, monbuf) int x, y; char *buf, *monbuf; @@ -529,7 +529,7 @@ char *buf, *monbuf; * lcase() for data.base lookup so that we can have a clean key. * Therefore, we create a copy of inp _just_ for data.base lookup. */ -STATIC_OVL void +static void checkfile(inp, pm, user_typed_name, without_asking, supplemental_name) char *inp; struct permonst *pm; @@ -1299,7 +1299,7 @@ coord *click_cc; return 0; } -STATIC_OVL void +static void look_all(nearby, do_mons) boolean nearby; /* True => within BOLTLIM, False => entire map */ boolean do_mons; /* True => monsters, False => objects */ @@ -1409,7 +1409,7 @@ static const char *suptext2[] = { (char *) 0, }; -STATIC_OVL void +static void do_supplemental_info(name, pm, without_asking) char *name; struct permonst *pm; @@ -1570,7 +1570,7 @@ doidtrap() rest_on_space, #if SHELL, #if SUSPEND) are booleans. */ -STATIC_DCL void +static void whatdoes_help() { dlb *fp; @@ -1604,10 +1604,10 @@ struct wd_stack_frame { Bitfield(else_seen, 1); }; -STATIC_DCL boolean FDECL(whatdoes_cond, (char *, struct wd_stack_frame *, +static boolean FDECL(whatdoes_cond, (char *, struct wd_stack_frame *, int *, int)); -STATIC_OVL boolean +static boolean whatdoes_cond(buf, stack, depth, lnum) char *buf; struct wd_stack_frame *stack; @@ -1855,7 +1855,7 @@ dowhatdoes() return 0; } -STATIC_OVL void +static void docontact(VOID_ARGS) { winid cwin = create_nhwindow(NHW_TEXT); @@ -1885,61 +1885,61 @@ docontact(VOID_ARGS) destroy_nhwindow(cwin); } -STATIC_OVL void +static void dispfile_help(VOID_ARGS) { display_file(HELP, TRUE); } -STATIC_OVL void +static void dispfile_shelp(VOID_ARGS) { display_file(SHELP, TRUE); } -STATIC_OVL void +static void dispfile_optionfile(VOID_ARGS) { display_file(OPTIONFILE, TRUE); } -STATIC_OVL void +static void dispfile_license(VOID_ARGS) { display_file(LICENSE, TRUE); } -STATIC_OVL void +static void dispfile_debughelp(VOID_ARGS) { display_file(DEBUGHELP, TRUE); } -STATIC_OVL void +static void hmenu_doextversion(VOID_ARGS) { (void) doextversion(); } -STATIC_OVL void +static void hmenu_dohistory(VOID_ARGS) { (void) dohistory(); } -STATIC_OVL void +static void hmenu_dowhatis(VOID_ARGS) { (void) dowhatis(); } -STATIC_OVL void +static void hmenu_dowhatdoes(VOID_ARGS) { (void) dowhatdoes(); } -STATIC_OVL void +static void hmenu_doextlist(VOID_ARGS) { (void) doextlist(); diff --git a/src/pickup.c b/src/pickup.c index 8ae5ca59c..fde27156e 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -11,40 +11,40 @@ #define CONTAINED_SYM '>' /* from invent.c */ -STATIC_DCL void FDECL(simple_look, (struct obj *, BOOLEAN_P)); -STATIC_DCL boolean FDECL(query_classes, (char *, boolean *, boolean *, +static void FDECL(simple_look, (struct obj *, BOOLEAN_P)); +static boolean FDECL(query_classes, (char *, boolean *, boolean *, const char *, struct obj *, BOOLEAN_P, int *)); -STATIC_DCL boolean FDECL(fatal_corpse_mistake, (struct obj *, BOOLEAN_P)); -STATIC_DCL void FDECL(check_here, (BOOLEAN_P)); -STATIC_DCL boolean FDECL(n_or_more, (struct obj *)); -STATIC_DCL boolean FDECL(all_but_uchain, (struct obj *)); +static boolean FDECL(fatal_corpse_mistake, (struct obj *, BOOLEAN_P)); +static void FDECL(check_here, (BOOLEAN_P)); +static boolean FDECL(n_or_more, (struct obj *)); +static boolean FDECL(all_but_uchain, (struct obj *)); #if 0 /* not used */ -STATIC_DCL boolean FDECL(allow_cat_no_uchain, (struct obj *)); +static boolean FDECL(allow_cat_no_uchain, (struct obj *)); #endif -STATIC_DCL int FDECL(autopick, (struct obj *, int, menu_item **)); -STATIC_DCL int FDECL(count_categories, (struct obj *, int)); -STATIC_DCL int FDECL(delta_cwt, (struct obj *, struct obj *)); -STATIC_DCL long FDECL(carry_count, (struct obj *, struct obj *, long, +static int FDECL(autopick, (struct obj *, int, menu_item **)); +static int FDECL(count_categories, (struct obj *, int)); +static int FDECL(delta_cwt, (struct obj *, struct obj *)); +static long FDECL(carry_count, (struct obj *, struct obj *, long, BOOLEAN_P, int *, int *)); -STATIC_DCL int FDECL(lift_object, (struct obj *, struct obj *, long *, +static int FDECL(lift_object, (struct obj *, struct obj *, long *, BOOLEAN_P)); -STATIC_DCL boolean FDECL(mbag_explodes, (struct obj *, int)); -STATIC_DCL long FDECL(boh_loss, (struct obj *container, int)); -STATIC_PTR int FDECL(in_container, (struct obj *)); -STATIC_PTR int FDECL(out_container, (struct obj *)); -STATIC_DCL void FDECL(removed_from_icebox, (struct obj *)); -STATIC_DCL long FDECL(mbag_item_gone, (int, struct obj *)); -STATIC_DCL void FDECL(explain_container_prompt, (BOOLEAN_P)); -STATIC_DCL int FDECL(traditional_loot, (BOOLEAN_P)); -STATIC_DCL int FDECL(menu_loot, (int, BOOLEAN_P)); -STATIC_DCL char FDECL(in_or_out_menu, (const char *, struct obj *, BOOLEAN_P, +static boolean FDECL(mbag_explodes, (struct obj *, int)); +static long FDECL(boh_loss, (struct obj *container, int)); +static int FDECL(in_container, (struct obj *)); +static int FDECL(out_container, (struct obj *)); +static void FDECL(removed_from_icebox, (struct obj *)); +static long FDECL(mbag_item_gone, (int, struct obj *)); +static void FDECL(explain_container_prompt, (BOOLEAN_P)); +static int FDECL(traditional_loot, (BOOLEAN_P)); +static int FDECL(menu_loot, (int, BOOLEAN_P)); +static char FDECL(in_or_out_menu, (const char *, struct obj *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL boolean FDECL(able_to_loot, (int, int, BOOLEAN_P)); -STATIC_DCL boolean NDECL(reverse_loot); -STATIC_DCL boolean FDECL(mon_beside, (int, int)); -STATIC_DCL int FDECL(do_loot_cont, (struct obj **, int, int)); -STATIC_DCL void FDECL(tipcontainer, (struct obj *)); +static boolean FDECL(able_to_loot, (int, int, BOOLEAN_P)); +static boolean NDECL(reverse_loot); +static boolean FDECL(mon_beside, (int, int)); +static int FDECL(do_loot_cont, (struct obj **, int, int)); +static void FDECL(tipcontainer, (struct obj *)); /* define for query_objlist() and autopickup() */ #define FOLLOW(curr, flags) \ @@ -64,7 +64,7 @@ static const char /* BUG: this lets you look at cockatrice corpses while blind without touching them */ /* much simpler version of the look-here code; used by query_classes() */ -STATIC_OVL void +static void simple_look(otmp, here) struct obj *otmp; /* list of objects */ boolean here; /* flag for type of obj list linkage */ @@ -126,7 +126,7 @@ int *itemcount; * "?/a" or "a?/" or "/a?",&c picks all '?' even though no '/' * (ie, treated as if it had just been "?a"). */ -STATIC_OVL boolean +static boolean query_classes(oclasses, one_at_a_time, everything, action, objs, here, menu_on_demand) char oclasses[]; @@ -249,7 +249,7 @@ int *menu_on_demand; } /* check whether hero is bare-handedly touching a cockatrice corpse */ -STATIC_OVL boolean +static boolean fatal_corpse_mistake(obj, remotely) struct obj *obj; boolean remotely; @@ -286,7 +286,7 @@ boolean remotely; } /* look at the objects at our location, unless there are too many of them */ -STATIC_OVL void +static void check_here(picked_some) boolean picked_some; { @@ -311,7 +311,7 @@ boolean picked_some; } /* query_objlist callback: return TRUE if obj's count is >= reference value */ -STATIC_OVL boolean +static boolean n_or_more(obj) struct obj *obj; { @@ -360,7 +360,7 @@ int c; } /* query_objlist callback: return TRUE if not uchain */ -STATIC_OVL boolean +static boolean all_but_uchain(obj) struct obj *obj; { @@ -440,7 +440,7 @@ struct obj *obj; #if 0 /* not used */ /* query_objlist callback: return TRUE if valid category (class), no uchain */ -STATIC_OVL boolean +static boolean allow_cat_no_uchain(obj) struct obj *obj; { @@ -762,7 +762,7 @@ boolean calc_costly; * picked is zero, the pickup list is left alone. The caller of this * function must free the pickup list. */ -STATIC_OVL int +static int autopick(olist, follow, pick_list) struct obj *olist; /* the object list */ int follow; /* how to follow the object list */ @@ -1179,7 +1179,7 @@ int how; /* type of query */ return n; } -STATIC_OVL int +static int count_categories(olist, qflags) struct obj *olist; int qflags; @@ -1213,7 +1213,7 @@ int qflags; * object is removed from it. Use before and after weight amounts rather * than trying to match the calculation used by weight() in mkobj.c. */ -STATIC_OVL int +static int delta_cwt(container, obj) struct obj *container, *obj; { @@ -1240,7 +1240,7 @@ struct obj *container, *obj; } /* could we carry `obj'? if not, could we carry some of it/them? */ -STATIC_OVL long +static long carry_count(obj, container, count, telekinesis, wt_before, wt_after) struct obj *obj, *container; /* object to pick up, bag it's coming out of */ long count; @@ -1375,7 +1375,7 @@ int *wt_before, *wt_after; } /* determine whether character is able and player is willing to carry `obj' */ -STATIC_OVL +static int lift_object(obj, container, cnt_p, telekinesis) struct obj *obj, *container; /* object to pick up, bag it's coming out of */ @@ -1651,7 +1651,7 @@ boolean countem; return container_count; } -STATIC_OVL boolean +static boolean able_to_loot(x, y, looting) int x, y; boolean looting; /* loot vs tip */ @@ -1681,7 +1681,7 @@ boolean looting; /* loot vs tip */ return TRUE; } -STATIC_OVL boolean +static boolean mon_beside(x, y) int x, y; { @@ -1697,7 +1697,7 @@ int x, y; return FALSE; } -STATIC_OVL int +static int do_loot_cont(cobjp, cindex, ccount) struct obj **cobjp; int cindex, ccount; /* index of this container (1..N), number of them (N) */ @@ -1916,7 +1916,7 @@ doloot() } /* called when attempting to #loot while confused */ -STATIC_OVL boolean +static boolean reverse_loot() { struct obj *goldob = 0, *coffers, *otmp, boxdummy; @@ -2057,7 +2057,7 @@ boolean *prev_loot; * Decide whether an object being placed into a magic bag will cause * it to explode. If the object is a bag itself, check recursively. */ -STATIC_OVL boolean +static boolean mbag_explodes(obj, depthin) struct obj *obj; int depthin; @@ -2081,7 +2081,7 @@ int depthin; return FALSE; } -STATIC_OVL long +static long boh_loss(container, held) struct obj *container; int held; @@ -2104,7 +2104,7 @@ int held; } /* Returns: -1 to stop, 1 item was inserted, 0 item was not inserted. */ -STATIC_PTR int +static int in_container(obj) register struct obj *obj; { @@ -2270,7 +2270,7 @@ struct obj *obj; } /* Returns: -1 to stop, 1 item was removed, 0 item was not removed. */ -STATIC_PTR int +static int out_container(obj) register struct obj *obj; { @@ -2330,7 +2330,7 @@ register struct obj *obj; } /* taking a corpse out of an ice box needs a couple of adjustments */ -STATIC_OVL void +static void removed_from_icebox(obj) struct obj *obj; { @@ -2342,7 +2342,7 @@ struct obj *obj; } /* an object inside a cursed bag of holding is being destroyed */ -STATIC_OVL long +static long mbag_item_gone(held, item) int held; struct obj *item; @@ -2439,7 +2439,7 @@ int FDECL((*fn), (OBJ_P)); && !g.current_container); } -STATIC_OVL void +static void explain_container_prompt(more_containers) boolean more_containers; { @@ -2732,7 +2732,7 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */ } /* loot current_container (take things out or put things in), by prompting */ -STATIC_OVL int +static int traditional_loot(put_in) boolean put_in; { @@ -2767,7 +2767,7 @@ boolean put_in; } /* loot current_container (take things out or put things in), using a menu */ -STATIC_OVL int +static int menu_loot(retry, put_in) int retry; boolean put_in; @@ -2859,7 +2859,7 @@ boolean put_in; return n_looted; } -STATIC_OVL char +static char in_or_out_menu(prompt, obj, outokay, inokay, alreadyused, more_containers) const char *prompt; struct obj *obj; @@ -3090,7 +3090,7 @@ dotip() return 0; } -STATIC_OVL void +static void tipcontainer(box) struct obj *box; /* or bag */ { diff --git a/src/polyself.c b/src/polyself.c index 9753e77ae..8517307d8 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -21,15 +21,15 @@ #include "hack.h" -STATIC_DCL void FDECL(check_strangling, (BOOLEAN_P)); -STATIC_DCL void FDECL(polyman, (const char *, const char *)); -STATIC_DCL void NDECL(break_armor); -STATIC_DCL void FDECL(drop_weapon, (int)); -STATIC_DCL int FDECL(armor_to_dragon, (int)); -STATIC_DCL void NDECL(newman); -STATIC_DCL void NDECL(polysense); +static void FDECL(check_strangling, (BOOLEAN_P)); +static void FDECL(polyman, (const char *, const char *)); +static void NDECL(break_armor); +static void FDECL(drop_weapon, (int)); +static int FDECL(armor_to_dragon, (int)); +static void NDECL(newman); +static void NDECL(polysense); -STATIC_VAR const char no_longer_petrify_resistant[] = +static const char no_longer_petrify_resistant[] = "No longer petrify-resistant, you"; /* update the g.youmonst.data structure pointer and intrinsics */ @@ -135,7 +135,7 @@ float_vs_flight() } /* for changing into form that's immune to strangulation */ -STATIC_OVL void +static void check_strangling(on) boolean on; { @@ -164,7 +164,7 @@ boolean on; } /* make a (new) human out of the player */ -STATIC_OVL void +static void polyman(fmt, arg) const char *fmt, *arg; { @@ -270,7 +270,7 @@ change_sex() } } -STATIC_OVL void +static void newman() { int i, oldlvl, newlvl, hpmax, enmax; @@ -876,7 +876,7 @@ int mntmp; return 1; } -STATIC_OVL void +static void break_armor() { register struct obj *otmp; @@ -989,7 +989,7 @@ break_armor() } } -STATIC_OVL void +static void drop_weapon(alone) int alone; { @@ -1799,7 +1799,7 @@ int damtype, dam; } } -STATIC_OVL int +static int armor_to_dragon(atyp) int atyp; { diff --git a/src/potion.c b/src/potion.c index f41f322c5..c2a6c88df 100644 --- a/src/potion.c +++ b/src/potion.c @@ -7,15 +7,15 @@ static NEARDATA const char beverages[] = { POTION_CLASS, 0 }; -STATIC_DCL long FDECL(itimeout, (long)); -STATIC_DCL long FDECL(itimeout_incr, (long, int)); -STATIC_DCL void NDECL(ghost_from_bottle); -STATIC_DCL boolean +static long FDECL(itimeout, (long)); +static long FDECL(itimeout_incr, (long, int)); +static void NDECL(ghost_from_bottle); +static boolean FDECL(H2Opotion_dip, (struct obj *, struct obj *, BOOLEAN_P, const char *)); -STATIC_DCL short FDECL(mixtype, (struct obj *, struct obj *)); +static short FDECL(mixtype, (struct obj *, struct obj *)); /* force `val' to be within valid range for intrinsic timeout value */ -STATIC_OVL long +static long itimeout(val) long val; { @@ -28,7 +28,7 @@ long val; } /* increment `old' by `incr' and force result to be valid intrinsic timeout */ -STATIC_OVL long +static long itimeout_incr(old, incr) long old; int incr; @@ -447,7 +447,7 @@ self_invis_message() : "can't see yourself"); } -STATIC_OVL void +static void ghost_from_bottle() { struct monst *mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, NO_MM_FLAGS); @@ -1207,7 +1207,7 @@ bottlename() } /* handle item dipped into water potion or steed saddle splashed by same */ -STATIC_OVL boolean +static boolean H2Opotion_dip(potion, targobj, useeit, objphrase) struct obj *potion, *targobj; boolean useeit; @@ -1762,7 +1762,7 @@ register struct obj *obj; } /* returns the potion type when o1 is dipped in o2 */ -STATIC_OVL short +static short mixtype(o1, o2) register struct obj *o1, *o2; { diff --git a/src/pray.c b/src/pray.c index e7a9082a0..a22cecb29 100644 --- a/src/pray.c +++ b/src/pray.c @@ -4,22 +4,22 @@ #include "hack.h" -STATIC_PTR int NDECL(prayer_done); -STATIC_DCL struct obj *NDECL(worst_cursed_item); -STATIC_DCL int NDECL(in_trouble); -STATIC_DCL void FDECL(fix_worst_trouble, (int)); -STATIC_DCL void FDECL(angrygods, (ALIGNTYP_P)); -STATIC_DCL void FDECL(at_your_feet, (const char *)); -STATIC_DCL void NDECL(gcrownu); -STATIC_DCL void FDECL(pleased, (ALIGNTYP_P)); -STATIC_DCL void FDECL(godvoice, (ALIGNTYP_P, const char *)); -STATIC_DCL void FDECL(god_zaps_you, (ALIGNTYP_P)); -STATIC_DCL void FDECL(fry_by_god, (ALIGNTYP_P, BOOLEAN_P)); -STATIC_DCL void FDECL(gods_angry, (ALIGNTYP_P)); -STATIC_DCL void FDECL(gods_upset, (ALIGNTYP_P)); -STATIC_DCL void FDECL(consume_offering, (struct obj *)); -STATIC_DCL boolean FDECL(water_prayer, (BOOLEAN_P)); -STATIC_DCL boolean FDECL(blocked_boulder, (int, int)); +static int NDECL(prayer_done); +static struct obj *NDECL(worst_cursed_item); +static int NDECL(in_trouble); +static void FDECL(fix_worst_trouble, (int)); +static void FDECL(angrygods, (ALIGNTYP_P)); +static void FDECL(at_your_feet, (const char *)); +static void NDECL(gcrownu); +static void FDECL(pleased, (ALIGNTYP_P)); +static void FDECL(godvoice, (ALIGNTYP_P, const char *)); +static void FDECL(god_zaps_you, (ALIGNTYP_P)); +static void FDECL(fry_by_god, (ALIGNTYP_P, BOOLEAN_P)); +static void FDECL(gods_angry, (ALIGNTYP_P)); +static void FDECL(gods_upset, (ALIGNTYP_P)); +static void FDECL(consume_offering, (struct obj *)); +static boolean FDECL(water_prayer, (BOOLEAN_P)); +static boolean FDECL(blocked_boulder, (int, int)); /* simplify a few tests */ #define Cursed_obj(obj, typ) ((obj) && (obj)->otyp == (typ) && (obj)->cursed) @@ -174,7 +174,7 @@ stuck_in_wall() * 3.4.2: make an exception if polymorphed into a form which lacks * hands; that's a case where the ramifications override this doubt. */ -STATIC_OVL int +static int in_trouble() { struct obj *otmp; @@ -264,7 +264,7 @@ in_trouble() } /* select an item for TROUBLE_CURSED_ITEMS */ -STATIC_OVL struct obj * +static struct obj * worst_cursed_item() { register struct obj *otmp; @@ -325,7 +325,7 @@ worst_cursed_item() return otmp; } -STATIC_OVL void +static void fix_worst_trouble(trouble) int trouble; { @@ -567,7 +567,7 @@ int trouble; * bathroom walls, but who is foiled by bathrobes." --Bertrand Russell, 1943 * Divine wrath, dungeon walls, and armor follow the same principle. */ -STATIC_OVL void +static void god_zaps_you(resp_god) aligntyp resp_god; { @@ -643,7 +643,7 @@ aligntyp resp_god; } } -STATIC_OVL void +static void fry_by_god(resp_god, via_disintegration) aligntyp resp_god; boolean via_disintegration; @@ -655,7 +655,7 @@ boolean via_disintegration; done(DIED); } -STATIC_OVL void +static void angrygods(resp_god) aligntyp resp_god; { @@ -748,7 +748,7 @@ const char *str; } } -STATIC_OVL void +static void gcrownu() { struct obj *obj; @@ -904,7 +904,7 @@ gcrownu() return; } -STATIC_OVL void +static void pleased(g_align) aligntyp g_align; { @@ -1215,7 +1215,7 @@ aligntyp g_align; /* either blesses or curses water on the altar, * returns true if it found any water here. */ -STATIC_OVL boolean +static boolean water_prayer(bless_water) boolean bless_water; { @@ -1244,7 +1244,7 @@ boolean bless_water; return (boolean) (changed > 0L); } -STATIC_OVL void +static void godvoice(g_align, words) aligntyp g_align; const char *words; @@ -1260,7 +1260,7 @@ const char *words; godvoices[rn2(SIZE(godvoices))], quot, words, quot); } -STATIC_OVL void +static void gods_angry(g_align) aligntyp g_align; { @@ -1268,7 +1268,7 @@ aligntyp g_align; } /* The g_align god is upset with you. */ -STATIC_OVL void +static void gods_upset(g_align) aligntyp g_align; { @@ -1279,7 +1279,7 @@ aligntyp g_align; angrygods(g_align); } -STATIC_OVL void +static void consume_offering(otmp) register struct obj *otmp; { @@ -1865,7 +1865,7 @@ dopray() return 1; } -STATIC_PTR int +static int prayer_done() /* M. Stephenson (1.0.3b) */ { aligntyp alignment = g.p_aligntyp; @@ -2240,7 +2240,7 @@ register int x, y; } /* assumes isok() at one space away, but not necessarily at two */ -STATIC_OVL boolean +static boolean blocked_boulder(dx, dy) int dx, dy; { diff --git a/src/priest.c b/src/priest.c index 2c0c67913..08853e982 100644 --- a/src/priest.c +++ b/src/priest.c @@ -9,8 +9,8 @@ #define ALGN_SINNED (-4) /* worse than strayed (-1..-3) */ #define ALGN_PIOUS 14 /* better than fervent (9..13) */ -STATIC_DCL boolean FDECL(histemple_at, (struct monst *, XCHAR_P, XCHAR_P)); -STATIC_DCL boolean FDECL(has_shrine, (struct monst *)); +static boolean FDECL(histemple_at, (struct monst *, XCHAR_P, XCHAR_P)); +static boolean FDECL(has_shrine, (struct monst *)); void newepri(mtmp) @@ -149,7 +149,7 @@ register char *array; return '\0'; } -STATIC_OVL boolean +static boolean histemple_at(priest, x, y) register struct monst *priest; register xchar x, y; @@ -349,7 +349,7 @@ struct monst *priest; return (boolean) (u.ualign.type == mon_aligntyp(priest)); } -STATIC_OVL boolean +static boolean has_shrine(pri) struct monst *pri; { diff --git a/src/quest.c b/src/quest.c index 46a30e667..42f2db639 100644 --- a/src/quest.c +++ b/src/quest.c @@ -12,18 +12,18 @@ #define Not_firsttime (on_level(&u.uz0, &u.uz)) #define Qstat(x) (g.quest_status.x) -STATIC_DCL void NDECL(on_start); -STATIC_DCL void NDECL(on_locate); -STATIC_DCL void NDECL(on_goal); -STATIC_DCL boolean NDECL(not_capable); -STATIC_DCL int FDECL(is_pure, (BOOLEAN_P)); -STATIC_DCL void FDECL(expulsion, (BOOLEAN_P)); -STATIC_DCL void NDECL(chat_with_leader); -STATIC_DCL void NDECL(chat_with_nemesis); -STATIC_DCL void NDECL(chat_with_guardian); -STATIC_DCL void FDECL(prisoner_speaks, (struct monst *)); +static void NDECL(on_start); +static void NDECL(on_locate); +static void NDECL(on_goal); +static boolean NDECL(not_capable); +static int FDECL(is_pure, (BOOLEAN_P)); +static void FDECL(expulsion, (BOOLEAN_P)); +static void NDECL(chat_with_leader); +static void NDECL(chat_with_nemesis); +static void NDECL(chat_with_guardian); +static void FDECL(prisoner_speaks, (struct monst *)); -STATIC_OVL void +static void on_start() { if (!Qstat(first_start)) { @@ -37,7 +37,7 @@ on_start() } } -STATIC_OVL void +static void on_locate() { /* the locate messages are phrased in a manner such that they only @@ -59,7 +59,7 @@ on_locate() } } -STATIC_OVL void +static void on_goal() { if (Qstat(killed_nemesis)) { @@ -136,13 +136,13 @@ ok_to_quest() && is_pure(FALSE) > 0); } -STATIC_OVL boolean +static boolean not_capable() { return (boolean) (u.ulevel < MIN_QUEST_LEVEL); } -STATIC_OVL int +static int is_pure(talk) boolean talk; { @@ -176,7 +176,7 @@ boolean talk; * This assumes that the hero is currently _in_ the quest dungeon and that * there is a single branch to and from it. */ -STATIC_OVL void +static void expulsion(seal) boolean seal; { @@ -243,7 +243,7 @@ struct obj *obj; /* quest artifact; possibly null if carrying Amulet */ } } -STATIC_OVL void +static void chat_with_leader() { /* Rule 0: Cheater checks. */ @@ -336,7 +336,7 @@ struct monst *mtmp; chat_with_leader(); } -STATIC_OVL void +static void chat_with_nemesis() { /* The nemesis will do most of the talking, but... */ @@ -367,7 +367,7 @@ nemesis_speaks() qt_pager(rn1(10, QT_DISCOURAGE)); } -STATIC_OVL void +static void chat_with_guardian() { /* These guys/gals really don't have much to say... */ @@ -377,7 +377,7 @@ chat_with_guardian() qt_pager(rn1(5, QT_GUARDTALK)); } -STATIC_OVL void +static void prisoner_speaks(mtmp) struct monst *mtmp; { diff --git a/src/questpgr.c b/src/questpgr.c index e2cdc8314..f0cf6283f 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -17,19 +17,19 @@ static void NDECL(dump_qtlist); static void FDECL(Fread, (genericptr_t, int, int, dlb *)); -STATIC_DCL struct qtmsg *FDECL(construct_qtlist, (long)); -STATIC_DCL const char *NDECL(intermed); -STATIC_DCL struct obj *FDECL(find_qarti, (struct obj *)); -STATIC_DCL const char *NDECL(neminame); -STATIC_DCL const char *NDECL(guardname); -STATIC_DCL const char *NDECL(homebase); -STATIC_DCL void FDECL(qtext_pronoun, (CHAR_P, CHAR_P)); -STATIC_DCL struct qtmsg *FDECL(msg_in, (struct qtmsg *, int)); -STATIC_DCL void FDECL(convert_arg, (CHAR_P)); -STATIC_DCL void FDECL(convert_line, (char *,char *)); -STATIC_DCL void FDECL(deliver_by_pline, (struct qtmsg *)); -STATIC_DCL void FDECL(deliver_by_window, (struct qtmsg *, int)); -STATIC_DCL boolean FDECL(skip_pager, (BOOLEAN_P)); +static struct qtmsg *FDECL(construct_qtlist, (long)); +static const char *NDECL(intermed); +static struct obj *FDECL(find_qarti, (struct obj *)); +static const char *NDECL(neminame); +static const char *NDECL(guardname); +static const char *NDECL(homebase); +static void FDECL(qtext_pronoun, (CHAR_P, CHAR_P)); +static struct qtmsg *FDECL(msg_in, (struct qtmsg *, int)); +static void FDECL(convert_arg, (CHAR_P)); +static void FDECL(convert_line, (char *,char *)); +static void FDECL(deliver_by_pline, (struct qtmsg *)); +static void FDECL(deliver_by_window, (struct qtmsg *, int)); +static boolean FDECL(skip_pager, (BOOLEAN_P)); /* dump the character msg list to check appearance; build with DEBUG enabled and use DEBUGFILES=questpgr.c @@ -65,7 +65,7 @@ dlb *stream; } } -STATIC_OVL struct qtmsg * +static struct qtmsg * construct_qtlist(hdr_offset) long hdr_offset; { @@ -175,7 +175,7 @@ ldrname() } /* return your intermediate target string */ -STATIC_OVL const char * +static const char * intermed() { return g.urole.intermed; @@ -188,7 +188,7 @@ struct obj *otmp; return (boolean) (otmp->oartifact == g.urole.questarti); } -STATIC_OVL struct obj * +static struct obj * find_qarti(ochain) struct obj *ochain; { @@ -241,7 +241,7 @@ unsigned whichchains; } /* return your role nemesis' name */ -STATIC_OVL const char * +static const char * neminame() { int i = g.urole.neminum; @@ -251,7 +251,7 @@ neminame() return g.nambuf; } -STATIC_OVL const char * +static const char * guardname() /* return your role leader's guard monster name */ { int i = g.urole.guardnum; @@ -259,7 +259,7 @@ guardname() /* return your role leader's guard monster name */ return mons[i].mname; } -STATIC_OVL const char * +static const char * homebase() /* return your role leader's location */ { return g.urole.homebase; @@ -267,7 +267,7 @@ homebase() /* return your role leader's location */ /* replace deity, leader, nemesis, or artifact name with pronoun; overwrites cvt_buf[] */ -STATIC_OVL void +static void qtext_pronoun(who, which) char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */ which; /* 'h'|'H'|'i'|'I'|'j'|'J' */ @@ -304,7 +304,7 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */ return; } -STATIC_OVL struct qtmsg * +static struct qtmsg * msg_in(qtm_list, msgnum) struct qtmsg *qtm_list; int msgnum; @@ -318,7 +318,7 @@ int msgnum; return (struct qtmsg *) 0; } -STATIC_OVL void +static void convert_arg(c) char c; { @@ -410,7 +410,7 @@ char c; Strcpy(g.cvt_buf, str); } -STATIC_OVL void +static void convert_line(in_line, out_line) char *in_line, *out_line; { @@ -504,7 +504,7 @@ char *in_line, *out_line; return; } -STATIC_OVL void +static void deliver_by_pline(qt_msg) struct qtmsg *qt_msg; { @@ -519,7 +519,7 @@ struct qtmsg *qt_msg; } } -STATIC_OVL void +static void deliver_by_window(qt_msg, how) struct qtmsg *qt_msg; int how; @@ -569,7 +569,7 @@ int how; putmsghistory(out_line, FALSE); } -STATIC_OVL boolean +static boolean skip_pager(common) boolean common; { diff --git a/src/read.c b/src/read.c index 9c3f88eb8..84a3278a3 100644 --- a/src/read.c +++ b/src/read.c @@ -16,26 +16,26 @@ static NEARDATA const char readable[] = { ALL_CLASSES, SCROLL_CLASS, SPBOOK_CLASS, 0 }; static const char all_count[] = { ALLOW_COUNT, ALL_CLASSES, 0 }; -STATIC_DCL boolean FDECL(learnscrolltyp, (SHORT_P)); -STATIC_DCL char *FDECL(erode_obj_text, (struct obj *, char *)); -STATIC_DCL char *FDECL(apron_text, (struct obj *, char *buf)); -STATIC_DCL void FDECL(stripspe, (struct obj *)); -STATIC_DCL void FDECL(p_glow1, (struct obj *)); -STATIC_DCL void FDECL(p_glow2, (struct obj *, const char *)); -STATIC_DCL void FDECL(forget_single_object, (int)); +static boolean FDECL(learnscrolltyp, (SHORT_P)); +static char *FDECL(erode_obj_text, (struct obj *, char *)); +static char *FDECL(apron_text, (struct obj *, char *buf)); +static void FDECL(stripspe, (struct obj *)); +static void FDECL(p_glow1, (struct obj *)); +static void FDECL(p_glow2, (struct obj *, const char *)); +static void FDECL(forget_single_object, (int)); #if 0 /* not used */ -STATIC_DCL void FDECL(forget_objclass, (int)); +static void FDECL(forget_objclass, (int)); #endif -STATIC_DCL void FDECL(randomize, (int *, int)); -STATIC_DCL void FDECL(forget, (int)); -STATIC_DCL int FDECL(maybe_tame, (struct monst *, struct obj *)); -STATIC_DCL boolean FDECL(get_valid_stinking_cloud_pos, (int, int)); -STATIC_DCL boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P)); -STATIC_PTR void FDECL(display_stinking_cloud_positions, (int)); -STATIC_PTR void FDECL(set_lit, (int, int, genericptr)); -STATIC_DCL void NDECL(do_class_genocide); +static void FDECL(randomize, (int *, int)); +static void FDECL(forget, (int)); +static int FDECL(maybe_tame, (struct monst *, struct obj *)); +static boolean FDECL(get_valid_stinking_cloud_pos, (int, int)); +static boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P)); +static void FDECL(display_stinking_cloud_positions, (int)); +static void FDECL(set_lit, (int, int, genericptr)); +static void NDECL(do_class_genocide); -STATIC_OVL boolean +static boolean learnscrolltyp(scrolltyp) short scrolltyp; { @@ -58,7 +58,7 @@ struct obj *sobj; (void) learnscrolltyp(sobj->otyp); } -STATIC_OVL char * +static char * erode_obj_text(otmp, buf) struct obj *otmp; char *buf; @@ -160,7 +160,7 @@ char *buf; return erode_obj_text(tshirt, buf); } -STATIC_OVL char * +static char * apron_text(apron, buf) struct obj *apron; char *buf; @@ -406,7 +406,7 @@ doread() return 1; } -STATIC_OVL void +static void stripspe(obj) register struct obj *obj; { @@ -422,14 +422,14 @@ register struct obj *obj; } } -STATIC_OVL void +static void p_glow1(otmp) register struct obj *otmp; { pline("%s briefly.", Yobjnam2(otmp, Blind ? "vibrate" : "glow")); } -STATIC_OVL void +static void p_glow2(otmp, color) register struct obj *otmp; register const char *color; @@ -712,7 +712,7 @@ int curse_bless; } /* Forget known information about this object type. */ -STATIC_OVL void +static void forget_single_object(obj_id) int obj_id; { @@ -729,7 +729,7 @@ int obj_id; #if 0 /* here if anyone wants it.... */ /* Forget everything known about a particular object class. */ -STATIC_OVL void +static void forget_objclass(oclass) int oclass; { @@ -742,7 +742,7 @@ int oclass; #endif /* randomize the given list of numbers 0 <= i < count */ -STATIC_OVL void +static void randomize(indices, count) int *indices; int count; @@ -890,7 +890,7 @@ int percent; * howmuch & ALL_MAP = forget whole map * howmuch & ALL_SPELLS = forget all spells */ -STATIC_OVL void +static void forget(howmuch) int howmuch; { @@ -924,7 +924,7 @@ int howmuch; } /* monster is hit by scroll of taming's effect */ -STATIC_OVL int +static int maybe_tame(mtmp, sobj) struct monst *mtmp; struct obj *sobj; @@ -947,7 +947,7 @@ struct obj *sobj; return 0; } -STATIC_OVL boolean +static boolean get_valid_stinking_cloud_pos(x,y) int x,y; { @@ -956,7 +956,7 @@ int x,y; || distu(x, y) >= 32)); } -STATIC_OVL boolean +static boolean is_valid_stinking_cloud_pos(x, y, showmsg) int x, y; boolean showmsg; @@ -969,7 +969,7 @@ boolean showmsg; return TRUE; } -STATIC_PTR void +static void display_stinking_cloud_positions(state) int state; { @@ -1897,12 +1897,12 @@ struct litmon { struct monst *mon; struct litmon *nxt; }; -STATIC_VAR struct litmon *gremlins = 0; +static struct litmon *gremlins = 0; /* * Low-level lit-field update routine. */ -STATIC_PTR void +static void set_lit(x, y, val) int x, y; genericptr_t val; @@ -2029,7 +2029,7 @@ struct obj *obj; } } -STATIC_OVL void +static void do_class_genocide() { int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0; diff --git a/src/rect.c b/src/rect.c index e8f2b5a3b..9f462fcc6 100644 --- a/src/rect.c +++ b/src/rect.c @@ -6,7 +6,7 @@ int FDECL(get_rect_ind, (NhRect *)); -STATIC_DCL boolean FDECL(intersect, (NhRect *, NhRect *, NhRect *)); +static boolean FDECL(intersect, (NhRect *, NhRect *, NhRect *)); /* * In this file, we will handle the various rectangle functions we @@ -97,7 +97,7 @@ rnd_rect() * otherwise returns FALSE */ -STATIC_OVL boolean +static boolean intersect(r1, r2, r3) NhRect *r1, *r2, *r3; { diff --git a/src/region.c b/src/region.c index 057d58bf6..d918b27d9 100644 --- a/src/region.c +++ b/src/region.c @@ -41,7 +41,7 @@ boolean FDECL(enter_force_field, (genericptr,genericptr)); NhRegion *FDECL(create_force_field, (XCHAR_P,XCHAR_P,int,long)); #endif -STATIC_DCL void FDECL(reset_region_mids, (NhRegion *)); +static void FDECL(reset_region_mids, (NhRegion *)); static const callback_proc callbacks[] = { #define INSIDE_GAS_CLOUD 0 @@ -925,7 +925,7 @@ long *count, *size; } /* update monster IDs for region being loaded from bones; `ghostly' implied */ -STATIC_OVL void +static void reset_region_mids(reg) NhRegion *reg; { diff --git a/src/restore.c b/src/restore.c index 0a9f823fe..ba9ef8f93 100644 --- a/src/restore.c +++ b/src/restore.c @@ -20,27 +20,27 @@ extern void FDECL(substitute_tiles, (d_level *)); /* from tile.c */ #endif #ifdef ZEROCOMP -STATIC_DCL void NDECL(zerocomp_minit); -STATIC_DCL void FDECL(zerocomp_mread, (int, genericptr_t, unsigned int)); -STATIC_DCL int NDECL(zerocomp_mgetc); +static void NDECL(zerocomp_minit); +static void FDECL(zerocomp_mread, (int, genericptr_t, unsigned int)); +static int NDECL(zerocomp_mgetc); #endif -STATIC_DCL void NDECL(find_lev_obj); -STATIC_DCL void FDECL(restlevchn, (NHFILE *)); -STATIC_DCL void FDECL(restdamage, (NHFILE *, BOOLEAN_P)); -STATIC_DCL void FDECL(restobj, (NHFILE *, struct obj *)); -STATIC_DCL struct obj *FDECL(restobjchn, (NHFILE *, BOOLEAN_P, BOOLEAN_P)); -STATIC_OVL void FDECL(restmon, (NHFILE *, struct monst *)); -STATIC_DCL struct monst *FDECL(restmonchn, (NHFILE *, BOOLEAN_P)); -STATIC_DCL struct fruit *FDECL(loadfruitchn, (NHFILE *)); -STATIC_DCL void FDECL(freefruitchn, (struct fruit *)); -STATIC_DCL void FDECL(ghostfruit, (struct obj *)); -STATIC_DCL boolean FDECL(restgamestate, (NHFILE *, unsigned int *, unsigned int *)); -STATIC_DCL void FDECL(restlevelstate, (unsigned int, unsigned int)); -STATIC_DCL int FDECL(restlevelfile, (NHFILE *, XCHAR_P)); -STATIC_OVL void FDECL(restore_msghistory, (NHFILE *)); -STATIC_DCL void FDECL(reset_oattached_mids, (BOOLEAN_P)); -STATIC_DCL void FDECL(rest_levl, (NHFILE *, BOOLEAN_P)); +static void NDECL(find_lev_obj); +static void FDECL(restlevchn, (NHFILE *)); +static void FDECL(restdamage, (NHFILE *, BOOLEAN_P)); +static void FDECL(restobj, (NHFILE *, struct obj *)); +static struct obj *FDECL(restobjchn, (NHFILE *, BOOLEAN_P, BOOLEAN_P)); +static void FDECL(restmon, (NHFILE *, struct monst *)); +static struct monst *FDECL(restmonchn, (NHFILE *, BOOLEAN_P)); +static struct fruit *FDECL(loadfruitchn, (NHFILE *)); +static void FDECL(freefruitchn, (struct fruit *)); +static void FDECL(ghostfruit, (struct obj *)); +static boolean FDECL(restgamestate, (NHFILE *, unsigned int *, unsigned int *)); +static void FDECL(restlevelstate, (unsigned int, unsigned int)); +static int FDECL(restlevelfile, (NHFILE *, XCHAR_P)); +static void FDECL(restore_msghistory, (NHFILE *)); +static void FDECL(reset_oattached_mids, (BOOLEAN_P)); +static void FDECL(rest_levl, (NHFILE *, BOOLEAN_P)); /* * Save a mapping of IDs from ghost levels to the current level. This @@ -55,8 +55,8 @@ struct bucket { } map[N_PER_BUCKET]; }; -STATIC_DCL void NDECL(clear_id_mapping); -STATIC_DCL void FDECL(add_id_mapping, (unsigned, unsigned)); +static void NDECL(clear_id_mapping); +static void FDECL(add_id_mapping, (unsigned, unsigned)); #ifdef AMII_GRAPHICS void FDECL(amii_setpens, (int)); /* use colors from save file */ @@ -68,7 +68,7 @@ extern int amii_numcolors; #define Is_IceBox(o) ((o)->otyp == ICE_BOX ? TRUE : FALSE) /* Recalculate g.level.objects[x][y], since this info was not saved. */ -STATIC_OVL void +static void find_lev_obj() { register struct obj *fobjtmp = (struct obj *) 0; @@ -118,7 +118,7 @@ boolean quietly; } } -STATIC_OVL void +static void restlevchn(nhfp) NHFILE *nhfp; { @@ -151,7 +151,7 @@ NHFILE *nhfp; /* SAVE2018 */ -STATIC_OVL void +static void restdamage(nhfp, ghostly) NHFILE *nhfp; boolean ghostly; @@ -207,7 +207,7 @@ boolean ghostly; /* SAVE2018 */ /* restore one object */ -STATIC_OVL void +static void restobj(nhfp, otmp) NHFILE *nhfp; struct obj *otmp; @@ -299,7 +299,7 @@ struct obj *otmp; /* SAVE2018 */ -STATIC_OVL struct obj * +static struct obj * restobjchn(nhfp, ghostly, frozen) NHFILE *nhfp; boolean ghostly, frozen; @@ -392,7 +392,7 @@ boolean ghostly, frozen; /* SAVE2018 */ /* restore one monster */ -STATIC_OVL void +static void restmon(nhfp, mtmp) NHFILE *nhfp; struct monst *mtmp; @@ -494,7 +494,7 @@ struct monst *mtmp; /* SAVE2018 */ -STATIC_OVL struct monst * +static struct monst * restmonchn(nhfp, ghostly) NHFILE *nhfp; boolean ghostly; @@ -573,7 +573,7 @@ boolean ghostly; /* SAVE2018 */ -STATIC_OVL struct fruit * +static struct fruit * loadfruitchn(nhfp) NHFILE *nhfp; { @@ -597,7 +597,7 @@ NHFILE *nhfp; return flist; } -STATIC_OVL void +static void freefruitchn(flist) register struct fruit *flist; { @@ -610,7 +610,7 @@ register struct fruit *flist; } } -STATIC_OVL void +static void ghostfruit(otmp) register struct obj *otmp; { @@ -632,7 +632,7 @@ register struct obj *otmp; #define SYSOPT_CHECK_SAVE_UID TRUE #endif -STATIC_OVL +static boolean restgamestate(nhfp, stuckid, steedid) NHFILE *nhfp; @@ -889,7 +889,7 @@ unsigned int *stuckid, *steedid; /* update game state pointers to those valid for the current level (so we * don't dereference a wild u.ustuck when saving the game state, for instance) */ -STATIC_OVL void +static void restlevelstate(stuckid, steedid) unsigned int stuckid, steedid; { @@ -915,7 +915,7 @@ unsigned int stuckid, steedid; } /*ARGSUSED*/ -STATIC_OVL int +static int restlevelfile(nhfp, ltmp) NHFILE *nhfp; /* used in MFLOPPY only */ xchar ltmp; @@ -1167,7 +1167,7 @@ struct cemetery **cemeteryaddr; /* SAVE2018 */ /*ARGSUSED*/ -STATIC_OVL void +static void rest_levl(nhfp, rlecomp) NHFILE *nhfp; boolean rlecomp; @@ -1488,7 +1488,7 @@ char *plbuf; /* SAVE2018 */ -STATIC_OVL void +static void restore_msghistory(nhfp) NHFILE *nhfp; { @@ -1520,7 +1520,7 @@ NHFILE *nhfp; } /* Clear all structures for object and monster ID mapping. */ -STATIC_OVL void +static void clear_id_mapping() { struct bucket *curr; @@ -1533,7 +1533,7 @@ clear_id_mapping() } /* Add a mapping to the ID map. */ -STATIC_OVL void +static void add_id_mapping(gid, nid) unsigned gid, nid; { @@ -1585,7 +1585,7 @@ unsigned gid, *nidp; return FALSE; } -STATIC_OVL void +static void reset_oattached_mids(ghostly) boolean ghostly; { diff --git a/src/rip.c b/src/rip.c index 70b272e1c..6b5fdb097 100644 --- a/src/rip.c +++ b/src/rip.c @@ -16,7 +16,7 @@ #endif #ifdef TEXT_TOMBSTONE -STATIC_DCL void FDECL(center, (int, char *)); +static void FDECL(center, (int, char *)); #ifndef NH320_DEDICATION /* A normal tombstone for end of game display. */ @@ -69,7 +69,7 @@ static const char *rip_txt[] = { #define DEATH_LINE 8 /* *char[] line # for death description */ #define YEAR_LINE 12 /* *char[] line # for year */ -STATIC_OVL void +static void center(line, text) int line; char *text; diff --git a/src/role.c b/src/role.c index 08a181b6f..487999ac7 100644 --- a/src/role.c +++ b/src/role.c @@ -712,10 +712,10 @@ const struct Align aligns[] = { { "evil", "unaligned", "Una", 0, A_NONE } }; -STATIC_DCL int NDECL(randrole_filtered); -STATIC_DCL char *FDECL(promptsep, (char *, int)); -STATIC_DCL int FDECL(role_gendercount, (int)); -STATIC_DCL int FDECL(race_alignmentcount, (int)); +static int NDECL(randrole_filtered); +static char *FDECL(promptsep, (char *, int)); +static int FDECL(role_gendercount, (int)); +static int FDECL(race_alignmentcount, (int)); /* used by str2XXX() */ static char NEARDATA randomstr[] = "random"; @@ -740,7 +740,7 @@ boolean for_display; return res; } -STATIC_OVL int +static int randrole_filtered() { int i, n = 0, set[SIZE(roles)]; @@ -1354,7 +1354,7 @@ clearrolefilter() g.rfilter.mask = 0; } -STATIC_OVL char * +static char * promptsep(buf, num_post_attribs) char *buf; int num_post_attribs; @@ -1371,7 +1371,7 @@ int num_post_attribs; return buf; } -STATIC_OVL int +static int role_gendercount(rolenum) int rolenum; { @@ -1388,7 +1388,7 @@ int rolenum; return gendcount; } -STATIC_OVL int +static int race_alignmentcount(racenum) int racenum; { diff --git a/src/rumors.c b/src/rumors.c index c6f61fd06..b5be74ff4 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -43,11 +43,11 @@ * and placed there by 'makedefs'. */ -STATIC_DCL void FDECL(init_rumors, (dlb *)); -STATIC_DCL void FDECL(init_oracles, (dlb *)); -STATIC_DCL void FDECL(couldnt_open_file, (const char *)); +static void FDECL(init_rumors, (dlb *)); +static void FDECL(init_oracles, (dlb *)); +static void FDECL(couldnt_open_file, (const char *)); -STATIC_OVL void +static void init_rumors(fp) dlb *fp; { @@ -362,7 +362,7 @@ int mechanism; pline1(line); } -STATIC_OVL void +static void init_oracles(fp) dlb *fp; { @@ -567,7 +567,7 @@ struct monst *oracl; return 1; } -STATIC_OVL void +static void couldnt_open_file(filename) const char *filename; { diff --git a/src/save.c b/src/save.c index 058935bd6..fbe133c9b 100644 --- a/src/save.c +++ b/src/save.c @@ -33,32 +33,32 @@ extern int NDECL(nhdatatypes_size); int dotcnt, dotrow; /* also used in restore */ #endif -STATIC_DCL void FDECL(savelevchn, (NHFILE *)); -STATIC_DCL void FDECL(savedamage, (NHFILE *)); -/* STATIC_DCL void FDECL(saveobj, (NHFILE *,struct obj *)); */ -/* STATIC_DCL void FDECL(savemon, (NHFILE *,struct monst *)); */ -/* STATIC_DCL void FDECL(savelevl, (NHFILE *, BOOLEAN_P)); */ -STATIC_DCL void FDECL(saveobj, (NHFILE *,struct obj *)); -STATIC_DCL void FDECL(savemon, (NHFILE *,struct monst *)); -STATIC_DCL void FDECL(savelevl, (NHFILE *,BOOLEAN_P)); -STATIC_DCL void FDECL(saveobjchn, (NHFILE *,struct obj *)); -STATIC_DCL void FDECL(savemonchn, (NHFILE *,struct monst *)); -STATIC_DCL void FDECL(savetrapchn, (NHFILE *,struct trap *)); -STATIC_DCL void FDECL(savegamestate, (NHFILE *)); -STATIC_OVL void FDECL(save_msghistory, (NHFILE *)); +static void FDECL(savelevchn, (NHFILE *)); +static void FDECL(savedamage, (NHFILE *)); +/* static void FDECL(saveobj, (NHFILE *,struct obj *)); */ +/* static void FDECL(savemon, (NHFILE *,struct monst *)); */ +/* static void FDECL(savelevl, (NHFILE *, BOOLEAN_P)); */ +static void FDECL(saveobj, (NHFILE *,struct obj *)); +static void FDECL(savemon, (NHFILE *,struct monst *)); +static void FDECL(savelevl, (NHFILE *,BOOLEAN_P)); +static void FDECL(saveobjchn, (NHFILE *,struct obj *)); +static void FDECL(savemonchn, (NHFILE *,struct monst *)); +static void FDECL(savetrapchn, (NHFILE *,struct trap *)); +static void FDECL(savegamestate, (NHFILE *)); +static void FDECL(save_msghistory, (NHFILE *)); #ifdef MFLOPPY -STATIC_DCL void FDECL(savelev0, (NHFILE *, XCHAR_P, int)); -STATIC_DCL boolean NDECL(swapout_oldest); -STATIC_DCL void FDECL(copyfile, (char *, char *)); +static void FDECL(savelev0, (NHFILE *, XCHAR_P, int)); +static boolean NDECL(swapout_oldest); +static void FDECL(copyfile, (char *, char *)); #endif /* MFLOPPY */ #ifdef ZEROCOMP -STATIC_DCL void FDECL(zerocomp_bufon, (int)); -STATIC_DCL void FDECL(zerocomp_bufoff, (int)); -STATIC_DCL void FDECL(zerocomp_bflush, (int)); -STATIC_DCL void FDECL(zerocomp_bwrite, (int, genericptr_t, unsigned int)); -STATIC_DCL void FDECL(zerocomp_bputc, (int)); +static void FDECL(zerocomp_bufon, (int)); +static void FDECL(zerocomp_bufoff, (int)); +static void FDECL(zerocomp_bflush, (int)); +static void FDECL(zerocomp_bwrite, (int, genericptr_t, unsigned int)); +static void FDECL(zerocomp_bputc, (int)); #endif #if defined(UNIX) || defined(VMS) || defined(__EMX__) || defined(WIN32) @@ -282,7 +282,7 @@ dosave0() return 1; } -STATIC_OVL void +static void savegamestate(nhfp) NHFILE *nhfp; { @@ -539,7 +539,7 @@ xchar lev; return TRUE; } -STATIC_OVL void +static void savelev0(nhfp, lev) #else void @@ -682,7 +682,7 @@ xchar lev; } } -STATIC_OVL void +static void savelevl(nhfp, rlecomp) NHFILE *nhfp; boolean rlecomp; @@ -790,7 +790,7 @@ struct cemetery **cemeteryaddr; *cemeteryaddr = 0; } -STATIC_OVL void +static void savedamage(nhfp) NHFILE *nhfp; { @@ -822,7 +822,7 @@ NHFILE *nhfp; g.level.damagelist = 0; } -STATIC_OVL void +static void saveobj(nhfp, otmp) NHFILE *nhfp; struct obj *otmp; @@ -898,7 +898,7 @@ struct obj *otmp; } } -STATIC_OVL void +static void saveobjchn(nhfp, otmp) NHFILE *nhfp; register struct obj *otmp; @@ -949,7 +949,7 @@ register struct obj *otmp; } } -STATIC_OVL void +static void savemon(nhfp, mtmp) NHFILE *nhfp; struct monst *mtmp; @@ -1043,7 +1043,7 @@ struct monst *mtmp; } } -STATIC_OVL void +static void savemonchn(nhfp, mtmp) NHFILE *nhfp; register struct monst *mtmp; @@ -1080,7 +1080,7 @@ register struct monst *mtmp; } /* save traps; g.ftrap is the only trap chain so the 2nd arg is superfluous */ -STATIC_OVL void +static void savetrapchn(nhfp, trap) NHFILE *nhfp; register struct trap *trap; @@ -1145,7 +1145,7 @@ NHFILE *nhfp; -STATIC_OVL void +static void savelevchn(nhfp) NHFILE *nhfp; { @@ -1195,7 +1195,7 @@ NHFILE *nhfp; return; } -STATIC_OVL void +static void save_msghistory(nhfp) NHFILE *nhfp; { @@ -1404,7 +1404,7 @@ int lev; return TRUE; } -STATIC_OVL boolean +static boolean swapout_oldest() { char to[PATHLEN], from[PATHLEN]; @@ -1435,7 +1435,7 @@ swapout_oldest() return TRUE; } -STATIC_OVL void +static void copyfile(from, to) char *from, *to; { diff --git a/src/sfstruct.c b/src/sfstruct.c index 94bbe4919..c2a07a5c0 100644 --- a/src/sfstruct.c +++ b/src/sfstruct.c @@ -41,7 +41,7 @@ void FDECL(mread, (int, genericptr_t, unsigned int)); void NDECL(minit); void FDECL(bclose, (int)); #endif /* TRACE_BUFFERING */ -STATIC_DCL int FDECL(getidx, (int, int)); +static int FDECL(getidx, (int, int)); #if defined(UNIX) || defined(WIN32) #define USE_BUFFERING @@ -97,7 +97,7 @@ static FILE *bw_FILE[MAXFD] = {0,0,0,0,0}; * happen. */ -STATIC_OVL int +static int getidx(fd, flg) int fd, flg; { diff --git a/src/shk.c b/src/shk.c index ab1672faa..c36d8d0d0 100644 --- a/src/shk.c +++ b/src/shk.c @@ -11,9 +11,9 @@ #define PAY_SKIP (-1) #define PAY_BROKE (-2) -STATIC_DCL void FDECL(makekops, (coord *)); -STATIC_DCL void FDECL(call_kops, (struct monst *, BOOLEAN_P)); -STATIC_DCL void FDECL(kops_gone, (BOOLEAN_P)); +static void FDECL(makekops, (coord *)); +static void FDECL(call_kops, (struct monst *, BOOLEAN_P)); +static void FDECL(kops_gone, (BOOLEAN_P)); #define NOTANGRY(mon) ((mon)->mpeaceful) #define ANGRY(mon) (!NOTANGRY(mon)) @@ -25,56 +25,56 @@ STATIC_DCL void FDECL(kops_gone, (BOOLEAN_P)); extern const struct shclass shtypes[]; /* defined in shknam.c */ -STATIC_VAR const char and_its_contents[] = " and its contents"; -STATIC_VAR const char the_contents_of[] = "the contents of "; +static const char and_its_contents[] = " and its contents"; +static const char the_contents_of[] = "the contents of "; -STATIC_DCL void FDECL(append_honorific, (char *)); -STATIC_DCL long FDECL(addupbill, (struct monst *)); -STATIC_DCL void FDECL(pacify_shk, (struct monst *)); -STATIC_DCL struct bill_x *FDECL(onbill, (struct obj *, struct monst *, +static void FDECL(append_honorific, (char *)); +static long FDECL(addupbill, (struct monst *)); +static void FDECL(pacify_shk, (struct monst *)); +static struct bill_x *FDECL(onbill, (struct obj *, struct monst *, BOOLEAN_P)); -STATIC_DCL struct monst *FDECL(next_shkp, (struct monst *, BOOLEAN_P)); -STATIC_DCL long FDECL(shop_debt, (struct eshk *)); -STATIC_DCL char *FDECL(shk_owns, (char *, struct obj *)); -STATIC_DCL char *FDECL(mon_owns, (char *, struct obj *)); -STATIC_DCL void FDECL(clear_unpaid_obj, (struct monst *, struct obj *)); -STATIC_DCL void FDECL(clear_unpaid, (struct monst *, struct obj *)); -STATIC_DCL long FDECL(check_credit, (long, struct monst *)); -STATIC_DCL void FDECL(pay, (long, struct monst *)); -STATIC_DCL long FDECL(get_cost, (struct obj *, struct monst *)); -STATIC_DCL long FDECL(set_cost, (struct obj *, struct monst *)); -STATIC_DCL const char *FDECL(shk_embellish, (struct obj *, long)); -STATIC_DCL long FDECL(cost_per_charge, (struct monst *, struct obj *, +static struct monst *FDECL(next_shkp, (struct monst *, BOOLEAN_P)); +static long FDECL(shop_debt, (struct eshk *)); +static char *FDECL(shk_owns, (char *, struct obj *)); +static char *FDECL(mon_owns, (char *, struct obj *)); +static void FDECL(clear_unpaid_obj, (struct monst *, struct obj *)); +static void FDECL(clear_unpaid, (struct monst *, struct obj *)); +static long FDECL(check_credit, (long, struct monst *)); +static void FDECL(pay, (long, struct monst *)); +static long FDECL(get_cost, (struct obj *, struct monst *)); +static long FDECL(set_cost, (struct obj *, struct monst *)); +static const char *FDECL(shk_embellish, (struct obj *, long)); +static long FDECL(cost_per_charge, (struct monst *, struct obj *, BOOLEAN_P)); -STATIC_DCL long FDECL(cheapest_item, (struct monst *)); -STATIC_DCL int FDECL(dopayobj, (struct monst *, struct bill_x *, +static long FDECL(cheapest_item, (struct monst *)); +static int FDECL(dopayobj, (struct monst *, struct bill_x *, struct obj **, int, BOOLEAN_P)); -STATIC_DCL long FDECL(stolen_container, (struct obj *, struct monst *, +static long FDECL(stolen_container, (struct obj *, struct monst *, long, BOOLEAN_P)); -STATIC_DCL long FDECL(getprice, (struct obj *, BOOLEAN_P)); -STATIC_DCL void FDECL(shk_names_obj, (struct monst *, struct obj *, +static long FDECL(getprice, (struct obj *, BOOLEAN_P)); +static void FDECL(shk_names_obj, (struct monst *, struct obj *, const char *, long, const char *)); -STATIC_DCL struct obj *FDECL(bp_to_obj, (struct bill_x *)); -STATIC_DCL boolean FDECL(inherits, (struct monst *, int, int, BOOLEAN_P)); -STATIC_DCL void FDECL(set_repo_loc, (struct monst *)); -STATIC_DCL boolean NDECL(angry_shk_exists); -STATIC_DCL void FDECL(rile_shk, (struct monst *)); -STATIC_DCL void FDECL(rouse_shk, (struct monst *, BOOLEAN_P)); -STATIC_DCL void FDECL(remove_damage, (struct monst *, BOOLEAN_P)); -STATIC_DCL void FDECL(sub_one_frombill, (struct obj *, struct monst *)); -STATIC_DCL void FDECL(add_one_tobill, (struct obj *, BOOLEAN_P, +static struct obj *FDECL(bp_to_obj, (struct bill_x *)); +static boolean FDECL(inherits, (struct monst *, int, int, BOOLEAN_P)); +static void FDECL(set_repo_loc, (struct monst *)); +static boolean NDECL(angry_shk_exists); +static void FDECL(rile_shk, (struct monst *)); +static void FDECL(rouse_shk, (struct monst *, BOOLEAN_P)); +static void FDECL(remove_damage, (struct monst *, BOOLEAN_P)); +static void FDECL(sub_one_frombill, (struct obj *, struct monst *)); +static void FDECL(add_one_tobill, (struct obj *, BOOLEAN_P, struct monst *)); -STATIC_DCL void FDECL(dropped_container, (struct obj *, struct monst *, +static void FDECL(dropped_container, (struct obj *, struct monst *, BOOLEAN_P)); -STATIC_DCL void FDECL(add_to_billobjs, (struct obj *)); -STATIC_DCL void FDECL(bill_box_content, (struct obj *, BOOLEAN_P, BOOLEAN_P, +static void FDECL(add_to_billobjs, (struct obj *)); +static void FDECL(bill_box_content, (struct obj *, BOOLEAN_P, BOOLEAN_P, struct monst *)); -STATIC_DCL boolean FDECL(rob_shop, (struct monst *)); -STATIC_DCL void FDECL(deserted_shop, (char *)); -STATIC_DCL boolean FDECL(special_stock, (struct obj *, struct monst *, +static boolean FDECL(rob_shop, (struct monst *)); +static void FDECL(deserted_shop, (char *)); +static boolean FDECL(special_stock, (struct obj *, struct monst *, BOOLEAN_P)); -STATIC_DCL const char *FDECL(cad, (BOOLEAN_P)); -STATIC_DCL long FDECL(get_pricing_units, (struct obj *obj)); +static const char *FDECL(cad, (BOOLEAN_P)); +static long FDECL(get_pricing_units, (struct obj *obj)); /* invariants: obj->unpaid iff onbill(obj) [unless bp->useup] @@ -157,7 +157,7 @@ long amount; } } -STATIC_OVL struct monst * +static struct monst * next_shkp(shkp, withbill) register struct monst *shkp; register boolean withbill; @@ -262,7 +262,7 @@ boolean ghostly; } /* Clear the unpaid bit on a single object and its contents. */ -STATIC_OVL void +static void clear_unpaid_obj(shkp, otmp) struct monst *shkp; struct obj *otmp; @@ -274,7 +274,7 @@ struct obj *otmp; } /* Clear the unpaid bit on all of the objects in the list. */ -STATIC_OVL void +static void clear_unpaid(shkp, list) struct monst *shkp; struct obj *list; @@ -317,7 +317,7 @@ register struct monst *shkp; } } -STATIC_OVL long +static long addupbill(shkp) register struct monst *shkp; { @@ -332,7 +332,7 @@ register struct monst *shkp; return total; } -STATIC_OVL void +static void call_kops(shkp, nearshop) register struct monst *shkp; register boolean nearshop; @@ -470,7 +470,7 @@ xchar x, y; /* shop merchandise has been taken; pay for it with any credit available; return false if the debt is fully covered by credit, true otherwise */ -STATIC_OVL boolean +static boolean rob_shop(shkp) struct monst *shkp; { @@ -503,7 +503,7 @@ struct monst *shkp; } /* give a message when entering an untended shop (caller has verified that) */ -STATIC_OVL void +static void deserted_shop(enterstring) /*const*/ char *enterstring; { @@ -748,7 +748,7 @@ struct obj *obj1, *obj2; * turning the `$' command into a way to discover that the current * level is bones data which has a shk on the warpath. */ -STATIC_OVL long +static long shop_debt(eshkp) struct eshk *eshkp; { @@ -850,7 +850,7 @@ struct mkroom *sroom; return !mtmp ? FALSE : (boolean) inhishop(mtmp); } -STATIC_OVL struct bill_x * +static struct bill_x * onbill(obj, shkp, silent) struct obj *obj; struct monst *shkp; @@ -988,7 +988,7 @@ register struct obj *obj, *merge; dealloc_obj(obj); } -STATIC_OVL long +static long check_credit(tmp, shkp) long tmp; register struct monst *shkp; @@ -1009,7 +1009,7 @@ register struct monst *shkp; return tmp; } -STATIC_OVL void +static void pay(tmp, shkp) long tmp; register struct monst *shkp; @@ -1047,7 +1047,7 @@ register boolean killkops; after_shk_move(shkp); } -STATIC_OVL boolean +static boolean angry_shk_exists() { register struct monst *shkp; @@ -1060,7 +1060,7 @@ angry_shk_exists() } /* remove previously applied surcharge from all billed items */ -STATIC_OVL void +static void pacify_shk(shkp) register struct monst *shkp; { @@ -1079,7 +1079,7 @@ register struct monst *shkp; } /* add aggravation surcharge to all billed items */ -STATIC_OVL void +static void rile_shk(shkp) register struct monst *shkp; { @@ -1098,7 +1098,7 @@ register struct monst *shkp; } /* wakeup and/or unparalyze shopkeeper */ -STATIC_OVL void +static void rouse_shk(shkp, verbosely) struct monst *shkp; boolean verbosely; @@ -1207,12 +1207,12 @@ xchar oy UNUSED; hot_pursuit(shkp); } -STATIC_VAR const char +static const char no_money[] = "Moreover, you%s have no money.", not_enough_money[] = "Besides, you don't have enough to interest %s."; /* delivers the cheapest item on the list */ -STATIC_OVL long +static long cheapest_item(shkp) register struct monst *shkp; { @@ -1575,7 +1575,7 @@ dopay() * -1 if skip this object * -2 if no money/credit left */ -STATIC_OVL int +static int dopayobj(shkp, bp, obj_p, which, itemize) register struct monst *shkp; register struct bill_x *bp; @@ -1773,7 +1773,7 @@ boolean silently; /* maybe avoid messages */ return taken; } -STATIC_OVL boolean +static boolean inherits(shkp, numsk, croaked, silently) struct monst *shkp; int numsk; @@ -1879,7 +1879,7 @@ boolean silently; return taken; } -STATIC_OVL void +static void set_repo_loc(shkp) struct monst *shkp; { @@ -1933,7 +1933,7 @@ finish_paybill() } /* find obj on one of the lists */ -STATIC_OVL struct obj * +static struct obj * bp_to_obj(bp) register struct bill_x *bp; { @@ -2021,7 +2021,7 @@ int *nochrg; /* alternate return value: 1: no charge, 0: shop owned, */ return cost; } -STATIC_OVL long +static long get_pricing_units(obj) struct obj *obj; { @@ -2055,7 +2055,7 @@ unsigned oid; } /* calculate the value that the shk will charge for [one of] an object */ -STATIC_OVL long +static long get_cost(obj, shkp) register struct obj *obj; register struct monst *shkp; /* if angry, impose a surcharge */ @@ -2234,7 +2234,7 @@ struct obj *obj; return value; } -STATIC_OVL void +static void dropped_container(obj, shkp, sale) register struct obj *obj; register struct monst *shkp; @@ -2274,7 +2274,7 @@ register struct obj *obj; } } -STATIC_OVL boolean +static boolean special_stock(obj, shkp, quietly) struct obj *obj; struct monst *shkp; @@ -2314,7 +2314,7 @@ boolean quietly; } /* calculate how much the shk will pay when buying [all of] an object */ -STATIC_OVL long +static long set_cost(obj, shkp) register struct obj *obj; register struct monst *shkp; @@ -2462,7 +2462,7 @@ boolean include_contents; return amt; } -STATIC_OVL void +static void add_one_tobill(obj, dummy, shkp) struct obj *obj; boolean dummy; @@ -2504,7 +2504,7 @@ struct monst *shkp; obj->unpaid = 1; } -STATIC_OVL void +static void add_to_billobjs(obj) struct obj *obj; { @@ -2519,7 +2519,7 @@ struct obj *obj; } /* recursive billing of objects within containers. */ -STATIC_OVL void +static void bill_box_content(obj, ininv, dummy, shkp) register struct obj *obj; register boolean ininv, dummy; @@ -2542,7 +2542,7 @@ register struct monst *shkp; } /* shopkeeper tells you what you bought or sold, sometimes partly IDing it */ -STATIC_OVL void +static void shk_names_obj(shkp, obj, fmt, amt, arg) struct monst *shkp; struct obj *obj; @@ -2719,7 +2719,7 @@ boolean ininv, dummy, silent; } } -STATIC_OVL void +static void append_honorific(buf) char *buf; { @@ -2779,7 +2779,7 @@ register struct obj *obj, *otmp; } } -STATIC_OVL void +static void sub_one_frombill(obj, shkp) register struct obj *obj; register struct monst *shkp; @@ -2842,7 +2842,7 @@ register struct monst *shkp; } } -STATIC_OVL long +static long stolen_container(obj, shkp, price, ininv) struct obj *obj; struct monst *shkp; @@ -3359,7 +3359,7 @@ int mode; /* 0: deliver count 1: paged */ return 0; } -STATIC_OVL long +static long getprice(obj, shk_buying) register struct obj *obj; boolean shk_buying; @@ -3482,7 +3482,7 @@ long cost; * assumption (they might all be dead too), but we have no reasonable way of * telling that. */ -STATIC_OVL +static void remove_damage(shkp, croaked) struct monst *shkp; @@ -4021,7 +4021,7 @@ register int fall; } } -STATIC_OVL void +static void makekops(mm) coord *mm; { @@ -4324,7 +4324,7 @@ register struct obj *first_obj; destroy_nhwindow(tmpwin); } -STATIC_OVL const char * +static const char * shk_embellish(itm, cost) register struct obj *itm; long cost; @@ -4453,7 +4453,7 @@ struct monst *shkp; } } -STATIC_OVL void +static void kops_gone(silent) boolean silent; { @@ -4473,7 +4473,7 @@ boolean silent; plur(cnt), (cnt == 1) ? "es" : ""); } -STATIC_OVL long +static long cost_per_charge(shkp, otmp, altusage) struct monst *shkp; struct obj *otmp; @@ -4716,7 +4716,7 @@ struct obj *obj; return buf; } -STATIC_OVL char * +static char * shk_owns(buf, obj) char *buf; struct obj *obj; @@ -4733,7 +4733,7 @@ struct obj *obj; return (char *) 0; } -STATIC_OVL char * +static char * mon_owns(buf, obj) char *buf; struct obj *obj; @@ -4743,7 +4743,7 @@ struct obj *obj; return (char *) 0; } -STATIC_OVL const char * +static const char * cad(altusage) boolean altusage; /* used as a verbalized exclamation: \"Cad! ...\" */ { diff --git a/src/shknam.c b/src/shknam.c index 5bec59922..dd815c93f 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -7,14 +7,14 @@ #include "hack.h" -STATIC_DCL boolean FDECL(stock_room_goodpos, (struct mkroom *, int, int, int, int)); -STATIC_DCL boolean FDECL(veggy_item, (struct obj * obj, int)); -STATIC_DCL int NDECL(shkveg); -STATIC_DCL void FDECL(mkveggy_at, (int, int)); -STATIC_DCL void FDECL(mkshobj_at, (const struct shclass *, int, int, +static boolean FDECL(stock_room_goodpos, (struct mkroom *, int, int, int, int)); +static boolean FDECL(veggy_item, (struct obj * obj, int)); +static int NDECL(shkveg); +static void FDECL(mkveggy_at, (int, int)); +static void FDECL(mkshobj_at, (const struct shclass *, int, int, BOOLEAN_P)); -STATIC_DCL void FDECL(nameshk, (struct monst *, const char *const *)); -STATIC_DCL int FDECL(shkinit, (const struct shclass *, struct mkroom *)); +static void FDECL(nameshk, (struct monst *, const char *const *)); +static int FDECL(shkinit, (const struct shclass *, struct mkroom *)); #define VEGETARIAN_CLASS (MAXOCLASSES + 1) @@ -369,7 +369,7 @@ init_shop_selection() /* decide whether an object or object type is considered vegetarian; for types, items which might go either way are assumed to be veggy */ -STATIC_OVL boolean +static boolean veggy_item(obj, otyp) struct obj *obj; int otyp; /* used iff obj is null */ @@ -400,7 +400,7 @@ int otyp; /* used iff obj is null */ return FALSE; } -STATIC_OVL int +static int shkveg() { int i, j, maxprob, prob; @@ -435,7 +435,7 @@ shkveg() } /* make a random item for health food store */ -STATIC_OVL void +static void mkveggy_at(sx, sy) int sx, sy; { @@ -447,7 +447,7 @@ int sx, sy; } /* make an object of the appropriate type for a shop square */ -STATIC_OVL void +static void mkshobj_at(shp, sx, sy, mkspecl) const struct shclass *shp; int sx, sy; @@ -487,7 +487,7 @@ boolean mkspecl; } /* extract a shopkeeper name for the given shop type */ -STATIC_OVL void +static void nameshk(shk, nlp) struct monst *shk; const char *const *nlp; @@ -585,7 +585,7 @@ struct monst *mtmp; } /* create a new shopkeeper in the given room */ -STATIC_OVL int +static int shkinit(shp, sroom) const struct shclass *shp; struct mkroom *sroom; @@ -679,7 +679,7 @@ struct mkroom *sroom; return sh; } -STATIC_OVL boolean +static boolean stock_room_goodpos(sroom, rmno, sh, sx, sy) struct mkroom *sroom; int rmno, sh, sx,sy; diff --git a/src/sounds.c b/src/sounds.c index 83c1e121a..614cba6ca 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -4,13 +4,13 @@ #include "hack.h" -STATIC_DCL boolean FDECL(mon_is_gecko, (struct monst *)); -STATIC_DCL int FDECL(domonnoise, (struct monst *)); -STATIC_DCL int NDECL(dochat); -STATIC_DCL int FDECL(mon_in_room, (struct monst *, int)); +static boolean FDECL(mon_is_gecko, (struct monst *)); +static int FDECL(domonnoise, (struct monst *)); +static int NDECL(dochat); +static int FDECL(mon_in_room, (struct monst *, int)); /* this easily could be a macro, but it might overtax dumb compilers */ -STATIC_OVL int +static int mon_in_room(mon, rmtyp) struct monst *mon; int rmtyp; @@ -468,7 +468,7 @@ register struct monst *mtmp; } /* return True if mon is a gecko or seems to look like one (hallucination) */ -STATIC_OVL boolean +static boolean mon_is_gecko(mon) struct monst *mon; { @@ -487,7 +487,7 @@ struct monst *mon; return (boolean) (glyph_to_mon(glyph) == PM_GECKO); } -STATIC_OVL int +static int domonnoise(mtmp) register struct monst *mtmp; { @@ -967,7 +967,7 @@ dotalk() return result; } -STATIC_OVL int +static int dochat() { struct monst *mtmp; diff --git a/src/sp_lev.c b/src/sp_lev.c index b47b891d5..1f77d70a2 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -22,150 +22,150 @@ typedef void FDECL((*select_iter_func), (int, int, genericptr)); extern void FDECL(mkmap, (lev_init *)); -STATIC_DCL void NDECL(solidify_map); -STATIC_DCL void FDECL(splev_stack_init, (struct splevstack *)); -STATIC_DCL void FDECL(splev_stack_done, (struct splevstack *)); -STATIC_DCL void FDECL(splev_stack_push, (struct splevstack *, +static void NDECL(solidify_map); +static void FDECL(splev_stack_init, (struct splevstack *)); +static void FDECL(splev_stack_done, (struct splevstack *)); +static void FDECL(splev_stack_push, (struct splevstack *, struct opvar *)); -STATIC_DCL struct opvar *FDECL(splev_stack_pop, (struct splevstack *)); -STATIC_DCL struct splevstack *FDECL(splev_stack_reverse, +static struct opvar *FDECL(splev_stack_pop, (struct splevstack *)); +static struct splevstack *FDECL(splev_stack_reverse, (struct splevstack *)); -STATIC_DCL struct opvar *FDECL(opvar_new_str, (char *)); -STATIC_DCL struct opvar *FDECL(opvar_new_int, (long)); -STATIC_DCL struct opvar *FDECL(opvar_new_coord, (int, int)); +static struct opvar *FDECL(opvar_new_str, (char *)); +static struct opvar *FDECL(opvar_new_int, (long)); +static struct opvar *FDECL(opvar_new_coord, (int, int)); #if 0 -STATIC_DCL struct opvar * FDECL(opvar_new_region, (int,int, int,int)); +static struct opvar * FDECL(opvar_new_region, (int,int, int,int)); #endif /*0*/ -STATIC_DCL struct opvar *FDECL(opvar_clone, (struct opvar *)); -STATIC_DCL struct opvar *FDECL(opvar_var_conversion, (struct sp_coder *, +static struct opvar *FDECL(opvar_clone, (struct opvar *)); +static struct opvar *FDECL(opvar_var_conversion, (struct sp_coder *, struct opvar *)); -STATIC_DCL struct splev_var *FDECL(opvar_var_defined, (struct sp_coder *, +static struct splev_var *FDECL(opvar_var_defined, (struct sp_coder *, char *)); -STATIC_DCL struct opvar *FDECL(splev_stack_getdat, (struct sp_coder *, +static struct opvar *FDECL(splev_stack_getdat, (struct sp_coder *, XCHAR_P)); -STATIC_DCL struct opvar *FDECL(splev_stack_getdat_any, (struct sp_coder *)); -STATIC_DCL void FDECL(variable_list_del, (struct splev_var *)); -STATIC_DCL void FDECL(lvlfill_maze_grid, (int, int, int, int, SCHAR_P)); -STATIC_DCL void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P)); -STATIC_DCL void FDECL(set_wall_property, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, +static struct opvar *FDECL(splev_stack_getdat_any, (struct sp_coder *)); +static void FDECL(variable_list_del, (struct splev_var *)); +static void FDECL(lvlfill_maze_grid, (int, int, int, int, SCHAR_P)); +static void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P)); +static void FDECL(set_wall_property, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, int)); -STATIC_DCL void NDECL(shuffle_alignments); -STATIC_DCL void NDECL(count_features); -STATIC_DCL void NDECL(remove_boundary_syms); -STATIC_DCL void FDECL(set_door_orientation, (int, int)); -STATIC_DCL void FDECL(maybe_add_door, (int, int, struct mkroom *)); -STATIC_DCL void NDECL(link_doors_rooms); -STATIC_DCL void NDECL(fill_rooms); -STATIC_DCL int NDECL(rnddoor); -STATIC_DCL int NDECL(rndtrap); -STATIC_DCL void FDECL(get_location, (schar *, schar *, int, struct mkroom *)); -STATIC_DCL boolean FDECL(is_ok_location, (SCHAR_P, SCHAR_P, int)); -STATIC_DCL unpacked_coord FDECL(get_unpacked_coord, (long, int)); -STATIC_DCL void FDECL(get_location_coord, (schar *, schar *, int, +static void NDECL(shuffle_alignments); +static void NDECL(count_features); +static void NDECL(remove_boundary_syms); +static void FDECL(set_door_orientation, (int, int)); +static void FDECL(maybe_add_door, (int, int, struct mkroom *)); +static void NDECL(link_doors_rooms); +static void NDECL(fill_rooms); +static int NDECL(rnddoor); +static int NDECL(rndtrap); +static void FDECL(get_location, (schar *, schar *, int, struct mkroom *)); +static boolean FDECL(is_ok_location, (SCHAR_P, SCHAR_P, int)); +static unpacked_coord FDECL(get_unpacked_coord, (long, int)); +static void FDECL(get_location_coord, (schar *, schar *, int, struct mkroom *, long)); -STATIC_DCL void FDECL(get_room_loc, (schar *, schar *, struct mkroom *)); -STATIC_DCL void FDECL(get_free_room_loc, (schar *, schar *, +static void FDECL(get_room_loc, (schar *, schar *, struct mkroom *)); +static void FDECL(get_free_room_loc, (schar *, schar *, struct mkroom *, packed_coord)); -STATIC_DCL boolean FDECL(create_subroom, (struct mkroom *, XCHAR_P, XCHAR_P, +static boolean FDECL(create_subroom, (struct mkroom *, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); -STATIC_DCL void FDECL(create_door, (room_door *, struct mkroom *)); -STATIC_DCL void FDECL(create_trap, (spltrap *, struct mkroom *)); -STATIC_DCL int FDECL(noncoalignment, (ALIGNTYP_P)); -STATIC_DCL boolean FDECL(m_bad_boulder_spot, (int, int)); -STATIC_DCL int FDECL(pm_to_humidity, (struct permonst *)); -STATIC_DCL void FDECL(create_monster, (monster *, struct mkroom *)); -STATIC_DCL void FDECL(create_object, (object *, struct mkroom *)); -STATIC_DCL void FDECL(create_altar, (altar *, struct mkroom *)); -STATIC_DCL void FDECL(replace_terrain, (replaceterrain *, struct mkroom *)); -STATIC_DCL boolean FDECL(search_door, (struct mkroom *, +static void FDECL(create_door, (room_door *, struct mkroom *)); +static void FDECL(create_trap, (spltrap *, struct mkroom *)); +static int FDECL(noncoalignment, (ALIGNTYP_P)); +static boolean FDECL(m_bad_boulder_spot, (int, int)); +static int FDECL(pm_to_humidity, (struct permonst *)); +static void FDECL(create_monster, (monster *, struct mkroom *)); +static void FDECL(create_object, (object *, struct mkroom *)); +static void FDECL(create_altar, (altar *, struct mkroom *)); +static void FDECL(replace_terrain, (replaceterrain *, struct mkroom *)); +static boolean FDECL(search_door, (struct mkroom *, xchar *, xchar *, XCHAR_P, int)); -STATIC_DCL void NDECL(fix_stair_rooms); -STATIC_DCL void FDECL(create_corridor, (corridor *)); -STATIC_DCL struct mkroom *FDECL(build_room, (room *, struct mkroom *)); -STATIC_DCL void FDECL(light_region, (region *)); -STATIC_DCL void FDECL(wallify_map, (int, int, int, int)); -STATIC_DCL void FDECL(maze1xy, (coord *, int)); -STATIC_DCL void NDECL(fill_empty_maze); -STATIC_DCL boolean FDECL(sp_level_loader, (dlb *, sp_lev *)); -STATIC_DCL boolean FDECL(sp_level_free, (sp_lev *)); -STATIC_DCL void FDECL(splev_initlev, (lev_init *)); -STATIC_DCL struct sp_frame *FDECL(frame_new, (long)); -STATIC_DCL void FDECL(frame_del, (struct sp_frame *)); -STATIC_DCL void FDECL(spo_frame_push, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_frame_pop, (struct sp_coder *)); -STATIC_DCL long FDECL(sp_code_jmpaddr, (long, long)); -STATIC_DCL void FDECL(spo_call, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_return, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_end_moninvent, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_pop_container, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_message, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_monster, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_object, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_level_flags, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_initlevel, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_engraving, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_mineralize, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_room, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_endroom, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_stair, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_ladder, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_grave, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_altar, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_trap, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_gold, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_corridor, (struct sp_coder *)); -STATIC_DCL void FDECL(selection_setpoint, (int, int, struct opvar *, XCHAR_P)); -STATIC_DCL struct opvar *FDECL(selection_not, (struct opvar *)); -STATIC_DCL struct opvar *FDECL(selection_logical_oper, (struct opvar *, +static void NDECL(fix_stair_rooms); +static void FDECL(create_corridor, (corridor *)); +static struct mkroom *FDECL(build_room, (room *, struct mkroom *)); +static void FDECL(light_region, (region *)); +static void FDECL(wallify_map, (int, int, int, int)); +static void FDECL(maze1xy, (coord *, int)); +static void NDECL(fill_empty_maze); +static boolean FDECL(sp_level_loader, (dlb *, sp_lev *)); +static boolean FDECL(sp_level_free, (sp_lev *)); +static void FDECL(splev_initlev, (lev_init *)); +static struct sp_frame *FDECL(frame_new, (long)); +static void FDECL(frame_del, (struct sp_frame *)); +static void FDECL(spo_frame_push, (struct sp_coder *)); +static void FDECL(spo_frame_pop, (struct sp_coder *)); +static long FDECL(sp_code_jmpaddr, (long, long)); +static void FDECL(spo_call, (struct sp_coder *)); +static void FDECL(spo_return, (struct sp_coder *)); +static void FDECL(spo_end_moninvent, (struct sp_coder *)); +static void FDECL(spo_pop_container, (struct sp_coder *)); +static void FDECL(spo_message, (struct sp_coder *)); +static void FDECL(spo_monster, (struct sp_coder *)); +static void FDECL(spo_object, (struct sp_coder *)); +static void FDECL(spo_level_flags, (struct sp_coder *)); +static void FDECL(spo_initlevel, (struct sp_coder *)); +static void FDECL(spo_engraving, (struct sp_coder *)); +static void FDECL(spo_mineralize, (struct sp_coder *)); +static void FDECL(spo_room, (struct sp_coder *)); +static void FDECL(spo_endroom, (struct sp_coder *)); +static void FDECL(spo_stair, (struct sp_coder *)); +static void FDECL(spo_ladder, (struct sp_coder *)); +static void FDECL(spo_grave, (struct sp_coder *)); +static void FDECL(spo_altar, (struct sp_coder *)); +static void FDECL(spo_trap, (struct sp_coder *)); +static void FDECL(spo_gold, (struct sp_coder *)); +static void FDECL(spo_corridor, (struct sp_coder *)); +static void FDECL(selection_setpoint, (int, int, struct opvar *, XCHAR_P)); +static struct opvar *FDECL(selection_not, (struct opvar *)); +static struct opvar *FDECL(selection_logical_oper, (struct opvar *, struct opvar *, CHAR_P)); -STATIC_DCL struct opvar *FDECL(selection_filter_mapchar, (struct opvar *, +static struct opvar *FDECL(selection_filter_mapchar, (struct opvar *, struct opvar *)); -STATIC_DCL void FDECL(selection_filter_percent, (struct opvar *, int)); -STATIC_DCL int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *, +static void FDECL(selection_filter_percent, (struct opvar *, int)); +static int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *, BOOLEAN_P)); -STATIC_DCL void FDECL(selection_do_grow, (struct opvar *, int)); -STATIC_DCL int FDECL(floodfillchk_match_under, (int, int)); -STATIC_DCL int FDECL(floodfillchk_match_accessible, (int, int)); -STATIC_DCL boolean FDECL(sel_flood_havepoint, (int, int, +static void FDECL(selection_do_grow, (struct opvar *, int)); +static int FDECL(floodfillchk_match_under, (int, int)); +static int FDECL(floodfillchk_match_accessible, (int, int)); +static boolean FDECL(sel_flood_havepoint, (int, int, xchar *, xchar *, int)); -STATIC_DCL void FDECL(selection_do_ellipse, (struct opvar *, int, int, +static void FDECL(selection_do_ellipse, (struct opvar *, int, int, int, int, int)); -STATIC_DCL long FDECL(line_dist_coord, (long, long, long, long, long, long)); -STATIC_DCL void FDECL(selection_do_gradient, (struct opvar *, long, long, long, +static long FDECL(line_dist_coord, (long, long, long, long, long, long)); +static void FDECL(selection_do_gradient, (struct opvar *, long, long, long, long, long, long, long, long)); -STATIC_DCL void FDECL(selection_do_line, (SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, +static void FDECL(selection_do_line, (SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, struct opvar *)); -STATIC_DCL void FDECL(selection_do_randline, (SCHAR_P, SCHAR_P, SCHAR_P, +static void FDECL(selection_do_randline, (SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, struct opvar *)); -STATIC_DCL void FDECL(selection_iterate, (struct opvar *, select_iter_func, +static void FDECL(selection_iterate, (struct opvar *, select_iter_func, genericptr_t)); -STATIC_DCL void FDECL(sel_set_ter, (int, int, genericptr_t)); -STATIC_DCL void FDECL(sel_set_feature, (int, int, genericptr_t)); -STATIC_DCL void FDECL(sel_set_door, (int, int, genericptr_t)); -STATIC_DCL void FDECL(spo_door, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_feature, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_terrain, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_replace_terrain, (struct sp_coder *)); -STATIC_DCL boolean FDECL(generate_way_out_method, (int, int, struct opvar *)); -STATIC_DCL void NDECL(ensure_way_out); -STATIC_DCL void FDECL(spo_levregion, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_region, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_drawbridge, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_mazewalk, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_wall_property, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_room_door, (struct sp_coder *)); -STATIC_DCL void FDECL(sel_set_wallify, (int, int, genericptr_t)); -STATIC_DCL void FDECL(spo_wallify, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_map, (struct sp_coder *)); -STATIC_DCL void FDECL(spo_jmp, (struct sp_coder *, sp_lev *)); -STATIC_DCL void FDECL(spo_conditional_jump, (struct sp_coder *, sp_lev *)); -STATIC_DCL void FDECL(spo_var_init, (struct sp_coder *)); +static void FDECL(sel_set_ter, (int, int, genericptr_t)); +static void FDECL(sel_set_feature, (int, int, genericptr_t)); +static void FDECL(sel_set_door, (int, int, genericptr_t)); +static void FDECL(spo_door, (struct sp_coder *)); +static void FDECL(spo_feature, (struct sp_coder *)); +static void FDECL(spo_terrain, (struct sp_coder *)); +static void FDECL(spo_replace_terrain, (struct sp_coder *)); +static boolean FDECL(generate_way_out_method, (int, int, struct opvar *)); +static void NDECL(ensure_way_out); +static void FDECL(spo_levregion, (struct sp_coder *)); +static void FDECL(spo_region, (struct sp_coder *)); +static void FDECL(spo_drawbridge, (struct sp_coder *)); +static void FDECL(spo_mazewalk, (struct sp_coder *)); +static void FDECL(spo_wall_property, (struct sp_coder *)); +static void FDECL(spo_room_door, (struct sp_coder *)); +static void FDECL(sel_set_wallify, (int, int, genericptr_t)); +static void FDECL(spo_wallify, (struct sp_coder *)); +static void FDECL(spo_map, (struct sp_coder *)); +static void FDECL(spo_jmp, (struct sp_coder *, sp_lev *)); +static void FDECL(spo_conditional_jump, (struct sp_coder *, sp_lev *)); +static void FDECL(spo_var_init, (struct sp_coder *)); #if 0 -STATIC_DCL long FDECL(opvar_array_length, (struct sp_coder *)); +static long FDECL(opvar_array_length, (struct sp_coder *)); #endif /*0*/ -STATIC_DCL void FDECL(spo_shuffle_array, (struct sp_coder *)); -STATIC_DCL boolean FDECL(sp_level_coder, (sp_lev *)); +static void FDECL(spo_shuffle_array, (struct sp_coder *)); +static boolean FDECL(sp_level_coder, (sp_lev *)); #define LEFT 1 #define H_LEFT 2 @@ -610,7 +610,7 @@ schar lit; /* * Make walls of the area (x1, y1, x2, y2) non diggable/non passwall-able */ -STATIC_OVL void +static void set_wall_property(x1, y1, x2, y2, prop) xchar x1, y1, x2, y2; int prop; @@ -633,7 +633,7 @@ int prop; } } -STATIC_OVL void +static void shuffle_alignments() { int i; @@ -654,7 +654,7 @@ shuffle_alignments() /* * Count the different features (sinks, fountains) in the level. */ -STATIC_OVL void +static void count_features() { xchar x, y; @@ -696,7 +696,7 @@ remove_boundary_syms() } /* used by sel_set_door() and link_doors_rooms() */ -STATIC_OVL void +static void set_door_orientation(x, y) int x, y; { @@ -743,7 +743,7 @@ int x, y; levl[x][y].horizontal = ((wleft || wright) && !(wup && wdown)) ? 1 : 0; } -STATIC_OVL void +static void maybe_add_door(x, y, droom) int x, y; struct mkroom *droom; @@ -752,7 +752,7 @@ struct mkroom *droom; add_door(x, y, droom); } -STATIC_OVL void +static void link_doors_rooms() { int x, y; @@ -792,7 +792,7 @@ fill_rooms() /* * Choose randomly the state (nodoor, open, closed or locked) for a door */ -STATIC_OVL int +static int rnddoor() { int i = 1 << rn2(5); @@ -804,7 +804,7 @@ rnddoor() /* * Select a random trap */ -STATIC_OVL int +static int rndtrap() { int rtrap; @@ -843,7 +843,7 @@ rndtrap() * The "humidity" flag is used to insure that engravings aren't * created underwater, or eels on dry land. */ -STATIC_OVL void +static void get_location(x, y, humidity, croom) schar *x, *y; int humidity; @@ -913,7 +913,7 @@ found_it: } } -STATIC_OVL boolean +static boolean is_ok_location(x, y, humidity) register schar x, y; register int humidity; @@ -967,7 +967,7 @@ int defhumidity; return c; } -STATIC_OVL void +static void get_location_coord(x, y, humidity, croom, crd) schar *x, *y; int humidity; @@ -990,7 +990,7 @@ long crd; * negative values for x or y means RANDOM! */ -STATIC_OVL void +static void get_room_loc(x, y, croom) schar *x, *y; struct mkroom *croom; @@ -1017,7 +1017,7 @@ struct mkroom *croom; * Get a relative position inside a room. * negative values for x or y means RANDOM! */ -STATIC_OVL void +static void get_free_room_loc(x, y, croom, pos) schar *x, *y; struct mkroom *croom; @@ -1274,7 +1274,7 @@ xchar rtype, rlit; * Create a subroom in room proom at pos x,y with width w & height h. * x & y are relative to the parent room. */ -STATIC_OVL boolean +static boolean create_subroom(proom, x, y, w, h, rtype, rlit) struct mkroom *proom; xchar x, y; @@ -1321,7 +1321,7 @@ xchar rtype, rlit; * Create a new door in a room. * It's placed on a wall (north, south, east or west). */ -STATIC_OVL void +static void create_door(dd, broom) room_door *dd; struct mkroom *broom; @@ -1475,7 +1475,7 @@ xchar walls; /* any of W_NORTH | W_SOUTH | W_EAST | W_WEST (or W_ANY) */ /* * Create a trap in a room. */ -STATIC_OVL void +static void create_trap(t, croom) spltrap *t; struct mkroom *croom; @@ -1504,7 +1504,7 @@ struct mkroom *croom; /* * Create a monster in a room. */ -STATIC_OVL int +static int noncoalignment(alignment) aligntyp alignment; { @@ -1517,7 +1517,7 @@ aligntyp alignment; } /* attempt to screen out locations where a mimic-as-boulder shouldn't occur */ -STATIC_OVL boolean +static boolean m_bad_boulder_spot(x, y) int x, y; { @@ -1538,7 +1538,7 @@ int x, y; return FALSE; } -STATIC_OVL int +static int pm_to_humidity(pm) struct permonst *pm; { @@ -1556,7 +1556,7 @@ struct permonst *pm; return loc; } -STATIC_OVL void +static void create_monster(m, croom) monster *m; struct mkroom *croom; @@ -1815,7 +1815,7 @@ struct mkroom *croom; /* * Create an object in a room. */ -STATIC_OVL void +static void create_object(o, croom) object *o; struct mkroom *croom; @@ -2065,7 +2065,7 @@ struct mkroom *croom; /* * Create an altar in a room. */ -STATIC_OVL void +static void create_altar(a, croom) altar *a; struct mkroom *croom; @@ -2151,7 +2151,7 @@ struct mkroom *croom; /* * Search for a door in a room on a specified wall. */ -STATIC_OVL boolean +static boolean search_door(croom, x, y, wall, cnt) struct mkroom *croom; xchar *x, *y; @@ -2323,7 +2323,7 @@ schar ftyp, btyp; * and g.dnstairs_room after the rooms have been sorted. On normal levels, * stairs don't get created until _after_ sorting takes place. */ -STATIC_OVL void +static void fix_stair_rooms() { int i; @@ -2366,7 +2366,7 @@ fix_stair_rooms() * Basically we search for door coordinates or for endpoints coordinates * (from a distance). */ -STATIC_OVL void +static void create_corridor(c) corridor *c; { @@ -2520,7 +2520,7 @@ struct mkroom *mkr; /* * set lighting in a region that will not become a room. */ -STATIC_OVL void +static void light_region(tmpregion) region *tmpregion; { @@ -2548,7 +2548,7 @@ region *tmpregion; } } -STATIC_OVL void +static void wallify_map(x1, y1, x2, y2) int x1, y1, x2, y2; { @@ -2584,7 +2584,7 @@ int x1, y1, x2, y2; * We want a place not 'touched' by the loader. That is, a place in * the maze outside every part of the special level. */ -STATIC_OVL void +static void maze1xy(m, humidity) coord *m; int humidity; @@ -2612,7 +2612,7 @@ int humidity; * Makes the number of traps, monsters, etc. proportional * to the size of the maze. */ -STATIC_OVL void +static void fill_empty_maze() { int mapcountmax, mapcount, mapfact; @@ -2666,7 +2666,7 @@ fill_empty_maze() /* * special level loader */ -STATIC_OVL boolean +static boolean sp_level_loader(fd, lvl) dlb *fd; sp_lev *lvl; @@ -2738,7 +2738,7 @@ sp_lev *lvl; } /* Frees the memory allocated for special level creation structs */ -STATIC_OVL boolean +static boolean sp_level_free(lvl) sp_lev *lvl; { @@ -3785,7 +3785,7 @@ int percent; selection_setpoint(x, y, ov, 0); } -STATIC_OVL int +static int selection_rndcoord(ov, x, y, removeit) struct opvar *ov; schar *x, *y; @@ -3861,8 +3861,8 @@ int dir; selection_setpoint(x, y, ov, 1); } -STATIC_VAR int FDECL((*selection_flood_check_func), (int, int)); -STATIC_VAR schar floodfillchk_match_under_typ; +static int FDECL((*selection_flood_check_func), (int, int)); +static schar floodfillchk_match_under_typ; void set_selection_floodfillchk(f) @@ -3871,14 +3871,14 @@ int FDECL((*f), (int, int)); selection_flood_check_func = f; } -STATIC_OVL int +static int floodfillchk_match_under(x,y) int x,y; { return (floodfillchk_match_under_typ == levl[x][y].typ); } -STATIC_OVL int +static int floodfillchk_match_accessible(x, y) int x, y; { @@ -3888,7 +3888,7 @@ int x, y; } /* check whethere is already in xs[],ys[] */ -STATIC_OVL boolean +static boolean sel_flood_havepoint(x, y, xs, ys, n) int x, y; xchar xs[], ys[]; @@ -4385,7 +4385,7 @@ struct sp_coder *coder; opvar_free(chance); } -STATIC_OVL boolean +static boolean generate_way_out_method(nx,ny, ov) int nx,ny; struct opvar *ov; @@ -4459,7 +4459,7 @@ struct opvar *ov; return res; } -STATIC_OVL void +static void ensure_way_out() { static const char nhFunc[] = "ensure_way_out"; @@ -5219,7 +5219,7 @@ struct sp_coder *coder; } #if 0 -STATIC_OVL long +static long opvar_array_length(coder) struct sp_coder *coder; { @@ -5288,7 +5288,7 @@ struct sp_coder *coder; /* Special level coder, creates the special level from the sp_lev codes. * Does not free the allocated memory. */ -STATIC_OVL boolean +static boolean sp_level_coder(lvl) sp_lev *lvl; { diff --git a/src/spell.c b/src/spell.c index 3d0ec4765..0cee8580b 100644 --- a/src/spell.c +++ b/src/spell.c @@ -25,25 +25,25 @@ #define spellet(spell) \ ((char) ((spell < 26) ? ('a' + spell) : ('A' + spell - 26))) -STATIC_DCL int FDECL(spell_let_to_idx, (CHAR_P)); -STATIC_DCL boolean FDECL(cursed_book, (struct obj * bp)); -STATIC_DCL boolean FDECL(confused_book, (struct obj *)); -STATIC_DCL void FDECL(deadbook, (struct obj *)); -STATIC_PTR int NDECL(learn); -STATIC_DCL boolean NDECL(rejectcasting); -STATIC_DCL boolean FDECL(getspell, (int *)); -STATIC_PTR int FDECL(CFDECLSPEC spell_cmp, (const genericptr, +static int FDECL(spell_let_to_idx, (CHAR_P)); +static boolean FDECL(cursed_book, (struct obj * bp)); +static boolean FDECL(confused_book, (struct obj *)); +static void FDECL(deadbook, (struct obj *)); +static int NDECL(learn); +static boolean NDECL(rejectcasting); +static boolean FDECL(getspell, (int *)); +static int FDECL(CFDECLSPEC spell_cmp, (const genericptr, const genericptr)); -STATIC_DCL void NDECL(sortspells); -STATIC_DCL boolean NDECL(spellsortmenu); -STATIC_DCL boolean FDECL(dospellmenu, (const char *, int, int *)); -STATIC_DCL int FDECL(percent_success, (int)); -STATIC_DCL char *FDECL(spellretention, (int, char *)); -STATIC_DCL int NDECL(throwspell); -STATIC_DCL void NDECL(cast_protection); -STATIC_DCL void FDECL(spell_backfire, (int)); -STATIC_DCL const char *FDECL(spelltypemnemonic, (int)); -STATIC_DCL boolean FDECL(spell_aim_step, (genericptr_t, int, int)); +static void NDECL(sortspells); +static boolean NDECL(spellsortmenu); +static boolean FDECL(dospellmenu, (const char *, int, int *)); +static int FDECL(percent_success, (int)); +static char *FDECL(spellretention, (int, char *)); +static int NDECL(throwspell); +static void NDECL(cast_protection); +static void FDECL(spell_backfire, (int)); +static const char *FDECL(spelltypemnemonic, (int)); +static boolean FDECL(spell_aim_step, (genericptr_t, int, int)); /* The roles[] table lists the role-specific values for tuning * percent_success(). @@ -101,7 +101,7 @@ STATIC_DCL boolean FDECL(spell_aim_step, (genericptr_t, int, int)); static const char explodes[] = "radiates explosive energy"; /* convert a letter into a number in the range 0..51, or -1 if not a letter */ -STATIC_OVL int +static int spell_let_to_idx(ilet) char ilet; { @@ -117,7 +117,7 @@ char ilet; } /* TRUE: book should be destroyed by caller */ -STATIC_OVL boolean +static boolean cursed_book(bp) struct obj *bp; { @@ -177,7 +177,7 @@ struct obj *bp; } /* study while confused: returns TRUE if the book is destroyed */ -STATIC_OVL boolean +static boolean confused_book(spellbook) struct obj *spellbook; { @@ -202,7 +202,7 @@ struct obj *spellbook; } /* special effects for The Book of the Dead */ -STATIC_OVL void +static void deadbook(book2) struct obj *book2; { @@ -336,7 +336,7 @@ struct obj *book; stop_occupation(); } -STATIC_PTR int +static int learn(VOID_ARGS) { int i; @@ -637,7 +637,7 @@ age_spells() /* return True if spellcasting is inhibited; only covers a small subset of reasons why casting won't work */ -STATIC_OVL boolean +static boolean rejectcasting() { /* rejections which take place before selecting a particular spell */ @@ -665,7 +665,7 @@ rejectcasting() * Return TRUE if a spell was picked, with the spell index in the return * parameter. Otherwise return FALSE. */ -STATIC_OVL boolean +static boolean getspell(spell_no) int *spell_no; { @@ -727,7 +727,7 @@ docast() return 0; } -STATIC_OVL const char * +static const char * spelltypemnemonic(skill) int skill; { @@ -759,7 +759,7 @@ int booktype; return objects[booktype].oc_skill; } -STATIC_OVL void +static void cast_protection() { int l = u.ulevel, loglev = 0, @@ -840,7 +840,7 @@ cast_protection() } /* attempting to cast a forgotten spell will cause disorientation */ -STATIC_OVL void +static void spell_backfire(spell) int spell; { @@ -1213,7 +1213,7 @@ boolean atme; } /*ARGSUSED*/ -STATIC_OVL boolean +static boolean spell_aim_step(arg, x, y) genericptr_t arg UNUSED; int x, y; @@ -1227,7 +1227,7 @@ int x, y; } /* Choose location where spell takes effect. */ -STATIC_OVL int +static int throwspell() { coord cc, uc; @@ -1439,7 +1439,7 @@ static const char *spl_sortchoices[NUM_SPELL_SORTBY] = { }; /* qsort callback routine */ -STATIC_PTR int CFDECLSPEC +static int CFDECLSPEC spell_cmp(vptr1, vptr2) const genericptr vptr1; const genericptr vptr2; @@ -1498,7 +1498,7 @@ const genericptr vptr2; /* sort the index used for display order of the "view known spells" list (sortmode == SORTBY_xxx), or sort the spellbook itself to make the current display order stick (sortmode == SORTRETAINORDER) */ -STATIC_OVL void +static void sortspells() { int i; @@ -1546,7 +1546,7 @@ sortspells() } /* called if the [sort spells] entry in the view spells menu gets chosen */ -STATIC_OVL boolean +static boolean spellsortmenu() { winid tmpwin; @@ -1625,7 +1625,7 @@ dovspell() return 0; } -STATIC_OVL boolean +static boolean dospellmenu(prompt, splaction, spell_no) const char *prompt; int splaction; /* SPELLMENU_CAST, SPELLMENU_VIEW, or g.spl_book[] index */ @@ -1707,7 +1707,7 @@ int *spell_no; return FALSE; } -STATIC_OVL int +static int percent_success(spell) int spell; { @@ -1822,7 +1822,7 @@ int spell; return chance; } -STATIC_OVL char * +static char * spellretention(idx, outbuf) int idx; char *outbuf; diff --git a/src/steal.c b/src/steal.c index 19fac8f48..7988b0316 100644 --- a/src/steal.c +++ b/src/steal.c @@ -5,11 +5,11 @@ #include "hack.h" -STATIC_PTR int NDECL(stealarm); +static int NDECL(stealarm); -STATIC_DCL const char *FDECL(equipname, (struct obj *)); +static const char *FDECL(equipname, (struct obj *)); -STATIC_OVL const char * +static const char * equipname(otmp) register struct obj *otmp; { @@ -143,7 +143,7 @@ register struct monst *mtmp; unsigned int stealoid; /* object to be stolen */ unsigned int stealmid; /* monster doing the stealing */ -STATIC_PTR int +static int stealarm(VOID_ARGS) { register struct monst *mtmp; diff --git a/src/steed.c b/src/steed.c index eca69c407..942bab8ec 100644 --- a/src/steed.c +++ b/src/steed.c @@ -9,8 +9,8 @@ static NEARDATA const char steeds[] = { S_QUADRUPED, S_UNICORN, S_ANGEL, S_CENTAUR, S_DRAGON, S_JABBERWOCK, '\0' }; -STATIC_DCL boolean FDECL(landing_spot, (coord *, int, int)); -STATIC_DCL void FDECL(maybewakesteed, (struct monst *)); +static boolean FDECL(landing_spot, (coord *, int, int)); +static void FDECL(maybewakesteed, (struct monst *)); /* caller has decided that hero can't reach something while mounted */ void @@ -430,7 +430,7 @@ kick_steed() * room's walls, which is not what we want. * Adapted from mail daemon code. */ -STATIC_OVL boolean +static boolean landing_spot(spot, reason, forceit) coord *spot; /* landing position (we fill it in) */ int reason; @@ -689,7 +689,7 @@ int reason; /* Player was thrown off etc. */ /* when attempting to saddle or mount a sleeping steed, try to wake it up (for the saddling case, it won't be u.usteed yet) */ -STATIC_OVL void +static void maybewakesteed(steed) struct monst *steed; { diff --git a/src/teleport.c b/src/teleport.c index 037be54fb..88d33325c 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -5,11 +5,11 @@ #include "hack.h" -STATIC_DCL boolean FDECL(tele_jump_ok, (int, int, int, int)); -STATIC_DCL boolean FDECL(teleok, (int, int, BOOLEAN_P)); -STATIC_DCL void NDECL(vault_tele); -STATIC_DCL boolean FDECL(rloc_pos_ok, (int, int, struct monst *)); -STATIC_DCL void FDECL(mvault_tele, (struct monst *)); +static boolean FDECL(tele_jump_ok, (int, int, int, int)); +static boolean FDECL(teleok, (int, int, BOOLEAN_P)); +static void NDECL(vault_tele); +static boolean FDECL(rloc_pos_ok, (int, int, struct monst *)); +static void FDECL(mvault_tele, (struct monst *)); /* * Is (x,y) a good position of mtmp? If mtmp is NULL, then is (x,y) good @@ -220,7 +220,7 @@ unsigned entflags; * need to be augmented to allow deliberate passage in wizard mode, but * only for explicitly chosen destinations.) */ -STATIC_OVL boolean +static boolean tele_jump_ok(x1, y1, x2, y2) int x1, y1, x2, y2; { @@ -255,7 +255,7 @@ int x1, y1, x2, y2; return TRUE; } -STATIC_OVL boolean +static boolean teleok(x, y, trapok) register int x, y; boolean trapok; @@ -417,7 +417,7 @@ boolean allow_drag; return FALSE; } -STATIC_OVL void +static void vault_tele() { register struct mkroom *croom = search_special(VAULT); @@ -1098,7 +1098,7 @@ unsigned trflags; } /* check whether monster can arrive at location via Tport (or fall) */ -STATIC_OVL boolean +static boolean rloc_pos_ok(x, y, mtmp) register int x, y; /* coordinates of candidate location */ struct monst *mtmp; @@ -1262,7 +1262,7 @@ boolean suppress_impossible; return TRUE; } -STATIC_OVL void +static void mvault_tele(mtmp) struct monst *mtmp; { diff --git a/src/timeout.c b/src/timeout.c index 5bf7084d3..b39937ee8 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -8,16 +8,16 @@ #include "sfproto.h" -STATIC_DCL void NDECL(stoned_dialogue); -STATIC_DCL void NDECL(vomiting_dialogue); -STATIC_DCL void NDECL(choke_dialogue); -STATIC_DCL void NDECL(levitation_dialogue); -STATIC_DCL void NDECL(slime_dialogue); -STATIC_DCL void FDECL(slimed_to_death, (struct kinfo *)); -STATIC_DCL void NDECL(slip_or_trip); -STATIC_DCL void FDECL(see_lamp_flicker, (struct obj *, const char *)); -STATIC_DCL void FDECL(lantern_message, (struct obj *)); -STATIC_DCL void FDECL(cleanup_burn, (ANY_P *, long)); +static void NDECL(stoned_dialogue); +static void NDECL(vomiting_dialogue); +static void NDECL(choke_dialogue); +static void NDECL(levitation_dialogue); +static void NDECL(slime_dialogue); +static void FDECL(slimed_to_death, (struct kinfo *)); +static void NDECL(slip_or_trip); +static void FDECL(see_lamp_flicker, (struct obj *, const char *)); +static void FDECL(lantern_message, (struct obj *)); +static void FDECL(cleanup_burn, (ANY_P *, long)); /* used by wizard mode #timeout and #wizintrinsic; order by 'interest' for timeout countdown, where most won't occur in normal play */ @@ -107,7 +107,7 @@ static NEARDATA const char *const stoned_texts[] = { "You are a statue." /* 1 */ }; -STATIC_OVL void +static void stoned_dialogue() { register long i = (Stoned & TIMEOUT); @@ -167,7 +167,7 @@ static NEARDATA const char *const vomiting_texts[] = { "are about to vomit." /* 2 */ }; -STATIC_OVL void +static void vomiting_dialogue() { const char *txt = 0; @@ -248,7 +248,7 @@ static NEARDATA const char *const choke_texts2[] = { "You suffocate." }; -STATIC_OVL void +static void choke_dialogue() { register long i = (Strangled & TIMEOUT); @@ -273,7 +273,7 @@ static NEARDATA const char *const levi_texts[] = { "You wobble unsteadily %s the %s." }; -STATIC_OVL void +static void levitation_dialogue() { /* -1 because the last message comes via float_down() */ @@ -308,7 +308,7 @@ static NEARDATA const char *const slime_texts[] = { "You have become %s." /* 1 */ }; -STATIC_OVL void +static void slime_dialogue() { register long i = (Slimed & TIMEOUT) / 2L; @@ -368,7 +368,7 @@ burn_away_slime() } /* countdown timer for turning into green slime has run out; kill our hero */ -STATIC_OVL void +static void slimed_to_death(kptr) struct kinfo *kptr; { @@ -446,7 +446,7 @@ static NEARDATA const char *const phaze_texts[] = { "You are feeling rather flabby.", }; -STATIC_OVL void +static void phaze_dialogue() { long i = ((HPasses_walls & TIMEOUT) / 2L); @@ -974,7 +974,7 @@ struct obj *figurine; } /* give a fumble message */ -STATIC_OVL void +static void slip_or_trip() { struct obj *otmp = vobj_at(u.ux, u.uy), *otmp2; @@ -1065,7 +1065,7 @@ slip_or_trip() } /* Print a lamp flicker message with tailer. */ -STATIC_OVL void +static void see_lamp_flicker(obj, tailer) struct obj *obj; const char *tailer; @@ -1082,7 +1082,7 @@ const char *tailer; } /* Print a dimming message for brass lanterns. */ -STATIC_OVL void +static void lantern_message(obj) struct obj *obj; { @@ -1662,15 +1662,15 @@ do_storms() * Check whether object has a timer of type timer_type. */ -STATIC_DCL const char *FDECL(kind_name, (SHORT_P)); -STATIC_DCL void FDECL(print_queue, (winid, timer_element *)); -STATIC_DCL void FDECL(insert_timer, (timer_element *)); -STATIC_DCL timer_element *FDECL(remove_timer, +static const char *FDECL(kind_name, (SHORT_P)); +static void FDECL(print_queue, (winid, timer_element *)); +static void FDECL(insert_timer, (timer_element *)); +static timer_element *FDECL(remove_timer, (timer_element **, SHORT_P, ANY_P *)); -STATIC_DCL void FDECL(write_timer, (NHFILE *, timer_element *)); -STATIC_DCL boolean FDECL(mon_is_local, (struct monst *)); -STATIC_DCL boolean FDECL(timer_is_local, (timer_element *)); -STATIC_DCL int FDECL(maybe_write_timer, (NHFILE *, int, BOOLEAN_P)); +static void FDECL(write_timer, (NHFILE *, timer_element *)); +static boolean FDECL(mon_is_local, (struct monst *)); +static boolean FDECL(timer_is_local, (timer_element *)); +static int FDECL(maybe_write_timer, (NHFILE *, int, BOOLEAN_P)); /* If defined, then include names when printing out the timer queue */ #define VERBOSE_TIMER @@ -1703,7 +1703,7 @@ static const ttable timeout_funcs[NUM_TIME_FUNCS] = { }; #undef TTAB -STATIC_OVL const char * +static const char * kind_name(kind) short kind; { @@ -1720,7 +1720,7 @@ short kind; return "unknown"; } -STATIC_OVL void +static void print_queue(win, base) winid win; timer_element *base; @@ -2072,7 +2072,7 @@ short func_index; } /* Insert timer into the global queue */ -STATIC_OVL void +static void insert_timer(gnu) timer_element *gnu; { @@ -2089,7 +2089,7 @@ timer_element *gnu; g.timer_base = gnu; } -STATIC_OVL timer_element * +static timer_element * remove_timer(base, func_index, arg) timer_element **base; short func_index; @@ -2111,7 +2111,7 @@ anything *arg; return curr; } -STATIC_OVL void +static void write_timer(nhfp, timer) NHFILE *nhfp; timer_element *timer; @@ -2205,7 +2205,7 @@ struct obj *obj; * Return TRUE if the given monster will stay on the level when the * level is saved. */ -STATIC_OVL boolean +static boolean mon_is_local(mon) struct monst *mon; { @@ -2225,7 +2225,7 @@ struct monst *mon; * Return TRUE if the timer is attached to something that will stay on the * level when the level is saved. */ -STATIC_OVL boolean +static boolean timer_is_local(timer) timer_element *timer; { @@ -2247,7 +2247,7 @@ timer_element *timer; * Part of the save routine. Count up the number of timers that would * be written. If write_it is true, actually write the timer. */ -STATIC_OVL int +static int maybe_write_timer(nhfp, range, write_it) NHFILE *nhfp; int range; diff --git a/src/topten.c b/src/topten.c index 43b449423..22347595d 100644 --- a/src/topten.c +++ b/src/topten.c @@ -57,26 +57,26 @@ struct toptenentry { room for separating space or trailing newline plus string terminator */ #define SCANBUFSZ (4 * (ROLESZ + 1) + (NAMSZ + 1) + (DTHSZ + 1) + 1) -STATIC_DCL void FDECL(topten_print, (const char *)); -STATIC_DCL void FDECL(topten_print_bold, (const char *)); -STATIC_DCL void NDECL(outheader); -STATIC_DCL void FDECL(outentry, (int, struct toptenentry *, BOOLEAN_P)); -STATIC_DCL void FDECL(discardexcess, (FILE *)); -STATIC_DCL void FDECL(readentry, (FILE *, struct toptenentry *)); -STATIC_DCL void FDECL(writeentry, (FILE *, struct toptenentry *)); +static void FDECL(topten_print, (const char *)); +static void FDECL(topten_print_bold, (const char *)); +static void NDECL(outheader); +static void FDECL(outentry, (int, struct toptenentry *, BOOLEAN_P)); +static void FDECL(discardexcess, (FILE *)); +static void FDECL(readentry, (FILE *, struct toptenentry *)); +static void FDECL(writeentry, (FILE *, struct toptenentry *)); #ifdef XLOGFILE -STATIC_DCL void FDECL(writexlentry, (FILE *, struct toptenentry *, int)); -STATIC_DCL long NDECL(encodexlogflags); -STATIC_DCL long NDECL(encodeconduct); -STATIC_DCL long NDECL(encodeachieve); +static void FDECL(writexlentry, (FILE *, struct toptenentry *, int)); +static long NDECL(encodexlogflags); +static long NDECL(encodeconduct); +static long NDECL(encodeachieve); #endif -STATIC_DCL void FDECL(free_ttlist, (struct toptenentry *)); -STATIC_DCL int FDECL(classmon, (char *, BOOLEAN_P)); -STATIC_DCL int FDECL(score_wanted, (BOOLEAN_P, int, struct toptenentry *, int, +static void FDECL(free_ttlist, (struct toptenentry *)); +static int FDECL(classmon, (char *, BOOLEAN_P)); +static int FDECL(score_wanted, (BOOLEAN_P, int, struct toptenentry *, int, const char **, int)); #ifdef NO_SCAN_BRACK -STATIC_DCL void FDECL(nsb_mung_line, (char *)); -STATIC_DCL void FDECL(nsb_unmung_line, (char *)); +static void FDECL(nsb_mung_line, (char *)); +static void FDECL(nsb_unmung_line, (char *)); #endif /* "killed by",&c ["an"] 'g.killer.name' */ @@ -152,7 +152,7 @@ boolean incl_helpless; } } -STATIC_OVL void +static void topten_print(x) const char *x; { @@ -162,7 +162,7 @@ const char *x; putstr(g.toptenwin, ATR_NONE, x); } -STATIC_OVL void +static void topten_print_bold(x) const char *x; { @@ -198,7 +198,7 @@ d_level *lev; } /* throw away characters until current record has been entirely consumed */ -STATIC_OVL void +static void discardexcess(rfile) FILE *rfile; { @@ -209,7 +209,7 @@ FILE *rfile; } while (c != '\n' && c != EOF); } -STATIC_OVL void +static void readentry(rfile, tt) FILE *rfile; struct toptenentry *tt; @@ -292,7 +292,7 @@ struct toptenentry *tt; } } -STATIC_OVL void +static void writeentry(rfile, tt) FILE *rfile; struct toptenentry *tt; @@ -331,7 +331,7 @@ struct toptenentry *tt; #ifdef XLOGFILE /* as tab is never used in eg. g.plname or death, no need to mangle those. */ -STATIC_OVL void +static void writexlentry(rfile, tt, how) FILE *rfile; struct toptenentry *tt; @@ -375,7 +375,7 @@ int how; #undef XLOG_SEP } -STATIC_OVL long +static long encodexlogflags() { long e = 0L; @@ -390,7 +390,7 @@ encodexlogflags() return e; } -STATIC_OVL long +static long encodeconduct() { long e = 0L; @@ -423,7 +423,7 @@ encodeconduct() return e; } -STATIC_OVL long +static long encodeachieve() { long r = 0L; @@ -462,7 +462,7 @@ encodeachieve() #endif /* XLOGFILE */ -STATIC_OVL void +static void free_ttlist(tt) struct toptenentry *tt; { @@ -774,7 +774,7 @@ destroywin: } } -STATIC_OVL void +static void outheader() { char linebuf[BUFSZ]; @@ -789,7 +789,7 @@ outheader() } /* so>0: standout line; so=0: ordinary line */ -STATIC_OVL void +static void outentry(rank, t1, so) struct toptenentry *t1; int rank; @@ -952,7 +952,7 @@ boolean so; topten_print(linebuf); } -STATIC_OVL int +static int score_wanted(current_ver, rank, t1, playerct, players, uid) boolean current_ver; int rank; @@ -1144,7 +1144,7 @@ char **argv; #endif } -STATIC_OVL int +static int classmon(plch, fem) char *plch; boolean fem; @@ -1236,7 +1236,7 @@ struct obj *otmp; /* Lattice scanf isn't up to reading the scorefile. What */ /* follows deals with that; I admit it's ugly. (KL) */ /* Now generally available (KL) */ -STATIC_OVL void +static void nsb_mung_line(p) char *p; { @@ -1244,7 +1244,7 @@ char *p; *p = '|'; } -STATIC_OVL void +static void nsb_unmung_line(p) char *p; { diff --git a/src/track.c b/src/track.c index 67b46467c..8ac35c51a 100644 --- a/src/track.c +++ b/src/track.c @@ -8,8 +8,8 @@ #define UTSZ 50 -STATIC_VAR NEARDATA int utcnt, utpnt; -STATIC_VAR NEARDATA coord utrack[UTSZ]; +static NEARDATA int utcnt, utpnt; +static NEARDATA coord utrack[UTSZ]; void initrack() diff --git a/src/trap.c b/src/trap.c index 6ad7667cb..ec75cf7a9 100644 --- a/src/trap.c +++ b/src/trap.c @@ -7,43 +7,43 @@ extern const char *const destroy_strings[][3]; /* from zap.c */ -STATIC_DCL boolean FDECL(keep_saddle_with_steedcorpse, (unsigned, struct obj *, +static boolean FDECL(keep_saddle_with_steedcorpse, (unsigned, struct obj *, struct obj *)); -STATIC_DCL struct obj *FDECL(t_missile, (int, struct trap *)); -STATIC_DCL char *FDECL(trapnote, (struct trap *, BOOLEAN_P)); -STATIC_DCL int FDECL(steedintrap, (struct trap *, struct obj *)); -STATIC_DCL void FDECL(launch_drop_spot, (struct obj *, XCHAR_P, XCHAR_P)); -STATIC_DCL int FDECL(mkroll_launch, (struct trap *, XCHAR_P, XCHAR_P, +static struct obj *FDECL(t_missile, (int, struct trap *)); +static char *FDECL(trapnote, (struct trap *, BOOLEAN_P)); +static int FDECL(steedintrap, (struct trap *, struct obj *)); +static void FDECL(launch_drop_spot, (struct obj *, XCHAR_P, XCHAR_P)); +static int FDECL(mkroll_launch, (struct trap *, XCHAR_P, XCHAR_P, SHORT_P, long)); -STATIC_DCL boolean FDECL(isclearpath, (coord *, int, SCHAR_P, SCHAR_P)); -STATIC_DCL void FDECL(dofiretrap, (struct obj *)); -STATIC_DCL void NDECL(domagictrap); -STATIC_DCL boolean FDECL(emergency_disrobe, (boolean *)); -STATIC_DCL int FDECL(untrap_prob, (struct trap *)); -STATIC_DCL void FDECL(move_into_trap, (struct trap *)); -STATIC_DCL int FDECL(try_disarm, (struct trap *, BOOLEAN_P)); -STATIC_DCL void FDECL(reward_untrap, (struct trap *, struct monst *)); -STATIC_DCL int FDECL(disarm_holdingtrap, (struct trap *)); -STATIC_DCL int FDECL(disarm_landmine, (struct trap *)); -STATIC_DCL int FDECL(disarm_squeaky_board, (struct trap *)); -STATIC_DCL int FDECL(disarm_shooting_trap, (struct trap *, int)); -STATIC_DCL void FDECL(clear_conjoined_pits, (struct trap *)); -STATIC_DCL boolean FDECL(adj_nonconjoined_pit, (struct trap *)); -STATIC_DCL int FDECL(try_lift, (struct monst *, struct trap *, int, +static boolean FDECL(isclearpath, (coord *, int, SCHAR_P, SCHAR_P)); +static void FDECL(dofiretrap, (struct obj *)); +static void NDECL(domagictrap); +static boolean FDECL(emergency_disrobe, (boolean *)); +static int FDECL(untrap_prob, (struct trap *)); +static void FDECL(move_into_trap, (struct trap *)); +static int FDECL(try_disarm, (struct trap *, BOOLEAN_P)); +static void FDECL(reward_untrap, (struct trap *, struct monst *)); +static int FDECL(disarm_holdingtrap, (struct trap *)); +static int FDECL(disarm_landmine, (struct trap *)); +static int FDECL(disarm_squeaky_board, (struct trap *)); +static int FDECL(disarm_shooting_trap, (struct trap *, int)); +static void FDECL(clear_conjoined_pits, (struct trap *)); +static boolean FDECL(adj_nonconjoined_pit, (struct trap *)); +static int FDECL(try_lift, (struct monst *, struct trap *, int, BOOLEAN_P)); -STATIC_DCL int FDECL(help_monster_out, (struct monst *, struct trap *)); +static int FDECL(help_monster_out, (struct monst *, struct trap *)); #if 0 -STATIC_DCL void FDECL(join_adjacent_pits, (struct trap *)); +static void FDECL(join_adjacent_pits, (struct trap *)); #endif -STATIC_DCL boolean FDECL(thitm, (int, struct monst *, struct obj *, int, +static boolean FDECL(thitm, (int, struct monst *, struct obj *, int, BOOLEAN_P)); -STATIC_DCL void NDECL(maybe_finish_sokoban); +static void NDECL(maybe_finish_sokoban); -STATIC_VAR const char *const a_your[2] = { "a", "your" }; -STATIC_VAR const char *const A_Your[2] = { "A", "Your" }; -STATIC_VAR const char tower_of_flame[] = "tower of flame"; -STATIC_VAR const char *const A_gush_of_water_hits = "A gush of water hits"; -STATIC_VAR const char *const blindgas[6] = { "humid", "odorless", +static const char *const a_your[2] = { "a", "your" }; +static const char *const A_Your[2] = { "A", "Your" }; +static const char tower_of_flame[] = "tower of flame"; +static const char *const A_gush_of_water_hits = "A gush of water hits"; +static const char *const blindgas[6] = { "humid", "odorless", "pungent", "chilling", "acrid", "biting" }; @@ -762,7 +762,7 @@ boolean shatter; return mtmp; } -STATIC_OVL boolean +static boolean keep_saddle_with_steedcorpse(steed_mid, objchn, saddle) unsigned steed_mid; struct obj *objchn, *saddle; @@ -838,7 +838,7 @@ struct trap *trap; } /* make a single arrow/dart/rock for a trap to shoot or drop */ -STATIC_OVL struct obj * +static struct obj * t_missile(otyp, trap) int otyp; struct trap *trap; @@ -1549,7 +1549,7 @@ unsigned trflags; } } -STATIC_OVL char * +static char * trapnote(trap, noprefix) struct trap *trap; boolean noprefix; @@ -1569,7 +1569,7 @@ boolean noprefix; return tnbuf; } -STATIC_OVL int +static int steedintrap(trap, otmp) struct trap *trap; struct obj *otmp; @@ -1681,7 +1681,7 @@ struct trap *trap; } } -STATIC_OVL void +static void launch_drop_spot(obj, x, y) struct obj *obj; xchar x, y; @@ -2008,7 +2008,7 @@ struct trap *trap; newsym(trap->tx, trap->ty); } -STATIC_OVL int +static int mkroll_launch(ttmp, x, y, otyp, ocount) struct trap *ttmp; xchar x, y; @@ -2078,7 +2078,7 @@ long ocount; return 1; } -STATIC_OVL boolean +static boolean isclearpath(cc, distance, dx, dy) coord *cc; int distance; @@ -3090,7 +3090,7 @@ climb_pit() } } -STATIC_OVL void +static void dofiretrap(box) struct obj *box; /* null for floor trap */ { @@ -3160,7 +3160,7 @@ struct obj *box; /* null for floor trap */ melt_ice(u.ux, u.uy, (char *) 0); } -STATIC_OVL void +static void domagictrap() { register int fate = rnd(20); @@ -3654,7 +3654,7 @@ boolean here; * Returns TRUE if disrobing made player unencumbered enough to * crawl out of the current predicament. */ -STATIC_OVL boolean +static boolean emergency_disrobe(lostsome) boolean *lostsome; { @@ -3902,7 +3902,7 @@ dountrap() } /* Probability of disabling a trap. Helge Hafting */ -STATIC_OVL int +static int untrap_prob(ttmp) struct trap *ttmp; { @@ -3964,7 +3964,7 @@ boolean bury_it; } /* while attempting to disarm an adjacent trap, we've fallen into it */ -STATIC_OVL void +static void move_into_trap(ttmp) struct trap *ttmp; { @@ -4006,7 +4006,7 @@ struct trap *ttmp; * 1: tries and fails * 2: succeeds */ -STATIC_OVL int +static int try_disarm(ttmp, force_failure) struct trap *ttmp; boolean force_failure; @@ -4091,7 +4091,7 @@ boolean force_failure; return 2; } -STATIC_OVL void +static void reward_untrap(ttmp, mtmp) struct trap *ttmp; struct monst *mtmp; @@ -4113,7 +4113,7 @@ struct monst *mtmp; } } -STATIC_OVL int +static int disarm_holdingtrap(ttmp) /* Helge Hafting */ struct trap *ttmp; { @@ -4146,7 +4146,7 @@ struct trap *ttmp; return 1; } -STATIC_OVL int +static int disarm_landmine(ttmp) /* Helge Hafting */ struct trap *ttmp; { @@ -4164,7 +4164,7 @@ static NEARDATA const char oil[] = { ALL_CLASSES, TOOL_CLASS, POTION_CLASS, 0 }; /* it may not make much sense to use grease on floor boards, but so what? */ -STATIC_OVL int +static int disarm_squeaky_board(ttmp) struct trap *ttmp; { @@ -4199,7 +4199,7 @@ struct trap *ttmp; } /* removes traps that shoot arrows, darts, etc. */ -STATIC_OVL int +static int disarm_shooting_trap(ttmp, otyp) struct trap *ttmp; int otyp; @@ -4215,7 +4215,7 @@ int otyp; /* Is the weight too heavy? * Formula as in near_capacity() & check_capacity() */ -STATIC_OVL int +static int try_lift(mtmp, ttmp, wt, stuff) struct monst *mtmp; struct trap *ttmp; @@ -4240,7 +4240,7 @@ boolean stuff; } /* Help trapped monster (out of a (spiked) pit) */ -STATIC_OVL int +static int help_monster_out(mtmp, ttmp) struct monst *mtmp; struct trap *ttmp; @@ -5003,7 +5003,7 @@ boolean u_entering_trap2; return FALSE; } -STATIC_OVL void +static void clear_conjoined_pits(trap) struct trap *trap; { @@ -5027,7 +5027,7 @@ struct trap *trap; } } -STATIC_OVL boolean +static boolean adj_nonconjoined_pit(adjtrap) struct trap *adjtrap; { @@ -5050,7 +5050,7 @@ struct trap *adjtrap; * Mark all neighboring pits as conjoined pits. * (currently not called from anywhere) */ -STATIC_OVL void +static void join_adjacent_pits(trap) struct trap *trap; { @@ -5134,7 +5134,7 @@ int bodypart; /* Monster is hit by trap. */ /* Note: doesn't work if both obj and d_override are null */ -STATIC_OVL boolean +static boolean thitm(tlev, mon, obj, d_override, nocorpse) int tlev; struct monst *mon; @@ -5390,7 +5390,7 @@ sokoban_guilt() } /* called when a trap has been deleted or had its ttyp replaced */ -STATIC_OVL void +static void maybe_finish_sokoban() { struct trap *t; diff --git a/src/u_init.c b/src/u_init.c index 4f0e80b1c..5ecbf7562 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -13,10 +13,10 @@ struct trobj { Bitfield(trbless, 2); }; -STATIC_DCL void FDECL(ini_inv, (struct trobj *)); -STATIC_DCL void FDECL(knows_object, (int)); -STATIC_DCL void FDECL(knows_class, (CHAR_P)); -STATIC_DCL boolean FDECL(restricted_spell_discipline, (int)); +static void FDECL(ini_inv, (struct trobj *)); +static void FDECL(knows_object, (int)); +static void FDECL(knows_class, (CHAR_P)); +static boolean FDECL(restricted_spell_discipline, (int)); #define UNDEF_TYP 0 #define UNDEF_SPE '\177' @@ -557,7 +557,7 @@ static const struct def_skill Skill_W[] = { { P_NONE, 0 } }; -STATIC_OVL void +static void knows_object(obj) register int obj; { @@ -568,7 +568,7 @@ register int obj; /* Know ordinary (non-magical) objects of a certain class, * like all gems except the loadstone and luckstone. */ -STATIC_OVL void +static void knows_class(sym) register char sym; { @@ -907,7 +907,7 @@ u_init() } /* skills aren't initialized, so we use the role-specific skill lists */ -STATIC_OVL boolean +static boolean restricted_spell_discipline(otyp) int otyp; { @@ -967,7 +967,7 @@ int otyp; return TRUE; } -STATIC_OVL void +static void ini_inv(trop) register struct trobj *trop; { diff --git a/src/uhitm.c b/src/uhitm.c index 0cf89951b..6c536b61f 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -5,24 +5,24 @@ #include "hack.h" -STATIC_DCL boolean FDECL(known_hitum, (struct monst *, struct obj *, int *, +static boolean FDECL(known_hitum, (struct monst *, struct obj *, int *, int, int, struct attack *, int)); -STATIC_DCL boolean FDECL(theft_petrifies, (struct obj *)); -STATIC_DCL void FDECL(steal_it, (struct monst *, struct attack *)); -STATIC_DCL boolean FDECL(hitum_cleave, (struct monst *, struct attack *)); -STATIC_DCL boolean FDECL(hitum, (struct monst *, struct attack *)); -STATIC_DCL boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int, +static boolean FDECL(theft_petrifies, (struct obj *)); +static void FDECL(steal_it, (struct monst *, struct attack *)); +static boolean FDECL(hitum_cleave, (struct monst *, struct attack *)); +static boolean FDECL(hitum, (struct monst *, struct attack *)); +static boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int, int)); -STATIC_DCL int FDECL(joust, (struct monst *, struct obj *)); -STATIC_DCL void NDECL(demonpet); -STATIC_DCL boolean FDECL(m_slips_free, (struct monst *, struct attack *)); -STATIC_DCL int FDECL(explum, (struct monst *, struct attack *)); -STATIC_DCL void FDECL(start_engulf, (struct monst *)); -STATIC_DCL void NDECL(end_engulf); -STATIC_DCL int FDECL(gulpum, (struct monst *, struct attack *)); -STATIC_DCL boolean FDECL(hmonas, (struct monst *)); -STATIC_DCL void FDECL(nohandglow, (struct monst *)); -STATIC_DCL boolean FDECL(shade_aware, (struct obj *)); +static int FDECL(joust, (struct monst *, struct obj *)); +static void NDECL(demonpet); +static boolean FDECL(m_slips_free, (struct monst *, struct attack *)); +static int FDECL(explum, (struct monst *, struct attack *)); +static void FDECL(start_engulf, (struct monst *)); +static void NDECL(end_engulf); +static int FDECL(gulpum, (struct monst *, struct attack *)); +static boolean FDECL(hmonas, (struct monst *)); +static void FDECL(nohandglow, (struct monst *)); +static boolean FDECL(shade_aware, (struct obj *)); #define PROJECTILE(obj) ((obj) && is_ammo(obj)) @@ -453,7 +453,7 @@ register struct monst *mtmp; } /* really hit target monster; returns TRUE if it still lives */ -STATIC_OVL boolean +static boolean known_hitum(mon, weapon, mhit, rollneeded, armorpenalty, uattk, dieroll) register struct monst *mon; struct obj *weapon; @@ -513,7 +513,7 @@ int dieroll; /* hit the monster next to you and the monsters to the left and right of it; return False if the primary target is killed, True otherwise */ -STATIC_OVL boolean +static boolean hitum_cleave(target, uattk) struct monst *target; /* non-Null; forcefight at nothing doesn't cleave... */ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */ @@ -594,7 +594,7 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */ } /* hit target monster; returns TRUE if it still lives */ -STATIC_OVL boolean +static boolean hitum(mon, uattk) struct monst *mon; struct attack *uattk; @@ -660,7 +660,7 @@ int dieroll; } /* guts of hmon() */ -STATIC_OVL boolean +static boolean hmon_hitmon(mon, obj, thrown, dieroll) struct monst *mon; struct obj *obj; @@ -1339,7 +1339,7 @@ int dieroll; return destroyed ? FALSE : TRUE; } -STATIC_OVL boolean +static boolean shade_aware(obj) struct obj *obj; { @@ -1364,7 +1364,7 @@ struct obj *obj; /* check whether slippery clothing protects from hug or wrap attack */ /* [currently assumes that you are the attacker] */ -STATIC_OVL boolean +static boolean m_slips_free(mdef, mattk) struct monst *mdef; struct attack *mattk; @@ -1408,7 +1408,7 @@ struct attack *mattk; /* used when hitting a monster with a lance while mounted; 1: joust hit; 0: ordinary hit; -1: joust but break lance */ -STATIC_OVL int +static int joust(mon, obj) struct monst *mon; /* target */ struct obj *obj; /* weapon */ @@ -1446,7 +1446,7 @@ struct obj *obj; /* weapon */ * Complex." * Pulling it out makes it work. */ -STATIC_OVL void +static void demonpet() { int i; @@ -1461,7 +1461,7 @@ demonpet() exercise(A_WIS, TRUE); } -STATIC_OVL boolean +static boolean theft_petrifies(otmp) struct obj *otmp; { @@ -1488,7 +1488,7 @@ struct obj *otmp; * If the target is wearing body armor, take all of its possessions; * otherwise, take one object. [Is this really the behavior we want?] */ -STATIC_OVL void +static void steal_it(mdef, mattk) struct monst *mdef; struct attack *mattk; @@ -1998,7 +1998,7 @@ int specialdmg; /* blessed and/or silver bonus against various things */ return 1; } -STATIC_OVL int +static int explum(mdef, mattk) register struct monst *mdef; register struct attack *mattk; @@ -2051,7 +2051,7 @@ register struct attack *mattk; return 1; } -STATIC_OVL void +static void start_engulf(mdef) struct monst *mdef; { @@ -2065,7 +2065,7 @@ struct monst *mdef; delay_output(); } -STATIC_OVL void +static void end_engulf() { if (!Invisible) { @@ -2074,7 +2074,7 @@ end_engulf() } } -STATIC_OVL int +static int gulpum(mdef, mattk) register struct monst *mdef; register struct attack *mattk; @@ -2312,7 +2312,7 @@ boolean wouldhavehit; } /* attack monster as a monster; returns True if mon survives */ -STATIC_OVL boolean +static boolean hmonas(mon) register struct monst *mon; { @@ -3045,7 +3045,7 @@ struct monst *mtmp; map_invisible(mtmp->mx, mtmp->my); } -STATIC_OVL void +static void nohandglow(mon) struct monst *mon; { diff --git a/src/vault.c b/src/vault.c index 6362b9c34..485a322fb 100644 --- a/src/vault.c +++ b/src/vault.c @@ -5,16 +5,16 @@ #include "hack.h" -STATIC_DCL boolean FDECL(clear_fcorr, (struct monst *, BOOLEAN_P)); -STATIC_DCL void FDECL(blackout, (int, int)); -STATIC_DCL void FDECL(restfakecorr, (struct monst *)); -STATIC_DCL void FDECL(parkguard, (struct monst *)); -STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *, int, int)); -STATIC_DCL boolean FDECL(find_guard_dest, (struct monst *, xchar *, xchar *)); -STATIC_DCL void FDECL(move_gold, (struct obj *, int)); -STATIC_DCL void FDECL(wallify_vault, (struct monst *)); -STATIC_DCL void FDECL(gd_mv_monaway, (struct monst *, int, int)); -STATIC_OVL void FDECL(gd_pick_corridor_gold, (struct monst *, int, int)); +static boolean FDECL(clear_fcorr, (struct monst *, BOOLEAN_P)); +static void FDECL(blackout, (int, int)); +static void FDECL(restfakecorr, (struct monst *)); +static void FDECL(parkguard, (struct monst *)); +static boolean FDECL(in_fcorridor, (struct monst *, int, int)); +static boolean FDECL(find_guard_dest, (struct monst *, xchar *, xchar *)); +static void FDECL(move_gold, (struct obj *, int)); +static void FDECL(wallify_vault, (struct monst *)); +static void FDECL(gd_mv_monaway, (struct monst *, int, int)); +static void FDECL(gd_pick_corridor_gold, (struct monst *, int, int)); void newegd(mtmp) @@ -42,7 +42,7 @@ struct monst *mtmp; /* try to remove the temporary corridor (from vault to rest of map) being maintained by guard 'grd'; if guard is still in it, removal will fail, to be tried again later */ -STATIC_OVL boolean +static boolean clear_fcorr(grd, forceshow) struct monst *grd; boolean forceshow; @@ -117,7 +117,7 @@ boolean forceshow; spots to unlit; if player used scroll/wand/spell of light while inside the corridor, we don't want the light to reappear if/when a new tunnel goes through the same area */ -STATIC_OVL void +static void blackout(x, y) int x, y; { @@ -139,7 +139,7 @@ int x, y; } } -STATIC_OVL void +static void restfakecorr(grd) struct monst *grd; { @@ -151,7 +151,7 @@ struct monst *grd; } /* move guard--dead to alive--to <0,0> until temporary corridor is removed */ -STATIC_OVL void +static void parkguard(grd) struct monst *grd; { @@ -189,7 +189,7 @@ struct monst *grd; return dispose; } -STATIC_OVL boolean +static boolean in_fcorridor(grd, x, y) struct monst *grd; int x, y; @@ -263,7 +263,7 @@ struct monst *grd; } } -STATIC_OVL boolean +static boolean find_guard_dest(guard, rx, ry) struct monst *guard; xchar *rx, *ry; @@ -550,7 +550,7 @@ invault() } } -STATIC_OVL void +static void move_gold(gold, vroom) struct obj *gold; int vroom; @@ -566,7 +566,7 @@ int vroom; newsym(nx, ny); } -STATIC_OVL void +static void wallify_vault(grd) struct monst *grd; { @@ -634,7 +634,7 @@ struct monst *grd; } } -STATIC_OVL void +static void gd_mv_monaway(grd, nx, ny) register struct monst *grd; int nx, ny; @@ -649,7 +649,7 @@ int nx, ny; /* have guard pick gold off the floor, possibly moving to the gold's position before message and back to his current spot after */ -STATIC_OVL void +static void gd_pick_corridor_gold(grd, goldx, goldy) struct monst *grd; int goldx, goldy; /* ox, gold->oy> */ diff --git a/src/version.c b/src/version.c index bd50cfb06..3eedd3ac9 100644 --- a/src/version.c +++ b/src/version.c @@ -26,7 +26,7 @@ const char *NetHack_git_sha = NETHACK_GIT_SHA; const char *NetHack_git_branch = NETHACK_GIT_BRANCH; #endif -STATIC_DCL void FDECL(insert_rtoption, (char *)); +static void FDECL(insert_rtoption, (char *)); /* fill buffer with short version (so caller can avoid including date.h) */ char * @@ -227,7 +227,7 @@ static struct rt_opt { * it depends which of several object files got linked into the * game image, so we insert those options here. */ -STATIC_OVL void +static void insert_rtoption(buf) char *buf; { diff --git a/src/vision.c b/src/vision.c index a62a978a2..fb3c589be 100644 --- a/src/vision.c +++ b/src/vision.c @@ -83,14 +83,14 @@ static char left_ptrs[ROWNO][COLNO]; /* LOS algorithm helpers */ static char right_ptrs[ROWNO][COLNO]; /* Forward declarations. */ -STATIC_DCL void FDECL(fill_point, (int, int)); -STATIC_DCL void FDECL(dig_point, (int, int)); -STATIC_DCL void NDECL(view_init); -STATIC_DCL void FDECL(view_from, (int, int, char **, char *, char *, int, +static void FDECL(fill_point, (int, int)); +static void FDECL(dig_point, (int, int)); +static void NDECL(view_init); +static void FDECL(view_from, (int, int, char **, char *, char *, int, void (*)(int, int, genericptr_t), genericptr_t)); -STATIC_DCL void FDECL(get_unused_cs, (char ***, char **, char **)); -STATIC_DCL void FDECL(rogue_vision, (char **, char *, char *)); +static void FDECL(get_unused_cs, (char ***, char **, char **)); +static void FDECL(rogue_vision, (char **, char *, char *)); /* Macro definitions that I can't find anywhere. */ #define sign(z) ((z) < 0 ? -1 : ((z) ? 1 : 0)) @@ -241,7 +241,7 @@ vision_reset() * Called from vision_recalc() and at least one light routine. Get pointers * to the unused vision work area. */ -STATIC_OVL void +static void get_unused_cs(rows, rmin, rmax) char ***rows; char **rmin, **rmax; @@ -283,7 +283,7 @@ char **rmin, **rmax; * We set the in_sight bit here as well to escape a bug that shows up * due to the one-sided lit wall hack. */ -STATIC_OVL void +static void rogue_vision(next, rmin, rmax) char **next; /* could_see array pointers */ char *rmin, *rmax; @@ -342,7 +342,7 @@ char *rmin, *rmax; #ifdef EXTEND_SPINE -STATIC_DCL int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); +static int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); /* * new_angle() * @@ -385,7 +385,7 @@ STATIC_DCL int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); * many exceptions. I may have to bite the bullet and do more * checks. - Dean 2/11/93 */ -STATIC_OVL int +static int new_angle(lev, sv, row, col) struct rm *lev; unsigned char *sv; @@ -912,7 +912,7 @@ int x, y; * This means that a right-edge (a blocked spot that has an open * spot on its right) will point to itself. */ -STATIC_OVL void +static void dig_point(row, col) int row, col; { @@ -997,7 +997,7 @@ int row, col; } } -STATIC_OVL void +static void fill_point(row, col) int row, col; { @@ -1342,10 +1342,10 @@ static genericptr_t varg; #else /* !MACRO_CPATH -- quadrants are really functions */ -STATIC_DCL int FDECL(_q1_path, (int, int, int, int)); -STATIC_DCL int FDECL(_q2_path, (int, int, int, int)); -STATIC_DCL int FDECL(_q3_path, (int, int, int, int)); -STATIC_DCL int FDECL(_q4_path, (int, int, int, int)); +static int FDECL(_q1_path, (int, int, int, int)); +static int FDECL(_q2_path, (int, int, int, int)); +static int FDECL(_q3_path, (int, int, int, int)); +static int FDECL(_q4_path, (int, int, int, int)); #define q1_path(sy, sx, y, x, dummy) result = _q1_path(sy, sx, y, x) #define q2_path(sy, sx, y, x, dummy) result = _q2_path(sy, sx, y, x) @@ -1355,7 +1355,7 @@ STATIC_DCL int FDECL(_q4_path, (int, int, int, int)); /* * Quadrant I (step < 0). */ -STATIC_OVL int +static int _q1_path(srow, scol, y2, x2) int scol, srow, y2, x2; { @@ -1403,7 +1403,7 @@ int scol, srow, y2, x2; /* * Quadrant IV (step > 0). */ -STATIC_OVL int +static int _q4_path(srow, scol, y2, x2) int scol, srow, y2, x2; { @@ -1451,7 +1451,7 @@ int scol, srow, y2, x2; /* * Quadrant II (step < 0). */ -STATIC_OVL int +static int _q2_path(srow, scol, y2, x2) int scol, srow, y2, x2; { @@ -1499,7 +1499,7 @@ int scol, srow, y2, x2; /* * Quadrant III (step > 0). */ -STATIC_OVL int +static int _q3_path(srow, scol, y2, x2) int scol, srow, y2, x2; { @@ -1601,18 +1601,18 @@ cleardone: static close2d *close_dy[CLOSE_MAX_BC_DY]; static far2d *far_dy[FAR_MAX_BC_DY]; -STATIC_DCL void FDECL(right_side, (int, int, int, int, int, +static void FDECL(right_side, (int, int, int, int, int, int, int, const char *)); -STATIC_DCL void FDECL(left_side, (int, int, int, int, int, int, int, +static void FDECL(left_side, (int, int, int, int, int, int, int, const char *)); -STATIC_DCL int FDECL(close_shadow, (int, int, int, int)); -STATIC_DCL int FDECL(far_shadow, (int, int, int, int)); +static int FDECL(close_shadow, (int, int, int, int)); +static int FDECL(far_shadow, (int, int, int, int)); /* * Initialize algorithm D's table pointers. If we don't have these, * then we do 3D table lookups. Verrrry slow. */ -STATIC_OVL void +static void view_init() { int i; @@ -1631,7 +1631,7 @@ view_init() */ #define OFF_TABLE 0xff -STATIC_OVL int +static int close_shadow(side, this_row, block_row, block_col) int side, this_row, block_row, block_col; { @@ -1664,7 +1664,7 @@ int side, this_row, block_row, block_col; return block_col - offset; } -STATIC_OVL int +static int far_shadow(side, this_row, block_row, block_col) int side, this_row, block_row, block_col; { @@ -1710,7 +1710,7 @@ int side, this_row, block_row, block_col; * * Figure out what could be seen on the right side of the source. */ -STATIC_OVL void +static void right_side(row, cb_row, cb_col, fb_row, fb_col, left, right_mark, limits) int row; /* current row */ int cb_row, cb_col; /* close block row and col */ @@ -1988,7 +1988,7 @@ char *limits; /* points at range limit for current row, or NULL */ * This routine is the mirror image of right_side(). Please see right_side() * for blow by blow comments. */ -STATIC_OVL void +static void left_side(row, cb_row, cb_col, fb_row, fb_col, left_mark, right, limits) int row; /* the current row */ int cb_row, cb_col; /* close block row and col */ @@ -2190,7 +2190,7 @@ const char *limits; * seen from the source location. Initialize and fill the left most * and right most boundaries of what could be seen. */ -STATIC_OVL void +static void view_from(srow, scol, loc_cs_rows, left_most, right_most, range, func, arg) int srow, scol; /* source row and column */ char **loc_cs_rows; /* could_see array (row pointers) */ @@ -2286,11 +2286,11 @@ genericptr_t arg; /* * Defines local to Algorithm C. */ -STATIC_DCL void FDECL(right_side, (int, int, int, const char *)); -STATIC_DCL void FDECL(left_side, (int, int, int, const char *)); +static void FDECL(right_side, (int, int, int, const char *)); +static void FDECL(left_side, (int, int, int, const char *)); /* Initialize algorithm C (nothing). */ -STATIC_OVL void +static void view_init() { } @@ -2299,7 +2299,7 @@ view_init() * Mark positions as visible on one quadrant of the right side. The * quadrant is determined by the value of the global variable step. */ -STATIC_OVL void +static void right_side(row, left, right_mark, limits) int row; /* current row */ int left; /* first (left side) visible spot on prev row */ @@ -2491,7 +2491,7 @@ const char *limits; /* points at range limit for current row, or NULL */ * This routine is the mirror image of right_side(). See right_side() for * extensive comments. */ -STATIC_OVL void +static void left_side(row, left_mark, right, limits) int row, left_mark, right; const char *limits; @@ -2627,7 +2627,7 @@ const char *limits; * (srow,scol). NOTE this is (y,x)! Mark the visible locations in the * array provided. */ -STATIC_OVL void +static void view_from(srow, scol, loc_cs_rows, left_most, right_most, range, func, arg) int srow, scol; /* starting row and column */ char **loc_cs_rows; /* pointers to the rows of the could_see array */ diff --git a/src/weapon.c b/src/weapon.c index 8a3b22fa5..d15ee550f 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -10,11 +10,11 @@ */ #include "hack.h" -STATIC_DCL void FDECL(give_may_advance_msg, (int)); -STATIC_DCL boolean FDECL(could_advance, (int)); -STATIC_DCL boolean FDECL(peaked_skill, (int)); -STATIC_DCL int FDECL(slots_required, (int)); -STATIC_DCL void FDECL(skill_advance, (int)); +static void FDECL(give_may_advance_msg, (int)); +static boolean FDECL(could_advance, (int)); +static boolean FDECL(peaked_skill, (int)); +static int FDECL(slots_required, (int)); +static void FDECL(skill_advance, (int)); /* Categories whose names don't come from OBJ_NAME(objects[type]) */ @@ -33,7 +33,7 @@ STATIC_DCL void FDECL(skill_advance, (int)); #define PN_ESCAPE_SPELL (-13) #define PN_MATTER_SPELL (-14) -STATIC_VAR NEARDATA const short skill_names_indices[P_NUM_SKILLS] = { +static NEARDATA const short skill_names_indices[P_NUM_SKILLS] = { 0, DAGGER, KNIFE, AXE, PICK_AXE, SHORT_SWORD, BROADSWORD, LONG_SWORD, TWO_HANDED_SWORD, SCIMITAR, PN_SABER, CLUB, MACE, MORNING_STAR, FLAIL, PN_HAMMER, QUARTERSTAFF, PN_POLEARMS, SPEAR, TRIDENT, LANCE, BOW, SLING, @@ -44,14 +44,14 @@ STATIC_VAR NEARDATA const short skill_names_indices[P_NUM_SKILLS] = { }; /* note: entry [0] isn't used */ -STATIC_VAR NEARDATA const char *const odd_skill_names[] = { +static NEARDATA const char *const odd_skill_names[] = { "no skill", "bare hands", /* use barehands_or_martial[] instead */ "two weapon combat", "riding", "polearms", "saber", "hammer", "whip", "attack spells", "healing spells", "divination spells", "enchantment spells", "clerical spells", "escape spells", "matter spells", }; /* indexed vis `is_martial() */ -STATIC_VAR NEARDATA const char *const barehands_or_martial[] = { +static NEARDATA const char *const barehands_or_martial[] = { "bare handed combat", "martial arts" }; @@ -65,7 +65,7 @@ STATIC_VAR NEARDATA const char *const barehands_or_martial[] = { static NEARDATA const char kebabable[] = { S_XORN, S_DRAGON, S_JABBERWOCK, S_NAGA, S_GIANT, '\0' }; -STATIC_OVL void +static void give_may_advance_msg(skill) int skill; { @@ -461,12 +461,12 @@ long silverhit; } } -STATIC_DCL struct obj *FDECL(oselect, (struct monst *, int)); +static struct obj *FDECL(oselect, (struct monst *, int)); #define Oselect(x) \ if ((otmp = oselect(mtmp, x)) != 0) \ return otmp; -STATIC_OVL struct obj * +static struct obj * oselect(mtmp, x) struct monst *mtmp; int x; @@ -1050,7 +1050,7 @@ int skill; } /* return the # of slots required to advance the skill */ -STATIC_OVL int +static int slots_required(skill) int skill; { @@ -1094,7 +1094,7 @@ boolean speedy; } /* return true if this skill could be advanced if more slots were available */ -STATIC_OVL boolean +static boolean could_advance(skill) int skill; { @@ -1109,7 +1109,7 @@ int skill; /* return true if this skill has reached its maximum and there's been enough practice to become eligible for the next step if that had been possible */ -STATIC_OVL boolean +static boolean peaked_skill(skill) int skill; { @@ -1121,7 +1121,7 @@ int skill; >= practice_needed_to_advance(P_SKILL(skill)))); } -STATIC_OVL void +static void skill_advance(skill) int skill; { diff --git a/src/wield.c b/src/wield.c index 784f71f14..1264987d1 100644 --- a/src/wield.c +++ b/src/wield.c @@ -52,8 +52,8 @@ * No item may be in more than one of these slots. */ -STATIC_DCL boolean FDECL(cant_wield_corpse, (struct obj *)); -STATIC_DCL int FDECL(ready_weapon, (struct obj *)); +static boolean FDECL(cant_wield_corpse, (struct obj *)); +static int FDECL(ready_weapon, (struct obj *)); /* used by will_weld() */ /* probably should be renamed */ @@ -114,7 +114,7 @@ register struct obj *obj; g.unweapon = TRUE; /* for "bare hands" message */ } -STATIC_OVL boolean +static boolean cant_wield_corpse(obj) struct obj *obj; { @@ -133,7 +133,7 @@ struct obj *obj; return TRUE; } -STATIC_OVL int +static int ready_weapon(wep) struct obj *wep; { diff --git a/src/windows.c b/src/windows.c index 92c235579..9d0ed7ceb 100644 --- a/src/windows.c +++ b/src/windows.c @@ -58,20 +58,20 @@ extern void FDECL(trace_procs_init, (int)); extern void *FDECL(trace_procs_chain, (int, int, void *, void *, void *)); #endif -STATIC_DCL void FDECL(def_raw_print, (const char *s)); -STATIC_DCL void NDECL(def_wait_synch); +static void FDECL(def_raw_print, (const char *s)); +static void NDECL(def_wait_synch); #ifdef DUMPLOG -STATIC_DCL winid FDECL(dump_create_nhwindow, (int)); -STATIC_DCL void FDECL(dump_clear_nhwindow, (winid)); -STATIC_DCL void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P)); -STATIC_DCL void FDECL(dump_destroy_nhwindow, (winid)); -STATIC_DCL void FDECL(dump_start_menu, (winid)); -STATIC_DCL void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P, +static winid FDECL(dump_create_nhwindow, (int)); +static void FDECL(dump_clear_nhwindow, (winid)); +static void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P)); +static void FDECL(dump_destroy_nhwindow, (winid)); +static void FDECL(dump_start_menu, (winid)); +static void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, const char *, BOOLEAN_P)); -STATIC_DCL void FDECL(dump_end_menu, (winid, const char *)); -STATIC_DCL int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **)); -STATIC_DCL void FDECL(dump_putstr, (winid, int, const char *)); +static void FDECL(dump_end_menu, (winid, const char *)); +static int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **)); +static void FDECL(dump_putstr, (winid, int, const char *)); #endif /* DUMPLOG */ #ifdef HANGUPHANDLING @@ -197,7 +197,7 @@ genl_can_suspend_yes(VOID_ARGS) return TRUE; } -STATIC_OVL +static void def_raw_print(s) const char *s; @@ -205,7 +205,7 @@ const char *s; puts(s); } -STATIC_OVL +static void def_wait_synch(VOID_ARGS) { @@ -1097,15 +1097,15 @@ unsigned long *colormasks UNUSED; putmixed(WIN_STATUS, 0, newbot2); /* putmixed() due to GOLD glyph */ } -STATIC_VAR struct window_procs dumplog_windowprocs_backup; -STATIC_VAR FILE *dumplog_file; +static struct window_procs dumplog_windowprocs_backup; +static FILE *dumplog_file; #ifdef DUMPLOG -STATIC_VAR time_t dumplog_now; +static time_t dumplog_now; -STATIC_DCL char *FDECL(dump_fmtstr, (const char *, char *)); +static char *FDECL(dump_fmtstr, (const char *, char *)); -STATIC_OVL char * +static char * dump_fmtstr(fmt, buf) const char *fmt; char *buf; @@ -1236,7 +1236,7 @@ int no_forward; } /*ARGSUSED*/ -STATIC_OVL void +static void dump_putstr(win, attr, str) winid win UNUSED; int attr UNUSED; @@ -1246,7 +1246,7 @@ const char *str; fprintf(dumplog_file, "%s\n", str); } -STATIC_OVL winid +static winid dump_create_nhwindow(dummy) int dummy; { @@ -1254,7 +1254,7 @@ int dummy; } /*ARGUSED*/ -STATIC_OVL void +static void dump_clear_nhwindow(win) winid win UNUSED; { @@ -1262,7 +1262,7 @@ winid win UNUSED; } /*ARGSUSED*/ -STATIC_OVL void +static void dump_display_nhwindow(win, p) winid win UNUSED; boolean p UNUSED; @@ -1271,7 +1271,7 @@ boolean p UNUSED; } /*ARGUSED*/ -STATIC_OVL void +static void dump_destroy_nhwindow(win) winid win UNUSED; { @@ -1279,7 +1279,7 @@ winid win UNUSED; } /*ARGUSED*/ -STATIC_OVL void +static void dump_start_menu(win) winid win UNUSED; { @@ -1287,7 +1287,7 @@ winid win UNUSED; } /*ARGSUSED*/ -STATIC_OVL void +static void dump_add_menu(win, glyph, identifier, ch, gch, attr, str, preselected) winid win UNUSED; int glyph; @@ -1307,7 +1307,7 @@ boolean preselected UNUSED; } /*ARGSUSED*/ -STATIC_OVL void +static void dump_end_menu(win, str) winid win UNUSED; const char *str; @@ -1320,7 +1320,7 @@ const char *str; } } -STATIC_OVL int +static int dump_select_menu(win, how, item) winid win UNUSED; int how UNUSED; diff --git a/src/wizard.c b/src/wizard.c index c03c3ed56..dbc61241e 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -11,13 +11,13 @@ #include "hack.h" #include "qtext.h" -STATIC_DCL short FDECL(which_arti, (int)); -STATIC_DCL boolean FDECL(mon_has_arti, (struct monst *, SHORT_P)); -STATIC_DCL struct monst *FDECL(other_mon_has_arti, (struct monst *, SHORT_P)); -STATIC_DCL struct obj *FDECL(on_ground, (SHORT_P)); -STATIC_DCL boolean FDECL(you_have, (int)); -STATIC_DCL unsigned long FDECL(target_on, (int, struct monst *)); -STATIC_DCL unsigned long FDECL(strategy, (struct monst *)); +static short FDECL(which_arti, (int)); +static boolean FDECL(mon_has_arti, (struct monst *, SHORT_P)); +static struct monst *FDECL(other_mon_has_arti, (struct monst *, SHORT_P)); +static struct obj *FDECL(on_ground, (SHORT_P)); +static boolean FDECL(you_have, (int)); +static unsigned long FDECL(target_on, (int, struct monst *)); +static unsigned long FDECL(strategy, (struct monst *)); /* adding more neutral creatures will tend to reduce the number of monsters summoned by nasty(); adding more lawful creatures will reduce the number @@ -140,7 +140,7 @@ register struct monst *mtmp; #define M_Wants(mask) (mtmp->data->mflags3 & (mask)) -STATIC_OVL short +static short which_arti(mask) register int mask; { @@ -164,7 +164,7 @@ register int mask; * since bell, book, candle, and amulet are all objects, not really * artifacts right now. [MRS] */ -STATIC_OVL boolean +static boolean mon_has_arti(mtmp, otyp) register struct monst *mtmp; register short otyp; @@ -181,7 +181,7 @@ register short otyp; return 0; } -STATIC_OVL struct monst * +static struct monst * other_mon_has_arti(mtmp, otyp) register struct monst *mtmp; register short otyp; @@ -197,7 +197,7 @@ register short otyp; return (struct monst *) 0; } -STATIC_OVL struct obj * +static struct obj * on_ground(otyp) register short otyp; { @@ -212,7 +212,7 @@ register short otyp; return (struct obj *) 0; } -STATIC_OVL boolean +static boolean you_have(mask) register int mask; { @@ -233,7 +233,7 @@ register int mask; return 0; } -STATIC_OVL unsigned long +static unsigned long target_on(mask, mtmp) register int mask; register struct monst *mtmp; @@ -261,7 +261,7 @@ register struct monst *mtmp; return (unsigned long) STRAT_NONE; } -STATIC_OVL unsigned long +static unsigned long strategy(mtmp) register struct monst *mtmp; { diff --git a/src/worm.c b/src/worm.c index 819999bed..53e7e1cf5 100644 --- a/src/worm.c +++ b/src/worm.c @@ -17,10 +17,10 @@ struct wseg { xchar wx, wy; /* the segment's position */ }; -STATIC_DCL void FDECL(toss_wsegs, (struct wseg *, BOOLEAN_P)); -STATIC_DCL void FDECL(shrink_worm, (int)); -STATIC_DCL void FDECL(random_dir, (XCHAR_P, XCHAR_P, xchar *, xchar *)); -STATIC_DCL struct wseg *FDECL(create_worm_tail, (int)); +static void FDECL(toss_wsegs, (struct wseg *, BOOLEAN_P)); +static void FDECL(shrink_worm, (int)); +static void FDECL(random_dir, (XCHAR_P, XCHAR_P, xchar *, xchar *)); +static struct wseg *FDECL(create_worm_tail, (int)); /* Description of long worm implementation. * @@ -139,7 +139,7 @@ int wseg_count; * Get rid of all worm segments on and following the given pointer curr. * The display may or may not need to be updated as we free the segments. */ -STATIC_OVL +static void toss_wsegs(curr, display_update) register struct wseg *curr; @@ -172,7 +172,7 @@ register boolean display_update; * * Remove the tail segment of the worm (the starting segment of the list). */ -STATIC_OVL +static void shrink_worm(wnum) int wnum; /* worm number */ @@ -728,7 +728,7 @@ xchar x, y; * This function, and the loop it serves, could be eliminated by coding * enexto() with a search radius. */ -STATIC_OVL +static void random_dir(x, y, nx, ny) xchar x, y; @@ -781,7 +781,7 @@ struct monst *mtmp; /* create_worm_tail() * will create a worm tail chain of (num_segs + 1) and return pointer to it. */ -STATIC_OVL +static struct wseg * create_worm_tail(num_segs) int num_segs; diff --git a/src/worn.c b/src/worn.c index 970c28687..b2ed54714 100644 --- a/src/worn.c +++ b/src/worn.c @@ -5,10 +5,10 @@ #include "hack.h" -STATIC_DCL void FDECL(m_lose_armor, (struct monst *, struct obj *)); -STATIC_DCL void FDECL(m_dowear_type, +static void FDECL(m_lose_armor, (struct monst *, struct obj *)); +static void FDECL(m_dowear_type, (struct monst *, long, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL int FDECL(extra_pref, (struct monst *, struct obj *)); +static int FDECL(extra_pref, (struct monst *, struct obj *)); const struct worn { long w_mask; @@ -505,7 +505,7 @@ boolean creation; m_dowear_type(mon, W_ARM, creation, RACE_EXCEPTION); } -STATIC_OVL void +static void m_dowear_type(mon, flag, creation, racialexception) struct monst *mon; long flag; @@ -685,7 +685,7 @@ long flag; } /* remove an item of armor and then drop it */ -STATIC_OVL void +static void m_lose_armor(mon, obj) struct monst *mon; struct obj *obj; @@ -987,7 +987,7 @@ boolean polyspot; } /* bias a monster's preferences towards armor that has special benefits. */ -STATIC_OVL int +static int extra_pref(mon, obj) struct monst *mon; struct obj *obj; diff --git a/src/write.c b/src/write.c index 2e2023eb8..be48b67b5 100644 --- a/src/write.c +++ b/src/write.c @@ -3,14 +3,14 @@ #include "hack.h" -STATIC_DCL int FDECL(cost, (struct obj *)); -STATIC_DCL boolean FDECL(label_known, (int, struct obj *)); -STATIC_DCL char *FDECL(new_book_description, (int, char *)); +static int FDECL(cost, (struct obj *)); +static boolean FDECL(label_known, (int, struct obj *)); +static char *FDECL(new_book_description, (int, char *)); /* * returns basecost of a scroll or a spellbook */ -STATIC_OVL int +static int cost(otmp) register struct obj *otmp; { @@ -61,7 +61,7 @@ register struct obj *otmp; unfortunately, we can't track things that haven't been added to the discoveries list and aren't present in current inventory, so some scrolls with ought to yield True will end up False */ -STATIC_OVL boolean +static boolean label_known(scrolltype, objlist) int scrolltype; struct obj *objlist; @@ -359,7 +359,7 @@ found: looks funny, so we want to insert "into " prior to such descriptions; even that's rather iffy, indicating that such descriptions probably ought to be eliminated (especially "cloth"!) */ -STATIC_OVL char * +static char * new_book_description(booktype, outbuf) int booktype; char *outbuf; diff --git a/src/zap.c b/src/zap.c index af386bde2..49fb7543b 100644 --- a/src/zap.c +++ b/src/zap.c @@ -12,20 +12,20 @@ */ #define MAGIC_COOKIE 1000 -STATIC_DCL void FDECL(polyuse, (struct obj *, int, int)); -STATIC_DCL void FDECL(create_polymon, (struct obj *, int)); -STATIC_DCL int FDECL(stone_to_flesh_obj, (struct obj *)); -STATIC_DCL boolean FDECL(zap_updown, (struct obj *)); -STATIC_DCL void FDECL(zhitu, (int, int, const char *, XCHAR_P, XCHAR_P)); -STATIC_DCL void FDECL(revive_egg, (struct obj *)); -STATIC_DCL boolean FDECL(zap_steed, (struct obj *)); -STATIC_DCL void FDECL(skiprange, (int, int *, int *)); -STATIC_DCL int FDECL(zap_hit, (int, int)); -STATIC_OVL void FDECL(disintegrate_mon, (struct monst *, int, const char *)); -STATIC_DCL void FDECL(backfire, (struct obj *)); -STATIC_DCL int FDECL(spell_hit_bonus, (int)); -STATIC_DCL void FDECL(destroy_one_item, (struct obj *, int, int)); -STATIC_DCL void FDECL(wishcmdassist, (int)); +static void FDECL(polyuse, (struct obj *, int, int)); +static void FDECL(create_polymon, (struct obj *, int)); +static int FDECL(stone_to_flesh_obj, (struct obj *)); +static boolean FDECL(zap_updown, (struct obj *)); +static void FDECL(zhitu, (int, int, const char *, XCHAR_P, XCHAR_P)); +static void FDECL(revive_egg, (struct obj *)); +static boolean FDECL(zap_steed, (struct obj *)); +static void FDECL(skiprange, (int, int *, int *)); +static int FDECL(zap_hit, (int, int)); +static void FDECL(disintegrate_mon, (struct monst *, int, const char *)); +static void FDECL(backfire, (struct obj *)); +static int FDECL(spell_hit_bonus, (int)); +static void FDECL(destroy_one_item, (struct obj *, int, int)); +static void FDECL(wishcmdassist, (int)); #define ZT_MAGIC_MISSILE (AD_MAGM - 1) #define ZT_FIRE (AD_FIRE - 1) @@ -46,7 +46,7 @@ STATIC_DCL void FDECL(wishcmdassist, (int)); #define M_IN_WATER(ptr) \ ((ptr)->mlet == S_EEL || amphibious(ptr) || is_swimmer(ptr)) -STATIC_VAR const char are_blinded_by_the_flash[] = +static const char are_blinded_by_the_flash[] = "are blinded by the flash!"; const char *const flash_types[] = /* also used in buzzmu(mcastu.c) */ @@ -935,7 +935,7 @@ boolean by_hero; return mtmp; } -STATIC_OVL void +static void revive_egg(obj) struct obj *obj; { @@ -1216,7 +1216,7 @@ struct obj *obj; * there's a random factor here to keep from always using the stuff * at the top of the pile. */ -STATIC_OVL void +static void polyuse(objhdr, mat, minwt) struct obj *objhdr; int mat, minwt; @@ -1259,7 +1259,7 @@ int mat, minwt; * Polymorph some of the stuff in this pile into a monster, preferably * a golem of the kind okind. */ -STATIC_OVL void +static void create_polymon(obj, okind) struct obj *obj; int okind; @@ -1680,7 +1680,7 @@ int id; } /* stone-to-flesh spell hits and maybe transforms or animates obj */ -STATIC_OVL int +static int stone_to_flesh_obj(obj) struct obj *obj; { @@ -2190,7 +2190,7 @@ register struct obj *obj; } } -STATIC_OVL void +static void backfire(otmp) struct obj *otmp; { @@ -2654,7 +2654,7 @@ long duration; * Return TRUE if the steed was hit by the wand. * Return FALSE if the steed was not hit by the wand. */ -STATIC_OVL boolean +static boolean zap_steed(obj) struct obj *obj; /* wand or spell */ { @@ -2798,7 +2798,7 @@ boolean youattack, allow_cancel_kill, self_cancel; } /* you've zapped an immediate type wand up or down */ -STATIC_OVL boolean +static boolean zap_updown(obj) struct obj *obj; /* wand or spell */ { @@ -3097,7 +3097,7 @@ int dmg; /* base amount to be adjusted by bonus or penalty */ * Generate the to hit bonus for a spell. Based on the hero's skill in * spell class and dexterity. */ -STATIC_OVL int +static int spell_hit_bonus(skill) int skill; { @@ -3172,7 +3172,7 @@ register struct monst *mtmp; : "it"); } -STATIC_OVL void +static void skiprange(range, skipstart, skipend) int range, *skipstart, *skipend; { @@ -3745,7 +3745,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */ return tmp; } -STATIC_OVL void +static void zhitu(type, nd, fltxt, sx, sy) int type, nd; const char *fltxt; @@ -3944,7 +3944,7 @@ boolean u_caused; } /* will zap/spell/breath attack score a hit against armor class `ac'? */ -STATIC_OVL int +static int zap_hit(ac, type) int ac; int type; /* either hero cast spell type or 0 */ @@ -3962,7 +3962,7 @@ int type; /* either hero cast spell type or 0 */ return (3 - chance < ac + spell_bonus); } -STATIC_OVL void +static void disintegrate_mon(mon, type, fltxt) struct monst *mon; int type; /* hero vs other */ @@ -4787,7 +4787,7 @@ const char *const destroy_strings[][3] = { /* guts of destroy_item(), which ought to be called maybe_destroy_items(); caller must decide whether obj is eligible */ -STATIC_OVL void +static void destroy_one_item(obj, osym, dmgtyp) struct obj *obj; int osym, dmgtyp; @@ -5204,7 +5204,7 @@ int damage, tell; #define MAXWISHTRY 5 -STATIC_OVL void +static void wishcmdassist(triesleft) int triesleft; { From 2ae6d72765d519a6e9e83f30273f54b1851a2c98 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 14 Jul 2019 17:26:52 -0400 Subject: [PATCH 076/296] remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR from sys/msdos --- sys/msdos/msdos.c | 16 ++++++++-------- sys/msdos/video.c | 4 ++-- sys/msdos/vidvga.c | 44 ++++++++++++++++++++++---------------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/sys/msdos/msdos.c b/sys/msdos/msdos.c index 69f994be6..b68041943 100644 --- a/sys/msdos/msdos.c +++ b/sys/msdos/msdos.c @@ -49,12 +49,12 @@ void FDECL(get_cursor, (int *, int *)); /* direct bios calls are used only when iflags.BIOS is set */ -STATIC_DCL char NDECL(DOSgetch); -STATIC_DCL char NDECL(BIOSgetch); +static char NDECL(DOSgetch); +static char NDECL(BIOSgetch); #ifndef __GO32__ -STATIC_DCL char *NDECL(getdta); +static char *NDECL(getdta); #endif -STATIC_DCL unsigned int FDECL(dos_ioctl, (int, int, unsigned)); +static unsigned int FDECL(dos_ioctl, (int, int, unsigned)); #ifdef USE_TILES extern boolean FDECL(pckeys, (unsigned char, unsigned char)); /* pckeys.c */ #endif @@ -243,7 +243,7 @@ static const char numeric_scanmap[] = { /* ... */ #define ALT 0x8 #endif /* PC9800 */ -STATIC_OVL char +static char BIOSgetch() { unsigned char scan, shift, ch = 0; @@ -303,7 +303,7 @@ BIOSgetch() return ch; } -STATIC_OVL char +static char DOSgetch() { union REGS regs; @@ -406,7 +406,7 @@ foundfile_buffer() } /* Get disk transfer area */ -STATIC_OVL char * +static char * getdta() { union REGS regs; @@ -503,7 +503,7 @@ enable_ctrlP() return; } -STATIC_OVL unsigned int +static unsigned int dos_ioctl(handle, mode, setvalue) int handle, mode; unsigned setvalue; diff --git a/sys/msdos/video.c b/sys/msdos/video.c index 76002cdf6..e53cc9d5f 100644 --- a/sys/msdos/video.c +++ b/sys/msdos/video.c @@ -122,7 +122,7 @@ void FDECL(get_cursor, (int *, int *)); void FDECL(adjust_cursor_flags, (struct WinDesc *)); void FDECL(cmov, (int, int)); void FDECL(nocmov, (int, int)); -STATIC_DCL void NDECL(init_ttycolor); +static void NDECL(init_ttycolor); int savevmode; /* store the original video mode in here */ int curcol, currow; /* graphics mode current cursor locations */ @@ -719,7 +719,7 @@ char *schoice[3] = { "dark", "normal", "light" }; char *shade[3]; #endif /* VIDEOSHADES */ -STATIC_OVL void +static void init_ttycolor() { #ifdef VIDEOSHADES diff --git a/sys/msdos/vidvga.c b/sys/msdos/vidvga.c index 13c873737..8f4240176 100644 --- a/sys/msdos/vidvga.c +++ b/sys/msdos/vidvga.c @@ -104,18 +104,18 @@ extern short glyph2tile[]; -/* STATIC_DCL void FDECL(vga_NoBorder, (int)); */ +/* static void FDECL(vga_NoBorder, (int)); */ void FDECL(vga_gotoloc, (int, int)); /* This should be made a macro */ void NDECL(vga_backsp); #ifdef SCROLLMAP -STATIC_DCL void FDECL(vga_scrollmap, (BOOLEAN_P)); +static void FDECL(vga_scrollmap, (BOOLEAN_P)); #endif -STATIC_DCL void FDECL(vga_redrawmap, (BOOLEAN_P)); +static void FDECL(vga_redrawmap, (BOOLEAN_P)); static void FDECL(vga_cliparound, (int, int)); -STATIC_OVL void FDECL(decal_planar, (struct planar_cell_struct *, unsigned)); +static void FDECL(decal_planar, (struct planar_cell_struct *, unsigned)); #ifdef POSITIONBAR -STATIC_DCL void NDECL(positionbar); +static void NDECL(positionbar); static void FDECL(vga_special, (int, int, int)); #endif @@ -147,11 +147,11 @@ extern boolean inmap; /* in the map window */ * Global Variables */ -STATIC_VAR unsigned char __far *font; -STATIC_VAR char *screentable[SCREENHEIGHT]; +static unsigned char __far *font; +static char *screentable[SCREENHEIGHT]; -STATIC_VAR const struct Pixel *paletteptr; -STATIC_VAR struct map_struct { +static const struct Pixel *paletteptr; +static struct map_struct { int glyph; int ch; int attr; @@ -171,13 +171,13 @@ STATIC_VAR struct map_struct { } #define TOP_MAP_ROW 1 -STATIC_VAR int vgacmap[CLR_MAX] = { 1, 4, 6, 10, 5, 9, 0, 15, +static int vgacmap[CLR_MAX] = { 1, 4, 6, 10, 5, 9, 0, 15, 12, 3, 7, 8, 2, 9, 0, 14 }; -STATIC_VAR int viewport_size = 40; -/* STATIC_VAR char masktable[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}; */ -/* STATIC_VAR char bittable[8]= {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; */ +static int viewport_size = 40; +/* static char masktable[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}; */ +/* static char bittable[8]= {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; */ #if 0 -STATIC_VAR char defpalette[] = { /* Default VGA palette */ +static char defpalette[] = { /* Default VGA palette */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0xaa, 0x00, @@ -202,10 +202,10 @@ int vp[SCREENPLANES] = { 8, 4, 2, 1 }; #endif int vp2[SCREENPLANES] = { 1, 2, 4, 8 }; -STATIC_VAR struct planar_cell_struct planecell; -STATIC_VAR struct overview_planar_cell_struct planecell_O; +static struct planar_cell_struct planecell; +static struct overview_planar_cell_struct planecell_O; -/* STATIC_VAR int g_attribute; */ /* Current attribute to use */ +/* static int g_attribute; */ /* Current attribute to use */ void vga_get_scr_size() @@ -455,7 +455,7 @@ int x, y; } } -STATIC_OVL void +static void vga_redrawmap(clearfirst) boolean clearfirst; { @@ -578,7 +578,7 @@ vga_refresh() } #ifdef SCROLLMAP -STATIC_OVL void +static void vga_scrollmap(left) boolean left; { @@ -724,7 +724,7 @@ unsigned char (*indexes)[TILE_X]; } } -STATIC_OVL void +static void decal_planar(gp, special) struct planar_cell_struct *gp; unsigned special; @@ -858,7 +858,7 @@ vga_Finish(void) * to a more standard values - MJA 94/04/23. * */ -STATIC_OVL void +static void vga_NoBorder(int bc) { union REGS regs; @@ -1121,7 +1121,7 @@ char *posbar; *p = 0; } -STATIC_OVL void +static void positionbar() { char *posbar = pbar; From 8c20c52ecf936259476d9e7382517b95de1fc39a Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 14 Jul 2019 17:28:48 -0400 Subject: [PATCH 077/296] remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR from sys/share --- sys/share/pcmain.c | 10 +++++----- sys/share/pcsys.c | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index a48f974b3..83649856a 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -41,8 +41,8 @@ extern int bigscreen; void NDECL(preserve_icon); #endif -STATIC_DCL void FDECL(process_options, (int argc, char **argv)); -STATIC_DCL void NDECL(nhusage); +static void FDECL(process_options, (int argc, char **argv)); +static void NDECL(nhusage); #if defined(MICRO) || defined(OS2) extern void FDECL(nethack_exit, (int)); @@ -51,7 +51,7 @@ extern void FDECL(nethack_exit, (int)); #endif #ifdef EXEPATH -STATIC_DCL char *FDECL(exepath, (char *)); +static char *FDECL(exepath, (char *)); #endif int FDECL(main, (int, char **)); @@ -531,7 +531,7 @@ attempt_restore: return resuming; } -STATIC_OVL void +static void process_options(argc, argv) int argc; char *argv[]; @@ -662,7 +662,7 @@ char *argv[]; } } -STATIC_OVL void +static void nhusage() { char buf1[BUFSZ], buf2[BUFSZ], *bufptr; diff --git a/sys/share/pcsys.c b/sys/share/pcsys.c index 38e8fb4a0..4dfa7291b 100644 --- a/sys/share/pcsys.c +++ b/sys/share/pcsys.c @@ -33,7 +33,7 @@ void FDECL(nethack_exit, (int)); #else #define nethack_exit exit #endif -STATIC_DCL void NDECL(msexit); +static void NDECL(msexit); #ifdef MOVERLAY extern void __far __cdecl _movepause(void); @@ -45,9 +45,9 @@ extern unsigned short __far __cdecl _movefpaused; #endif /* MOVERLAY */ #ifdef MFLOPPY -STATIC_DCL boolean NDECL(record_exists); +static boolean NDECL(record_exists); #ifndef TOS -STATIC_DCL boolean NDECL(comspec_exists); +static boolean NDECL(comspec_exists); #endif #endif @@ -305,7 +305,7 @@ int start; } /* Return 1 if the record file was found */ -STATIC_OVL boolean +static boolean record_exists() { FILE *fp; @@ -324,7 +324,7 @@ record_exists() #else #ifdef MFLOPPY /* Return 1 if the comspec was found */ -STATIC_OVL boolean +static boolean comspec_exists() { int fd; @@ -492,7 +492,7 @@ int code; extern boolean run_from_desktop; /* set in pcmain.c */ #endif -STATIC_OVL void +static void msexit() { #ifdef CHDIR From a0c38bd76c7b94ce27509ffbc4dc1b63525bbf7d Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 14 Jul 2019 17:30:26 -0400 Subject: [PATCH 078/296] remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR from sys/winnt --- sys/winnt/windmain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index ce1781193..eb5fc994b 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -374,7 +374,7 @@ attempt_restore: return 0; } -STATIC_OVL void +static void process_options(argc, argv) int argc; char *argv[]; @@ -550,7 +550,7 @@ char *argv[]; } } -STATIC_OVL void +static void nhusage() { char buf1[BUFSZ], buf2[BUFSZ], *bufptr; From d9da488c35de801fd651c3dd0ee8f152d5309337 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 14:30:38 -0700 Subject: [PATCH 079/296] Move fuzzer_start, fuzzer_stop and fuzzer_log to pline.c --- include/extern.h | 6 ++--- src/allmain.c | 63 ++++-------------------------------------------- src/pline.c | 57 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 61 deletions(-) diff --git a/include/extern.h b/include/extern.h index 3c74bfda0..ba6164be2 100644 --- a/include/extern.h +++ b/include/extern.h @@ -27,10 +27,7 @@ E void NDECL(newgame); E void FDECL(welcome, (BOOLEAN_P)); E time_t NDECL(get_realtime); E int FDECL(argcheck, (int, char **, enum earlyarg)); -E void NDECL(fuzzer_start); -E void NDECL(fuzzer_stop); E void NDECL(fuzzer_toggle); -E void VDECL(fuzzer_log, (int, const char *, ...)) PRINTF_F(2, 3); E void NDECL(fuzzer_check); E void NDECL(fuzzer_auto_start); E boolean FDECL(fuzzer_msg_history, (const char *)); @@ -1943,6 +1940,9 @@ E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2); E void FDECL(nhassert_failed, (const char *, int)); +E void NDECL(fuzzer_start); +E void NDECL(fuzzer_stop); +E void VDECL(fuzzer_log, (int, const char *, ...)) PRINTF_F(2, 3); /* ### polyself.c ### */ diff --git a/src/allmain.c b/src/allmain.c index 957c47a44..b834f0a8c 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -4,7 +4,6 @@ /* NetHack may be freely redistributed. See license for details. */ /* various code that was replicated in *main.c */ -#define NEED_VARARGS #include "hack.h" #include @@ -927,38 +926,6 @@ const char *opts; return; } -static FILE * g_fuzzer_log_file = NULL; -static int g_fuzzer_log_level = LOG_MINIMAL; - -/* fuzzer_start() starts the fuzzer opening the fuzzer log file */ -void -fuzzer_start() -{ - if (!iflags.debug_fuzzer) { - const char * fq_replay; - - iflags.debug_fuzzer = TRUE; - iflags.fuzzer_auto_start = FALSE; - - nhassert(g_fuzzer_log_file == NULL); - fq_replay = fqname("fuzzer.log", SAVEPREFIX, 0); - - g_fuzzer_log_file = fopen(fq_replay, "w"); - } -} - -/* fuzzer_stop() stops the fuzzer and close the fuzzer log file */ -void -fuzzer_stop() -{ - if (iflags.debug_fuzzer) { - if(g_fuzzer_log_file != NULL) { - fclose(g_fuzzer_log_file); - g_fuzzer_log_file = NULL; - } - } -} - /* fuzzer_toggle() toggles fuzzer state */ void fuzzer_toggle() @@ -969,29 +936,6 @@ fuzzer_toggle() fuzzer_start(); } -/* fuzzer_log() is used to place messages in the file 'fuzzer.log'. This - * log is the primary tool for monitoring fuzzer activity and tracking down - * issues that the fuzzer is able to reproduce. - */ -void -fuzzer_log -VA_DECL2(int, level, const char *, str) -{ - VA_START(str); - VA_INIT(str, char *); - - if (!g_fuzzer_log_file) - return; - - if (iflags.verbose_logging_start != 0 && moves >= iflags.verbose_logging_start) - g_fuzzer_log_level = LOG_VERBOSE; - - if (level <= g_fuzzer_log_level) - Vfprintf(g_fuzzer_log_file, str, VA_ARGS); - - VA_END(); -} - /* fuzzer_check() is called prior to rhack(0) to allow the fuzzer to * check if it should stop and to allow it to reseed the game. */ @@ -1000,6 +944,8 @@ fuzzer_check() { if (iflags.debug_fuzzer) { + unsigned long seed; + if (moves >= iflags.fuzzer_stop_and_save) { iflags.fuzzer_saving = TRUE; dosave0(); @@ -1008,7 +954,7 @@ fuzzer_check() nh_terminate(EXIT_SUCCESS); } - unsigned long seed = rul(); + seed = rul(); set_random(seed, rn2); fuzzer_log(LOG_MINIMAL, "SEED:%ld:%lu\n", moves, seed); @@ -1022,9 +968,10 @@ void fuzzer_auto_start() { if (iflags.fuzzer_auto_start) { + unsigned long seed; nhassert(!iflags.debug_fuzzer); fuzzer_start(); - unsigned long seed = rul(); + seed = rul(); set_random(seed, rn2); fuzzer_log(LOG_MINIMAL, "START:%ld:%lu\n", moves, seed); } diff --git a/src/pline.c b/src/pline.c index 91e825963..03654355e 100644 --- a/src/pline.c +++ b/src/pline.c @@ -599,4 +599,61 @@ nhassert_failed(filepath, line) impossible("nhassert failed in file '%s' at line %d", filename, line); } +static FILE * g_fuzzer_log_file = NULL; +static int g_fuzzer_log_level = LOG_MINIMAL; + +/* fuzzer_start() starts the fuzzer opening the fuzzer log file */ +void +fuzzer_start() +{ + if (!iflags.debug_fuzzer) { + const char * fq_replay; + + iflags.debug_fuzzer = TRUE; + iflags.fuzzer_auto_start = FALSE; + + nhassert(g_fuzzer_log_file == NULL); + fq_replay = fqname("fuzzer.log", SAVEPREFIX, 0); + + g_fuzzer_log_file = fopen(fq_replay, "w"); + } +} + +/* fuzzer_stop() stops the fuzzer and close the fuzzer log file */ +void +fuzzer_stop() +{ + if (iflags.debug_fuzzer) { + if(g_fuzzer_log_file != NULL) { + fclose(g_fuzzer_log_file); + g_fuzzer_log_file = NULL; + } + } +} + +/* fuzzer_log() is used to place messages in the file 'fuzzer.log'. This + * log is the primary tool for monitoring fuzzer activity and tracking down + * issues that the fuzzer is able to reproduce. + */ +void +fuzzer_log +VA_DECL2(int, lvl, const char *, str) +{ + VA_START(str); + VA_INIT(str, char *); + + if (!g_fuzzer_log_file) + return; + + if (iflags.verbose_logging_start != 0 && + moves >= iflags.verbose_logging_start) + g_fuzzer_log_level = LOG_VERBOSE; + + if (lvl <= g_fuzzer_log_level) + Vfprintf(g_fuzzer_log_file, str, VA_ARGS); + + VA_END(); +} + + /*pline.c*/ From 5428d73287d3e808f4480b04dc9733165dd32e83 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 14:31:00 -0700 Subject: [PATCH 080/296] Remove dead code. --- win/tty/topl.c | 74 -------------------------------------------------- 1 file changed, 74 deletions(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index db151265f..df19eed7a 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -17,8 +17,6 @@ STATIC_DCL void FDECL(redotoplin, (const char *)); STATIC_DCL void FDECL(topl_putsym, (CHAR_P)); STATIC_DCL void FDECL(removetopl, (int)); -STATIC_DCL void FDECL(msghistory_snapshot, (BOOLEAN_P)); -STATIC_DCL void FDECL(free_msghistory_snapshot, (BOOLEAN_P)); int tty_doprev_message() @@ -545,78 +543,6 @@ char def; return q; } -/* shared by tty_getmsghistory() and tty_putmsghistory() */ -static char **snapshot_mesgs = 0; - -/* collect currently available message history data into a sequential array; - optionally, purge that data from the active circular buffer set as we go */ -STATIC_OVL void -msghistory_snapshot(purge) -boolean purge; /* clear message history buffer as we copy it */ -{ - char *mesg; - int i, inidx, outidx; - struct WinDesc *cw; - - /* paranoia (too early or too late panic save attempt?) */ - if (WIN_MESSAGE == WIN_ERR || !wins[WIN_MESSAGE]) - return; - cw = wins[WIN_MESSAGE]; - - /* flush toplines[], moving most recent message to history */ - remember_topl(); - - /* for a passive snapshot, we just copy pointers, so can't allow further - history updating to take place because that could clobber them */ - if (!purge) - cw->flags |= WIN_LOCKHISTORY; - - snapshot_mesgs = (char **) alloc((cw->rows + 1) * sizeof(char *)); - outidx = 0; - inidx = cw->maxrow; - for (i = 0; i < cw->rows; ++i) { - snapshot_mesgs[i] = (char *) 0; - mesg = cw->data[inidx]; - if (mesg && *mesg) { - snapshot_mesgs[outidx++] = mesg; - if (purge) { - /* we're taking this pointer away; subsequest history - updates will eventually allocate a new one to replace it */ - cw->data[inidx] = (char *) 0; - cw->datlen[inidx] = 0; - } - } - inidx = (inidx + 1) % cw->rows; - } - snapshot_mesgs[cw->rows] = (char *) 0; /* sentinel */ - - /* for a destructive snapshot, history is now completely empty */ - if (purge) - cw->maxcol = cw->maxrow = 0; -} - -/* release memory allocated to message history snapshot */ -STATIC_OVL void -free_msghistory_snapshot(purged) -boolean purged; /* True: took history's pointers, False: just cloned them */ -{ - if (snapshot_mesgs) { - /* snapshot pointers are no longer in use */ - if (purged) { - int i; - - for (i = 0; snapshot_mesgs[i]; ++i) - free((genericptr_t) snapshot_mesgs[i]); - } - - free((genericptr_t) snapshot_mesgs), snapshot_mesgs = (char **) 0; - - /* history can resume being updated at will now... */ - if (!purged) - wins[WIN_MESSAGE]->flags &= ~WIN_LOCKHISTORY; - } -} - STATIC_OVL ptr_array_t * get_message_history() { From fa5c499268f4f6b687a25a3004c47e5f5dc0a546 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 14:31:30 -0700 Subject: [PATCH 081/296] Fix typo in formatting string. --- src/rnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rnd.c b/src/rnd.c index 5473be949..02ffddce3 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -62,7 +62,7 @@ rul() unsigned long value; value = (unsigned long) isaac64_next_uint64(&rnglist[CORE].rng_state); - fuzzer_log(LOG_VERBOSE, "RANDOM:%llu\n", value); + fuzzer_log(LOG_VERBOSE, "RANDOM:%lu\n", value); return value; } From 6688053802654e3b11e61a3001ea067ea500bfb9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 14 Jul 2019 17:33:44 -0400 Subject: [PATCH 082/296] remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR from win/tty --- win/tty/getline.c | 10 ++-- win/tty/termcap.c | 14 ++--- win/tty/topl.c | 24 ++++---- win/tty/wintty.c | 136 +++++++++++++++++++++++----------------------- 4 files changed, 92 insertions(+), 92 deletions(-) diff --git a/win/tty/getline.c b/win/tty/getline.c index 9f7933122..bf2c79666 100644 --- a/win/tty/getline.c +++ b/win/tty/getline.c @@ -15,12 +15,12 @@ #include "func_tab.h" char morc = 0; /* tell the outside world what char you chose */ -STATIC_VAR boolean suppress_history; -STATIC_DCL boolean FDECL(ext_cmd_getlin_hook, (char *)); +static boolean suppress_history; +static boolean FDECL(ext_cmd_getlin_hook, (char *)); typedef boolean FDECL((*getlin_hook_proc), (char *)); -STATIC_DCL void FDECL(hooked_tty_getlin, +static void FDECL(hooked_tty_getlin, (const char *, char *, getlin_hook_proc)); extern int NDECL(extcmd_via_menu); /* cmd.c */ @@ -41,7 +41,7 @@ register char *bufp; hooked_tty_getlin(query, bufp, (getlin_hook_proc) 0); } -STATIC_OVL void +static void hooked_tty_getlin(query, bufp, hook) const char *query; register char *bufp; @@ -252,7 +252,7 @@ register const char *s; /* chars allowed besides return */ * + we don't change the characters that are already in base * + base has enough room to hold our string */ -STATIC_OVL boolean +static boolean ext_cmd_getlin_hook(base) char *base; { diff --git a/win/tty/termcap.c b/win/tty/termcap.c index 07e790dd6..ee9d6ff75 100644 --- a/win/tty/termcap.c +++ b/win/tty/termcap.c @@ -34,15 +34,15 @@ static void NDECL(kill_hilite); /* (see tcap.h) -- nh_CM, nh_ND, nh_CD, nh_HI,nh_HE, nh_US,nh_UE, ul_hack */ struct tc_lcl_data tc_lcl_data = { 0, 0, 0, 0, 0, 0, 0, FALSE }; -STATIC_VAR char *HO, *CL, *CE, *UP, *XD, *BC, *SO, *SE, *TI, *TE; -STATIC_VAR char *VS, *VE; -STATIC_VAR char *ME, *MR, *MB, *MH, *MD; +static char *HO, *CL, *CE, *UP, *XD, *BC, *SO, *SE, *TI, *TE; +static char *VS, *VE; +static char *ME, *MR, *MB, *MH, *MD; #ifdef TERMLIB boolean dynamic_HIHE = FALSE; -STATIC_VAR int SG; -STATIC_OVL char PC = '\0'; -STATIC_VAR char tbuf[512]; +static int SG; +static char PC = '\0'; +static char tbuf[512]; #endif /*TERMLIB*/ #ifdef TEXTCOLOR @@ -61,7 +61,7 @@ extern boolean HE_resets_AS; #endif #ifndef TERMLIB -STATIC_VAR char tgotobuf[20]; +static char tgotobuf[20]; #ifdef TOS #define tgoto(fmt, x, y) (Sprintf(tgotobuf, fmt, y + ' ', x + ' '), tgotobuf) #else diff --git a/win/tty/topl.c b/win/tty/topl.c index 820f5d41a..836819b0c 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -14,11 +14,11 @@ #define C(c) (0x1f & (c)) #endif -STATIC_DCL void FDECL(redotoplin, (const char *)); -STATIC_DCL void FDECL(topl_putsym, (CHAR_P)); -STATIC_DCL void FDECL(removetopl, (int)); -STATIC_DCL void FDECL(msghistory_snapshot, (BOOLEAN_P)); -STATIC_DCL void FDECL(free_msghistory_snapshot, (BOOLEAN_P)); +static void FDECL(redotoplin, (const char *)); +static void FDECL(topl_putsym, (CHAR_P)); +static void FDECL(removetopl, (int)); +static void FDECL(msghistory_snapshot, (BOOLEAN_P)); +static void FDECL(free_msghistory_snapshot, (BOOLEAN_P)); int tty_doprev_message() @@ -122,7 +122,7 @@ tty_doprev_message() return 0; } -STATIC_OVL void +static void redotoplin(str) const char *str; { @@ -298,7 +298,7 @@ register const char *bp; redotoplin(g.toplines); } -STATIC_OVL +static void topl_putsym(c) char c; @@ -350,7 +350,7 @@ const char *str; topl_putsym(*str++); } -STATIC_OVL void +static void removetopl(n) register int n; { @@ -550,7 +550,7 @@ static char **snapshot_mesgs = 0; /* collect currently available message history data into a sequential array; optionally, purge that data from the active circular buffer set as we go */ -STATIC_OVL void +static void msghistory_snapshot(purge) boolean purge; /* clear message history buffer as we copy it */ { @@ -596,7 +596,7 @@ boolean purge; /* clear message history buffer as we copy it */ } /* release memory allocated to message history snapshot */ -STATIC_OVL void +static void free_msghistory_snapshot(purged) boolean purged; /* True: took history's pointers, False: just cloned them */ { @@ -617,7 +617,7 @@ boolean purged; /* True: took history's pointers, False: just cloned them */ } } -STATIC_OVL ptr_array_t * +static ptr_array_t * get_message_history() { char *mesg; @@ -653,7 +653,7 @@ get_message_history() return a; } -STATIC_OVL void +static void purge_message_history() { int i; diff --git a/win/tty/wintty.c b/win/tty/wintty.c index fc4cb79eb..f27e08593 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -180,45 +180,45 @@ boolean HE_resets_AS; /* see termcap.c */ static const char to_continue[] = "to continue"; #define getret() getreturn(to_continue) #else -STATIC_DCL void NDECL(getret); +static void NDECL(getret); #endif -STATIC_DCL void FDECL(bail, (const char *)); /* __attribute__((noreturn)) */ -STATIC_DCL void NDECL(new_status_window); -STATIC_DCL void FDECL(erase_menu_or_text, (winid, struct WinDesc *, +static void FDECL(bail, (const char *)); /* __attribute__((noreturn)) */ +static void NDECL(new_status_window); +static void FDECL(erase_menu_or_text, (winid, struct WinDesc *, BOOLEAN_P)); -STATIC_DCL void FDECL(free_window_info, (struct WinDesc *, BOOLEAN_P)); -STATIC_DCL void FDECL(dmore, (struct WinDesc *, const char *)); -STATIC_DCL void FDECL(set_item_state, (winid, int, tty_menu_item *)); -STATIC_DCL void FDECL(set_all_on_page, (winid, tty_menu_item *, +static void FDECL(free_window_info, (struct WinDesc *, BOOLEAN_P)); +static void FDECL(dmore, (struct WinDesc *, const char *)); +static void FDECL(set_item_state, (winid, int, tty_menu_item *)); +static void FDECL(set_all_on_page, (winid, tty_menu_item *, tty_menu_item *)); -STATIC_DCL void FDECL(unset_all_on_page, (winid, tty_menu_item *, +static void FDECL(unset_all_on_page, (winid, tty_menu_item *, tty_menu_item *)); -STATIC_DCL void FDECL(invert_all_on_page, (winid, tty_menu_item *, +static void FDECL(invert_all_on_page, (winid, tty_menu_item *, tty_menu_item *, CHAR_P)); -STATIC_DCL void FDECL(invert_all, (winid, tty_menu_item *, +static void FDECL(invert_all, (winid, tty_menu_item *, tty_menu_item *, CHAR_P)); -STATIC_DCL void FDECL(toggle_menu_attr, (BOOLEAN_P, int, int)); -STATIC_DCL void FDECL(process_menu_window, (winid, struct WinDesc *)); -STATIC_DCL void FDECL(process_text_window, (winid, struct WinDesc *)); -STATIC_DCL tty_menu_item *FDECL(reverse, (tty_menu_item *)); -STATIC_DCL const char *FDECL(compress_str, (const char *)); -STATIC_DCL void FDECL(tty_putsym, (winid, int, int, CHAR_P)); -STATIC_DCL void FDECL(setup_rolemenu, (winid, BOOLEAN_P, int, int, int)); -STATIC_DCL void FDECL(setup_racemenu, (winid, BOOLEAN_P, int, int, int)); -STATIC_DCL void FDECL(setup_gendmenu, (winid, BOOLEAN_P, int, int, int)); -STATIC_DCL void FDECL(setup_algnmenu, (winid, BOOLEAN_P, int, int, int)); -STATIC_DCL boolean NDECL(reset_role_filtering); +static void FDECL(toggle_menu_attr, (BOOLEAN_P, int, int)); +static void FDECL(process_menu_window, (winid, struct WinDesc *)); +static void FDECL(process_text_window, (winid, struct WinDesc *)); +static tty_menu_item *FDECL(reverse, (tty_menu_item *)); +static const char *FDECL(compress_str, (const char *)); +static void FDECL(tty_putsym, (winid, int, int, CHAR_P)); +static void FDECL(setup_rolemenu, (winid, BOOLEAN_P, int, int, int)); +static void FDECL(setup_racemenu, (winid, BOOLEAN_P, int, int, int)); +static void FDECL(setup_gendmenu, (winid, BOOLEAN_P, int, int, int)); +static void FDECL(setup_algnmenu, (winid, BOOLEAN_P, int, int, int)); +static boolean NDECL(reset_role_filtering); #ifdef STATUS_HILITES -STATIC_DCL boolean FDECL(check_fields, (BOOLEAN_P, int *)); -STATIC_DCL void NDECL(render_status); -STATIC_DCL void FDECL(tty_putstatusfield, (const char *, int, int)); -STATIC_DCL boolean NDECL(check_windowdata); -STATIC_DCL int NDECL(condition_size); -STATIC_DCL int FDECL(make_things_fit, (BOOLEAN_P)); -STATIC_DCL void FDECL(shrink_enc, (int)); -STATIC_DCL void FDECL(shrink_dlvl, (int)); +static boolean FDECL(check_fields, (BOOLEAN_P, int *)); +static void NDECL(render_status); +static void FDECL(tty_putstatusfield, (const char *, int, int)); +static boolean NDECL(check_windowdata); +static int NDECL(condition_size); +static int FDECL(make_things_fit, (BOOLEAN_P)); +static void FDECL(shrink_enc, (int)); +static void FDECL(shrink_dlvl, (int)); #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) -STATIC_DCL void NDECL(status_sanity_check); +static void NDECL(status_sanity_check); #endif /* NH_DEVEL_STATUS */ #endif @@ -266,7 +266,7 @@ int i, c, d; /* clean up and quit */ -STATIC_OVL void +static void bail(mesg) const char *mesg; { @@ -277,7 +277,7 @@ const char *mesg; } #if defined(SIGWINCH) && defined(CLIPPING) -STATIC_DCL void FDECL(winch_handler, (int)); +static void FDECL(winch_handler, (int)); /* * This really ought to just set a flag like the hangup handler does, @@ -289,7 +289,7 @@ STATIC_DCL void FDECL(winch_handler, (int)); * 'winch_seen' has been "notyet" for a long time.... */ /*ARGUSED*/ -STATIC_OVL void +static void winch_handler(sig_unused) /* signal handler is called with at least 1 arg */ int sig_unused UNUSED; { @@ -355,7 +355,7 @@ int sig_unused UNUSED; /* destroy and recreate status window; extracted from winch_handler() and augmented for use by tty_preference_update() */ -STATIC_OVL void +static void new_status_window() { if (WIN_STATUS != WIN_ERR) { @@ -1031,7 +1031,7 @@ tty_player_selection() return; } -STATIC_OVL boolean +static boolean reset_role_filtering() { winid win; @@ -1085,7 +1085,7 @@ reset_role_filtering() #undef ALGN /* add entries a-Archeologist, b-Barbarian, &c to menu being built in 'win' */ -STATIC_OVL void +static void setup_rolemenu(win, filtering, race, gend, algn) winid win; boolean filtering; /* True => exclude filtered roles; False => filter reset */ @@ -1128,7 +1128,7 @@ int race, gend, algn; /* all ROLE_NONE for !filtering case */ } } -STATIC_OVL void +static void setup_racemenu(win, filtering, role, gend, algn) winid win; boolean filtering; @@ -1161,7 +1161,7 @@ int role, gend, algn; } } -STATIC_DCL void +static void setup_gendmenu(win, filtering, role, race, algn) winid win; boolean filtering; @@ -1192,7 +1192,7 @@ int role, race, algn; } } -STATIC_DCL void +static void setup_algnmenu(win, filtering, role, race, gend) winid win; boolean filtering; @@ -1342,7 +1342,7 @@ tty_get_nh_event() } #if !defined(MICRO) && !defined(WIN32CON) -STATIC_OVL void +static void getret() { HUPSKIP(); @@ -1535,7 +1535,7 @@ int type; return newid; } -STATIC_OVL void +static void erase_menu_or_text(window, cw, clear) winid window; struct WinDesc *cw; @@ -1555,7 +1555,7 @@ boolean clear; } } -STATIC_OVL void +static void free_window_info(cw, free_data) struct WinDesc *cw; boolean free_data; @@ -1699,7 +1699,7 @@ long count; return FALSE; } -STATIC_OVL void +static void dmore(cw, s) register struct WinDesc *cw; const char *s; /* valid responses */ @@ -1720,7 +1720,7 @@ const char *s; /* valid responses */ xwaitforspace(s); } -STATIC_OVL void +static void set_item_state(window, lineno, item) winid window; int lineno; @@ -1736,7 +1736,7 @@ tty_menu_item *item; term_end_attr(item->attr); } -STATIC_OVL void +static void set_all_on_page(window, page_start, page_end) winid window; tty_menu_item *page_start, *page_end; @@ -1751,7 +1751,7 @@ tty_menu_item *page_start, *page_end; } } -STATIC_OVL void +static void unset_all_on_page(window, page_start, page_end) winid window; tty_menu_item *page_start, *page_end; @@ -1767,7 +1767,7 @@ tty_menu_item *page_start, *page_end; } } -STATIC_OVL void +static void invert_all_on_page(window, page_start, page_end, acc) winid window; tty_menu_item *page_start, *page_end; @@ -1790,7 +1790,7 @@ char acc; /* group accelerator, 0 => all */ /* * Invert all entries that match the give group accelerator (or all if zero). */ -STATIC_OVL void +static void invert_all(window, page_start, page_end, acc) winid window; tty_menu_item *page_start, *page_end; @@ -1821,7 +1821,7 @@ char acc; /* group accelerator, 0 => all */ } /* support menucolor in addition to caller-supplied attribute */ -STATIC_OVL void +static void toggle_menu_attr(on, color, attr) boolean on; int color, attr; @@ -1845,7 +1845,7 @@ int color, attr; #endif } -STATIC_OVL void +static void process_menu_window(window, cw) winid window; struct WinDesc *cw; @@ -2216,7 +2216,7 @@ struct WinDesc *cw; free((genericptr_t) morestr); } -STATIC_OVL void +static void process_text_window(window, cw) winid window; struct WinDesc *cw; @@ -2560,7 +2560,7 @@ register int x, y; /* not xchar: perhaps xchar is unsigned and ttyDisplay->cury = y; } -STATIC_OVL void +static void tty_putsym(window, x, y, ch) winid window; int x, y; @@ -2593,7 +2593,7 @@ char ch; } } -STATIC_OVL const char * +static const char * compress_str(str) const char *str; { @@ -2963,7 +2963,7 @@ boolean preselected; /* item is marked as selected */ } /* Invert the given list, can handle NULL as an input. */ -STATIC_OVL tty_menu_item * +static tty_menu_item * reverse(curr) tty_menu_item *curr; { @@ -3758,9 +3758,9 @@ extern winid WIN_STATUS; #ifdef STATUS_HILITES #ifdef TEXTCOLOR -STATIC_DCL int FDECL(condcolor, (long, unsigned long *)); +static int FDECL(condcolor, (long, unsigned long *)); #endif -STATIC_DCL int FDECL(condattr, (long, unsigned long *)); +static int FDECL(condattr, (long, unsigned long *)); static unsigned long *tty_colormasks; static long tty_condition_bits; static struct tty_status_fields tty_status[2][MAXBLSTATS]; /* 2: NOW,BEFORE */ @@ -4066,7 +4066,7 @@ unsigned long *colormasks; return; } -STATIC_OVL int +static int make_things_fit(force_update) boolean force_update; { @@ -4130,7 +4130,7 @@ boolean force_update; * must be updated because they need to change. * This is now done at an individual field case-by-case level. */ -STATIC_OVL boolean +static boolean check_fields(forcefields, sz) boolean forcefields; int sz[3]; @@ -4233,7 +4233,7 @@ int sz[3]; } #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) -STATIC_OVL void +static void status_sanity_check(VOID_ARGS) { int i; @@ -4281,7 +4281,7 @@ status_sanity_check(VOID_ARGS) /* * This is what places a field on the tty display. */ -STATIC_OVL void +static void tty_putstatusfield(text, x, y) const char *text; int x, y; @@ -4320,7 +4320,7 @@ int x, y; } /* caller must set cond_shrinklvl (0..2) before calling us */ -STATIC_OVL int +static int condition_size() { long mask; @@ -4338,7 +4338,7 @@ condition_size() return lth; } -STATIC_OVL void +static void shrink_enc(lvl) int lvl; { @@ -4350,7 +4350,7 @@ int lvl; tty_status[NOW][BL_CAP].lth = strlen(status_vals[BL_CAP]); } -STATIC_OVL void +static void shrink_dlvl(lvl) int lvl; { @@ -4371,7 +4371,7 @@ int lvl; * Ensure the underlying status window data start out * blank and null-terminated. */ -STATIC_OVL boolean +static boolean check_windowdata(VOID_ARGS) { if (WIN_STATUS == WIN_ERR || wins[WIN_STATUS] == (struct WinDesc *) 0) { @@ -4389,7 +4389,7 @@ check_windowdata(VOID_ARGS) * Return what color this condition should * be displayed in based on user settings. */ -STATIC_OVL int +static int condcolor(bm, bmarray) long bm; unsigned long *bmarray; @@ -4411,7 +4411,7 @@ unsigned long *bmarray; #define term_end_color(color) /*empty*/ #endif /* TEXTCOLOR */ -STATIC_OVL int +static int condattr(bm, bmarray) long bm; unsigned long *bmarray; @@ -4477,7 +4477,7 @@ unsigned long *bmarray; } \ } while (0) -STATIC_OVL void +static void render_status(VOID_ARGS) { long mask, bits; From 865b301f0d340a281b4a3210c8e5ac0e83009d45 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 14 Jul 2019 17:34:47 -0400 Subject: [PATCH 083/296] another STATIC_VAR bit in sys/msdos --- sys/msdos/pctiles.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/msdos/pctiles.c b/sys/msdos/pctiles.c index 1a8a53aad..7df6d9881 100644 --- a/sys/msdos/pctiles.c +++ b/sys/msdos/pctiles.c @@ -33,8 +33,8 @@ #include "tile.h" #include "pctiles.h" -STATIC_VAR FILE *tilefile; -STATIC_VAR FILE *tilefile_O; +static FILE *tilefile; +static FILE *tilefile_O; extern short glyph2tile[]; /* in tile.c (made from tilemap.c) */ #ifdef TILES_IN_RAM From 6a75dc5dcf432da60b0b769cc988683dae26363d Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 14:49:31 -0700 Subject: [PATCH 084/296] Fix build break in pline.c --- src/pline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pline.c b/src/pline.c index 004c3ed40..13f782fef 100644 --- a/src/pline.c +++ b/src/pline.c @@ -636,7 +636,7 @@ VA_DECL2(int, lvl, const char *, str) return; if (iflags.verbose_logging_start != 0 && - moves >= iflags.verbose_logging_start) + g.moves >= iflags.verbose_logging_start) g_fuzzer_log_level = LOG_VERBOSE; if (lvl <= g_fuzzer_log_level) From e933882eb8140a7c4d6902460ff938f90cea2cb8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 14 Jul 2019 18:20:17 -0400 Subject: [PATCH 085/296] fixes entry --- doc/fixes37.0 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 2cd323116..2e2f93d51 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -38,4 +38,5 @@ Code Cleanup and Reorganization ------------------------------- move majority of global variables into instance_globals struct g move zeroobj, zeromonst, zeroany into const_globals struct cg +remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR From a4317b738aeae6b8ed8d8e28d3dcb9e2c1282595 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:09:07 -0700 Subject: [PATCH 086/296] Revert "Fix typo in formatting string." This reverts commit fa5c499268f4f6b687a25a3004c47e5f5dc0a546. --- src/rnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rnd.c b/src/rnd.c index 02ffddce3..5473be949 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -62,7 +62,7 @@ rul() unsigned long value; value = (unsigned long) isaac64_next_uint64(&rnglist[CORE].rng_state); - fuzzer_log(LOG_VERBOSE, "RANDOM:%lu\n", value); + fuzzer_log(LOG_VERBOSE, "RANDOM:%llu\n", value); return value; } From 340ec01cafb931a38209d31df2c8512528853c0d Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:09:16 -0700 Subject: [PATCH 087/296] Revert "Remove dead code." This reverts commit 5428d73287d3e808f4480b04dc9733165dd32e83. --- win/tty/topl.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/win/tty/topl.c b/win/tty/topl.c index df19eed7a..db151265f 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -17,6 +17,8 @@ STATIC_DCL void FDECL(redotoplin, (const char *)); STATIC_DCL void FDECL(topl_putsym, (CHAR_P)); STATIC_DCL void FDECL(removetopl, (int)); +STATIC_DCL void FDECL(msghistory_snapshot, (BOOLEAN_P)); +STATIC_DCL void FDECL(free_msghistory_snapshot, (BOOLEAN_P)); int tty_doprev_message() @@ -543,6 +545,78 @@ char def; return q; } +/* shared by tty_getmsghistory() and tty_putmsghistory() */ +static char **snapshot_mesgs = 0; + +/* collect currently available message history data into a sequential array; + optionally, purge that data from the active circular buffer set as we go */ +STATIC_OVL void +msghistory_snapshot(purge) +boolean purge; /* clear message history buffer as we copy it */ +{ + char *mesg; + int i, inidx, outidx; + struct WinDesc *cw; + + /* paranoia (too early or too late panic save attempt?) */ + if (WIN_MESSAGE == WIN_ERR || !wins[WIN_MESSAGE]) + return; + cw = wins[WIN_MESSAGE]; + + /* flush toplines[], moving most recent message to history */ + remember_topl(); + + /* for a passive snapshot, we just copy pointers, so can't allow further + history updating to take place because that could clobber them */ + if (!purge) + cw->flags |= WIN_LOCKHISTORY; + + snapshot_mesgs = (char **) alloc((cw->rows + 1) * sizeof(char *)); + outidx = 0; + inidx = cw->maxrow; + for (i = 0; i < cw->rows; ++i) { + snapshot_mesgs[i] = (char *) 0; + mesg = cw->data[inidx]; + if (mesg && *mesg) { + snapshot_mesgs[outidx++] = mesg; + if (purge) { + /* we're taking this pointer away; subsequest history + updates will eventually allocate a new one to replace it */ + cw->data[inidx] = (char *) 0; + cw->datlen[inidx] = 0; + } + } + inidx = (inidx + 1) % cw->rows; + } + snapshot_mesgs[cw->rows] = (char *) 0; /* sentinel */ + + /* for a destructive snapshot, history is now completely empty */ + if (purge) + cw->maxcol = cw->maxrow = 0; +} + +/* release memory allocated to message history snapshot */ +STATIC_OVL void +free_msghistory_snapshot(purged) +boolean purged; /* True: took history's pointers, False: just cloned them */ +{ + if (snapshot_mesgs) { + /* snapshot pointers are no longer in use */ + if (purged) { + int i; + + for (i = 0; snapshot_mesgs[i]; ++i) + free((genericptr_t) snapshot_mesgs[i]); + } + + free((genericptr_t) snapshot_mesgs), snapshot_mesgs = (char **) 0; + + /* history can resume being updated at will now... */ + if (!purged) + wins[WIN_MESSAGE]->flags &= ~WIN_LOCKHISTORY; + } +} + STATIC_OVL ptr_array_t * get_message_history() { From a66fed3d5a140e873def653e84e6931441bad210 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:09:29 -0700 Subject: [PATCH 088/296] Revert "Move fuzzer_start, fuzzer_stop and fuzzer_log to pline.c" This reverts commit d9da488c35de801fd651c3dd0ee8f152d5309337. --- include/extern.h | 6 ++--- src/allmain.c | 63 ++++++++++++++++++++++++++++++++++++++++++++---- src/pline.c | 57 ------------------------------------------- 3 files changed, 61 insertions(+), 65 deletions(-) diff --git a/include/extern.h b/include/extern.h index ba6164be2..3c74bfda0 100644 --- a/include/extern.h +++ b/include/extern.h @@ -27,7 +27,10 @@ E void NDECL(newgame); E void FDECL(welcome, (BOOLEAN_P)); E time_t NDECL(get_realtime); E int FDECL(argcheck, (int, char **, enum earlyarg)); +E void NDECL(fuzzer_start); +E void NDECL(fuzzer_stop); E void NDECL(fuzzer_toggle); +E void VDECL(fuzzer_log, (int, const char *, ...)) PRINTF_F(2, 3); E void NDECL(fuzzer_check); E void NDECL(fuzzer_auto_start); E boolean FDECL(fuzzer_msg_history, (const char *)); @@ -1940,9 +1943,6 @@ E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2); E void FDECL(nhassert_failed, (const char *, int)); -E void NDECL(fuzzer_start); -E void NDECL(fuzzer_stop); -E void VDECL(fuzzer_log, (int, const char *, ...)) PRINTF_F(2, 3); /* ### polyself.c ### */ diff --git a/src/allmain.c b/src/allmain.c index b834f0a8c..957c47a44 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -4,6 +4,7 @@ /* NetHack may be freely redistributed. See license for details. */ /* various code that was replicated in *main.c */ +#define NEED_VARARGS #include "hack.h" #include @@ -926,6 +927,38 @@ const char *opts; return; } +static FILE * g_fuzzer_log_file = NULL; +static int g_fuzzer_log_level = LOG_MINIMAL; + +/* fuzzer_start() starts the fuzzer opening the fuzzer log file */ +void +fuzzer_start() +{ + if (!iflags.debug_fuzzer) { + const char * fq_replay; + + iflags.debug_fuzzer = TRUE; + iflags.fuzzer_auto_start = FALSE; + + nhassert(g_fuzzer_log_file == NULL); + fq_replay = fqname("fuzzer.log", SAVEPREFIX, 0); + + g_fuzzer_log_file = fopen(fq_replay, "w"); + } +} + +/* fuzzer_stop() stops the fuzzer and close the fuzzer log file */ +void +fuzzer_stop() +{ + if (iflags.debug_fuzzer) { + if(g_fuzzer_log_file != NULL) { + fclose(g_fuzzer_log_file); + g_fuzzer_log_file = NULL; + } + } +} + /* fuzzer_toggle() toggles fuzzer state */ void fuzzer_toggle() @@ -936,6 +969,29 @@ fuzzer_toggle() fuzzer_start(); } +/* fuzzer_log() is used to place messages in the file 'fuzzer.log'. This + * log is the primary tool for monitoring fuzzer activity and tracking down + * issues that the fuzzer is able to reproduce. + */ +void +fuzzer_log +VA_DECL2(int, level, const char *, str) +{ + VA_START(str); + VA_INIT(str, char *); + + if (!g_fuzzer_log_file) + return; + + if (iflags.verbose_logging_start != 0 && moves >= iflags.verbose_logging_start) + g_fuzzer_log_level = LOG_VERBOSE; + + if (level <= g_fuzzer_log_level) + Vfprintf(g_fuzzer_log_file, str, VA_ARGS); + + VA_END(); +} + /* fuzzer_check() is called prior to rhack(0) to allow the fuzzer to * check if it should stop and to allow it to reseed the game. */ @@ -944,8 +1000,6 @@ fuzzer_check() { if (iflags.debug_fuzzer) { - unsigned long seed; - if (moves >= iflags.fuzzer_stop_and_save) { iflags.fuzzer_saving = TRUE; dosave0(); @@ -954,7 +1008,7 @@ fuzzer_check() nh_terminate(EXIT_SUCCESS); } - seed = rul(); + unsigned long seed = rul(); set_random(seed, rn2); fuzzer_log(LOG_MINIMAL, "SEED:%ld:%lu\n", moves, seed); @@ -968,10 +1022,9 @@ void fuzzer_auto_start() { if (iflags.fuzzer_auto_start) { - unsigned long seed; nhassert(!iflags.debug_fuzzer); fuzzer_start(); - seed = rul(); + unsigned long seed = rul(); set_random(seed, rn2); fuzzer_log(LOG_MINIMAL, "START:%ld:%lu\n", moves, seed); } diff --git a/src/pline.c b/src/pline.c index 03654355e..91e825963 100644 --- a/src/pline.c +++ b/src/pline.c @@ -599,61 +599,4 @@ nhassert_failed(filepath, line) impossible("nhassert failed in file '%s' at line %d", filename, line); } -static FILE * g_fuzzer_log_file = NULL; -static int g_fuzzer_log_level = LOG_MINIMAL; - -/* fuzzer_start() starts the fuzzer opening the fuzzer log file */ -void -fuzzer_start() -{ - if (!iflags.debug_fuzzer) { - const char * fq_replay; - - iflags.debug_fuzzer = TRUE; - iflags.fuzzer_auto_start = FALSE; - - nhassert(g_fuzzer_log_file == NULL); - fq_replay = fqname("fuzzer.log", SAVEPREFIX, 0); - - g_fuzzer_log_file = fopen(fq_replay, "w"); - } -} - -/* fuzzer_stop() stops the fuzzer and close the fuzzer log file */ -void -fuzzer_stop() -{ - if (iflags.debug_fuzzer) { - if(g_fuzzer_log_file != NULL) { - fclose(g_fuzzer_log_file); - g_fuzzer_log_file = NULL; - } - } -} - -/* fuzzer_log() is used to place messages in the file 'fuzzer.log'. This - * log is the primary tool for monitoring fuzzer activity and tracking down - * issues that the fuzzer is able to reproduce. - */ -void -fuzzer_log -VA_DECL2(int, lvl, const char *, str) -{ - VA_START(str); - VA_INIT(str, char *); - - if (!g_fuzzer_log_file) - return; - - if (iflags.verbose_logging_start != 0 && - moves >= iflags.verbose_logging_start) - g_fuzzer_log_level = LOG_VERBOSE; - - if (lvl <= g_fuzzer_log_level) - Vfprintf(g_fuzzer_log_file, str, VA_ARGS); - - VA_END(); -} - - /*pline.c*/ From 3adaa798582f02f646bc123f9f0166b752513f1e Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:09:38 -0700 Subject: [PATCH 089/296] Revert "Revert type change of lit which would break code." This reverts commit cc1219b5a8bae222a6ba6a0c755419c9ca200a79. --- src/sp_lev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sp_lev.c b/src/sp_lev.c index ba9d75c72..b2206ae70 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3763,7 +3763,7 @@ struct opvar *mc; { int x, y; schar mapc; - xchar lit; + uchar lit; struct opvar *ret = selection_opvar((char *) 0); if (!ov || !mc || !ret) @@ -3783,7 +3783,7 @@ struct opvar *mc; break; case 0: case 1: - if (levl[x][y].lit == (unsigned int) lit) + if (levl[x][y].lit == lit) selection_setpoint(x, y, ret, 1); break; } From 0f0b6c5aabd7a4559d78c104027aa14396fa1e32 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:10:07 -0700 Subject: [PATCH 090/296] Revert "Tweaks to fuzzer scripts." This reverts commit cd375064ddbf70770a934820e37b796c4623a145. --- win/win32/scripts/fuzzer/longtest.bat | 13 ------------- win/win32/scripts/fuzzer/runtill.bat | 4 ---- 2 files changed, 17 deletions(-) diff --git a/win/win32/scripts/fuzzer/longtest.bat b/win/win32/scripts/fuzzer/longtest.bat index 64b6286bd..e5e8d1529 100644 --- a/win/win32/scripts/fuzzer/longtest.bat +++ b/win/win32/scripts/fuzzer/longtest.bat @@ -7,19 +7,6 @@ set STEP_SIZE=5000 set FINAL_MOVE=500000 set START_MOVE=5000 -set BIN_DIR=..\..\..\..\bin\Debug\Win32 -set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game -set LOG_FILE=%BIN_DIR%\runtil.log -set FUZZER_LOG=%BIN_DIR%\fuzzer.log -set FUZZER_DIR=%BIN_DIR%\fuzzer -set SAVE_DIR=%FUZZER_DIR%\save -set BASELINE=%FUZZER_DIR%\fuzzer.log - -if exist %FUZZER_DIR% rmdir /s /q %FUZZER_DIR% - -mkdir %FUZZER_DIR% -mkdir %SAVE_DIR% - for /L %%i in (%START_MOVE%, %STEP_SIZE%, %FINAL_MOVE%) do ( call runtill.bat %%i diff --git a/win/win32/scripts/fuzzer/runtill.bat b/win/win32/scripts/fuzzer/runtill.bat index cdbd954f3..ebb5aa4b6 100644 --- a/win/win32/scripts/fuzzer/runtill.bat +++ b/win/win32/scripts/fuzzer/runtill.bat @@ -18,11 +18,9 @@ set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game set LOG_FILE=%BIN_DIR%\runtil.log set FUZZER_LOG=%BIN_DIR%\fuzzer.log set FUZZER_DIR=%BIN_DIR%\fuzzer -set SAVE_DIR=%FUZZER_DIR%\save set BASELINE=%FUZZER_DIR%\fuzzer.log if not exist %FUZZER_DIR% mkdir %FUZZER_DIR% -if not exist %SAVE_DIR% mkdir %SAVE_DIR% call clean.bat @@ -30,7 +28,6 @@ if not exist %FUZZER_DIR%\%SAVED_GAME% ( %BIN_DIR%\nethack -D -F 0 copy %BIN_DIR%\%SAVED_GAME% %FUZZER_DIR% - copy %BIN_DIR%\%SAVED_GAME% %SAVE_DIR%\0.save ) call restore.bat @@ -71,7 +68,6 @@ if ERRORLEVEL 1 ( del /q %FUZZER_DIR%\%SAVED_GAME% copy %BIN_DIR%\%SAVED_GAME% %FUZZER_DIR% -copy %BIN_DIR%\%SAVED_GAME% %SAVE_DIR%\!STOP_MOVE!.save echo !START_MOVE! to !STOP_MOVE!. echo SUCCESS. From 5d2181ced35a19cca76b97d2cf11a0d84465100b Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:10:27 -0700 Subject: [PATCH 091/296] Revert "Fix build issue on linux." This reverts commit d33160d069c00e26de902e48c2bfda2de2eeeb3d. --- src/allmain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/allmain.c b/src/allmain.c index 957c47a44..cde2ef9a2 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -4,7 +4,7 @@ /* NetHack may be freely redistributed. See license for details. */ /* various code that was replicated in *main.c */ -#define NEED_VARARGS + #include "hack.h" #include From 4c1c247028fb42eed9f9b460f5c75996a70a98a0 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:10:39 -0700 Subject: [PATCH 092/296] Revert "Fuzzer improvements." This reverts commit 435f1c46267a194e44f0b75c7348be5a900d8ede. --- include/decl.h | 4 - include/extern.h | 9 -- include/flag.h | 4 - src/allmain.c | 131 -------------------------- src/hacklib.c | 12 +-- src/restore.c | 2 - src/rnd.c | 29 +----- src/save.c | 14 +-- sys/winnt/nttty.c | 10 +- sys/winnt/windmain.c | 19 +--- win/win32/scripts/fuzzer/clean.bat | 8 -- win/win32/scripts/fuzzer/longtest.bat | 23 ----- win/win32/scripts/fuzzer/restore.bat | 7 -- win/win32/scripts/fuzzer/runtill.bat | 73 -------------- 14 files changed, 8 insertions(+), 337 deletions(-) delete mode 100644 win/win32/scripts/fuzzer/clean.bat delete mode 100644 win/win32/scripts/fuzzer/longtest.bat delete mode 100644 win/win32/scripts/fuzzer/restore.bat delete mode 100644 win/win32/scripts/fuzzer/runtill.bat diff --git a/include/decl.h b/include/decl.h index 711ba614e..834b14ab8 100644 --- a/include/decl.h +++ b/include/decl.h @@ -462,10 +462,6 @@ struct ptr_array { }; typedef struct ptr_array ptr_array_t; -/* logging verbosity levels */ -#define LOG_MINIMAL 0 -#define LOG_VERBOSE 1 - #undef E #endif /* DECL_H */ diff --git a/include/extern.h b/include/extern.h index 3c74bfda0..d2ed2ff9e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -27,13 +27,6 @@ E void NDECL(newgame); E void FDECL(welcome, (BOOLEAN_P)); E time_t NDECL(get_realtime); E int FDECL(argcheck, (int, char **, enum earlyarg)); -E void NDECL(fuzzer_start); -E void NDECL(fuzzer_stop); -E void NDECL(fuzzer_toggle); -E void VDECL(fuzzer_log, (int, const char *, ...)) PRINTF_F(2, 3); -E void NDECL(fuzzer_check); -E void NDECL(fuzzer_auto_start); -E boolean FDECL(fuzzer_msg_history, (const char *)); /* ### apply.c ### */ @@ -957,7 +950,6 @@ E boolean FDECL(fuzzymatch, (const char *, const char *, const char *, BOOLEAN_P)); E void FDECL(init_random, (int FDECL((*fn), (int)))); E void FDECL(reseed_random, (int FDECL((*fn), (int)))); -E void FDECL(set_random, (unsigned long, int FDECL((*fn), (int)))); E time_t NDECL(getnow); E int NDECL(getyear); #if 0 @@ -2169,7 +2161,6 @@ E int FDECL(rnd, (int)); E int FDECL(d, (int, int)); E int FDECL(rne, (int)); E int FDECL(rnz, (int)); -E unsigned long NDECL(rul); /* ### role.c ### */ diff --git a/include/flag.h b/include/flag.h index 50f76c457..3ea3ada26 100644 --- a/include/flag.h +++ b/include/flag.h @@ -447,10 +447,6 @@ struct instance_flags { chosen_windowport[], but do not switch to it in the midst of options processing */ boolean obsolete; /* obsolete options can point at this, it isn't used */ - boolean fuzzer_auto_start; /* start fuzzer automatically */ - int fuzzer_stop_and_save; /* move when fuzzer stops and saves game */ - boolean fuzzer_saving; /* fuzzer is saving game */ - int verbose_logging_start; /* move when verbose fuzzer logging starts */ }; /* diff --git a/src/allmain.c b/src/allmain.c index cde2ef9a2..082447b3b 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -436,8 +436,6 @@ boolean resuming; #ifdef MAIL ckmailstatus(); #endif - fuzzer_check(); - rhack((char *) 0); } if (u.utotype) /* change dungeon level */ @@ -585,8 +583,6 @@ newgame() { int i; - fuzzer_auto_start(); - #ifdef MFLOPPY gameDiskPrompt(); #endif @@ -926,131 +922,4 @@ const char *opts; #endif return; } - -static FILE * g_fuzzer_log_file = NULL; -static int g_fuzzer_log_level = LOG_MINIMAL; - -/* fuzzer_start() starts the fuzzer opening the fuzzer log file */ -void -fuzzer_start() -{ - if (!iflags.debug_fuzzer) { - const char * fq_replay; - - iflags.debug_fuzzer = TRUE; - iflags.fuzzer_auto_start = FALSE; - - nhassert(g_fuzzer_log_file == NULL); - fq_replay = fqname("fuzzer.log", SAVEPREFIX, 0); - - g_fuzzer_log_file = fopen(fq_replay, "w"); - } -} - -/* fuzzer_stop() stops the fuzzer and close the fuzzer log file */ -void -fuzzer_stop() -{ - if (iflags.debug_fuzzer) { - if(g_fuzzer_log_file != NULL) { - fclose(g_fuzzer_log_file); - g_fuzzer_log_file = NULL; - } - } -} - -/* fuzzer_toggle() toggles fuzzer state */ -void -fuzzer_toggle() -{ - if (iflags.debug_fuzzer) - fuzzer_stop(); - else - fuzzer_start(); -} - -/* fuzzer_log() is used to place messages in the file 'fuzzer.log'. This - * log is the primary tool for monitoring fuzzer activity and tracking down - * issues that the fuzzer is able to reproduce. - */ -void -fuzzer_log -VA_DECL2(int, level, const char *, str) -{ - VA_START(str); - VA_INIT(str, char *); - - if (!g_fuzzer_log_file) - return; - - if (iflags.verbose_logging_start != 0 && moves >= iflags.verbose_logging_start) - g_fuzzer_log_level = LOG_VERBOSE; - - if (level <= g_fuzzer_log_level) - Vfprintf(g_fuzzer_log_file, str, VA_ARGS); - - VA_END(); -} - -/* fuzzer_check() is called prior to rhack(0) to allow the fuzzer to - * check if it should stop and to allow it to reseed the game. - */ -void -fuzzer_check() -{ - if (iflags.debug_fuzzer) - { - if (moves >= iflags.fuzzer_stop_and_save) { - iflags.fuzzer_saving = TRUE; - dosave0(); - exit_nhwindows("Goodbye from the fuzzer..."); - fuzzer_stop(); - nh_terminate(EXIT_SUCCESS); - } - - unsigned long seed = rul(); - set_random(seed, rn2); - fuzzer_log(LOG_MINIMAL, "SEED:%ld:%lu\n", moves, seed); - - } -} - -/* fuzzer_auto_start is called when creating a new game to allow - * the fuzzer to start itself. - */ -void -fuzzer_auto_start() -{ - if (iflags.fuzzer_auto_start) { - nhassert(!iflags.debug_fuzzer); - fuzzer_start(); - unsigned long seed = rul(); - set_random(seed, rn2); - fuzzer_log(LOG_MINIMAL, "START:%ld:%lu\n", moves, seed); - } -} - -/* fuzzer_msg_history is called during save file recovery to allow - * the fuzzer to snoop the messages being recovered. The fuzzer - * saves a seed as a message in save files and this is the mechanism - * used to recover that seed if the fuzzer is being auto started. - */ -boolean -fuzzer_msg_history(msg) - const char * msg; -{ - long saved_moves; - unsigned long saved_seed; - if (sscanf(msg, "SEED:%ld:%lu", &saved_moves, &saved_seed) == 2) { - nhassert(saved_moves == moves); - if (iflags.fuzzer_auto_start) { - fuzzer_start(); - set_random(saved_seed, rn2); - fuzzer_log(LOG_MINIMAL, "START:%ld:%lu\n", moves, saved_seed); - } - return TRUE; - } - - return FALSE; -} /*allmain.c*/ diff --git a/src/hacklib.c b/src/hacklib.c index 1f43325df..9fe316517 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -854,7 +854,7 @@ STATIC_DCL struct tm *NDECL(getlt); /* Sets the seed for the random number generator */ #ifdef USE_ISAAC64 -void +static void set_random(seed, fn) unsigned long seed; int FDECL((*fn), (int)); @@ -865,7 +865,7 @@ int FDECL((*fn), (int)); #else /* USE_ISAAC64 */ /*ARGSUSED*/ -void +static void set_random(seed, fn) unsigned long seed; int FDECL((*fn), (int)) UNUSED; @@ -917,7 +917,7 @@ int FDECL((*fn), (int)); { /* only reseed if we are certain that the seed generation is unguessable * by the players. */ - if (has_strong_rngseed && !iflags.debug_fuzzer) + if (has_strong_rngseed) init_random(fn); } @@ -1108,9 +1108,6 @@ phase_of_the_moon() /* 0-7, with 0: new, 4: full */ register struct tm *lt = getlt(); register int epact, diy, goldn; - if(iflags.debug_fuzzer) - return rn2(8); - diy = lt->tm_yday; goldn = (lt->tm_year % 19) + 1; epact = (11 * goldn + 18) % 30; @@ -1125,9 +1122,6 @@ friday_13th() { register struct tm *lt = getlt(); - if(iflags.debug_fuzzer) - return rn2(30); - /* tm_wday (day of week; 0==Sunday) == 5 => Friday */ return (boolean) (lt->tm_wday == 5 && lt->tm_mday == 13); } diff --git a/src/restore.c b/src/restore.c index 7d1f6d894..b6126a227 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1231,8 +1231,6 @@ register int fd; panic("restore_msghistory: msg too big (%d)", msgsize); mread(fd, (genericptr_t) msg, msgsize); msg[msgsize] = '\0'; - if(fuzzer_msg_history(msg)) - continue; putmsghistory(msg, TRUE); ++msgcount; } diff --git a/src/rnd.c b/src/rnd.c index 5473be949..0ca649fbb 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -56,21 +56,10 @@ int FDECL((*fn), (int)); (int) sizeof seed); } -unsigned long -rul() -{ - unsigned long value; - - value = (unsigned long) isaac64_next_uint64(&rnglist[CORE].rng_state); - fuzzer_log(LOG_VERBOSE, "RANDOM:%llu\n", value); - - return value; -} - static int RND(int x) { - return (rul() % x); + return (isaac64_next_uint64(&rnglist[CORE].rng_state) % x); } /* 0 <= rn2(x) < x, but on a different sequence from the "main" rn2; @@ -80,8 +69,6 @@ int rn2_on_display_rng(x) register int x; { - if (iflags.debug_fuzzer) - return rn2(x); return (isaac64_next_uint64(&rnglist[DISP].rng_state) % x); } @@ -107,20 +94,6 @@ register int x; seed *= 2739110765; return (int)((seed >> 16) % (unsigned)x); } - -unsigned long -rul() -{ -#if defined(LINT) && defined(UNIX) - return (unsigned long) rand(); -#else /* LINT */ -#if defined(UNIX) || defined(RANDOM) - return (unsigned long) Rand(); -#else - return (unsigned long) (Rand() >> 3); -#endif /* defined(UNIX) || defined(RANDOM) */ -#endif /* LINT */ -} #endif /* USE_ISAAC64 */ /* 0 <= rn2(x) < x */ diff --git a/src/save.c b/src/save.c index e931eae76..e0af4b8d2 100644 --- a/src/save.c +++ b/src/save.c @@ -139,7 +139,7 @@ dosave0() return 0; #endif - HUP if (!iflags.debug_fuzzer && iflags.window_inited) { + HUP if (iflags.window_inited) { nh_uncompress(fq_save); fd = open_savefile(); if (fd > 0) { @@ -1238,18 +1238,6 @@ int fd, mode; bwrite(fd, (genericptr_t) msg, msglen); ++msgcount; } - /* If the fuzzer is stopping and saving, save a seed as a message. - In 3.7, we will modify the save file format and save the seed - directly in the saved game state. */ - if (iflags.fuzzer_saving) { - char message[BUFSIZ]; - unsigned long seed = rul(); - sprintf(message, "SEED:%ld:%lu", moves, seed); - fuzzer_log(LOG_MINIMAL, "STOP:%ld:%lu\n", moves, seed); - msglen = strlen(message); - bwrite(fd, (genericptr_t) &msglen, sizeof msglen); - bwrite(fd, (genericptr_t) message, msglen); - } bwrite(fd, (genericptr_t) &minusone, sizeof (int)); } debugpline1("Stored %d messages into savefile.", msgcount); diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index 4cca4dcbd..a8000bc05 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -475,14 +475,8 @@ int *x, *y, *mod; coord cc; DWORD count; really_move_cursor(); - if (iflags.debug_fuzzer) { - int poskey = randomkey(); - if (poskey == 0) { - *x = rn2(console.width); - *y = rn2(console.height); - } - return poskey; - } + if (iflags.debug_fuzzer) + return randomkey(); ch = (program_state.done_hup) ? '\033' : keyboard_handler.pCheckInput( diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index d1712ffe4..b2bb18e79 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -336,7 +336,7 @@ attempt_restore: resuming = TRUE; /* not starting new game */ if (discover) You("are in non-scoring discovery mode."); - if ((discover || wizard) && !iflags.fuzzer_auto_start) { + if (discover || wizard) { if (yn("Do you want to keep the save file?") == 'n') (void) delete_savefile(); else { @@ -461,23 +461,6 @@ char *argv[]; case 'X': discover = TRUE, wizard = FALSE; break; - case 'F': - { - iflags.fuzzer_auto_start = 1; - - if (argc > 1 && argv[1][0] != '-') { - argc--; - argv++; - iflags.fuzzer_stop_and_save = atoi(*argv); - - if (argc > 1 && argv[1][0] != '-') { - argc--; - argv++; - iflags.verbose_logging_start = atoi(*argv); - } - } - } - break; #ifdef NEWS case 'n': iflags.news = FALSE; diff --git a/win/win32/scripts/fuzzer/clean.bat b/win/win32/scripts/fuzzer/clean.bat deleted file mode 100644 index a02c48739..000000000 --- a/win/win32/scripts/fuzzer/clean.bat +++ /dev/null @@ -1,8 +0,0 @@ -set BIN_DIR=..\..\..\..\bin\Debug\Win32 - -set FUZZER_LOG=%BIN_DIR%\fuzzer.log -set FUZZER_DIR=%BIN_DIR%\fuzzer - -if exist %BIN_DIR%\%USERNAME%* del %BIN_DIR%\%USERNAME%* -if exist %FUZZER_LOG% del %FUZZER_LOG% - diff --git a/win/win32/scripts/fuzzer/longtest.bat b/win/win32/scripts/fuzzer/longtest.bat deleted file mode 100644 index e5e8d1529..000000000 --- a/win/win32/scripts/fuzzer/longtest.bat +++ /dev/null @@ -1,23 +0,0 @@ -echo off - -SETLOCAL ENABLEEXTENSIONS -SETLOCAL ENABLEDELAYEDEXPANSION - -set STEP_SIZE=5000 -set FINAL_MOVE=500000 -set START_MOVE=5000 - -for /L %%i in (%START_MOVE%, %STEP_SIZE%, %FINAL_MOVE%) do ( - - call runtill.bat %%i - - if ERRORLEVEL 1 ( - echo FAILED getting running to %%i. - exit /b 1 - ) - -) - -echo SUCCESS. - - diff --git a/win/win32/scripts/fuzzer/restore.bat b/win/win32/scripts/fuzzer/restore.bat deleted file mode 100644 index 9752fed96..000000000 --- a/win/win32/scripts/fuzzer/restore.bat +++ /dev/null @@ -1,7 +0,0 @@ -call clean.bat - -set BIN_DIR=..\..\..\..\bin\Debug\Win32 -set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game -set FUZZER_DIR=%BIN_DIR%\fuzzer - -copy %FUZZER_DIR%\%SAVED_GAME% %BIN_DIR%\%SAVED_GAME% diff --git a/win/win32/scripts/fuzzer/runtill.bat b/win/win32/scripts/fuzzer/runtill.bat deleted file mode 100644 index ebb5aa4b6..000000000 --- a/win/win32/scripts/fuzzer/runtill.bat +++ /dev/null @@ -1,73 +0,0 @@ -REM -REM runtill target_move -REM -echo off - -SETLOCAL ENABLEEXTENSIONS -SETLOCAL ENABLEDELAYEDEXPANSION - -set TARGET_MOVE=%1 - -if %TARGET_MOVE% == "" ( - echo Usage:runtill target_move - goto :eof -) - -set BIN_DIR=..\..\..\..\bin\Debug\Win32 -set SAVED_GAME=%USERNAME%-wizard.NetHack-saved-game -set LOG_FILE=%BIN_DIR%\runtil.log -set FUZZER_LOG=%BIN_DIR%\fuzzer.log -set FUZZER_DIR=%BIN_DIR%\fuzzer -set BASELINE=%FUZZER_DIR%\fuzzer.log - -if not exist %FUZZER_DIR% mkdir %FUZZER_DIR% - -call clean.bat - -if not exist %FUZZER_DIR%\%SAVED_GAME% ( - %BIN_DIR%\nethack -D -F 0 - - copy %BIN_DIR%\%SAVED_GAME% %FUZZER_DIR% -) - -call restore.bat - -%BIN_DIR%\nethack -D -F %TARGET_MOVE% - -move %BIN_DIR%\*.snap %BIN_DIR%\snapshots -copy %FUZZER_LOG% %BASELINE% - -for /f "tokens=2,3 delims=: usebackq" %%i in (`findstr /c:START %BASELINE%`) do ( - set START_SEED=%%j - set START_MOVE=%%i -) - -for /f "tokens=2,3 delims=: usebackq" %%i in (`findstr /c:STOP %BASELINE%`) do ( - set STOP_SEED=%%j - set STOP_MOVE=%%i -) - -if !STOP_MOVE! LSS %TARGET_MOVE% ( - cls - echo FAILED: Failed to reach target move. !STOP_MOVE! is not GTE %TARGET_MOVE%. - exit /b 1 -) - -call restore.bat - -%BIN_DIR%\nethack -D -F %TARGET_MOVE% - -fc %FUZZER_LOG% %BASELINE% - -if ERRORLEVEL 1 ( - cls - echo FAILED: Unable to reproduce same timeline - exit /b 1 -) - -del /q %FUZZER_DIR%\%SAVED_GAME% - -copy %BIN_DIR%\%SAVED_GAME% %FUZZER_DIR% - -echo !START_MOVE! to !STOP_MOVE!. -echo SUCCESS. From 454419e6c10a8dc8d220d3615a8554f27eeb217b Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:10:51 -0700 Subject: [PATCH 093/296] Revert "Removed the older version of tty_putmsghistory and tty_getmsghistory." This reverts commit aa95e20ca7cbb2a90f8076f04410886c0733dc74. --- win/tty/topl.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/win/tty/topl.c b/win/tty/topl.c index db151265f..b19bc0700 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -617,6 +617,115 @@ boolean purged; /* True: took history's pointers, False: just cloned them */ } } +#if 0 +/* + * This is called by the core save routines. + * Each time we are called, we return one string from the + * message history starting with the oldest message first. + * When none are left, we return a final null string. + * + * History is collected at the time of the first call. + * Any new messages issued after that point will not be + * included among the output of the subsequent calls. + */ +char * +tty_getmsghistory(init) +boolean init; +{ + static int nxtidx; + char *nextmesg; + char *result = 0; + + if (init) { + msghistory_snapshot(FALSE); + nxtidx = 0; + } + + if (snapshot_mesgs) { + nextmesg = snapshot_mesgs[nxtidx++]; + if (nextmesg) { + result = (char *) nextmesg; + } else { + free_msghistory_snapshot(FALSE); + } + } + return result; +} + +/* + * This is called by the core savefile restore routines. + * Each time we are called, we stuff the string into our message + * history recall buffer. The core will send the oldest message + * first (actually it sends them in the order they exist in the + * save file, but that is supposed to be the oldest first). + * These messages get pushed behind any which have been issued + * since this session with the program has been started, since + * they come from a previous session and logically precede + * anything (like "Restoring save file...") that's happened now. + * + * Called with a null pointer to finish up restoration. + * + * It's also called by the quest pager code when a block message + * has a one-line summary specified. We put that line directly + * into message history for ^P recall without having displayed it. + */ +void +tty_putmsghistory(msg, restoring_msghist) +const char *msg; +boolean restoring_msghist; +{ + static boolean initd = FALSE; + int idx; +#ifdef DUMPLOG + extern unsigned saved_pline_index; /* pline.c */ +#endif + + if (restoring_msghist && !initd) { + /* we're restoring history from the previous session, but new + messages have already been issued this session ("Restoring...", + for instance); collect current history (ie, those new messages), + and also clear it out so that nothing will be present when the + restored ones are being put into place */ + msghistory_snapshot(TRUE); + initd = TRUE; +#ifdef DUMPLOG + /* this suffices; there's no need to scrub saved_pline[] pointers */ + saved_pline_index = 0; +#endif + } + + if (msg) { + /* Caller is asking us to remember a top line that needed more. + Should we call more? This can happen when the player has set + iflags.force_invmenu and they attempt to shoot with nothing in + the quiver. */ + if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) + ttyDisplay->toplin = TOPLINE_NON_EMPTY; + + /* move most recent message to history, make this become most recent */ + remember_topl(); + Strcpy(toplines, msg); +#ifdef DUMPLOG + dumplogmsg(toplines); +#endif + } else if (snapshot_mesgs) { + nhassert(ttyDisplay == NULL || + ttyDisplay->toplin != TOPLINE_NEED_MORE); + + /* done putting arbitrary messages in; put the snapshot ones back */ + for (idx = 0; snapshot_mesgs[idx]; ++idx) { + remember_topl(); + Strcpy(toplines, snapshot_mesgs[idx]); +#ifdef DUMPLOG + dumplogmsg(toplines); +#endif + } + /* now release the snapshot */ + free_msghistory_snapshot(TRUE); + initd = FALSE; /* reset */ + } +} +#else STATIC_OVL ptr_array_t * get_message_history() { @@ -810,6 +919,7 @@ boolean restoring_msghist; } } +#endif #endif /* TTY_GRAPHICS */ From 9bc190d2fcf9463b17c65d19fe0b242d3c5afa2a Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:11:41 -0700 Subject: [PATCH 094/296] Revert "Add stopping in the debugger when nhassert() is hit in the windows port." This reverts commit 5d2872dd4f24fb76f29bf34f6f950394910d6d33. --- sys/winnt/winnt.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 39978cab4..8d513c59e 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -718,19 +718,9 @@ nt_assert_failed(expression, filepath, line) { const char * filename; + /* get file name from path */ filename = strrchr(filepath, '\\'); filename = (filename == NULL ? filepath : filename + 1); - - if (IsDebuggerPresent()) { - char message[BUFSIZ]; - snprintf(message, sizeof(message), - "nhassert(%s) failed in file '%s' at line %d", - expression, filename, line); - OutputDebugStringA(message); - DebugBreak(); - } - - /* get file name from path */ impossible("nhassert(%s) failed in file '%s' at line %d", expression, filename, line); } From 1c5b28e7f9a23707a60b7e952ee61b43e9d548a2 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:12:21 -0700 Subject: [PATCH 095/296] Revert "Re-worked tty_putmsgistory and tty_getmsghistory." This reverts commit 1d0b8b4680512a85a045006b3adf7fe65100f1bd. --- win/tty/topl.c | 196 ------------------------------------------------- 1 file changed, 196 deletions(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index b19bc0700..74331dece 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -617,7 +617,6 @@ boolean purged; /* True: took history's pointers, False: just cloned them */ } } -#if 0 /* * This is called by the core save routines. * Each time we are called, we return one string from the @@ -725,201 +724,6 @@ boolean restoring_msghist; initd = FALSE; /* reset */ } } -#else -STATIC_OVL ptr_array_t * -get_message_history() -{ - char *mesg; - int i; - struct WinDesc *cw; - size_t max_length; - ptr_array_t * a; - - nhassert(WIN_MESSAGE != WIN_ERR); - nhassert(wins[WIN_MESSAGE] != NULL); - - /* paranoia (too early or too late panic save attempt?) */ - if (WIN_MESSAGE == WIN_ERR || !wins[WIN_MESSAGE]) - return NULL; - - cw = wins[WIN_MESSAGE]; - - max_length = cw->rows; - - if (*toplines) max_length++; - - a = ptr_array_new(max_length); - - nhassert(cw->maxrow <= cw->rows); - for (i = 0; i < cw->rows; ++i) { - mesg = cw->data[(i + cw->maxrow) % cw->rows]; - if (mesg && *mesg) - a->elements[a->length++] = strdup(mesg); - } - if (*toplines) - a->elements[a->length++] = strdup(toplines); - - return a; -} - -STATIC_OVL void -purge_message_history() -{ - int i; - struct WinDesc *cw; - - nhassert(WIN_MESSAGE != WIN_ERR); - nhassert(wins[WIN_MESSAGE] != NULL); - - cw = wins[WIN_MESSAGE]; - - *toplines = '\0'; - - for (i = 0; i < cw->rows; ++i) { - if (cw->data[i]) { - free(cw->data[i]); - cw->data[i] = (char *) 0; - cw->datlen[i] = 0; - } - } - - cw->maxcol = cw->maxrow = 0; -} - -/* - * This is called by the core save routines. - * Each time we are called, we return one string from the - * message history starting with the oldest message first. - * When none are left, we return a final null string. - * - * History is collected at the time of the first call. - * Any new messages issued after that point will not be - * included among the output of the subsequent calls. - */ -char * -tty_getmsghistory(init) -boolean init; -{ - static size_t nxtidx; - static ptr_array_t * saved_messages = NULL; - char *result = NULL; - - if (init) { - nhassert(saved_messages == NULL); - saved_messages = get_message_history(); - nxtidx = 0; - wins[WIN_MESSAGE]->flags |= WIN_LOCKHISTORY; - } - - if (saved_messages) { - if (nxtidx < saved_messages->length) - result = saved_messages->elements[nxtidx++]; - - if (result == NULL) { - ptr_array_free(saved_messages); - saved_messages = NULL; - wins[WIN_MESSAGE]->flags &= ~WIN_LOCKHISTORY; - } - } - return result; -} - -/* - * This is called by the core savefile restore routines. - * Each time we are called, we stuff the string into our message - * history recall buffer. The core will send the oldest message - * first (actually it sends them in the order they exist in the - * save file, but that is supposed to be the oldest first). - * These messages get pushed behind any which have been issued - * since this session with the program has been started, since - * they come from a previous session and logically precede - * anything (like "Restoring save file...") that's happened now. - * - * Called with a null pointer to finish up restoration. - * - * It's also called by the quest pager code when a block message - * has a one-line summary specified. We put that line directly - * into message history for ^P recall without having displayed it. - */ -void -tty_putmsghistory(msg, restoring_msghist) -const char *msg; -boolean restoring_msghist; -{ - static boolean initd = FALSE; - static ptr_array_t * saved_messages = NULL; - size_t i; -#ifdef DUMPLOG - extern unsigned saved_pline_index; /* pline.c */ -#endif - - nhassert(!(wins[WIN_MESSAGE]->flags & WIN_LOCKHISTORY)); - - if (restoring_msghist && !initd) { - /* we're restoring history from the previous session, but new - messages have already been issued this session ("Restoring...", - for instance); collect current history (ie, those new messages), - and also clear it out so that nothing will be present when the - restored ones are being put into place */ - nhassert(saved_messages == NULL); - saved_messages = get_message_history(); - purge_message_history(); - initd = TRUE; -#ifdef DUMPLOG - /* this suffices; there's no need to scrub saved_pline[] pointers */ - saved_pline_index = 0; -#endif - } - - if (msg) { - /* Caller is asking us to remember a top line that needed more. - Should we call more? This can happen when the player has set - iflags.force_invmenu and they attempt to shoot with nothing in - the quiver. */ - if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) - ttyDisplay->toplin = TOPLINE_NON_EMPTY; - - /* move most recent message to history, make this become most recent */ - remember_topl(); - Strcpy(toplines, msg); -#ifdef DUMPLOG - dumplogmsg(toplines); -#endif - return; - } - - /* tty_putmsghistory() is called with msg==NULL to indidate that - * we are finished restoring the message history. If we saved - * some message history when we started, its time now to appened - * those saved messages. - * - * We don't otherwise expect to get called with msg==NULL. - * - */ - nhassert(restoring_msghist && initd); - - if (initd && restoring_msghist) { - if (saved_messages) { - nhassert(ttyDisplay == NULL || - ttyDisplay->toplin != TOPLINE_NEED_MORE); - - for (i = 0; ilength; i++) { - const char * mesg = saved_messages->elements[i]; - remember_topl(); - nhassert(mesg); - Strcpy(toplines, mesg); -#ifdef DUMPLOG - dumplogmsg(toplines); -#endif - } - ptr_array_free(saved_messages); - saved_messages = NULL; - } - initd = FALSE; - } - -} -#endif #endif /* TTY_GRAPHICS */ From f7c956c35a20b0c316e3268762be991cb70c37dc Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:12:59 -0700 Subject: [PATCH 096/296] Revert "Adding ptr_array data structure." This reverts commit e665d3b85024e3a7580e80888a70b47d5ae9384c. --- include/decl.h | 7 ------- include/extern.h | 2 -- src/hacklib.c | 34 ---------------------------------- 3 files changed, 43 deletions(-) diff --git a/include/decl.h b/include/decl.h index 834b14ab8..5ebaa326e 100644 --- a/include/decl.h +++ b/include/decl.h @@ -455,13 +455,6 @@ struct early_opt { boolean valallowed; }; -struct ptr_array { - size_t length; - size_t max_length; - void ** elements; -}; -typedef struct ptr_array ptr_array_t; - #undef E #endif /* DECL_H */ diff --git a/include/extern.h b/include/extern.h index d2ed2ff9e..abea20a68 100644 --- a/include/extern.h +++ b/include/extern.h @@ -968,8 +968,6 @@ E void FDECL(strbuf_append, (strbuf_t *, const char *)); E void FDECL(strbuf_reserve, (strbuf_t *, int)); E void FDECL(strbuf_empty, (strbuf_t *)); E void FDECL(strbuf_nl_to_crlf, (strbuf_t *)); -E struct ptr_array * FDECL(ptr_array_new, (size_t length)); -E void FDECL(ptr_array_free, (struct ptr_array *)); /* ### invent.c ### */ diff --git a/src/hacklib.c b/src/hacklib.c index 9fe316517..b97a78a65 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -1223,38 +1223,4 @@ strbuf_t *strbuf; } } -ptr_array_t * -ptr_array_new(max_length) - size_t max_length; -{ - size_t esize = max_length * sizeof(void *); - ptr_array_t * a = (ptr_array_t *) malloc(sizeof(ptr_array_t) + esize); - a->elements = (void **)(a + 1); - a->length = 0; - a->max_length = max_length; - memset(a->elements, 0, esize); - return a; -} - -void -ptr_array_free(a) - ptr_array_t * a; -{ - size_t i; - - nhassert(a->length <= a->max_length); - - for(i = 0; i < a->length; i++) - if(a->elements[i]) - free(a->elements[i]); - - for (i = a->length; i < a->max_length; i++) { - nhassert(a->elements[i] == NULL); - if(a->elements[i]) - free(a->elements[i]); - } - - free(a); -} - /*hacklib.c*/ From 2df1b179ca0498b4a4fe2d3996a4f4282c13ef93 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:13:18 -0700 Subject: [PATCH 097/296] Revert "Removing assertion that does not hold under all scenarios." This reverts commit c44ad5645d90267e7ed1d1a6c57acc1437dca10e. --- win/tty/topl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index 74331dece..cfd17838d 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -259,7 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - /* nhassert((long) strlen(toplines) == cw->curx); */ + nhassert((long) strlen(toplines) == cw->curx); Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; From ec05e1ec70f956cecdf23ebfefc81ef2f22f8ce8 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:13:43 -0700 Subject: [PATCH 098/296] Revert "Fix compiler warnings." This reverts commit 90f5aa91b794ad333fc04693677d0a7a9d8ca18e. --- src/dungeon.c | 3 +-- src/sp_lev.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dungeon.c b/src/dungeon.c index 0e483a11d..27b748104 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -2409,8 +2409,7 @@ recalc_mapseen() struct monst *mtmp; struct cemetery *bp, **bonesaddr; unsigned i, ridx; - int x, y, ltyp, count; - unsigned int atmp; + int x, y, ltyp, count, atmp; /* Should not happen in general, but possible if in the process * of being booted from the quest. The mapseen object gets diff --git a/src/sp_lev.c b/src/sp_lev.c index b2206ae70..dbab1dfdc 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3763,7 +3763,7 @@ struct opvar *mc; { int x, y; schar mapc; - uchar lit; + xchar lit; struct opvar *ret = selection_opvar((char *) 0); if (!ov || !mc || !ret) From 177bd39646bcfbdcf9c10783fc9066ff15631464 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:15:01 -0700 Subject: [PATCH 099/296] Revert "Tweaks to nhassert implementation. Change to warnings on MSC build." This reverts commit 2f3da35c6893d2a44e8281ae209f00d54eefa2f2. --- include/extern.h | 2 +- include/global.h | 2 +- include/ntconf.h | 12 ------------ src/pline.c | 15 ++------------- sys/winnt/winnt.c | 17 ----------------- 5 files changed, 4 insertions(+), 44 deletions(-) diff --git a/include/extern.h b/include/extern.h index abea20a68..5812366f2 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1932,7 +1932,7 @@ E void VDECL(verbalize, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2); -E void FDECL(nhassert_failed, (const char *, int)); +E void FDECL(nhassert_failed, (const char *, const char *, int)); /* ### polyself.c ### */ diff --git a/include/global.h b/include/global.h index 1bcc2ae5d..ada34523c 100644 --- a/include/global.h +++ b/include/global.h @@ -378,7 +378,7 @@ struct savefile_info { /* Supply nhassert macro if not supplied by port */ #ifndef nhassert #define nhassert(expression) (void)((!!(expression)) || \ - (nhassert_failed(__FILE__, __LINE__), 0)) + (nhassert_failed(#expression, __FILE__, __LINE__), 0)) #endif #endif /* GLOBAL_H */ diff --git a/include/ntconf.h b/include/ntconf.h index 0c76ed718..62c269bab 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -134,8 +134,6 @@ extern void NDECL(getlock); #ifndef HAS_STDINT_H #define HAS_STDINT_H /* force include of stdint.h in integer.h */ #endif -/* Turn on some additional warnings */ -#pragma warning(3:4389) #endif /* _MSC_VER */ /* The following is needed for prototypes of certain functions */ @@ -272,14 +270,4 @@ extern int FDECL(alternative_palette, (char *)); #define nethack_enter(argc, argv) nethack_enter_winnt() extern void FDECL(nethack_exit, (int)) NORETURN; extern boolean FDECL(file_exists, (const char *)); - -/* Override the default version of nhassert. The default version is unable - * to generate a string form of the expression due to the need to be - * compatible with compilers which do not support macro stringization (i.e. - * #x to turn x into its string form). - */ -extern void FDECL(nt_assert_failed, (const char *, const char *, int)); -#define nhassert(expression) (void)((!!(expression)) || \ - (nt_assert_failed(#expression, __FILE__, __LINE__), 0)) - #endif /* NTCONF_H */ diff --git a/src/pline.c b/src/pline.c index 91e825963..535b75e95 100644 --- a/src/pline.c +++ b/src/pline.c @@ -583,20 +583,9 @@ VA_DECL(const char *, str) } /* nhassert_failed is called when an nhassert's condition is false */ -void -nhassert_failed(filepath, line) - const char * filepath; - int line; +void nhassert_failed(const char * exp, const char * file, int line) { - const char * filename; - - /* attempt to get filename from path. TODO: we really need a port provided - * function to return a filename from a path */ - filename = strrchr(filepath, '/'); - filename = (filename == NULL ? strrchr(filepath, '\\') : filename); - filename = (filename == NULL ? filepath : filename + 1); - - impossible("nhassert failed in file '%s' at line %d", filename, line); + impossible("NHASSERT(%s) in '%s' at line %d", exp, file, line); } /*pline.c*/ diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 8d513c59e..0e19e1f76 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -708,23 +708,6 @@ sys_random_seed(VOID_ARGS) } return ourseed; } - -/* nt_assert_failed is called when an nhassert's condition is false */ -void -nt_assert_failed(expression, filepath, line) - const char * expression; - const char * filepath; - int line; -{ - const char * filename; - - /* get file name from path */ - filename = strrchr(filepath, '\\'); - filename = (filename == NULL ? filepath : filename + 1); - impossible("nhassert(%s) failed in file '%s' at line %d", - expression, filename, line); -} - #endif /* WIN32 */ /*winnt.c*/ From a90f9d4365802b0ead7f41b8cffb69e70aaaf676 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:15:31 -0700 Subject: [PATCH 100/296] Revert "Fixed sign/unsigned comparisions." This reverts commit 0e8e5aac93e660a001dccb66df7320023aaa36de. --- src/teleport.c | 4 ++-- win/tty/topl.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/teleport.c b/src/teleport.c index 0c8271845..100a74d3b 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -1143,10 +1143,10 @@ struct monst *mtmp; sent out of his room (caller might resort to goodpos() if we report failure here, so this isn't full prevention) */ if (mtmp->isshk && inhishop(mtmp)) { - if (levl[x][y].roomno != (unsigned char) ESHK(mtmp)->shoproom) + if (levl[x][y].roomno != ESHK(mtmp)->shoproom) return FALSE; } else if (mtmp->ispriest && inhistemple(mtmp)) { - if (levl[x][y].roomno != (unsigned char) EPRI(mtmp)->shroom) + if (levl[x][y].roomno != EPRI(mtmp)->shroom) return FALSE; } /* current location is */ diff --git a/win/tty/topl.c b/win/tty/topl.c index cfd17838d..bb79be26c 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -259,7 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - nhassert((long) strlen(toplines) == cw->curx); + nhassert(strlen(toplines) == cw->curx); Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; From fe9fc4cac15002a28af608e96045d0332c68f95a Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:15:54 -0700 Subject: [PATCH 101/296] Revert "Added nhassert to core." This reverts commit 0ca299acb3b52c90e65ad3ca3eb69ccfa8cceb97. --- include/extern.h | 1 - include/global.h | 5 ----- include/ntconf.h | 10 ++++++++++ src/pline.c | 6 ------ sys/winnt/winnt.c | 10 ++++++++++ win/tty/topl.c | 8 ++++---- win/tty/wintty.c | 6 +++--- 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/include/extern.h b/include/extern.h index 5812366f2..0761d224e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1932,7 +1932,6 @@ E void VDECL(verbalize, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(raw_printf, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(impossible, (const char *, ...)) PRINTF_F(1, 2); E void VDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2); -E void FDECL(nhassert_failed, (const char *, const char *, int)); /* ### polyself.c ### */ diff --git a/include/global.h b/include/global.h index ada34523c..6e0f96ebf 100644 --- a/include/global.h +++ b/include/global.h @@ -375,10 +375,5 @@ struct savefile_info { #define nethack_enter(argc, argv) ((void) 0) #endif -/* Supply nhassert macro if not supplied by port */ -#ifndef nhassert -#define nhassert(expression) (void)((!!(expression)) || \ - (nhassert_failed(#expression, __FILE__, __LINE__), 0)) -#endif #endif /* GLOBAL_H */ diff --git a/include/ntconf.h b/include/ntconf.h index 62c269bab..9d79006f0 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -267,6 +267,16 @@ extern int FDECL(set_win32_option, (const char *, const char *)); extern int FDECL(alternative_palette, (char *)); #endif +#ifdef NDEBUG +#define nhassert(expression) ((void)0) +#else +extern void FDECL(nhassert_failed, (const char * exp, const char * file, + int line)); + +#define nhassert(expression) (void)((!!(expression)) || \ + (nhassert_failed(#expression, __FILE__, __LINE__), 0)) +#endif + #define nethack_enter(argc, argv) nethack_enter_winnt() extern void FDECL(nethack_exit, (int)) NORETURN; extern boolean FDECL(file_exists, (const char *)); diff --git a/src/pline.c b/src/pline.c index 535b75e95..d7db3f43d 100644 --- a/src/pline.c +++ b/src/pline.c @@ -582,10 +582,4 @@ VA_DECL(const char *, str) #endif } -/* nhassert_failed is called when an nhassert's condition is false */ -void nhassert_failed(const char * exp, const char * file, int line) -{ - impossible("NHASSERT(%s) in '%s' at line %d", exp, file, line); -} - /*pline.c*/ diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 0e19e1f76..d54982975 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -475,6 +475,16 @@ char *buf; } #endif /* RUNTIME_PORT_ID */ +/* nhassert_failed is called when an nhassert's condition is false */ +void nhassert_failed(const char * exp, const char * file, int line) +{ + char message[BUFSZ]; + snprintf(message, sizeof(message), + "NHASSERT(%s) in '%s' at line %d", exp, file, line); + + impossible(message); +} + void nethack_exit(code) int code; diff --git a/win/tty/topl.c b/win/tty/topl.c index bb79be26c..14e9bc548 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -259,7 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - nhassert(strlen(toplines) == cw->curx); + /* nhassert(strlen(toplines) == cw->curx); */ Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; @@ -313,7 +313,7 @@ char c; if (ttyDisplay->curx == 0 && ttyDisplay->cury > 0) tty_curs(BASE_WINDOW, CO, (int) ttyDisplay->cury - 1); backsp(); - nhassert(ttyDisplay->curx > 0); + /* nhassert(ttyDisplay->curx > 0); */ ttyDisplay->curx--; cw->curx = ttyDisplay->curx; return; @@ -708,8 +708,8 @@ boolean restoring_msghist; dumplogmsg(toplines); #endif } else if (snapshot_mesgs) { - nhassert(ttyDisplay == NULL || - ttyDisplay->toplin != TOPLINE_NEED_MORE); + /* nhassert(ttyDisplay == NULL || + ttyDisplay->toplin != TOPLINE_NEED_MORE); */ /* done putting arbitrary messages in; put the snapshot ones back */ for (idx = 0; snapshot_mesgs[idx]; ++idx) { diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 63861d62b..6d5042f8e 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2321,7 +2321,7 @@ boolean blocking; /* with ttys, all windows are blocking */ more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(window); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } else ttyDisplay->toplin = TOPLINE_EMPTY; cw->curx = cw->cury = 0; @@ -2409,7 +2409,7 @@ winid window; case NHW_MESSAGE: if (ttyDisplay->toplin != TOPLINE_EMPTY) tty_display_nhwindow(WIN_MESSAGE, TRUE); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -3164,7 +3164,7 @@ const char *mesg; more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(WIN_MESSAGE); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } /* normally means skip further messages, but in this case it means cancel the current prompt; any other messages should From 04f4ac94cabb85b785e7544352ccbe6f167b7ecf Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:16:27 -0700 Subject: [PATCH 102/296] Revert "Comment out nhassert() calls." This reverts commit 45a9c5eb14326521188457fe87a9d853b44a64ce. --- win/tty/topl.c | 8 ++++---- win/tty/wintty.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index 14e9bc548..bb79be26c 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -259,7 +259,7 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - /* nhassert(strlen(toplines) == cw->curx); */ + nhassert(strlen(toplines) == cw->curx); Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; @@ -313,7 +313,7 @@ char c; if (ttyDisplay->curx == 0 && ttyDisplay->cury > 0) tty_curs(BASE_WINDOW, CO, (int) ttyDisplay->cury - 1); backsp(); - /* nhassert(ttyDisplay->curx > 0); */ + nhassert(ttyDisplay->curx > 0); ttyDisplay->curx--; cw->curx = ttyDisplay->curx; return; @@ -708,8 +708,8 @@ boolean restoring_msghist; dumplogmsg(toplines); #endif } else if (snapshot_mesgs) { - /* nhassert(ttyDisplay == NULL || - ttyDisplay->toplin != TOPLINE_NEED_MORE); */ + nhassert(ttyDisplay == NULL || + ttyDisplay->toplin != TOPLINE_NEED_MORE); /* done putting arbitrary messages in; put the snapshot ones back */ for (idx = 0; snapshot_mesgs[idx]; ++idx) { diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 6d5042f8e..63861d62b 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2321,7 +2321,7 @@ boolean blocking; /* with ttys, all windows are blocking */ more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(window); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); } else ttyDisplay->toplin = TOPLINE_EMPTY; cw->curx = cw->cury = 0; @@ -2409,7 +2409,7 @@ winid window; case NHW_MESSAGE: if (ttyDisplay->toplin != TOPLINE_EMPTY) tty_display_nhwindow(WIN_MESSAGE, TRUE); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -3164,7 +3164,7 @@ const char *mesg; more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(WIN_MESSAGE); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ + nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); } /* normally means skip further messages, but in this case it means cancel the current prompt; any other messages should From 988d474d426e8e8dace97475dcf8b31787c4a062 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:16:59 -0700 Subject: [PATCH 103/296] Revert "Added assertions to check toplin state." This reverts commit 1db45c8016484114841f39ffe70c8d9cdd1ad92c. --- win/tty/wintty.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 63861d62b..6d5042f8e 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2321,7 +2321,7 @@ boolean blocking; /* with ttys, all windows are blocking */ more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(window); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } else ttyDisplay->toplin = TOPLINE_EMPTY; cw->curx = cw->cury = 0; @@ -2409,7 +2409,7 @@ winid window; case NHW_MESSAGE: if (ttyDisplay->toplin != TOPLINE_EMPTY) tty_display_nhwindow(WIN_MESSAGE, TRUE); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -3164,7 +3164,7 @@ const char *mesg; more(); ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ tty_clear_nhwindow(WIN_MESSAGE); - nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } /* normally means skip further messages, but in this case it means cancel the current prompt; any other messages should From a598428fc9bdabf33d482855f8b5db4c78896a10 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:17:19 -0700 Subject: [PATCH 104/296] Revert "Fixed bug with inmore and toplin state management." This reverts commit 0f57f0e48ca6e6823fb238566d5faddd3cf0726b. --- win/tty/topl.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/win/tty/topl.c b/win/tty/topl.c index bb79be26c..d2a889cc9 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -139,7 +139,7 @@ const char *str; putsyms(str); cl_end(); ttyDisplay->toplin = TOPLINE_NEED_MORE; - if (ttyDisplay->cury && otoplin != TOPLINE_SPECIAL_PROMPT) + if (ttyDisplay->cury && otoplin != 3) more(); } @@ -204,15 +204,12 @@ more() { struct WinDesc *cw = wins[WIN_MESSAGE]; + /* avoid recursion -- only happens from interrupts */ + if (ttyDisplay->inmore++) + return; if (iflags.debug_fuzzer) return; - /* avoid recursion -- only happens from interrupts */ - if (ttyDisplay->inmore) - return; - - ttyDisplay->inmore++; - if (ttyDisplay->toplin) { tty_curs(BASE_WINDOW, cw->curx + 1, cw->cury); if (cw->curx >= CO - 8) @@ -259,7 +256,6 @@ register const char *bp; && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { - nhassert(strlen(toplines) == cw->curx); Strcat(toplines, " "); Strcat(toplines, bp); cw->curx += 2; @@ -313,7 +309,6 @@ char c; if (ttyDisplay->curx == 0 && ttyDisplay->cury > 0) tty_curs(BASE_WINDOW, CO, (int) ttyDisplay->cury - 1); backsp(); - nhassert(ttyDisplay->curx > 0); ttyDisplay->curx--; cw->curx = ttyDisplay->curx; return; @@ -694,13 +689,6 @@ boolean restoring_msghist; } if (msg) { - /* Caller is asking us to remember a top line that needed more. - Should we call more? This can happen when the player has set - iflags.force_invmenu and they attempt to shoot with nothing in - the quiver. */ - if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) - ttyDisplay->toplin = TOPLINE_NON_EMPTY; - /* move most recent message to history, make this become most recent */ remember_topl(); Strcpy(toplines, msg); @@ -708,9 +696,6 @@ boolean restoring_msghist; dumplogmsg(toplines); #endif } else if (snapshot_mesgs) { - nhassert(ttyDisplay == NULL || - ttyDisplay->toplin != TOPLINE_NEED_MORE); - /* done putting arbitrary messages in; put the snapshot ones back */ for (idx = 0; snapshot_mesgs[idx]; ++idx) { remember_topl(); From 44d84c3163988502e041a4c3aa178cadc54d5797 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:17:39 -0700 Subject: [PATCH 105/296] Revert "Modified nhassert_failed to call impossoible." This reverts commit 3e4a0759a37ec6fe62d026cdd02dadd0ec6f682d. --- sys/winnt/winnt.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index d54982975..e9041262d 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -478,11 +478,18 @@ char *buf; /* nhassert_failed is called when an nhassert's condition is false */ void nhassert_failed(const char * exp, const char * file, int line) { - char message[BUFSZ]; - snprintf(message, sizeof(message), - "NHASSERT(%s) in '%s' at line %d", exp, file, line); + char message[128]; + _snprintf(message, sizeof(message), + "NHASSERT(%s) in '%s' at line %d\n", exp, file, line); - impossible(message); + if (IsDebuggerPresent()) { + OutputDebugStringA(message); + DebugBreak(); + } + + // strip off the newline + message[strlen(message) - 1] = '\0'; + error(message); } void From 733e760638dbef96484b097a9a92b261503e2c74 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:18:03 -0700 Subject: [PATCH 106/296] Revert "Remove the remapping of snprintf to _snprintf when compiling with MSC." This reverts commit 9801635f56804a195c2b1f5c6bec0e239c9c4935. --- include/ntconf.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/ntconf.h b/include/ntconf.h index 9d79006f0..994615c2d 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -146,6 +146,14 @@ extern void NDECL(getlock); #define strncmpi(a, b, c) strnicmp(a, b, c) #endif +#ifdef _MSC_VER +/* Visual Studio defines this in their own headers, which we don't use */ +#ifndef snprintf +#define snprintf _snprintf +#pragma warning( \ + disable : 4996) /* deprecation warning suggesting snprintf_s */ +#endif +#endif #include #include From 05d77d91b827d35da4c3845b4324648a5a47e052 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:28:03 -0700 Subject: [PATCH 107/296] Revert "Moved declaration of topline state to wintty.h." This reverts commit 7bb41c797fb2491dc39102ddd4f1d31bd74c10c8. --- include/decl.h | 6 ++++++ include/wintty.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/decl.h b/include/decl.h index 5ebaa326e..6c0f9721c 100644 --- a/include/decl.h +++ b/include/decl.h @@ -455,6 +455,12 @@ struct early_opt { boolean valallowed; }; +/* topline states */ +#define TOPLINE_EMPTY 0 /* empty */ +#define TOPLINE_NEED_MORE 1 /* non-empty, need --More-- */ +#define TOPLINE_NON_EMPTY 2 /* non-empty, no --More-- required */ +#define TOPLINE_SPECIAL_PROMPT 3 /* special prompt state */ + #undef E #endif /* DECL_H */ diff --git a/include/wintty.h b/include/wintty.h index e6388ec0d..6994fc93f 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -50,12 +50,6 @@ struct WinDesc { #define WIN_STOP 1 /* for NHW_MESSAGE; stops output */ #define WIN_LOCKHISTORY 2 /* for NHW_MESSAGE; suppress history updates */ -/* topline states */ -#define TOPLINE_EMPTY 0 /* empty */ -#define TOPLINE_NEED_MORE 1 /* non-empty, need --More-- */ -#define TOPLINE_NON_EMPTY 2 /* non-empty, no --More-- required */ -#define TOPLINE_SPECIAL_PROMPT 3 /* special prompt state */ - /* descriptor for tty-based displays -- all the per-display data */ struct DisplayDesc { short rows, cols; /* width and height of tty display */ From e83fcd0353b03ce3ed6ff5b33e2d4576c11dac79 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:28:40 -0700 Subject: [PATCH 108/296] Revert "Improved readability of topline state management." This reverts commit 08a19108678e772ab52ee195be74101b2792accb. --- include/decl.h | 6 ------ win/tty/getline.c | 6 +++--- win/tty/topl.c | 24 ++++++++++++------------ win/tty/wintty.c | 48 +++++++++++++++++++++-------------------------- 4 files changed, 36 insertions(+), 48 deletions(-) diff --git a/include/decl.h b/include/decl.h index 6c0f9721c..5ebaa326e 100644 --- a/include/decl.h +++ b/include/decl.h @@ -455,12 +455,6 @@ struct early_opt { boolean valallowed; }; -/* topline states */ -#define TOPLINE_EMPTY 0 /* empty */ -#define TOPLINE_NEED_MORE 1 /* non-empty, need --More-- */ -#define TOPLINE_NON_EMPTY 2 /* non-empty, no --More-- required */ -#define TOPLINE_SPECIAL_PROMPT 3 /* special prompt state */ - #undef E #endif /* DECL_H */ diff --git a/win/tty/getline.c b/win/tty/getline.c index a3abfcc53..f4894a950 100644 --- a/win/tty/getline.c +++ b/win/tty/getline.c @@ -52,10 +52,10 @@ getlin_hook_proc hook; struct WinDesc *cw = wins[WIN_MESSAGE]; boolean doprev = 0; - if (ttyDisplay->toplin == TOPLINE_NEED_MORE && !(cw->flags & WIN_STOP)) + if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP)) more(); cw->flags &= ~WIN_STOP; - ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT; + ttyDisplay->toplin = 3; /* special prompt state */ ttyDisplay->inread++; /* issue the prompt */ @@ -193,7 +193,7 @@ getlin_hook_proc hook; } else tty_nhbell(); } - ttyDisplay->toplin = TOPLINE_NON_EMPTY; + ttyDisplay->toplin = 2; /* nonempty, no --More-- required */ ttyDisplay->inread--; clear_nhwindow(WIN_MESSAGE); /* clean up after ourselves */ diff --git a/win/tty/topl.c b/win/tty/topl.c index d2a889cc9..62fb3eb53 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -138,7 +138,7 @@ const char *str; end_glyphout(); /* in case message printed during graphics output */ putsyms(str); cl_end(); - ttyDisplay->toplin = TOPLINE_NEED_MORE; + ttyDisplay->toplin = 1; if (ttyDisplay->cury && otoplin != 3) more(); } @@ -151,7 +151,7 @@ const char *str; struct WinDesc *cw = wins[WIN_MESSAGE]; if (!(cw->flags & WIN_STOP)) { - if (ttyDisplay->cury && ttyDisplay->toplin == TOPLINE_NON_EMPTY) + if (ttyDisplay->cury && ttyDisplay->toplin == 2) tty_clear_nhwindow(WIN_MESSAGE); cw->curx = cw->cury = 0; @@ -159,8 +159,8 @@ const char *str; cl_end(); addtopl(str); - if (ttyDisplay->cury && ttyDisplay->toplin != TOPLINE_SPECIAL_PROMPT) - ttyDisplay->toplin = TOPLINE_NON_EMPTY; + if (ttyDisplay->cury && ttyDisplay->toplin != 3) + ttyDisplay->toplin = 2; } } @@ -196,7 +196,7 @@ const char *s; tty_curs(BASE_WINDOW, cw->curx + 1, cw->cury); putsyms(s); cl_end(); - ttyDisplay->toplin = TOPLINE_NEED_MORE; + ttyDisplay->toplin = 1; } void @@ -236,7 +236,7 @@ more() home(); cl_end(); } - ttyDisplay->toplin = TOPLINE_EMPTY; + ttyDisplay->toplin = 0; ttyDisplay->inmore = 0; } @@ -252,7 +252,7 @@ register const char *bp; /* If there is room on the line, print message on same line */ /* But messages like "You die..." deserve their own line */ n0 = strlen(bp); - if ((ttyDisplay->toplin == TOPLINE_NEED_MORE || (cw->flags & WIN_STOP)) + if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP)) && cw->cury == 0 && n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && (notdied = strncmp(bp, "You die", 7)) != 0) { @@ -263,9 +263,9 @@ register const char *bp; addtopl(bp); return; } else if (!(cw->flags & WIN_STOP)) { - if (ttyDisplay->toplin == TOPLINE_NEED_MORE) { + if (ttyDisplay->toplin == 1) { more(); - } else if (cw->cury) { /* for toplin == TOPLINE_NON_EMPTY && cury > 1 */ + } else if (cw->cury) { /* for when flags.toplin == 2 && cury > 1 */ docorner(1, cw->cury + 1); /* reset cury = 0 if redraw screen */ cw->curx = cw->cury = 0; /* from home--cls() & docorner(1,n) */ } @@ -381,10 +381,10 @@ char def; char prompt[BUFSZ]; yn_number = 0L; - if (ttyDisplay->toplin == TOPLINE_NEED_MORE && !(cw->flags & WIN_STOP)) + if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP)) more(); cw->flags &= ~WIN_STOP; - ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT; + ttyDisplay->toplin = 3; /* special prompt state */ ttyDisplay->inread++; if (resp) { char *rb, respbuf[QBUFSZ]; @@ -531,7 +531,7 @@ char def; dumplogmsg(toplines); #endif ttyDisplay->inread--; - ttyDisplay->toplin = TOPLINE_NON_EMPTY; + ttyDisplay->toplin = 2; if (ttyDisplay->intr) ttyDisplay->intr--; if (wins[WIN_MESSAGE]->cury) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 6d5042f8e..b4e22ae02 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -332,7 +332,7 @@ int sig_unused UNUSED; new_status_window(); if (u.ux) { i = ttyDisplay->toplin; - ttyDisplay->toplin = TOPLINE_EMPTY; + ttyDisplay->toplin = 0; docrt(); bot(); ttyDisplay->toplin = i; @@ -420,7 +420,7 @@ char **argv UNUSED; /* set up tty descriptor */ ttyDisplay = (struct DisplayDesc *) alloc(sizeof (struct DisplayDesc)); - ttyDisplay->toplin = TOPLINE_EMPTY; + ttyDisplay->toplin = 0; ttyDisplay->rows = hgt; ttyDisplay->cols = wid; ttyDisplay->curx = ttyDisplay->cury = 0; @@ -1621,12 +1621,12 @@ winid window; switch (cw->type) { case NHW_MESSAGE: - if (ttyDisplay->toplin != TOPLINE_EMPTY) { + if (ttyDisplay->toplin) { home(); cl_end(); if (cw->cury) docorner(1, cw->cury + 1); - ttyDisplay->toplin = TOPLINE_EMPTY; + ttyDisplay->toplin = 0; } break; case NHW_STATUS: @@ -2317,13 +2317,12 @@ boolean blocking; /* with ttys, all windows are blocking */ switch (cw->type) { case NHW_MESSAGE: - if (ttyDisplay->toplin == TOPLINE_NEED_MORE) { + if (ttyDisplay->toplin == 1) { more(); - ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ + ttyDisplay->toplin = 1; /* more resets this */ tty_clear_nhwindow(window); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } else - ttyDisplay->toplin = TOPLINE_EMPTY; + ttyDisplay->toplin = 0; cw->curx = cw->cury = 0; if (!cw->active) iflags.window_inited = TRUE; @@ -2331,8 +2330,8 @@ boolean blocking; /* with ttys, all windows are blocking */ case NHW_MAP: end_glyphout(); if (blocking) { - if (ttyDisplay->toplin != TOPLINE_EMPTY) - ttyDisplay->toplin = TOPLINE_NEED_MORE; + if (!ttyDisplay->toplin) + ttyDisplay->toplin = 1; tty_display_nhwindow(WIN_MESSAGE, TRUE); return; } @@ -2362,7 +2361,7 @@ boolean blocking; /* with ttys, all windows are blocking */ cw->offx = 0; if (cw->type == NHW_MENU) cw->offy = 0; - if (ttyDisplay->toplin == TOPLINE_NEED_MORE) + if (ttyDisplay->toplin == 1) tty_display_nhwindow(WIN_MESSAGE, TRUE); #ifdef H2344_BROKEN if (cw->maxrow >= (int) ttyDisplay->rows @@ -2378,7 +2377,7 @@ boolean blocking; /* with ttys, all windows are blocking */ cl_eos(); } else clear_screen(); - ttyDisplay->toplin = TOPLINE_EMPTY; + ttyDisplay->toplin = 0; } else { if (WIN_MESSAGE != WIN_ERR) tty_clear_nhwindow(WIN_MESSAGE); @@ -2407,9 +2406,8 @@ winid window; switch (cw->type) { case NHW_MESSAGE: - if (ttyDisplay->toplin != TOPLINE_EMPTY) + if (ttyDisplay->toplin) tty_display_nhwindow(WIN_MESSAGE, TRUE); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -3160,11 +3158,10 @@ const char *mesg; response to a prompt, we'll assume that the display is up to date */ tty_putstr(WIN_MESSAGE, 0, mesg); /* if `mesg' didn't wrap (triggering --More--), force --More-- now */ - if (ttyDisplay->toplin == TOPLINE_NEED_MORE) { + if (ttyDisplay->toplin == 1) { more(); - ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */ + ttyDisplay->toplin = 1; /* more resets this */ tty_clear_nhwindow(WIN_MESSAGE); - /* nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); */ } /* normally means skip further messages, but in this case it means cancel the current prompt; any other messages should @@ -3204,7 +3201,7 @@ tty_wait_synch() (void) fflush(stdout); } else if (ttyDisplay->inread > program_state.gameover) { /* this can only happen if we were reading and got interrupted */ - ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT; + ttyDisplay->toplin = 3; /* do this twice; 1st time gets the Quit? message again */ (void) tty_doprev_message(); (void) tty_doprev_message(); @@ -3533,9 +3530,8 @@ tty_nhgetch() i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */ else if (i == EOF) i = '\033'; /* same for EOF */ - /* topline has been seen - we can clear need for more */ - if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) - ttyDisplay->toplin = TOPLINE_NON_EMPTY; + if (ttyDisplay && ttyDisplay->toplin == 1) + ttyDisplay->toplin = 2; #ifdef TTY_TILES_ESCCODES { /* hack to force output of the window select code */ @@ -3614,9 +3610,8 @@ tty_nhgetch() i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */ else if (i == EOF) i = '\033'; /* same for EOF */ - /* topline has been seen - we can clear need for more */ - if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) - ttyDisplay->toplin = TOPLINE_NON_EMPTY; + if (ttyDisplay && ttyDisplay->toplin == 1) + ttyDisplay->toplin = 2; #ifdef TTY_TILES_ESCCODES { /* hack to force output of the window select code */ @@ -3661,9 +3656,8 @@ int *x, *y, *mod; i = ntposkey(x, y, mod); if (!i && mod && (*mod == 0 || *mod == EOF)) i = '\033'; /* map NUL or EOF to ESC, nethack doesn't expect either */ - /* topline has been seen - we can clear need for more */ - if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE) - ttyDisplay->toplin = TOPLINE_NON_EMPTY; + if (ttyDisplay && ttyDisplay->toplin == 1) + ttyDisplay->toplin = 2; #else /* !WIN32CON */ nhUse(x); nhUse(y); From 5870cb6a92c7d13477980568ed31cf7cf5b7524f Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:28:55 -0700 Subject: [PATCH 109/296] Revert "Added experimental feature NEW_KEYBOARD_HIT." This reverts commit bc65112ce07c6e2056ed28b5e93954679fb36acd. --- include/config.h | 8 +--- include/extern.h | 15 ------- include/ntconf.h | 3 -- include/unixconf.h | 2 - include/winprocs.h | 12 ------ include/wintty.h | 4 -- src/allmain.c | 4 -- src/windows.c | 14 ------- sys/winnt/nttty.c | 10 ----- sys/winnt/winnt.c | 7 +--- win/share/safeproc.c | 11 ----- win/tty/wintty.c | 97 -------------------------------------------- win/win32/mswproc.c | 12 ------ win/win32/winMS.h | 3 -- 14 files changed, 3 insertions(+), 199 deletions(-) diff --git a/include/config.h b/include/config.h index f054de5c4..d12576f9d 100644 --- a/include/config.h +++ b/include/config.h @@ -564,13 +564,9 @@ typedef unsigned char uchar; %N first character of player name DUMPLOG_FILE is not used if SYSCF is defined */ -#endif /* DUMPLOG_FILE */ +#endif -#endif /* DUMPLOG */ - -/* NEW_KEYBOARD_HIT adds new window proc to return whether keyboard has been hit - and character input is available */ -/* #define NEW_KEYBOARD_HIT */ +#endif #define USE_ISAAC64 /* Use cross-plattform, bundled RNG */ diff --git a/include/extern.h b/include/extern.h index 0761d224e..90548cf37 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1147,9 +1147,6 @@ E void NDECL(gettty); E void NDECL(setftty); E void FDECL(settty, (const char *)); E int NDECL(tgetch); -#ifdef NEW_KEYBOARD_HIT -E boolean NDECL(tkbhit); -#endif E void FDECL(cmov, (int x, int y)); E void FDECL(nocmov, (int x, int y)); @@ -1555,9 +1552,6 @@ E void FDECL(mplayer_talk, (struct monst *)); #ifndef WIN32 E int NDECL(tgetch); -#ifdef NEW_KEYBOARD_HIT -E boolean NDECL(tkbhit); -#endif #endif #ifndef TOS E char NDECL(switchar); @@ -1588,9 +1582,7 @@ E void FDECL(gotoxy, (int, int)); #endif #ifdef TOS E int FDECL(_copyfile, (char *, char *)); -#ifndef NEW_KEYBOARD_HIT E int NDECL(kbhit); -#endif E void NDECL(set_colors); E void NDECL(restore_colors); #ifdef SUSPEND @@ -1600,9 +1592,7 @@ E int NDECL(dosuspend); #ifdef WIN32 E char *FDECL(get_username, (int *)); E void FDECL(nt_regularize, (char *)); -#ifndef NEW_KEYBOARD_HIT E int NDECL((*nt_kbhit)); -#endif E void FDECL(Delay, (int)); #endif /* WIN32 */ #endif /* MICRO || WIN32 */ @@ -1670,15 +1660,10 @@ E void FDECL(regex_free, (struct nhregex *)); #ifdef WIN32 E void NDECL(get_scr_size); -#ifndef NEW_KEYBOARD_HIT E int NDECL(nttty_kbhit); -#endif E void FDECL(nttty_open, (int)); E void NDECL(nttty_rubout); E int NDECL(tgetch); -#ifdef NEW_KEYBOARD_HIT -E boolean NDECL(tkbhit); -#endif E int FDECL(ntposkey, (int *, int *, int *)); E void FDECL(set_output_mode, (int)); E void NDECL(synch_cursor); diff --git a/include/ntconf.h b/include/ntconf.h index 994615c2d..eb106090f 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -252,11 +252,8 @@ int _RTLENTRY _EXPFUNC read(int __handle, void _FAR *__buf, unsigned __len); #ifndef CURSES_GRAPHICS #include /* conflicting definitions with curses.h */ #endif - -#ifndef NEW_KEYBOARD_HIT #undef kbhit /* Use our special NT kbhit */ #define kbhit (*nt_kbhit) -#endif #ifdef LAN_FEATURES #define MAX_LAN_USERNAME 20 diff --git a/include/unixconf.h b/include/unixconf.h index f9ac16f0c..c126d6839 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -311,9 +311,7 @@ #define HLOCK "perm" /* an empty file used for locking purposes */ -#ifndef NEW_KEYBOARD_HIT #define tgetch getchar -#endif #ifndef NOSHELL #define SHELL /* do not delete the '!' command */ diff --git a/include/winprocs.h b/include/winprocs.h index d1cea9a3c..36962750e 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -79,9 +79,6 @@ struct window_procs { (int, const char *, const char *, BOOLEAN_P)); void FDECL((*win_status_update), (int, genericptr_t, int, int, int, unsigned long *)); boolean NDECL((*win_can_suspend)); -#ifdef NEW_KEYBOARD_HIT - boolean NDECL((*win_keyboard_hit)); -#endif }; extern @@ -163,9 +160,6 @@ extern */ #define status_enablefield (*windowprocs.win_status_enablefield) #define status_update (*windowprocs.win_status_update) -#ifdef NEW_KEYBOARD_HIT -#define keyboard_hit (*windowprocs.win_keyboard_hit) -#endif /* * WINCAP @@ -385,9 +379,6 @@ struct chain_procs { (CARGS, int, const char *, const char *, BOOLEAN_P)); void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int, int, unsigned long *)); boolean FDECL((*win_can_suspend), (CARGS)); -#ifdef NEW_KEYBOARD_HIT - boolean FDECL((*keyboard_hit), (CARGS)); -#endif }; #endif /* WINCHAIN */ @@ -458,9 +449,6 @@ extern void FDECL(safe_status_enablefield, (int, const char *, const char *, BOOLEAN_P)); extern void FDECL(safe_status_update, (int, genericptr_t, int, int, int, unsigned long *)); extern boolean NDECL(safe_can_suspend); -#ifdef NEW_KEYBOARD_HIT -extern boolean NDECL(safe_keyboard_hit); -#endif extern void FDECL(stdio_raw_print, (const char *)); extern void FDECL(stdio_raw_print_bold, (const char *)); extern void NDECL(stdio_wait_synch); diff --git a/include/wintty.h b/include/wintty.h index 6994fc93f..4863d6e10 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -247,10 +247,6 @@ E void FDECL(genl_outrip, (winid, int, time_t)); E char *FDECL(tty_getmsghistory, (BOOLEAN_P)); E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P)); -#ifdef NEW_KEYBOARD_HIT -E boolean NDECL(tty_keyboard_hit); -#endif - #ifdef NO_TERMS #ifdef MAC #ifdef putchar diff --git a/src/allmain.c b/src/allmain.c index 082447b3b..57170b66c 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -374,11 +374,7 @@ boolean resuming; if (multi >= 0 && occupation) { #if defined(MICRO) || defined(WIN32) abort_lev = 0; -#ifdef NEW_KEYBOARD_HIT - if (keyboard_hit()) { -#else if (kbhit()) { -#endif if ((ch = pgetchar()) == ABORT) abort_lev++; else diff --git a/src/windows.c b/src/windows.c index 0d2ce514d..ad7b91b0d 100644 --- a/src/windows.c +++ b/src/windows.c @@ -523,9 +523,6 @@ static void NDECL(hup_void_ndecl); static void FDECL(hup_void_fdecl_int, (int)); static void FDECL(hup_void_fdecl_winid, (winid)); static void FDECL(hup_void_fdecl_constchar_p, (const char *)); -#ifdef NEW_KEYBOARD_HIT -static boolean NDECL(hup_keyboard_hit); -#endif static struct window_procs hup_procs = { "hup", 0L, 0L, hup_init_nhwindows, @@ -573,9 +570,6 @@ static struct window_procs hup_procs = { hup_void_ndecl, /* status_finish */ genl_status_enablefield, hup_status_update, genl_can_suspend_no, -#ifdef NEW_KEYBOARD_HIT - hup_keyboard_hit -#endif }; static void FDECL((*previnterface_exit_nhwindows), (const char *)) = 0; @@ -630,14 +624,6 @@ hup_nhgetch(VOID_ARGS) return '\033'; /* ESC */ } -#ifdef NEW_KEYBOARD_HIT -static boolean -hup_keyboard_hit(VOID_ARGS) -{ - return FALSE; -} -#endif - /*ARGSUSED*/ static char hup_yn_function(prompt, resp, deflt) diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index a8000bc05..3233dc9cb 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -398,12 +398,10 @@ int mode; // unused { DWORD cmode; -#ifndef NEW_KEYBOARD_HIT /* Initialize the function pointer that points to * the kbhit() equivalent, in this TTY case nttty_kbhit() */ nt_kbhit = nttty_kbhit; -#endif if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE)) { /* Unable to set control handler */ @@ -438,19 +436,11 @@ int portdebug; return ch; } -#ifndef NEW_KEYBOARD_HIT int nttty_kbhit() { return keyboard_handler.pNHkbhit(console.hConIn, &ir); } -#else -boolean -tkbhit() -{ - return keyboard_handler.pNHkbhit(console.hConIn, &ir) != 0; -} -#endif int tgetch() diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index e9041262d..f6a9aa791 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -56,7 +56,6 @@ extern void NDECL(backsp); int NDECL(windows_console_custom_nhgetch); extern void NDECL(safe_routines); -#ifndef NEW_KEYBOARD_HIT /* The function pointer nt_kbhit contains a kbhit() equivalent * which varies depending on which window port is active. * For the tty port it is tty_kbhit() [from nttty.c] @@ -66,7 +65,6 @@ extern void NDECL(safe_routines); int def_kbhit(void); int (*nt_kbhit)() = def_kbhit; -#endif char switchar() @@ -160,13 +158,11 @@ max_filename() return 0; } -#ifndef NEW_KEYBOARD_HIT int def_kbhit() { return 0; } -#endif /* * Strip out troublesome file system characters. @@ -514,9 +510,7 @@ int code; exit(code); } -#ifndef NEW_KEYBOARD_HIT #undef kbhit -#endif #include int @@ -725,6 +719,7 @@ sys_random_seed(VOID_ARGS) } return ourseed; } + #endif /* WIN32 */ /*winnt.c*/ diff --git a/win/share/safeproc.c b/win/share/safeproc.c index 9f3e0ce2f..ab5cb1c5a 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -101,9 +101,6 @@ struct window_procs safe_procs = { safe_status_update, #endif safe_can_suspend, -#ifdef NEW_KEYBOARD_HIT - safe_keyboard_hit -#endif }; struct window_procs * @@ -389,14 +386,6 @@ safe_can_suspend() return FALSE; } -#ifdef NEW_KEYBOARD_HIT -boolean -safe_keyboard_hit() -{ - return FALSE; -} -#endif - void safe_nhbell() { diff --git a/win/tty/wintty.c b/win/tty/wintty.c index b4e22ae02..85c1ca59d 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -36,12 +36,6 @@ extern void msmsg(const char *, ...); #endif #endif -#ifdef NEW_KEYBOARD_HIT -#if defined(UNIX) -#include -#endif -#endif - #ifdef TTY_TILES_ESCCODES extern short glyph2tile[]; #define TILE_ANSI_COMMAND 'z' @@ -139,9 +133,6 @@ struct window_procs tty_procs = { genl_status_update, #endif genl_can_suspend_yes, -#ifdef NEW_KEYBOARD_HIT - tty_keyboard_hit -#endif }; static int maxwin = 0; /* number of windows in use */ @@ -3488,7 +3479,6 @@ const char *str; #endif } -#ifndef NEW_KEYBOARD_HIT int tty_nhgetch() { @@ -3543,93 +3533,6 @@ tty_nhgetch() #endif /* TTY_TILES_ESCCODES */ return i; } -#else /* NEW_KEYBOARD_HIT */ -#ifdef UNIX -static boolean stdin_non_blocking = FALSE; - -int -tgetch() -{ - static volatile int nesting = 0; - int i; - char nestbuf; - - if (stdin_non_blocking) { - fcntl(0, F_SETFL, fcntl(0, F_GETFL) & ~O_NONBLOCK); - stdin_non_blocking = FALSE; - } - - /* kludge alert: Some Unix variants return funny values if getc() - * is called, interrupted, and then called again. There - * is non-reentrant code in the internal _filbuf() routine, called by - * getc(). - */ - i = (++nesting == 1) - ? getchar() - : (read(fileno(stdin), (genericptr_t) &nestbuf, 1) == 1) - ? (int) nestbuf : EOF; - --nesting; - - return i; -} - -boolean -tkbhit() -{ - int i; - if (!stdin_non_blocking) { - fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK); - stdin_non_blocking = TRUE; - } - i = getchar(); - if (i != EOF) ungetc(i, stdin); - return (i != EOF); - } -#endif - -int -tty_nhgetch() -{ - int i; - HUPSKIP_RESULT('\033'); - print_vt_code1(AVTC_INLINE_SYNC); - (void) fflush(stdout); - /* Note: if raw_print() and wait_synch() get called to report terminal - * initialization problems, then wins[] and ttyDisplay might not be - * available yet. Such problems will probably be fatal before we get - * here, but validate those pointers just in case... - */ - if (WIN_MESSAGE != WIN_ERR && wins[WIN_MESSAGE]) - wins[WIN_MESSAGE]->flags &= ~WIN_STOP; - if (iflags.debug_fuzzer) { - i = randomkey(); - } else { - i = tgetch(); - } - if (!i) - i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */ - else if (i == EOF) - i = '\033'; /* same for EOF */ - if (ttyDisplay && ttyDisplay->toplin == 1) - ttyDisplay->toplin = 2; -#ifdef TTY_TILES_ESCCODES - { - /* hack to force output of the window select code */ - int tmp = vt_tile_current_window; - - vt_tile_current_window++; - print_vt_code2(AVTC_SELECT_WINDOW, tmp); - } -#endif /* TTY_TILES_ESCCODES */ - return i; -} - -boolean tty_keyboard_hit() -{ - /* tgetch provider needs to also provide tkbhit() */ - return tkbhit(); -} -#endif /* NEW_KEYBOARD_HIT */ /* * return a key, or 0, in which case a mouse button was pressed diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index a5aa02bb4..b637c463f 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -116,9 +116,6 @@ struct window_procs mswin_procs = { mswin_status_init, mswin_status_finish, mswin_status_enablefield, mswin_status_update, genl_can_suspend_yes, -#ifdef NEW_KEYBOARD_HIT - mswin_keyboard_hit -#endif }; /* @@ -1405,15 +1402,6 @@ mswin_nhgetch() return (key); } -#ifdef NEW_KEYBOARD_HIT -/* boolean keyboard_hit() -- returns TRUE if input is available */ -boolean -mswin_keyboard_hit() -{ - return mswin_have_input() != 0; -} -#endif - /* int nh_poskey(int *x, int *y, int *mod) -- Returns a single character input from the user or a diff --git a/win/win32/winMS.h b/win/win32/winMS.h index c649917dc..c5ee77368 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -167,9 +167,6 @@ void mswin_raw_print(const char *str); void mswin_raw_print_bold(const char *str); void mswin_raw_print_flush(); int mswin_nhgetch(void); -#ifdef NEW_KEYBOARD_HIT -boolean mswin_keyboard_hit(void); -#endif int mswin_nh_poskey(int *x, int *y, int *mod); void mswin_nhbell(void); int mswin_doprev_message(void); From a607ea2b7f2a24ba8c8f9ae2ace27bf922f4656f Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 14 Jul 2019 21:29:41 -0700 Subject: [PATCH 110/296] Revert "When fuzzing, use the number of moves as a proxy for the hour." This reverts commit f75deae0bcca5bdd4afddb40291e5e2bb0ecd846. --- src/hacklib.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/hacklib.c b/src/hacklib.c index b97a78a65..7cf5a47c6 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -1129,8 +1129,7 @@ friday_13th() int night() { - register int hour = (iflags.debug_fuzzer ? (moves / 1000) % 24 : - getlt()->tm_hour); + register int hour = getlt()->tm_hour; return (hour < 6 || hour > 21); } @@ -1138,10 +1137,7 @@ night() int midnight() { - register int hour = (iflags.debug_fuzzer ? (moves / 1000) % 24 : - getlt()->tm_hour); - - return (hour == 0); + return (getlt()->tm_hour == 0); } /* strbuf_init() initializes strbuf state for use */ From 2dd9aac83281563d117e6c428805fd9c5512b515 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 15 Jul 2019 07:52:43 -0400 Subject: [PATCH 111/296] remove some old comments and bits --- src/dungeon.c | 1 - src/light.c | 11 ----------- src/mkroom.c | 3 --- src/restore.c | 26 +++----------------------- src/save.c | 5 ----- src/worm.c | 2 -- 6 files changed, 3 insertions(+), 45 deletions(-) diff --git a/src/dungeon.c b/src/dungeon.c index 3b119284a..474a85a21 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -58,7 +58,6 @@ static const char *FDECL(br_string, (int)); static char FDECL(chr_u_on_lvl, (d_level *)); static void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P, struct lchoice *)); -/* SAVE2018 */ static mapseen *FDECL(load_mapseen, (NHFILE *)); static void FDECL(save_mapseen, (NHFILE *, mapseen *)); static mapseen *FDECL(find_mapseen, (d_level *)); diff --git a/src/light.c b/src/light.c index 328a69f1c..2fd09425a 100644 --- a/src/light.c +++ b/src/light.c @@ -44,7 +44,6 @@ #define LSF_SHOW 0x1 /* display the light source */ #define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */ -/* SAVE2018 */ static void FDECL(write_ls, (NHFILE *, light_source *)); static int FDECL(maybe_write_ls, (NHFILE *, int, BOOLEAN_P)); @@ -446,8 +445,6 @@ boolean ghostly; } } -/* SAVE2018 */ - /* * Part of the light source save routine. Count up the number of light * sources that would be written. If write_it is true, actually write @@ -518,14 +515,6 @@ light_sources_sanity_check() } } -/* SAVE2018 */ -#if 0 -static void -write_ls(fd, ls) -int fd; -light_source *ls; -#endif /* 0 */ - /* Write a light source structure to disk. */ static void write_ls(nhfp, ls) diff --git a/src/mkroom.c b/src/mkroom.c index 05eb9550b..de87a14e2 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -26,9 +26,6 @@ static void NDECL(mktemple); static coord *FDECL(shrine_pos, (int)); static struct permonst *NDECL(morguemon); static struct permonst *NDECL(squadmon); -/* SAVE2018 */ -/* static void FDECL(save_room, (int,struct mkroom *)); */ -/* static void FDECL(rest_room, (int,struct mkroom *)); */ static void FDECL(save_room, (NHFILE *, struct mkroom *)); static void FDECL(rest_room, (NHFILE *, struct mkroom *)); diff --git a/src/restore.c b/src/restore.c index 9c01c5432..fd44f2ea1 100644 --- a/src/restore.c +++ b/src/restore.c @@ -149,8 +149,6 @@ NHFILE *nhfp; } } -/* SAVE2018 */ - static void restdamage(nhfp, ghostly) NHFILE *nhfp; @@ -204,8 +202,6 @@ boolean ghostly; free((genericptr_t) tmp_dam); } -/* SAVE2018 */ - /* restore one object */ static void restobj(nhfp, otmp) @@ -249,7 +245,7 @@ struct obj *otmp; newomonst(otmp); /* this is actually a monst struct, so we can just defer to restmon() here */ - restmon(nhfp, OMONST(otmp)); /* SAVE2018 */ + restmon(nhfp, OMONST(otmp)); } /* omid - monster id number, connecting corpse to ghost */ @@ -297,8 +293,6 @@ struct obj *otmp; } } -/* SAVE2018 */ - static struct obj * restobjchn(nhfp, ghostly, frozen) NHFILE *nhfp; @@ -318,7 +312,7 @@ boolean ghostly, frozen; break; otmp = newobj(); - restobj(nhfp, otmp); /* SAVE2018 */ + restobj(nhfp, otmp); if (!first) first = otmp; else @@ -389,8 +383,6 @@ boolean ghostly, frozen; return first; } -/* SAVE2018 */ - /* restore one monster */ static void restmon(nhfp, mtmp) @@ -492,8 +484,6 @@ struct monst *mtmp; } /* mextra */ } -/* SAVE2018 */ - static struct monst * restmonchn(nhfp, ghostly) NHFILE *nhfp; @@ -571,8 +561,6 @@ boolean ghostly; return first; } -/* SAVE2018 */ - static struct fruit * loadfruitchn(nhfp) NHFILE *nhfp; @@ -1134,8 +1122,6 @@ NHFILE *nhfp; return 1; } -/* SAVE2018 */ - void restcemetery(nhfp, cemeteryaddr) NHFILE *nhfp; @@ -1164,8 +1150,6 @@ struct cemetery **cemeteryaddr; } } -/* SAVE2018 */ - /*ARGSUSED*/ static void rest_levl(nhfp, rlecomp) @@ -1362,7 +1346,7 @@ boolean ghostly; keepgoing = FALSE; } dealloc_trap(trap); - fobj = restobjchn(nhfp, ghostly, FALSE); /* SAVE2018 */ + fobj = restobjchn(nhfp, ghostly, FALSE); find_lev_obj(); /* restobjchn()'s `frozen' argument probably ought to be a callback routine so that we can check for objects being buried under ice */ @@ -1466,8 +1450,6 @@ boolean ghostly; clear_id_mapping(); } -/* SAVE2018 */ - void get_plname_from_file(nhfp, plbuf) NHFILE *nhfp; @@ -1486,8 +1468,6 @@ char *plbuf; return; } -/* SAVE2018 */ - static void restore_msghistory(nhfp) NHFILE *nhfp; diff --git a/src/save.c b/src/save.c index b651ce52f..2b36da546 100644 --- a/src/save.c +++ b/src/save.c @@ -24,11 +24,6 @@ static int count_only; #define USE_BUFFERING #endif -/*SAVE2018*/ -extern void FDECL(nhout, (int, const char *, - const char *, int, genericptr_t, int)); -extern int NDECL(nhdatatypes_size); - #ifdef MICRO int dotcnt, dotrow; /* also used in restore */ #endif diff --git a/src/worm.c b/src/worm.c index 53e7e1cf5..0d14c83a0 100644 --- a/src/worm.c +++ b/src/worm.c @@ -535,8 +535,6 @@ NHFILE *nhfp; } } -/* SAVE2018 */ - /* * rest_worm() * From ed18ebc5459505f6bbf2e9104a59abb4941999a3 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 27 Jul 2019 16:12:24 -0700 Subject: [PATCH 112/296] timer validations Add the contributed code that checks for attempting to start a duplicate timer. It's based on a comment which must have been there at least 25 years and doesn't solve any known problems, but it is conceptually similar to the large amount of sanity checking which has gone into 3.6.x. It didn't work as is because it was comparing two unions with '=='. I don't know offhand whether C++ supports that but C doesn't (through C11 at least; don't know about C17). The union ('anything') is simple enough that two instances can be compared without jumping through hoops. I've also added another check for timer 'kind' (level, object, monster, or global). --- doc/fixes36.3 | 4 +++- include/timeout.h | 11 ++++++----- src/timeout.c | 32 +++++++++++++++++++++++++------- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 909dbd345..a20fc650e 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.94 $ $NHDT-Date: 1562838835 2019/07/11 09:53:55 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.95 $ $NHDT-Date: 1564269131 2019/07/27 23:12:11 $ 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, @@ -105,6 +105,8 @@ when farlook describes a monster at a visible spot as trapped, reveal the trap fix theft when poly'd into nymph form; 3.6.2 change made that anger the victim hero poly'd into nymph would steal gold along with other items change wizard mode #panic to require "yes" if 'paranoid_confirm:quit' is set +add some additional validation checks when setting up a new timer (triggered + by an ancient source comment rather than by any observed problems) Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/include/timeout.h b/include/timeout.h index 0cb4c706a..0ac85a3c8 100644 --- a/include/timeout.h +++ b/include/timeout.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 timeout.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ +/* NetHack 3.6 timeout.h $NHDT-Date: 1564269131 2019/07/27 23:12:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ */ /* Copyright 1994, Dean Luick */ /* NetHack may be freely redistributed. See license for details. */ @@ -10,10 +10,11 @@ typedef void FDECL((*timeout_proc), (ANY_P *, long)); /* kind of timer */ enum timer_type { - TIMER_LEVEL = 0, /* event specific to level */ - TIMER_GLOBAL, /* event follows current play */ - TIMER_OBJECT, /* event follows a object */ - TIMER_MONSTER /* event follows a monster */ + TIMER_LEVEL = 0, /* event specific to level [melting ice] */ + TIMER_GLOBAL = 1, /* event follows current play [not used] */ + TIMER_OBJECT = 2, /* event follows an object [various] */ + TIMER_MONSTER = 3, /* event follows a monster [not used] */ + NUM_TIMER_KINDS /* 4 */ }; /* save/restore timer ranges */ diff --git a/src/timeout.c b/src/timeout.c index 54a2943c3..3d820b0fb 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 timeout.c $NHDT-Date: 1559664953 2019/06/04 16:15:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.90 $ */ +/* NetHack 3.6 timeout.c $NHDT-Date: 1564269133 2019/07/27 23:12:13 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.91 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1868,13 +1868,32 @@ short kind; short func_index; anything *arg; { - timer_element *gnu; + timer_element *gnu, *dup; - if (func_index < 0 || func_index >= NUM_TIME_FUNCS) - panic("start_timer"); + if (kind < 0 || kind >= NUM_TIMER_KINDS + || func_index < 0 || func_index >= NUM_TIME_FUNCS) + panic("start_timer (%s: %d)", kind_name(kind), (int) func_index); - gnu = (timer_element *) alloc(sizeof(timer_element)); - (void) memset((genericptr_t)gnu, 0, sizeof(timer_element)); + /* fail if already has a timer running */ + for (dup = timer_base; dup; dup = dup->next) + if (dup->kind == kind + && dup->func_index == func_index + && dup->arg.a_void == arg->a_void) + break; + if (dup) { + char idbuf[QBUFSZ]; + +#ifdef VERBOSE_TIMER + Sprintf(idbuf, "%s timer", timeout_funcs[func_index].name); +#else + Sprintf(idbuf, "%s timer (%d)", kind_name(kind), (int) func_index); +#endif + impossible("Attempted to start duplicate %s, aborted.", idbuf); + return FALSE; + } + + gnu = (timer_element *) alloc(sizeof *gnu); + (void) memset((genericptr_t) gnu, 0, sizeof *gnu); gnu->next = 0; gnu->tid = timer_id++; gnu->timeout = monstermoves + when; @@ -1887,7 +1906,6 @@ anything *arg; if (kind == TIMER_OBJECT) /* increment object's timed count */ (arg->a_obj)->timed++; - /* should check for duplicates and fail if any */ return TRUE; } From c4a2f20af0280f6889819bea2f7f18e243a30c2a Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 28 Jul 2019 15:06:02 -0700 Subject: [PATCH 113/296] Mjollnir comment in artilist[] The description of Mjollnir's behavior when thrown was incomplete and slightly inaccurate. --- include/artilist.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/artilist.h b/include/artilist.h index 8948e521a..d1b1ef624 100644 --- a/include/artilist.h +++ b/include/artilist.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 artilist.h $NHDT-Date: 1433050874 2015/05/31 05:41:14 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */ +/* NetHack 3.6 artilist.h $NHDT-Date: 1564351548 2019/07/28 22:05:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.20 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -57,8 +57,16 @@ STATIC_OVL NEARDATA struct artifact artilist[] = { DRLI(5, 2), DRLI(0, 0), NO_CARY, 0, A_CHAOTIC, NON_PM, NON_PM, 8000L, NO_COLOR), /* - * Mjollnir will return to the hand of the wielder when thrown - * if the wielder is a Valkyrie wearing Gauntlets of Power. + * Mjollnir can be thrown when wielded if hero has 25 Strength + * (usually via gauntlets of power but possible with rings of + * gain strength). If the thrower is a Valkyrie, Mjollnir will + * usually (99%) return and then usually (separate 99%) be caught + * and automatically be re-wielded. When returning Mjollnir is + * not caught, there is a 50:50 chance of hitting hero for damage + * and its lightning shock might destroy some wands and/or rings. + * + * Monsters don't throw Mjollnir regardless of strength (not even + * fake-player valkyries). */ A("Mjollnir", WAR_HAMMER, /* Mjo:llnir */ (SPFX_RESTR | SPFX_ATTK), 0, 0, ELEC(5, 24), NO_DFNS, NO_CARY, 0, From 6dffe52a27adf9659e830667e868e34d992754fd Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 30 Jul 2019 17:24:33 -0700 Subject: [PATCH 114/296] Glory of Arioch vs spellbook From the newsgroup (reported for slash'em but applies to nethack too): a chaotic monk was crowned and told he or she had been "chosen to steal souls for My Glory!" while being given a spellbook of restore ability which has nothing whatever to do with soul stealing. There's alternate wording for when Stormbringer can't be given because it already exists; also use that for when it's not going to be given because the character is discouraged against wielding weapons. --- doc/fixes36.3 | 5 ++++- src/pray.c | 35 +++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index a20fc650e..1eeb0de1b 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.95 $ $NHDT-Date: 1564269131 2019/07/27 23:12:11 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.96 $ $NHDT-Date: 1564532667 2019/07/31 00:24:27 $ 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, @@ -107,6 +107,9 @@ hero poly'd into nymph would steal gold along with other items change wizard mode #panic to require "yes" if 'paranoid_confirm:quit' is set add some additional validation checks when setting up a new timer (triggered by an ancient source comment rather than by any observed problems) +if a chaotic monk or wizard gets crowned and is given a spellbook rather than + Stormbringer as the crowning gift, don't describe the hero as having + been "chosen to steal souls for [Arioch's] glory" Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/pray.c b/src/pray.c index d40bb933c..42e5f8be8 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pray.c $NHDT-Date: 1562462064 2019/07/07 01:14:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */ +/* NetHack 3.6 pray.c $NHDT-Date: 1564532667 2019/07/31 00:24:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.117 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -771,6 +771,20 @@ gcrownu() HPoison_resistance |= FROMOUTSIDE; godvoice(u.ualign.type, (char *) 0); + class_gift = STRANGE_OBJECT; + /* 3.3.[01] had this in the A_NEUTRAL case, + preventing chaotic wizards from receiving a spellbook */ + if (Role_if(PM_WIZARD) + && (!uwep || (uwep->oartifact != ART_VORPAL_BLADE + && uwep->oartifact != ART_STORMBRINGER)) + && !carrying(SPE_FINGER_OF_DEATH)) { + class_gift = SPE_FINGER_OF_DEATH; + } else if (Role_if(PM_MONK) && (!uwep || !uwep->oartifact) + && !carrying(SPE_RESTORE_ABILITY)) { + /* monks rarely wield a weapon */ + class_gift = SPE_RESTORE_ABILITY; + } + obj = ok_wep(uwep) ? uwep : 0; already_exists = in_hand = FALSE; /* lint suppression */ switch (u.ualign.type) { @@ -791,19 +805,13 @@ gcrownu() already_exists = exist_artifact(RUNESWORD, artiname(ART_STORMBRINGER)); verbalize("Thou art chosen to %s for My Glory!", - already_exists && !in_hand ? "take lives" : "steal souls"); + ((already_exists && !in_hand) + || class_gift != STRANGE_OBJECT) ? "take lives" + : "steal souls"); break; } - class_gift = STRANGE_OBJECT; - /* 3.3.[01] had this in the A_NEUTRAL case below, - preventing chaotic wizards from receiving a spellbook */ - if (Role_if(PM_WIZARD) - && (!uwep || (uwep->oartifact != ART_VORPAL_BLADE - && uwep->oartifact != ART_STORMBRINGER)) - && !carrying(SPE_FINGER_OF_DEATH)) { - class_gift = SPE_FINGER_OF_DEATH; - make_splbk: + if (objects[class_gift].oc_class == SPBOOK_CLASS) { obj = mksobj(class_gift, TRUE, FALSE); bless(obj); obj->bknown = 1; /* ok to skip set_bknown() */ @@ -818,11 +826,6 @@ gcrownu() obj = uwep; /* to be blessed,&c */ break; } - } else if (Role_if(PM_MONK) && (!uwep || !uwep->oartifact) - && !carrying(SPE_RESTORE_ABILITY)) { - /* monks rarely wield a weapon */ - class_gift = SPE_RESTORE_ABILITY; - goto make_splbk; } switch (u.ualign.type) { From 31c80383447ad3332f893724deff600efb648132 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 31 Jul 2019 14:22:09 -0700 Subject: [PATCH 115/296] bad weapon check for monster multi-shot shooting A typo caused the bow and arrow check when a monster was wielding an elven box to test the hero's weapon with monster's ammo. [I looked at the old slash'em code where I think this came from and it doesn't have the typo but does have a different bug. A monster could get a multi-shot volley by wielding an elven bow when throwing darts or spears. The extra bow and arrow check is intended to prevent that. The typo was probably by me but I have no memory of that code....] Elves with bows (or other monsters who manage to pick up and wield an elven bow) will shoot bigger volleys after this fix. That will make them more dangerous but also cause them to run out of arrows more quickly. --- doc/fixes36.3 | 4 +++- src/mthrowu.c | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 1eeb0de1b..2ff46966a 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.96 $ $NHDT-Date: 1564532667 2019/07/31 00:24:27 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.97 $ $NHDT-Date: 1564608120 2019/07/31 21:22:00 $ 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, @@ -110,6 +110,8 @@ add some additional validation checks when setting up a new timer (triggered if a chaotic monk or wizard gets crowned and is given a spellbook rather than Stormbringer as the crowning gift, don't describe the hero as having been "chosen to steal souls for [Arioch's] glory" +for multi-shot shooting by monsters, a typo checked hero's weapon for + compatibility with ammo when monster was wielding an elven bow Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/mthrowu.c b/src/mthrowu.c index d10d2f1f1..7cb178ed4 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mthrowu.c $NHDT-Date: 1542765360 2018/11/21 01:56:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.78 $ */ +/* NetHack 3.6 mthrowu.c $NHDT-Date: 1564608121 2019/07/31 21:22:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.84 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -183,7 +183,10 @@ struct obj *otmp, *mwep; /* Elven Craftsmanship makes for light, quick bows */ if (otmp->otyp == ELVEN_ARROW && !otmp->cursed) multishot++; - if (ammo_and_launcher(otmp, uwep) && mwep->otyp == ELVEN_BOW + /* for arrow, we checked bow&arrow at start of block, but for + bow, so far we've only validated that otmp is a weapon stack; + need to verify that it's a stack of arrows rather than darts */ + if (mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep) && !mwep->cursed) multishot++; /* 1/3 of launcher enchantment */ From 55e166ba08cbeab621055fa8bf80284289283c54 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 2 Aug 2019 10:42:26 -0700 Subject: [PATCH 116/296] fix #H9082 - post-3.6.2 monster throwing crash Changing if (ammo_and_launcher(otmp, uwep) && mwep->otyp == ELVEN_BOW) (with 'uwep' typo) to if (mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep)) (with fixed 'mwep') moved ammo_and_launcher()'s hidden non-null test to after 'mwep->otyp'. If mwep was Null (so monster must be throwing non-ammo such as darts or daggers rather than shooting with a launcher), a crash occurred. (Throwing such things while the monster is wielding any weapon doesn't have this problem.) I don't think 3.6.2 can crash here. If hero's uwep is a bow, otmp must be arrows to get past pre-3.6.3's incorrect ammo_and_launcher() check. And a monster won't shoot arrows unless wielding a bow, so monster's mwep would be non-Null regardless of what uwep is. I tested a kobold with darts and an elven bow. But I also gave it one elven arrow to provoke it into wielding the bow and my test didn't throw darts with nothing wielded.... --- doc/fixes36.3 | 4 +++- src/mthrowu.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 2ff46966a..bf9e7a39f 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.97 $ $NHDT-Date: 1564608120 2019/07/31 21:22:00 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.98 $ $NHDT-Date: 1564767725 2019/08/02 17:42:05 $ 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, @@ -128,6 +128,8 @@ fix for feedback when a monster plays a fire horn at self to cure green slime ended up being used for zapping a wand of fire at self too wizard mode ^I "not carrying anything" still claimed "not carrying anything" if "(all items are already identified)" was given +monster throwing from stack of missiles (darts, daggers, spears) would cause + crash if it wasn't wielding a weapon (bug in multi-shot shooting fix) curses: sometimes the message window would show a blank line after a prompt curses: the change to show map in columns 1..79 instead of 2..80 made the highlight for '@' show up in the wrong place if clipped map had been diff --git a/src/mthrowu.c b/src/mthrowu.c index 7cb178ed4..1c65e2488 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mthrowu.c $NHDT-Date: 1564608121 2019/07/31 21:22:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.84 $ */ +/* NetHack 3.6 mthrowu.c $NHDT-Date: 1564767726 2019/08/02 17:42:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.85 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -183,10 +183,10 @@ struct obj *otmp, *mwep; /* Elven Craftsmanship makes for light, quick bows */ if (otmp->otyp == ELVEN_ARROW && !otmp->cursed) multishot++; - /* for arrow, we checked bow&arrow at start of block, but for + /* for arrow, we checked bow&arrow when entering block, but for bow, so far we've only validated that otmp is a weapon stack; need to verify that it's a stack of arrows rather than darts */ - if (mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep) + if (mwep && mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep) && !mwep->cursed) multishot++; /* 1/3 of launcher enchantment */ From 508af05e422126ac38b31b157b89699437b5c05c Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 2 Aug 2019 11:51:26 -0700 Subject: [PATCH 117/296] fix #H9084 - teleported boulder left stale screen Report was for Sokoban but it applied anywhere: if a teleported boulder landed in a pit or trap door or hole and flooreffects() used it up (so returned True), rloco() didn't update the location it was teleported from and it appeared not to have moved. (Line of sight was updated to reflect its absence but map spot wasn't redrawn without it.) --- doc/fixes36.3 | 5 ++++- src/teleport.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index bf9e7a39f..00745966a 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.98 $ $NHDT-Date: 1564767725 2019/08/02 17:42:05 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.99 $ $NHDT-Date: 1564771880 2019/08/02 18:51:20 $ 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, @@ -112,6 +112,9 @@ if a chaotic monk or wizard gets crowned and is given a spellbook rather than been "chosen to steal souls for [Arioch's] glory" for multi-shot shooting by monsters, a typo checked hero's weapon for compatibility with ammo when monster was wielding an elven bow +when a boulder was teleported, if it landed in a pit or trap door or hole its + former location wasn't updated to show that it wasn't there anymore + (noticed in Sokoban but not limited to there) Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/teleport.c b/src/teleport.c index 100a74d3b..9c2bd66f5 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 teleport.c $NHDT-Date: 1561336020 2019/06/24 00:27:00 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.89 $ */ +/* NetHack 3.6 teleport.c $NHDT-Date: 1564771880 2019/08/02 18:51:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.92 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1450,6 +1450,9 @@ register struct obj *obj; dndest.nhx, dndest.nhy))); if (flooreffects(obj, tx, ty, "fall")) { + /* update old location since flooreffects() couldn't; + unblock_point() for boulder handled by obj_extract_self() */ + newsym(otx, oty); return FALSE; } else if (otx == 0 && oty == 0) { ; /* fell through a trap door; no update of old loc needed */ @@ -1466,6 +1469,7 @@ register struct obj *obj; newsym(otx, oty); /* update old location */ } place_object(obj, tx, ty); + /* note: block_point() for boulder handled by place_object() */ newsym(tx, ty); return TRUE; } From 380a2d2848088fc728f37d4b1a27b98986024f56 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 6 Aug 2019 04:24:21 -0700 Subject: [PATCH 118/296] fix #H9100 - typo in Mort #4 For "They look at you but the don't see you", "the" should be a second "they". Simple transcription typo rather than a mistake in the book. --- dat/tribute | 4 ++-- doc/fixes36.3 | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dat/tribute b/dat/tribute index 46777f253..bacde1efe 100644 --- a/dat/tribute +++ b/dat/tribute @@ -1,4 +1,4 @@ -# NetHack 3.6 tribute $NHDT-Date: 1524689580 2018/04/25 20:53:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.82 $ +# NetHack 3.6 tribute $NHDT-Date: 1565090653 2019/08/06 11:24:13 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.83 $ # Copyright (c) 2017 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details. # A tribute introduced in NetHack 3.6.0 to: @@ -853,7 +853,7 @@ WOULDN'T IT? WHAT DO YOU THINK? said Death. AM I REALLY HERE, BOY? "Yes," said Mort slowly. "I... I've watched people. They look at you but -the don't see you, I think. You do something to their minds." +they don't see you, I think. You do something to their minds." Death shook his head. diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 00745966a..aacc0e8de 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.99 $ $NHDT-Date: 1564771880 2019/08/02 18:51:20 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.100 $ $NHDT-Date: 1565090653 2019/08/06 11:24:13 $ 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, @@ -115,6 +115,7 @@ for multi-shot shooting by monsters, a typo checked hero's weapon for when a boulder was teleported, if it landed in a pit or trap door or hole its former location wasn't updated to show that it wasn't there anymore (noticed in Sokoban but not limited to there) +Terry Pratchett tribute, fix typo in passage #4 for Mort ("the" -> "they") Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository From cc3d97d9b3793d4ea982730d4fbfca17fe0ed655 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 8 Aug 2019 11:01:56 -0700 Subject: [PATCH 119/296] fix github issue #209 - typo in end_of_input() Fixes #209 Fix typo: program_statue should be program_state. Apparently NOSAVEONHANGUP+INSURANCE isn't used by anyone since it wouldn't compile. --- doc/fixes36.3 | 4 +++- src/cmd.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index aacc0e8de..907d9b883 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.100 $ $NHDT-Date: 1565090653 2019/08/06 11:24:13 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.101 $ $NHDT-Date: 1565287308 2019/08/08 18:01:48 $ 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, @@ -116,6 +116,8 @@ when a boulder was teleported, if it landed in a pit or trap door or hole its former location wasn't updated to show that it wasn't there anymore (noticed in Sokoban but not limited to there) Terry Pratchett tribute, fix typo in passage #4 for Mort ("the" -> "they") +fix typo in end_of_input() present since 3.6.0 that would prevent compilation + for NOSAVEONHANGUP+INSURANCE configuration Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/cmd.c b/src/cmd.c index 8fd6d5f68..6a89d3dd4 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1562838823 2019/07/11 09:53:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.340 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1565287308 2019/08/08 18:01:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.342 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -5848,7 +5848,7 @@ end_of_input() #ifdef NOSAVEONHANGUP #ifdef INSURANCE if (flags.ins_chkpt && program_state.something_worth_saving) - program_statue.preserve_locks = 1; /* keep files for recovery */ + program_state.preserve_locks = 1; /* keep files for recovery */ #endif program_state.something_worth_saving = 0; /* don't save */ #endif From a2a257a5125fc7c15dcd7047ba77ecc20ce2039e Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 8 Aug 2019 11:25:36 -0700 Subject: [PATCH 120/296] fix github issue #211 - wrong parentheses Fixes #211 dopickup() was getting the wrong value from pickup_checks() due to misplaced closing parenthesis. But it didn't actually impact play; picking things up from engulfer's minvent while swallowed worked even though the special check for that was failing. The code which was accidentally being skipped can probably go away but I haven't gone that far. --- src/hack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hack.c b/src/hack.c index 95e5ea06c..718eea8bf 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 hack.c $NHDT-Date: 1559664951 2019/06/04 16:15:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.213 $ */ +/* NetHack 3.6 hack.c $NHDT-Date: 1565288730 2019/08/08 18:25:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.215 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2641,9 +2641,9 @@ dopickup(VOID_ARGS) ? multi + 1 : 0; multi = 0; /* always reset */ - if ((ret = pickup_checks() >= 0)) + if ((ret = pickup_checks()) >= 0) { return ret; - else if (ret == -2) { + } else if (ret == -2) { tmpcount = -count; return loot_mon(u.ustuck, &tmpcount, (boolean *) 0); } /* else ret == -1 */ From c814ca8e040bb13e0d3b8c4c0773b3bb15a4ab45 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 11 Aug 2019 18:56:43 -0700 Subject: [PATCH 121/296] fix #H9117 - bookeeping for fatal status condition When Stoned, Slimed, Strangled, Sick (TermIll or FoodPois or both) counts down to 0 without being cured, keep it listed as an active condition while killing off the hero. It will show in the status section when disclosing final attributes and in both that section and map's status lines when producing a dumplog. --- doc/fixes36.3 | 4 +++- src/cmd.c | 52 +++++++++++++++++++++++++++++++++++++-------------- src/timeout.c | 33 +++++++++++++++++++++++++------- 3 files changed, 67 insertions(+), 22 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 907d9b883..ea02fdf39 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.101 $ $NHDT-Date: 1565287308 2019/08/08 18:01:48 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.102 $ $NHDT-Date: 1565574993 2019/08/12 01:56:33 $ 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, @@ -118,6 +118,8 @@ when a boulder was teleported, if it landed in a pit or trap door or hole its Terry Pratchett tribute, fix typo in passage #4 for Mort ("the" -> "they") fix typo in end_of_input() present since 3.6.0 that would prevent compilation for NOSAVEONHANGUP+INSURANCE configuration +when a status condition becomes fatal, keep it listed as an active condition + during disclosure and/or dumplog rather than having it already reset Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/cmd.c b/src/cmd.c index 6a89d3dd4..82a7819c7 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1565287308 2019/08/08 18:01:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.342 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1565574994 2019/08/12 01:56:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.343 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2333,26 +2333,50 @@ int final; youhiding(TRUE, final); /* internal troubles, mostly in the order that prayer ranks them */ - if (Stoned) - you_are("turning to stone", ""); - if (Slimed) - you_are("turning into slime", ""); + if (Stoned) { + if (final && (Stoned & I_SPECIAL)) + enlght_out(" You turned into stone."); + else + you_are("turning to stone", ""); + } + if (Slimed) { + if (final && (Slimed & I_SPECIAL)) + enlght_out(" You turned into slime."); + else + you_are("turning into slime", ""); + } if (Strangled) { if (u.uburied) { you_are("buried", ""); } else { - Strcpy(buf, "being strangled"); - if (wizard) - Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT)); - you_are(buf, from_what(STRANGLED)); + if (final && (Strangled & I_SPECIAL)) { + enlght_out(" You died from strangulation."); + } else { + Strcpy(buf, "being strangled"); + if (wizard) + Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT)); + you_are(buf, from_what(STRANGLED)); + } } } if (Sick) { - /* prayer lumps these together; botl puts Ill before FoodPois */ - if (u.usick_type & SICK_NONVOMITABLE) - you_are("terminally sick from illness", ""); - if (u.usick_type & SICK_VOMITABLE) - you_are("terminally sick from food poisoning", ""); + /* the two types of sickness are lumped together; hero can be + afflicted by both but there is only one timeout; botl status + puts TermIll before FoodPois and death due to timeout reports + terminal illness if both are in effect, so do the same here */ + if (final && (Sick & I_SPECIAL)) { + Sprintf(buf, " %sdied from %s.", You_, /* has trailing space */ + (u.usick_type & SICK_NONVOMITABLE) + ? "terminal illness" : "food poisoning"); + enlght_out(buf); + } else { + /* unlike death due to sickness, report the two cases separately + because it is possible to cure one without curing the other */ + if (u.usick_type & SICK_NONVOMITABLE) + you_are("terminally sick from illness", ""); + if (u.usick_type & SICK_VOMITABLE) + you_are("terminally sick from food poisoning", ""); + } } if (Vomiting) you_are("nauseated", ""); diff --git a/src/timeout.c b/src/timeout.c index 3d820b0fb..7b5fb7818 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 timeout.c $NHDT-Date: 1564269133 2019/07/27 23:12:13 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.91 $ */ +/* NetHack 3.6 timeout.c $NHDT-Date: 1565574996 2019/08/12 01:56:36 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.92 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -12,6 +12,8 @@ STATIC_DCL void NDECL(choke_dialogue); STATIC_DCL void NDECL(levitation_dialogue); STATIC_DCL void NDECL(slime_dialogue); STATIC_DCL void FDECL(slimed_to_death, (struct kinfo *)); +STATIC_DCL void NDECL(phaze_dialogue); +STATIC_DCL void FDECL(done_timeout, (int, int)); STATIC_DCL void NDECL(slip_or_trip); STATIC_DCL void FDECL(see_lamp_flicker, (struct obj *, const char *)); STATIC_DCL void FDECL(lantern_message, (struct obj *)); @@ -406,7 +408,7 @@ struct kinfo *kptr; /* become a green slime; also resets youmonst.m_ap_type+.mappearance */ (void) polymon(PM_GREEN_SLIME); mvitals[PM_GREEN_SLIME].mvflags = save_mvflags; - done(TURNED_SLIME); + done_timeout(TURNED_SLIME, SLIMED); /* life-saved; even so, hero still has turned into green slime; player may have genocided green slimes after being infected */ @@ -425,7 +427,7 @@ struct kinfo *kptr; /* follows "The medallion crumbles to dust." */ pline("Unfortunately, %s", slimebuf); /* die again; no possibility of amulet this time */ - done(GENOCIDED); + done(GENOCIDED); /* [should it be done_timeout(GENOCIDED, SLIMED)?] */ /* could be life-saved again (only in explore or wizard mode) but green slimes are gone; just stay in current form */ } @@ -456,6 +458,23 @@ phaze_dialogue() pline1(phaze_texts[SIZE(phaze_texts) - i]); } +/* when a status timeout is fatal, keep the status line indicator shown + during end of game rundown (and potential dumplog); + timeout has already counted down to 0 by the time we get here */ +STATIC_OVL void +done_timeout(how, which) +int how, which; +{ + long *intrinsic_p = &u.uprops[which].intrinsic; + + *intrinsic_p |= I_SPECIAL; /* affects final disclosure */ + done(how); + + /* life-saved */ + *intrinsic_p &= ~I_SPECIAL; + context.botl = TRUE; +} + void nh_timeout() { @@ -541,10 +560,10 @@ nh_timeout() } dealloc_killer(kptr); /* (unlike sliming, you aren't changing form here) */ - done(STONING); + done_timeout(STONING, STONED); break; case SLIMED: - slimed_to_death(kptr); /* done(TURNED_SLIME) */ + slimed_to_death(kptr); /* done_timeout(TURNED_SLIME,SLIMED) */ break; case VOMITING: make_vomiting(0L, TRUE); @@ -568,8 +587,8 @@ nh_timeout() killer.format = KILLED_BY; } } + done_timeout(POISONING, SICK); u.usick_type = 0; - done(POISONING); break; case FAST: if (!Very_fast) @@ -672,7 +691,7 @@ nh_timeout() killer.format = KILLED_BY; Strcpy(killer.name, (u.uburied) ? "suffocation" : "strangulation"); - done(DIED); + done_timeout(DIED, STRANGLED); /* must be declining to die in explore|wizard mode; treat like being cured of strangulation by prayer */ if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) { From 899311efdeb6657b92a6b444308d297919bb5c23 Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 14 Aug 2019 08:21:21 -0400 Subject: [PATCH 122/296] merge correction bit --- src/timeout.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/timeout.c b/src/timeout.c index ae9b52e69..d34955c5b 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -13,6 +13,7 @@ static void NDECL(vomiting_dialogue); static void NDECL(choke_dialogue); static void NDECL(levitation_dialogue); static void NDECL(slime_dialogue); +static void FDECL(slimed_to_death, (struct kinfo *)); static void NDECL(phaze_dialogue); static void FDECL(done_timeout, (int, int)); static void NDECL(slip_or_trip); From a995929168c5848857c06179079c06a21be66087 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 14 Aug 2019 18:49:16 -0700 Subject: [PATCH 123/296] fix #H9118 - stoning a sandestin causes "dmonsfree: N removed doesn't match N+1 pending" warning. The sandestin monster definition flags it as MR_STONE, immune to being turned to stone. If the hero hit it with a cockatrice while it was shape-changed into something which isn't MR_STONE, it had its mon->mhp set to 0, so died, and its form (mon->data) was set back to sandestin. known_hitum() decided that it didn't turn to stone because of MR_STONE for that form so proceeded to kill it off due to lack of hit points, causing it to die twice. I started to change that so that it didn't kill off the critter a second time, bit it really shouldn't be able to kill it by stoning in the first place. So sandestin how shares some vampire code to revert to innate form and not turn to stone when "killed" by stoning. It only yields the normal visible polymorph message: "the turns into a " without any attempt to explain why. Once in sandestin form, smacking it with a cockatrice corpse doesn't do anything special (due to MR_STONE now being unambiguously in effect). It will soon shape-change to some other form and then become subject to being forced back to innate shape by stoning again. --- doc/fixes36.3 | 7 ++++++- src/mon.c | 26 ++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index ea02fdf39..5f8b0815a 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.102 $ $NHDT-Date: 1565574993 2019/08/12 01:56:33 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.103 $ $NHDT-Date: 1565833748 2019/08/15 01:49:08 $ 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, @@ -120,6 +120,11 @@ fix typo in end_of_input() present since 3.6.0 that would prevent compilation for NOSAVEONHANGUP+INSURANCE configuration when a status condition becomes fatal, keep it listed as an active condition during disclosure and/or dumplog rather than having it already reset +when a shape-shifted sandestin was turned to stone, it died and reverted to + sandestin form with 0 HP; that confused known_hitum() because + sandestins are immune to stoning; net result was monster dying twice, + triggering "dmonsfree: N removed doesn't match N+1 pending" warning; + instead of dying, make it revert to sandestin form with full health Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/mon.c b/src/mon.c index 862125289..ca2e19276 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mon.c $NHDT-Date: 1560791350 2019/06/17 17:09:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.294 $ */ +/* NetHack 3.6 mon.c $NHDT-Date: 1565833749 2019/08/15 01:49:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.296 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1363,8 +1363,8 @@ long flag; thrudoor = TRUE; } -nexttry: /* eels prefer the water, but if there is no water nearby, - they will crawl over land */ + nexttry: /* eels prefer the water, but if there is no water nearby, + they will crawl over land */ if (mon->mconf) { flag |= ALLOW_ALL; flag &= ~NOTONL; @@ -2185,7 +2185,9 @@ struct monst *mdef; xchar x = mdef->mx, y = mdef->my; boolean wasinside = FALSE; - if (!vamp_stone(mdef)) /* vampshifter reverts to vampire */ + /* vampshifter reverts to vampire; + 3.6.3: also used to unshift shape-changed sandestin */ + if (!vamp_stone(mdef)) return; /* we have to make the statue before calling mondead, to be able to @@ -2454,7 +2456,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */ /* monster is gone, corpse or other object might now be visible */ newsym(x, y); -cleanup: + cleanup: /* punish bad behaviour */ if (is_human(mdat) && (!always_hostile(mdat) && mtmp->malign <= 0) @@ -2588,6 +2590,18 @@ struct monst *mtmp; newsym(mtmp->mx, mtmp->my); return FALSE; /* didn't petrify */ } + } else if (mtmp->cham >= LOW_PM + && (mons[mtmp->cham].mresists & MR_STONE)) { + /* sandestins are stoning-immune so if hit by stoning damage + they revert to innate shape rather than become a statue */ + mtmp->mcanmove = 1; + mtmp->mfrozen = 0; + if (mtmp->mhpmax <= 0) + mtmp->mhpmax = 10; + mtmp->mhp = mtmp->mhpmax; + (void) newcham(mtmp, &mons[mtmp->cham], FALSE, TRUE); + newsym(mtmp->mx, mtmp->my); + return FALSE; /* didn't petrify */ } return TRUE; } @@ -2688,7 +2702,7 @@ struct monst *mon; mtmp->mstate |= MON_OBLITERATE; mongone(mtmp); /* places in the code might still reference mtmp->mx, mtmp->my */ - /* mtmp->mx = mtmp->my = 0; */ + /* mtmp->mx = mtmp->my = 0; */ rloc_to(mon, mx, my); /* note: mon, not mtmp */ /* last resort - migrate mon to the next plane */ From d1bc65b75bc6d421e45935e253851a97650cbb10 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 15 Aug 2019 20:41:50 -0400 Subject: [PATCH 124/296] add X11 packages to couple of travis builds --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index e2c522f80..a2373f078 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,12 @@ matrix: - os: linux env: HINTS=linux-x11 compiler: gcc + addons: + apt: + packages: + - libx11-dev + - libxaw7-dev + - xfonts-utils script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" - os: linux env: HINTS=linux-qt5 @@ -19,6 +25,9 @@ matrix: addons: apt: packages: + - libx11-dev + - libxaw7-dev + - xfonts-utils - qtbase5-dev - qtmultimedia5-dev - qtbase5-dev-tools From 0091920f001085e4e2f3b4befd686fd9c8258a8b Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 16 Aug 2019 13:50:41 -0400 Subject: [PATCH 125/296] travis build update and mkfontdir argument for linux travis recently changed linux default dist from trusty to xenial, and bionic is next include an additional travis linux build under bionic to eliminate surprises there add a parameter to mkfontdir under linux to prevent it form going after .lev files --- .travis.yml | 27 ++++++++++++++++++--------- sys/unix/hints/linux-qt5 | 2 +- sys/unix/hints/linux-x11 | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index a2373f078..46e74c339 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,15 @@ language: c matrix: include: - os: linux - env: HINTS=linux + env: DESCR=linux-xenial-gcc HINTS=linux compiler: gcc script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" - os: linux - env: HINTS=linux + env: DESCR=linux-xenial-gcc HINTS=linux compiler: clang script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" - os: linux - env: HINTS=linux-x11 + env: DESCR=linux-xenial-gcc-x11 HINTS=linux-x11 compiler: gcc addons: apt: @@ -20,7 +20,7 @@ matrix: - xfonts-utils script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" - os: linux - env: HINTS=linux-qt5 + env: DESCR=linux-xenial-gcc-qt5 HINTS=linux-qt5 compiler: gcc addons: apt: @@ -33,7 +33,18 @@ matrix: - qtbase5-dev-tools script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && QT_SELECT=5 make MOC=moc install" - os: linux - env: HINTS=linux-minimal + env: DESCR=linux-bionic-gcc-x11 HINTS=linux-x11 + dist: bionic + compiler: gcc + addons: + apt: + packages: + - libx11-dev + - libxaw7-dev + - xfonts-utils + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + - os: linux + env: DESCR=linux-xenial-gcc-minimal HINTS=linux-minimal compiler: gcc script: | cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ @@ -59,7 +70,7 @@ matrix: make install cat dat/options - os: windows - env: HINTS=windows-visual-studio + env: DESCR=windows-visualstudio language: shell script: # - find /c/Program\ Files\ \(x86\) -iname 'rc.exe' -print @@ -98,7 +109,7 @@ matrix: - nmake install - os: windows # install: choco install mingw - env: HINTS=windows-mingw + env: DESCR=windows-mingw script: - git clone --depth 1 https://github.com/wmcbrine/PDCurses.git ../pdcurses - export ADD_CURSES=Y @@ -118,5 +129,3 @@ notifications: email: recipients: - devteam@nethack.org - - diff --git a/sys/unix/hints/linux-qt5 b/sys/unix/hints/linux-qt5 index 8532cc207..9a561130f 100644 --- a/sys/unix/hints/linux-qt5 +++ b/sys/unix/hints/linux-qt5 @@ -18,7 +18,7 @@ VARDIR = $(HACKDIR) POSTINSTALL= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir -x .lev); CFLAGS=-g -O -I../include -DNOTPARMDECL CFLAGS+=-DHACKDIR=\"$(HACKDIR)\" diff --git a/sys/unix/hints/linux-x11 b/sys/unix/hints/linux-x11 index d8e29aa85..3b1caf8d9 100644 --- a/sys/unix/hints/linux-x11 +++ b/sys/unix/hints/linux-x11 @@ -18,7 +18,7 @@ VARDIR = $(HACKDIR) POSTINSTALL= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir -x .lev); CFLAGS=-g -O -I../include -DNOTPARMDECL CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" From 490d7f6d549e77dcf5bff972624c65fffe617370 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 16 Aug 2019 21:47:37 -0400 Subject: [PATCH 126/296] copy-paste error bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 46e74c339..67d05077d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ matrix: compiler: gcc script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" - os: linux - env: DESCR=linux-xenial-gcc HINTS=linux + env: DESCR=linux-xenial-clang HINTS=linux compiler: clang script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" - os: linux From 8a328ff7eb5f7452150d17ce9fb8b79e0970edac Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 17 Aug 2019 12:55:48 -0400 Subject: [PATCH 127/296] quite some Xcode warnings --- src/mkmaze.c | 2 +- src/shk.c | 2 +- sys/unix/NetHack.xcodeproj/project.pbxproj | 1 + win/curses/cursstat.c | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mkmaze.c b/src/mkmaze.c index a9d0c1461..9079b1e4f 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1400,7 +1400,7 @@ movebubbles() struct bubble *b; struct container *cons; struct trap *btrap; - int x, y, i, j, bcpin; + int x, y, i, j, bcpin = 0; /* set up the portal the first time bubbles are moved */ if (!wportal) diff --git a/src/shk.c b/src/shk.c index fa29b1f31..f5c42bacd 100644 --- a/src/shk.c +++ b/src/shk.c @@ -4828,7 +4828,7 @@ void globby_bill_fixup(obj_absorber, obj_absorbed) struct obj *obj_absorber, *obj_absorbed; { - int x, y; + int x = 0, y = 0; struct bill_x *bp, *bp_absorber = (struct bill_x *) 0; struct monst *shkp = 0; struct eshk *eshkp; diff --git a/sys/unix/NetHack.xcodeproj/project.pbxproj b/sys/unix/NetHack.xcodeproj/project.pbxproj index 78b618ce9..94d7eacc0 100644 --- a/sys/unix/NetHack.xcodeproj/project.pbxproj +++ b/sys/unix/NetHack.xcodeproj/project.pbxproj @@ -1158,6 +1158,7 @@ hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 3189576821A1FCC100FB2ABE; productRefGroup = 3189577221A1FCC100FB2ABE /* Products */; diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 4847308f0..664b9e31e 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -907,7 +907,7 @@ curs_HPbar(char *text, /* pre-padded with trailing spaces if short */ { #ifdef STATUS_HILITES #ifdef TEXTCOLOR - int coloridx; + int coloridx = 0; #endif #endif /* STATUS_HILITES */ int k, bar_pos; From b7b8c7a44637b7253d1723a30bca8d541e3c240c Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 20 Aug 2019 17:16:57 -0700 Subject: [PATCH 128/296] sys/unix/hints/*: mkfontdir and cp -n Change all the POSTINSTALL 'mkfontdir' to 'mkfontdir -x .lev' although the mkfontdir version on my system didn't think $(HACKDIR)/*.lev were font files when I built without dlb. Also change the PREINSTALL 'cp -n win/X11/nethack.rc ~/.nethackrc' to keep going if it fails. The linux hints use 'cp -n' for sysconf but since it is doing so for the playground directory and 'make install' starts out by clearing away everything in that directory, it shouldn't fail. But some extra bullet proofing there may be warranted. Only the initial cp is protected against clobbering an existing file; the ownership+permission fixups that are applied to the copy of original file still get applied to an existing one. --- sys/unix/hints/linux-qt4 | 4 ++-- sys/unix/hints/linux-qt5 | 4 ++-- sys/unix/hints/linux-x11 | 4 ++-- sys/unix/hints/macosx | 9 ++++----- sys/unix/hints/macosx10.10 | 9 +++++---- sys/unix/hints/macosx10.10-qt | 10 +++++----- sys/unix/hints/macosx10.14 | 6 +++--- sys/unix/hints/macosx10.5 | 9 +++++---- sys/unix/hints/macosx10.7 | 9 +++++---- sys/unix/hints/macosx10.8 | 8 ++++---- 10 files changed, 37 insertions(+), 35 deletions(-) diff --git a/sys/unix/hints/linux-qt4 b/sys/unix/hints/linux-qt4 index 804118562..910345ed1 100644 --- a/sys/unix/hints/linux-qt4 +++ b/sys/unix/hints/linux-qt4 @@ -1,5 +1,5 @@ # -# NetHack 3.6 linux-qt4 $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +# NetHack 3.6 linux-qt4 $NHDT-Date: 1566346592 2019/08/21 00:16:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.27 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. # NetHack may be freely redistributed. See license for details. # @@ -18,7 +18,7 @@ VARDIR = $(HACKDIR) POSTINSTALL= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; ( cd $(INSTDIR); mkfontdir -x .lev ); CFLAGS=-g -O -I../include -DNOTPARMDECL CFLAGS+=-DHACKDIR=\"$(HACKDIR)\" diff --git a/sys/unix/hints/linux-qt5 b/sys/unix/hints/linux-qt5 index 9a561130f..c1b13d890 100644 --- a/sys/unix/hints/linux-qt5 +++ b/sys/unix/hints/linux-qt5 @@ -1,5 +1,5 @@ # -# NetHack 3.6 linux-qt5 $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +# NetHack 3.6 linux-qt5 $NHDT-Date: 1566346602 2019/08/21 00:16:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.27 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. # NetHack may be freely redistributed. See license for details. # @@ -18,7 +18,7 @@ VARDIR = $(HACKDIR) POSTINSTALL= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir -x .lev); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; ( cd $(INSTDIR); mkfontdir -x .lev ); CFLAGS=-g -O -I../include -DNOTPARMDECL CFLAGS+=-DHACKDIR=\"$(HACKDIR)\" diff --git a/sys/unix/hints/linux-x11 b/sys/unix/hints/linux-x11 index 3b1caf8d9..2f340e981 100644 --- a/sys/unix/hints/linux-x11 +++ b/sys/unix/hints/linux-x11 @@ -1,5 +1,5 @@ # -# NetHack 3.6 linux-x11 $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +# NetHack 3.6 linux-x11 $NHDT-Date: 1566346602 2019/08/21 00:16:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.24 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. # NetHack may be freely redistributed. See license for details. # @@ -18,7 +18,7 @@ VARDIR = $(HACKDIR) POSTINSTALL= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir -x .lev); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; ( cd $(INSTDIR); mkfontdir -x .lev ); CFLAGS=-g -O -I../include -DNOTPARMDECL CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" diff --git a/sys/unix/hints/macosx b/sys/unix/hints/macosx index 0cd98b3fa..573473249 100644 --- a/sys/unix/hints/macosx +++ b/sys/unix/hints/macosx @@ -1,13 +1,12 @@ # -# NetHack 3.6 macosx $NHDT-Date: 1447844580 2015/11/18 11:03:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ +# NetHack 3.6 macosx $NHDT-Date: 1566346603 2019/08/21 00:16:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.20 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. # NetHack may be freely redistributed. See license for details. # #-PRE # Mac OS X (Darwin) hints file -# This is for Mac OS X 10.4.10 (Darwin 8.10). If this doesn't work for some -# other version of either Darwin or Mac OS X, make a new file for that OS, -# don't change this one. And let us know about it. +# This is for Mac OS X 10.4 (Darwin 8.10). Use one of the more specific +# hints files for later versions. # Useful info: http://www.opensource.apple.com/darwinsource/index.html # This hints file can build several different types of installations. @@ -72,7 +71,7 @@ WINOBJ += $(WINX11OBJ) WINLIB += $(WINX11LIB) LFLAGS=-L/usr/X11R6/lib VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm -POSTINSTALL= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir) +POSTINSTALL= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; ( cd $(INSTDIR); mkfontdir -x .lev ) CFLAGS += -DX11_GRAPHICS endif diff --git a/sys/unix/hints/macosx10.10 b/sys/unix/hints/macosx10.10 index e53a80d77..279a15ec3 100644 --- a/sys/unix/hints/macosx10.10 +++ b/sys/unix/hints/macosx10.10 @@ -1,11 +1,11 @@ # -# NetHack 3.6 macosx10.11 $NHDT-Date: 1546220383 2018/12/31 01:39:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.51 $ +# NetHack 3.6 macosx10.11 $NHDT-Date: 1566346603 2019/08/21 00:16:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.53 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. # NetHack may be freely redistributed. See license for details. # #-PRE # Mac OS X (Darwin) hints file -# This is for Mac OS X 10.10 or later, and has been tested on 10.11 +# This is for Mac OS X 10.10 through 10.13, and has been tested on 10.11 # (El Capitan) and 10.13. If this doesn't work for some other # version of Mac OS X, make a new file for that OS, don't change this one. # And let us know about it. @@ -108,7 +108,8 @@ endif ifdef WANT_WIN_X11 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir); +# -x: if built without dlb, some versions of mkfontdir think *.lev are fonts +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev ); # separate from CFLAGS so that we don't pass it to every file X11CFLAGS = -I/opt/X11/include CFLAGS += -DX11_GRAPHICS @@ -204,7 +205,7 @@ VARFILEPERM = 0600 VARDIRPERM = 0700 ifdef WANT_WIN_X11 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists -PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc +PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true endif # WANT_WIN_X11 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE diff --git a/sys/unix/hints/macosx10.10-qt b/sys/unix/hints/macosx10.10-qt index 3d9747649..865c2d20a 100644 --- a/sys/unix/hints/macosx10.10-qt +++ b/sys/unix/hints/macosx10.10-qt @@ -1,12 +1,12 @@ # -# NetHack 3.6 macosx10.11 $NHDT-Date: 1515549543 2018/01/10 01:59:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.48 $ +# NetHack 3.6 macosx10.11 $NHDT-Date: 1566346604 2019/08/21 00:16:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.51 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. # NetHack may be freely redistributed. See license for details. # #-PRE # Mac OS X (Darwin) hints file -# This is for Mac OS X 10.10 or later, and has been tested on 10.11 -# (El Capitan). If this doesn't work for some other +# This is for the Qt interface on Mac OS X 10.10 through 10.13, and has +# been tested on 10.11 (El Capitan). If this doesn't work for some other # version of Mac OS X, make a new file for that OS, don't change this one. # And let us know about it. # Useful info: http://www.opensource.apple.com/darwinsource/index.html @@ -106,7 +106,7 @@ WINOBJ0 += $(WINX11OBJ) WINLIB += $(WINX11LIB) LFLAGS += -L/opt/X11/lib VARDATND += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev ); CFLAGS += -DX11_GRAPHICS -I/opt/X11/include # avoid repeated complaints about _X_NONNULL(args...) in CFLAGS += -Wno-variadic-macros @@ -184,7 +184,7 @@ VARFILEPERM = 0600 VARDIRPERM = 0700 ifdef WANT_WIN_X11 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists -PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc +PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true endif # WANT_WIN_X11 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE diff --git a/sys/unix/hints/macosx10.14 b/sys/unix/hints/macosx10.14 index c5e5a0cf1..751ba7774 100644 --- a/sys/unix/hints/macosx10.14 +++ b/sys/unix/hints/macosx10.14 @@ -1,5 +1,5 @@ # -# NetHack 3.6 macosx10.14 $NHDT-Date: 1546225353 2018/12/31 03:02:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.57 $ +# NetHack 3.6 macosx10.14 $NHDT-Date: 1566346605 2019/08/21 00:16:45 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.59 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. # NetHack may be freely redistributed. See license for details. # @@ -108,7 +108,7 @@ endif ifdef WANT_WIN_X11 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev ); # separate from CFLAGS so that we don't pass it to every file X11CFLAGS = -I/opt/X11/include CFLAGS += -DX11_GRAPHICS @@ -204,7 +204,7 @@ VARFILEPERM = 0600 VARDIRPERM = 0700 ifdef WANT_WIN_X11 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists -PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc +PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true endif # WANT_WIN_X11 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE diff --git a/sys/unix/hints/macosx10.5 b/sys/unix/hints/macosx10.5 index f6d9e5483..3cbe335be 100644 --- a/sys/unix/hints/macosx10.5 +++ b/sys/unix/hints/macosx10.5 @@ -1,11 +1,12 @@ # -# NetHack 3.6 macosx10.5 $NHDT-Date: 1546082882 2018/12/29 11:28:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ +# NetHack 3.6 macosx10.5 $NHDT-Date: 1566346606 2019/08/21 00:16:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.32 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2009. # NetHack may be freely redistributed. See license for details. # #-PRE # Mac OS X (Darwin) hints file -# This is for Mac OS X 10.5.3 (Darwin 9.3). If this doesn't work for some +# This is for Mac OS X 10.5 (Darwin 9.3) and also 10.6. +# If this doesn't work for some # other version of either Darwin or Mac OS X, make a new file for that OS, # don't change this one. And let us know about it. # Useful info: http://www.opensource.apple.com/darwinsource/index.html @@ -78,7 +79,7 @@ endif # !WANT_WIN_TTY ifdef WANT_WIN_X11 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; ( cd $(INSTDIR); mkfontdir -x .lev ); CFLAGS += -DX11_GRAPHICS ifdef USE_XPM CFLAGS += -DUSE_XPM @@ -176,7 +177,7 @@ VARFILEPERM = 0600 VARDIRPERM = 0700 ifdef WANT_WIN_X11 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists -PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc +PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true endif # WANT_WIN_X11 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE diff --git a/sys/unix/hints/macosx10.7 b/sys/unix/hints/macosx10.7 index 776cb4b81..4937c64dc 100644 --- a/sys/unix/hints/macosx10.7 +++ b/sys/unix/hints/macosx10.7 @@ -1,11 +1,12 @@ # -# NetHack 3.6 macosx10.7 $NHDT-Date: 1546082882 2018/12/29 11:28:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.34 $ +# NetHack 3.6 macosx10.7 $NHDT-Date: 1566346606 2019/08/21 00:16:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.36 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2009. # NetHack may be freely redistributed. See license for details. # #-PRE # Mac OS X (Darwin) hints file -# This is for Mac OS X 10.7.2. If this doesn't work for some other version +# This is for Mac OS X 10.7. +# If this doesn't work for some other version # of Mac OS X, make a new file for that OS, don't change this one. And # let us know about it. # Useful info: http://www.opensource.apple.com/darwinsource/index.html @@ -95,7 +96,7 @@ endif # !WANT_WIN_TTY ifdef WANT_WIN_X11 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; ( cd $(INSTDIR); mkfontdir -x .lev ); CFLAGS += -DX11_GRAPHICS ifdef USE_XPM CFLAGS += -DUSE_XPM @@ -194,7 +195,7 @@ VARFILEPERM = 0600 VARDIRPERM = 0700 ifdef WANT_WIN_X11 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists -PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc +PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true endif # WANT_WIN_X11 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE diff --git a/sys/unix/hints/macosx10.8 b/sys/unix/hints/macosx10.8 index 87d0e8305..a6e9c4d3c 100644 --- a/sys/unix/hints/macosx10.8 +++ b/sys/unix/hints/macosx10.8 @@ -1,11 +1,11 @@ # -# NetHack 3.6 macosx10.8 $NHDT-Date: 1546220385 2018/12/31 01:39:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.36 $ +# NetHack 3.6 macosx10.8 $NHDT-Date: 1566346607 2019/08/21 00:16:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.38 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2009. # NetHack may be freely redistributed. See license for details. # #-PRE # Mac OS X (Darwin) hints file -# This is for Mac OS X 10.8, Mountain Lion. +# This is for Mac OS X 10.8, Mountain Lion, and also 10.9. # # X11 is no longer included with OSX. # To regain X11, download and install XQuartz. (Attempting to run X11.app @@ -103,7 +103,7 @@ endif # !WANT_WIN_TTY ifdef WANT_WIN_X11 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir); +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; ( cd $(INSTDIR); mkfontdir -x .lev ); # separate from CFLAGS so that we don't pass it to every file X11CFLAGS = -I/opt/X11/include CFLAGS += -DX11_GRAPHICS @@ -206,7 +206,7 @@ VARFILEPERM = 0600 VARDIRPERM = 0700 ifdef WANT_WIN_X11 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists -PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc +PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true endif # WANT_WIN_X11 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE From 3e0d029a45969d86a2febc99a527c989e68e22e3 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 30 Aug 2019 18:11:43 -0700 Subject: [PATCH 129/296] fix #H9164 - crash during restore when swallowed Subject was "display crash while in curses mode". Restoring with perm_invent set in config file or NETHACKOPTIONS when the save was made while swallowed (regardless of perm_invent at that time) resulted in a crash when invalid u.ustuck was referenced before restoration had done its pointer fixups. init_nhwindows() is called with perm_invent On; restgamestate() temporarily turns it Off (3.6.2 restore hack); if/when update_inventory() gets called, curses notices that the persistent window has been disabled so it tears down all its windows in order to redraw the screen without that one; docrt() sees non-Null u.ustuck and calls swallowed(); swallowed() tries to use the value of that pointer rather than just Null/non-Null but the value is from the previous game session, not valid for the current session; crash. Make yet another attempt to prevent update_inventory() from being called during restore. curses won't try to redraw and the crash won't happen. But the invalid pointer is still lurking (until an eventual fixup later during restore). An earlier fix for update_inventory() during restore actually handled this problem (for the most common trigger, setworn(), but not in general), so the 3.6.2 behavior is a regression. --- doc/fixes36.3 | 7 ++++++- include/extern.h | 3 ++- include/winprocs.h | 4 ++-- src/display.c | 10 ++++++---- src/invent.c | 22 +++++++++++++++++++++- 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 5f8b0815a..8677345fb 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.103 $ $NHDT-Date: 1565833748 2019/08/15 01:49:08 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.104 $ $NHDT-Date: 1567213888 2019/08/31 01:11:28 $ 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, @@ -125,6 +125,8 @@ when a shape-shifted sandestin was turned to stone, it died and reverted to sandestins are immune to stoning; net result was monster dying twice, triggering "dmonsfree: N removed doesn't match N+1 pending" warning; instead of dying, make it revert to sandestin form with full health +toggling perm_invent (where supported) while swallowed or underwater didn't + necessarily update the persistent inventory window right away Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository @@ -214,6 +216,9 @@ curses+'perm_invent': if too many entries for window height, last one which curses+'perm_invent': top line was wasted (left blank) when borders Off curses+'perm_invent': don't highlight inventory letters since nothing is selectable from the menu comprising the persistent inventory window +curses+'perm_invent': could crash during restore if game was saved while + hero was swallowed (invalid u.ustuck pointer; suppressing attempts to + update persistent inventory window during restore hides the problem) curses+'popup_dialog': show the text cursor at the end of prompts for single character input curses+DUMPLOG: pass along old messages from save file and quest message diff --git a/include/extern.h b/include/extern.h index 90548cf37..7c37297b3 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1562114349 2019/07/03 00:39:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.715 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1567213888 2019/08/31 01:11:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.728 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1013,6 +1013,7 @@ E int FDECL(identify, (struct obj *)); E int FDECL(count_unidentified, (struct obj *)); E void FDECL(identify_pack, (int, BOOLEAN_P)); E void NDECL(learn_unseen_invent); +E void NDECL(update_inventory); E void FDECL(prinv, (const char *, struct obj *, long)); E char *FDECL(xprname, (struct obj *, const char *, CHAR_P, BOOLEAN_P, long, long)); diff --git a/include/winprocs.h b/include/winprocs.h index 36962750e..cc3b4046c 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 winprocs.h $NHDT-Date: 1553204011 2019/03/21 21:33:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.47 $ */ +/* NetHack 3.6 winprocs.h $NHDT-Date: 1567213890 2019/08/31 01:11:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.50 $ */ /* Copyright (c) David Cohrs, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -112,7 +112,7 @@ extern #define end_menu (*windowprocs.win_end_menu) #define select_menu (*windowprocs.win_select_menu) #define message_menu (*windowprocs.win_message_menu) -#define update_inventory (*windowprocs.win_update_inventory) + #define mark_synch (*windowprocs.win_mark_synch) #define wait_synch (*windowprocs.win_wait_synch) #ifdef CLIPPING diff --git a/src/display.c b/src/display.c index 70a008a0a..7d948deae 100644 --- a/src/display.c +++ b/src/display.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 display.c $NHDT-Date: 1560085863 2019/06/09 13:11:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.104 $ */ +/* NetHack 3.6 display.c $NHDT-Date: 1567213890 2019/08/31 01:11:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.106 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1368,15 +1368,15 @@ docrt() if (u.uswallow) { swallowed(1); - return; + goto post_map; } if (Underwater && !Is_waterlevel(&u.uz)) { under_water(1); - return; + goto post_map; } if (u.uburied) { under_ground(1); - return; + goto post_map; } /* shut down vision */ @@ -1403,6 +1403,8 @@ docrt() /* overlay with monsters */ see_monsters(); + post_map: + /* perm_invent */ update_inventory(); diff --git a/src/invent.c b/src/invent.c index fe21fa7b4..1f8bae8c4 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 invent.c $NHDT-Date: 1562203850 2019/07/04 01:30:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.261 $ */ +/* NetHack 3.6 invent.c $NHDT-Date: 1567213892 2019/08/31 01:11:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.262 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2398,6 +2398,26 @@ learn_unseen_invent() update_inventory(); } +/* persistent inventory window is maintained by interface code; + 'update_inventory' used to be a macro for + (*windowprocs.win_update_inventory) but the restore hackery + was getting out of hand; this is now a central call point */ +void +update_inventory() +{ + if (restoring) + return; + + /* + * Ought to check (windowprocs.wincap2 & WC2_PERM_INVENT) here.... + * + * We currently don't skip this call when iflags.perm_invent is False + * because curses uses that to disable a previous perm_invent window + * (after toggle via 'O'; perhaps the options code should handle that). + */ + (*windowprocs.win_update_inventory)(); +} + /* should of course only be called for things in invent */ STATIC_OVL char obj_to_let(obj) From db5d353d7c2f414278c19ff73dab049d34081f73 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 30 Aug 2019 22:16:30 -0400 Subject: [PATCH 130/296] Merge branch 'NetHack-3.6' part 2 --- src/invent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invent.c b/src/invent.c index 9aceb05e4..13132536e 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2400,7 +2400,7 @@ learn_unseen_invent() void update_inventory() { - if (restoring) + if (g.restoring) return; /* From d8598bd6bb9f75867f4a3938482466016b9728d9 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 31 Aug 2019 01:38:19 -0700 Subject: [PATCH 131/296] 'O' vs perm_invent (mostly) Update persistent inventory window if 'implicit_uncursed', 'menucolors', or 'guicolor' is toggled. (curses should be changed to use menucolors instead of guicolor to decide whether menu coloring is used. Right now it requires that both be On.) Also, EDIT_GETLIN was providing junk default response when message type or menu color looped and prompted for another entry after handling one. Mixed in with this is a fix for easily induced buffer overflow which has security ramifications.... --- doc/fixes36.3 | 11 ++++++++++- src/options.c | 45 +++++++++++++++++++++++++++++++++------------ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 8677345fb..2fc55c341 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.104 $ $NHDT-Date: 1567213888 2019/08/31 01:11:28 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.105 $ $NHDT-Date: 1567240693 2019/08/31 08:38:13 $ 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, @@ -127,6 +127,12 @@ when a shape-shifted sandestin was turned to stone, it died and reverted to instead of dying, make it revert to sandestin form with full health toggling perm_invent (where supported) while swallowed or underwater didn't necessarily update the persistent inventory window right away +have 'O' update persistent inventory window if 'implicit_uncursed', + 'menucolors', or 'guicolors' (curses) is toggled or if menucolors is + On and any menu color patterns are added or removed +'O's "set