From 98cb3ff161f712355e13948f8f4e8b375ee0dc68 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 20 Dec 2019 13:48:36 +0200 Subject: [PATCH 01/35] Prevent fuzzer using wizloadlua and wizloaddes Otherwise the fuzzer will enter a nonexistent file name, and stop. --- src/cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 31b3397c7..fa9e4cae6 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -943,7 +943,7 @@ wiz_detect(VOID_ARGS) static int wiz_load_lua(VOID_ARGS) { - if (wizard) { + if (wizard && !iflags.debug_fuzzer) { char buf[BUFSZ]; buf[0] = '\0'; @@ -961,7 +961,7 @@ wiz_load_lua(VOID_ARGS) static int wiz_load_splua(VOID_ARGS) { - if (wizard) { + if (wizard && !iflags.debug_fuzzer) { boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz); char buf[BUFSZ]; int ridx; From 2c3be8ebe1c6b71e00ed40e24bfa93a5179188e9 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 20 Dec 2019 15:16:12 +0200 Subject: [PATCH 02/35] Prevent accessing outside the mons array --- doc/fixes37.0 | 1 + src/minion.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 37627fafa..41f7347a7 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -12,6 +12,7 @@ fix internal self-recover to work with recent fields added to checkpoint file improvements to pronoun usage when hallucinating function calls made from mapglyph based on dungeon level are now called once per level +fix accessing mons[-1] when trying to gate in a non-valid demon Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository diff --git a/src/minion.c b/src/minion.c index 6a8a06ee7..dac4430a0 100644 --- a/src/minion.c +++ b/src/minion.c @@ -78,11 +78,13 @@ struct monst *mon; if (is_dprince(ptr) || (ptr == &mons[PM_WIZARD_OF_YENDOR])) { dtype = (!rn2(20)) ? dprince(atyp) : (!rn2(4)) ? dlord(atyp) : ndemon(atyp); - cnt = (!rn2(4) && is_ndemon(&mons[dtype])) ? 2 : 1; + cnt = ((dtype != NON_PM) + && !rn2(4) && is_ndemon(&mons[dtype])) ? 2 : 1; } else if (is_dlord(ptr)) { dtype = (!rn2(50)) ? dprince(atyp) : (!rn2(20)) ? dlord(atyp) : ndemon(atyp); - cnt = (!rn2(4) && is_ndemon(&mons[dtype])) ? 2 : 1; + cnt = ((dtype != NON_PM) + && !rn2(4) && is_ndemon(&mons[dtype])) ? 2 : 1; } else if (is_ndemon(ptr)) { dtype = (!rn2(20)) ? dlord(atyp) : (!rn2(6)) ? ndemon(atyp) : monsndx(ptr); @@ -91,7 +93,8 @@ struct monst *mon; dtype = (is_lord(ptr) && !rn2(20)) ? llord() : (is_lord(ptr) || !rn2(6)) ? lminion() : monsndx(ptr); - cnt = (!rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1; + cnt = ((dtype != NON_PM) + && !rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1; } else if (ptr == &mons[PM_ANGEL]) { /* non-lawful angels can also summon */ if (!rn2(6)) { @@ -107,7 +110,8 @@ struct monst *mon; } else { dtype = PM_ANGEL; } - cnt = (!rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1; + cnt = ((dtype != NON_PM) + && !rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1; } if (dtype == NON_PM) From 0bcebf7343633aa47d43eb6f2cf490e8ce56c08b Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 20 Dec 2019 20:56:01 -0500 Subject: [PATCH 03/35] compiler warnings --- src/nhlobj.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/nhlobj.c b/src/nhlobj.c index 1ce9cd710..f7c9b5637 100644 --- a/src/nhlobj.c +++ b/src/nhlobj.c @@ -6,24 +6,16 @@ #include "sp_lev.h" static int FDECL(l_obj_add_to_container, (lua_State *)); -static int FDECL(l_obj_addcontent, (lua_State *)); -static int FDECL(l_obj_at, (lua_State *)); -static int FDECL(l_obj_class, (lua_State *)); -static int FDECL(l_obj_container, (lua_State *)); -static int FDECL(l_obj_contents, (lua_State *)); static int FDECL(l_obj_gc, (lua_State *)); static int FDECL(l_obj_getcontents, (lua_State *)); static int FDECL(l_obj_isnull, (lua_State *)); static int FDECL(l_obj_new_readobjnam, (lua_State *)); -static int FDECL(l_obj_next, (lua_State *)); static int FDECL(l_obj_nextobj, (lua_State *)); -static int FDECL(l_obj_obj_add_to_container, (lua_State *)); -static int FDECL(l_obj_obj_getcontents, (lua_State *)); -static int FDECL(l_obj_obj_objects_to_table, (lua_State *)); static int FDECL(l_obj_objects_to_table, (lua_State *)); static int FDECL(l_obj_placeobj, (lua_State *)); static int FDECL(l_obj_to_table, (lua_State *)); -static int FDECL(l_obj_totable, (lua_State *)); +static int FDECL(l_obj_at, (lua_State *)); +static int FDECL(l_obj_container, (lua_State *)); struct _lua_obj { int state; /* UNUSED */ From bdb8edff11cb74fcb64f152d157d0ec0979d8a4f Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 21 Dec 2019 14:22:24 -0500 Subject: [PATCH 04/35] attempt to get all 3.7.0 builds working in travis successfully multiple flavours of unix including bionic and xenial multiple Windows builds including visual studio and mingw msdos cross-compile on unix --- .travis.yml | 26 ++++++++++++++++---------- sys/winnt/Makefile.gcc | 26 ++++++++++++-------------- sys/winnt/travis-gcc.sh | 8 ++++++++ 3 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 sys/winnt/travis-gcc.sh diff --git a/.travis.yml b/.travis.yml index cc707bb88..dba3f2649 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,11 @@ matrix: env: DESCR=linux-xenial-gcc HINTS=linux compiler: gcc script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" + - os: linux + env: DESCR=linux-bionic-gcc HINTS=linux + dist: bionic + compiler: gcc + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-clang HINTS=linux compiler: clang @@ -74,6 +79,17 @@ matrix: language: shell script: - ./win/win32/vs2017/travisci.sh + - os: windows +# install: choco install mingw + env: DESCR=windows-mingw + script: + - sh sys/winnt/travis-gcc.sh + - export ADD_CURSES=Y + - export PDCURSES_TOP=../lib/pdcurses + - export LUA_VERSION=5.3.5 + - cd src + - cp ../sys/winnt/Makefile.gcc ./Makefile + - mingw32-make install - os: linux env: DESCR=msdos-cross-on-linux HINTS=linux LUA_VERSION=5.3.5 compiler: gcc @@ -84,16 +100,6 @@ matrix: - cd lib/lua-$LUA_VERSION/src && make a && cd ../../.. - sh sys/msdos/msdos-cross-compile.sh exclude: - - os: windows -# install: choco install mingw - env: DESCR=windows-mingw - script: - - git clone --depth 1 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 # - os: osx # osx_image: xcode10.3 # env: DESCR=osx-xcode10.3-x11 HINTS=macosx10.14 WANT_WIN_CURSES=1 WANT_WIN_X11=1 USE_XPM=1 diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index fbfd11000..92828aea3 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -270,9 +270,7 @@ U = $(UTIL)/ # Utility Objects. # -MAKESRC = $(U)makedefs.c - -MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o +MAKEDEFSOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o RECOVOBJS = $(O)recover.o @@ -304,8 +302,8 @@ VOBJ05 = $(O)do_wear.o $(O)dog.o $(O)dogmove.o $(O)dokick.o VOBJ06 = $(O)dothrow.o $(O)drawing.o $(O)dungeon.o $(O)eat.o VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o -VOBJ09 = $(O)hacklib.o $(O)invent.o $(O)light.o $(O)lock.o -VOBJ10 = $(O)mail.o $(O)makemon.o $(O)mapglyph.o $(O)isaac64.o +VOBJ09 = $(O)hacklib.o $(O)invent.o $(O)light.o $(O)lock.o +VOBJ10 = $(O)mail.o $(O)makemon.o $(O)mapglyph.o $(O)mdlib.o $(O)isaac64.o VOBJ11 = $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o $(O)minion.o VOBJ12 = $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o VOBJ13 = $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o @@ -791,12 +789,12 @@ $(O)utility.tag: $(INCL)/date.h $(INCL)/onames.h $(INCL)/pm.h \ @echo utilities made. $(INCL)/nhlua.h: - echo '/* nhlua.h - generated by top Makefile */' > $@ - @echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@ - @echo 'LUA_API int (lua_error) (lua_State *L) NORETURN;' >>$@ - @echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@ - @echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@ - @echo '/*nhlua.h*/' >> $@ + echo /* nhlua.h - generated by top Makefile */ > $@ + @echo #include "../lib/lua-$(LUA_VERSION)/src/lua.h" >> $@ + @echo LUA_API int (lua_error) (lua_State *L) NORETURN; >>$@ + @echo #include "../lib/lua-$(LUA_VERSION)/src/lualib.h" >> $@ + @echo #include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h" >> $@ + @echo /*nhlua.h*/ >> $@ tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe @echo Optional tile development utilities are up to date. @@ -894,12 +892,12 @@ objdir.tag: # Makedefs Stuff #========================================== -$(U)makedefs.exe: $(MAKEOBJS) - $(link) $(LFLAGSU) -o$@ $(MAKEOBJS) +$(U)makedefs.exe: $(MAKEDEFSOBJS) + $(link) $(LFLAGSU) -o$@ $(MAKEDEFSOBJS) $(O)makedefs.o: $(CONFIG_H) $(INCL)/monattk.h $(INCL)/monflag.h \ $(INCL)/objclass.h $(INCL)/monsym.h \ - $(INCL)/patchlevel.h $(U)makedefs.c + $(INCL)/patchlevel.h $(U)makedefs.c $(SRC)\mdlib.c $(cc) $(CFLAGSU) -o$@ $(U)makedefs.c # diff --git a/sys/winnt/travis-gcc.sh b/sys/winnt/travis-gcc.sh new file mode 100644 index 000000000..562b1a142 --- /dev/null +++ b/sys/winnt/travis-gcc.sh @@ -0,0 +1,8 @@ +set -x +mkdir -p lib +cd lib +git clone --depth 1 https://github.com/wmcbrine/PDCurses.git pdcurses +git clone --depth 1 https://github.com/universal-ctags/ctags.git ctags +curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz +tar zxf lua-5.3.5.tar.gz +cd ../ From 496a81d5b0c9477115bdd54ef3e1f4782f75bec7 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 21 Dec 2019 15:34:31 -0800 Subject: [PATCH 05/35] Get Visual Studio builds working once again. --- win/win32/vs2017/NetHack.vcxproj | 4 +++- win/win32/vs2017/NetHackW.vcxproj | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/win/win32/vs2017/NetHack.vcxproj b/win/win32/vs2017/NetHack.vcxproj index 924900537..9b542f737 100644 --- a/win/win32/vs2017/NetHack.vcxproj +++ b/win/win32/vs2017/NetHack.vcxproj @@ -128,6 +128,7 @@ + @@ -144,8 +145,9 @@ - + + diff --git a/win/win32/vs2017/NetHackW.vcxproj b/win/win32/vs2017/NetHackW.vcxproj index 1ea3ce9e5..0d3236627 100644 --- a/win/win32/vs2017/NetHackW.vcxproj +++ b/win/win32/vs2017/NetHackW.vcxproj @@ -122,6 +122,7 @@ + @@ -138,8 +139,9 @@ - + + From 7074b1c55feb1990368b4e80246be36a034d2a12 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 21 Dec 2019 15:34:57 -0800 Subject: [PATCH 06/35] Prevent crash caused by division by zero in NetHackW. --- win/win32/mhmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 28308913d..7569314a8 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -308,6 +308,10 @@ mswin_map_stretch(HWND hWnd, LPSIZE map_size, BOOL redraw) data->xFrontTile = (int) ((double) data->xBackTile * data->frontScale); data->yFrontTile = (int) ((double) data->yBackTile * data->frontScale); + /* ensure front tile is non-zero in size */ + data->xFrontTile = max(data->xFrontTile, 1); + data->yFrontTile = max(data->yFrontTile, 1); + /* calcuate ASCII cursor height */ data->yBlinkCursor = (int) ((double) CURSOR_HEIGHT * data->backScale); data->yNoBlinkCursor = data->yBackTile; From 78b64b6cb5260435d0f583fe485d1e86e771c87e Mon Sep 17 00:00:00 2001 From: nhw_cron Date: Sat, 21 Dec 2019 15:17:23 -0500 Subject: [PATCH 07/35] This is cron-daily v1-Dec-12-2019. files updated: Files --- Files | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Files b/Files index 93cde626b..c609cd478 100644 --- a/Files +++ b/Files @@ -289,9 +289,9 @@ Makefile.msc console.rc nethack.def nh340key.c nhdefkey.c nhico.uu nhraykey.c nhsetup.bat ntsound.c nttty.c porthelp stub-pdcscrn.c -stubs.c sysconf.template win10.c -win10.h win32api.h windmain.c -winnt.c winos.h +stubs.c sysconf.template travis-gcc.sh +win10.c win10.h win32api.h +windmain.c winnt.c winos.h test: (files in top directory) From 9b9925828a1b3ca140fc254990aadc10eececbdb Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 21 Dec 2019 16:57:53 -0800 Subject: [PATCH 08/35] Unix Makefile.utl Build feedback filtered by a script which filters out -Dthis -Wthat: gcc -g -I../include -I../lib/lua-/src -c ../win/share/tilemap.c The second -I is obsolete or else its bogus value would have caused build failure. When removing it, I noticed that there was still quite a bit of obsolete yacc and lex stuff in there. Remove that too. --- sys/unix/Makefile.utl | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/sys/unix/Makefile.utl b/sys/unix/Makefile.utl index 53a0805fb..6a190bd48 100644 --- a/sys/unix/Makefile.utl +++ b/sys/unix/Makefile.utl @@ -1,5 +1,5 @@ # Makefile for NetHack's utility programs. -# NetHack 3.6 Makefile.utl $NHDT-Date: 1574646950 2019/11/25 01:55:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ +# NetHack 3.6 Makefile.utl $NHDT-Date: 1576976264 2019/12/22 00:57:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.49 $ # Copyright (c) 2018 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details. @@ -84,7 +84,6 @@ NHSROOT=.. # LFLAGS = -b i486-linuxaout -L/usr/X11R6/lib # flags for BeOS using the command line -# remember to uncomment flex and bison below # BeOS on a Mac/BeBox: #CC = mwcc #CFLAGS = -I../include @@ -97,7 +96,7 @@ NHSROOT=.. #CFLAGS = -O -I../include #LFLAGS = -CFLAGS += -I../lib/lua-$(LUA_VERSION)/src +# -lm required by lua LFLAGS += -lm # we specify C preprocessor flags via CFLAGS; files built with default rules @@ -112,23 +111,6 @@ LIBS = # otherwise, you can save a little bit of disk space with this: OBJDIR = ../src -# yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c. -# if, instead of yacc/lex you have bison/flex, comment/uncomment the following. -YACC = yacc -LEX = lex -# YACC = bison -y -# YACC = byacc -# LEX = flex - -# these are the names of the output files from YACC/LEX. Under MS-DOS -# and similar systems, they may differ -YTABC = y.tab.c -YTABH = y.tab.h -LEXYYC = lex.yy.c -# YTABC = y_tab.c -# YTABH = y_tab.h -# LEXYYC = lexyy.c - # if you change this to 1, feedback while building will omit -Dthis -Wthat # -Isomewhere so that each file being compiled is listed on one short line; # it requires support for '$<' in rules with more than one prerequisite @@ -204,18 +186,6 @@ RECOVOBJS = recover.o # object files for the data librarian DLBOBJS = dlb_main.o $(OBJDIR)/dlb.o $(OALLOC) -# flags for creating distribution versions of sys/share/*_lex.c, using -# a more portable flex skeleton, which is not included in the distribution. -# hopefully keeping this out of the section to be edited will keep too -# many people from being confused by it... -# FLEXDIST = -L -S../sys/share/flexhack.skl -FLEXDIST = -# -# flags for creating distribution versions of sys/share/*_yacc.c, without -# line numbers so patches from version to version are practical -# YACCDIST = -l -YACCDIST = - # dependencies for makedefs # From 48a82fea8ce138577fafa35f4fdd968ac41225b3 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 22 Dec 2019 13:30:25 -0800 Subject: [PATCH 09/35] fix github issue #266 - timed clairvoyance When the hero has random clairvoyance, the code used | (moves % 15) == 0 && rn2(2) != 0 (where 'moves' is actually the turn number) to decide when it would kick in and show a portion of the map. If the hero was fast enough to get an extra move when the turn value met the (moves % 15) == 0 condition then clairvoyance could happen twice (or more if poly'd) on the same turn. The changes (one new field, reordering a few others) in 'struct context' invalidate existing 3.7.0-x save files. Fixes #266 --- doc/fixes37.0 | 5 +++-- include/context.h | 15 ++++++++------- include/patchlevel.h | 4 ++-- src/allmain.c | 24 ++++++++++++++++++++---- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 41f7347a7..63c0f879d 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ $NHDT-Date: 1576288434 2019/12/14 01:53:54 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.26 $ $NHDT-Date: 1577050214 2019/12/22 21:30:14 $ General Fixes and Modified Features ----------------------------------- @@ -13,6 +13,7 @@ improvements to pronoun usage when hallucinating function calls made from mapglyph based on dungeon level are now called once per level fix accessing mons[-1] when trying to gate in a non-valid demon +fast hero could have random clairvoyance happen more than once on same turn Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository @@ -56,7 +57,7 @@ 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 -old Qt moved from win/Qt to win/Qt3 +old Qt moved from win/Qt to win/Qt3 and files renamed to use qt3_ prefix more current Qt for Qt version 4 and 5 moved from win/Qt4 to win/Qt; qt4 moniker changed to qt_ diff --git a/include/context.h b/include/context.h index 4e20f3bdc..10034a4fb 100644 --- a/include/context.h +++ b/include/context.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 context.h $NHDT-Date: 1575775592 2019/12/08 03:26:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */ +/* NetHack 3.6 context.h $NHDT-Date: 1577050216 2019/12/22 21:30:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.36 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -111,14 +111,15 @@ struct context_info { unsigned run; /* 0: h (etc), 1: H (etc), 2: fh (etc) */ /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */ /* 8: travel */ - unsigned startingpet_mid; - int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */ - int warnlevel; + unsigned startingpet_mid; /* monster id number for initial pet */ + int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */ + int mysteryforce; /* adjusts how often "mysterious force" kicks in */ int rndencode; /* randomized escape sequence introducer */ - int mysteryforce; + int warnlevel; /* threshold (digit) to warn about unseen mons */ long next_attrib_check; /* next attribute check */ - long stethoscope_move; - short stethoscope_movement; + long seer_turn; /* when random clairvoyance will next kick in */ + long stethoscope_move; /* when a stethoscope was last used */ + short stethoscope_movement; /* to track multiple moves on same turn */ boolean travel; /* find way automatically to u.tx,u.ty */ boolean travel1; /* first travel step */ boolean forcefight; diff --git a/include/patchlevel.h b/include/patchlevel.h index 3d272ed14..4f90efd41 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 patchlevel.h $NHDT-Date: 1575775596 2019/12/08 03:26:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ +/* NetHack 3.7 patchlevel.h $NHDT-Date: 1577050214 2019/12/22 21:30:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.141 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 3 +#define EDITLEVEL 4 #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019" #define COPYRIGHT_BANNER_B \ diff --git a/src/allmain.c b/src/allmain.c index 5808503e8..678ff117d 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 allmain.c $NHDT-Date: 1555552624 2019/04/18 01:57:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.100 $ */ +/* NetHack 3.6 allmain.c $NHDT-Date: 1577050218 2019/12/22 21:30:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -66,6 +66,10 @@ boolean resuming; g.context.rndencode = rnd(9000); set_wear((struct obj *) 0); /* for side-effects of starting gear */ (void) pickup(1); /* autopickup at initial location */ + /* only matters if someday a character is able to start with + clairvoyance (wizard with cornuthaum perhaps?); without this, + first "random" occurrence would always kick in on turn 1 */ + g.context.seer_turn = (long) rnd(30); } g.context.botlx = TRUE; /* for STATUS_HILITES */ update_inventory(); /* for perm_invent */ @@ -336,9 +340,21 @@ boolean resuming; #endif if (g.context.bypasses) clear_bypasses(); - if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz) - && !BClairvoyant && !(g.moves % 15) && !rn2(2)) - do_vicinity_map((struct obj *) 0); + if (g.moves >= g.context.seer_turn) { + if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz) + && !BClairvoyant) + do_vicinity_map((struct obj *) 0); + /* we maintain this counter even when clairvoyance isn't + taking place; on average, go again 30 turns from now */ + g.context.seer_turn = g.moves + (long) rn1(31, 15); /*15..45*/ + /* [it used to be that on every 15th turn, there was a 50% + chance of farsight, so it could happen as often as every + 15 turns or theoretically never happen at all; but when + a fast hero got multiple moves on that 15th turn, it + could actually happen more than once on the same turn!] */ + } + /* [fast hero who gets multiple moves per turn ends up sinking + multiple times per turn; is that what we really want?] */ if (u.utrap && u.utraptype == TT_LAVA) sink_into_lava(); /* when/if hero escapes from lava, he can't just stay there */ From c3fb94104b6c044507fe7e1dbeae4384f44003d8 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 22 Dec 2019 13:40:59 -0800 Subject: [PATCH 10/35] 'quick_farsight' option Bite the bullet and add a special purpose boolean option to control game behavior for random clairvoyance. When objects or monsters are discovered, it normally issues "you sense your surroundings" and performs a getpos() operation which allows the player to browse the map by moving the cursor around and getting 'autodescribe' feedback. But there have been complaints that once the hero has the Amulet (which triggers random clairvoyance even though hero isn't flagged as having that attribute) the message and pause-to-browse become too intrusive. This was initially combined with the 'timed clairvoyance' fix because they both bump EDITLEVEL to invalidate existing save files, but their details don't interact so I separated them. --- dat/opthelp | 2 ++ doc/Guidebook.mn | 10 +++++++++- doc/Guidebook.tex | 11 ++++++++++- doc/fixes37.0 | 5 ++++- include/flag.h | 28 +++++++++++++++------------- include/patchlevel.h | 4 ++-- src/detect.c | 18 +++++++++++++++--- src/options.c | 3 ++- 8 files changed, 59 insertions(+), 22 deletions(-) diff --git a/dat/opthelp b/dat/opthelp index 0bcc8547e..29fcb2404 100644 --- a/dat/opthelp +++ b/dat/opthelp @@ -43,6 +43,8 @@ perm_invent keep inventory in a permanent window [FALSE] pickup_thrown override pickup_types for thrown objects [TRUE] pushweapon when wielding a new weapon, put your previously [FALSE] wielded weapon into the secondary weapon slot +quick_farsight usually skip the chance to browse the map when [FALSE] + randomly triggered clairvoyance takes place rawio allow the use of raw I/O [FALSE] rest_on_space count the space bar as a rest character [FALSE] safe_pet prevent you from (knowingly) attacking your pet(s) [TRUE] diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index c85238f4d..0b0ecd10d 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.337 $ $NHDT-Date: 1576431522 2019/12/15 17:38:42 $ +.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.345 $ $NHDT-Date: 1577050469 2019/12/22 21:34:29 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -3422,6 +3422,14 @@ something pushes the old item into your alternate weapon slot (default off). Likewise for the \(oqa\(cq (apply) command if it causes the applied item to become wielded. Persistent. +.lp quick_farsight +When set, usually prevents the \(lqyou sense your surroundings\(rq message +where play pauses to allow you to browse the map whenever clairvoyance +randomly activates. +Some situations, such as being underwater or engulfed, ignore this option. +It does not affect the clairvoyance spell where pausing to examine revealed +objects or monsters is less intrusive. +Default is off. Persistent. .lp "race " Selects your race (for example, \(lqrace:human\(rq). Default is random. diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 4e36344af..48ed797a9 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -3760,7 +3760,16 @@ Using the `w' (wield) command when already wielding something pushes the old item into your alternate weapon slot (default off). Likewise for the `a' (apply) command if it causes the applied item to become wielded. Persistent. -%.Ip +%.lp +\item[\ib(quick\verb+_+farsight} +When set, usually prevents the ``you sense your surroundings'' message +where play pauses to allow you to browse the map whenever clairvoyance +randomly activates. +Some situations, such as being underwater or engulfed, ignore this option. +It does not affect the clairvoyance spell where pausing to examine revealed +objects or monsters is less intrusive. +Default is off. Persistent. +%.lp \item[\ib{race}] Selects your race (for example, ``{\tt race:human}''). Default is random. If you prefix the value with `{\tt !}' or ``{\tt no}'', you will diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 63c0f879d..742e3dd85 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.26 $ $NHDT-Date: 1577050214 2019/12/22 21:30:14 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.27 $ $NHDT-Date: 1577050470 2019/12/22 21:34:30 $ General Fixes and Modified Features ----------------------------------- @@ -42,6 +42,9 @@ split off some of the functionality that was in makedefs (compiled-in options replace quest.txt and associated conversion to quest.dat via makedefs with lua quest texts loaded at runtime some altars are displayed in different colors (for tty and curses at least) +add 'quick_farsight' option to provide some control over random clairvoyance + where pausing to be able to browse temporarily visible aspects of the + revealed map can seem intrusive; doesn't affect clairvoyance spell Platform- and/or Interface-Specific New Features diff --git a/include/flag.h b/include/flag.h index d0237d628..e1091a562 100644 --- a/include/flag.h +++ b/include/flag.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 flag.h $NHDT-Date: 1574982014 2019/11/28 23:00:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.166 $ */ +/* NetHack 3.7 flag.h $NHDT-Date: 1577050470 2019/12/22 21:34:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.167 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -16,19 +16,19 @@ */ struct flag { - boolean acoustics; /* allow dungeon sound messages */ - boolean autodig; /* MRKR: Automatically dig */ - boolean autoquiver; /* Automatically fill quiver */ - boolean autoopen; /* open doors by walking into them */ - boolean beginner; - boolean biff; /* enable checking for mail */ - boolean bones; /* allow saving/loading bones */ - boolean confirm; /* confirm before hitting tame monsters */ - boolean dark_room; /* show shadows in lit rooms */ - boolean debug; /* in debugging mode */ + boolean acoustics; /* allow dungeon sound messages */ + boolean autodig; /* MRKR: Automatically dig */ + boolean autoquiver; /* Automatically fill quiver */ + boolean autoopen; /* open doors by walking into them */ + boolean beginner; /* True early in each game; affects feedback */ + boolean biff; /* enable checking for mail */ + boolean bones; /* allow saving/loading bones */ + boolean confirm; /* confirm before hitting tame monsters */ + boolean dark_room; /* show shadows in lit rooms */ + boolean debug; /* in debugging mode (aka wizard mode) */ #define wizard flags.debug - boolean end_own; /* list all own scores */ - boolean explore; /* in exploration mode */ + boolean end_own; /* list all own scores */ + boolean explore; /* in exploration mode (aka discover mode) */ #define discover flags.explore boolean female; boolean friday13; /* it's Friday the 13th */ @@ -44,6 +44,8 @@ struct flag { boolean pickup; /* whether you pickup or move and look */ boolean pickup_thrown; /* auto-pickup items you threw */ boolean pushweapon; /* When wielding, push old weapon into second slot */ + boolean quick_farsight; /* True disables map browsing during random + * clairvoyance */ boolean rest_on_space; /* space means rest */ boolean safe_dog; /* give complete protection to the dog */ boolean showexp; /* show experience points */ diff --git a/include/patchlevel.h b/include/patchlevel.h index 4f90efd41..8fd411eb1 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 patchlevel.h $NHDT-Date: 1577050214 2019/12/22 21:30:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.141 $ */ +/* NetHack 3.7 patchlevel.h $NHDT-Date: 1577050471 2019/12/22 21:34:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.142 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 4 +#define EDITLEVEL 5 #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019" #define COPYRIGHT_BANNER_B \ diff --git a/src/detect.c b/src/detect.c index e35d3829a..417afb595 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 detect.c $NHDT-Date: 1575245054 2019/12/02 00:04:14 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.100 $ */ +/* NetHack 3.6 detect.c $NHDT-Date: 1577050472 2019/12/22 21:34:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.110 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1314,7 +1314,8 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */ /* fake spellbook 'sobj' implies hero has cast the spell; when book is blessed, casting is skilled or expert level; if already clairvoyant, non-skilled spell acts like skilled */ - extended = (sobj && (sobj->blessed || Clairvoyant)); + extended = (sobj && (sobj->blessed || Clairvoyant)), + random_farsight = !sobj; int newglyph, oldglyph, lo_y = ((u.uy - 5 < 0) ? 0 : u.uy - 5), hi_y = ((u.uy + 6 >= ROWNO) ? ROWNO - 1 : u.uy + 6), @@ -1391,7 +1392,18 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */ } } - if (!g.level.flags.hero_memory || unconstrained || mdetected || odetected) { + /* when this instance of clairvoyance is random (see allmain()) and + the only reason to browse the map is that previously undetected + monster(s) or object(s) have been revealed, player can prevent + the you-sense-your-surroundings message and browse operation from + happening by setting 'quick_farsight' option; for clairvoyance + spell, that option is ignored because the message and the pause + for map browsing isn't as intrusive in that circumstance */ + if (random_farsight && flags.quick_farsight) + mdetected = odetected = FALSE; + + if (!g.level.flags.hero_memory || unconstrained + || mdetected || odetected) { flush_screen(1); /* flush temp screen */ /* the getpos() prompt from browse_map() is only shown when flags.verbose is set, but make this unconditional so that diff --git a/src/options.c b/src/options.c index 357902582..d6129dd97 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 options.c $NHDT-Date: 1575245078 2019/12/02 00:04:38 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.391 $ */ +/* NetHack 3.7 options.c $NHDT-Date: 1577050473 2019/12/22 21:34:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.422 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -184,6 +184,7 @@ static const struct Bool_Opt { { "popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME }, /*WC*/ { "preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME }, /*WC*/ { "pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME }, + { "quick_farsight", &flags.quick_farsight, FALSE, SET_IN_GAME }, #if defined(MICRO) && !defined(AMIGA) { "rawio", &iflags.rawio, FALSE, DISP_IN_GAME }, #else From 4079c50cb3fe5b330634de97a08cebecbcea3b3f Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Dec 2019 17:21:02 -0500 Subject: [PATCH 11/35] urealtime.realtime was being incorrectly calculated Looks like a branch merge gone awry perhaps. fixes #270 --- doc/fixes37.0 | 1 + src/save.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 41f7347a7..65457fbc3 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -13,6 +13,7 @@ improvements to pronoun usage when hallucinating function calls made from mapglyph based on dungeon level are now called once per level fix accessing mons[-1] when trying to gate in a non-valid demon +urealtime.realtime was being incorrectly calculated Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository diff --git a/src/save.c b/src/save.c index aff484987..55fcc8b73 100644 --- a/src/save.c +++ b/src/save.c @@ -287,10 +287,6 @@ NHFILE *nhfp; urealtime.finish_time = getnow(); urealtime.realtime += (long) (urealtime.finish_time - urealtime.start_timing); - - urealtime.finish_time = getnow(); - urealtime.realtime += (long) (urealtime.finish_time - - urealtime.start_timing); if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &u, sizeof u); bwrite(nhfp->fd, yyyymmddhhmmss(ubirthday), 14); From 0f1284f0682afe0e23b9b036ba5070c6a5c240d4 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 22 Dec 2019 14:51:05 -0800 Subject: [PATCH 12/35] wielding partial stack If you're wielding a stack of N items, issuing the command to quiver them asks whether you want to quiver N-1 of them (implicitly leaving one wielded). If you answer no then you're asked whether to quiver all of them. You could also give a count when picking the item to be quivered and the stack would be split based on that. However, if you have a stack of N items quivered, issuing the command to wield them just did so, leaving the quiver empty. And picking an item ignored any count, so even explicitly asking for 1 (out of N) wielded the whole stack. Change 'w' to parallel 'Q'; if you try to wield a quivered stack, you'll be asked whether to wield just 1 of them. For no, ask whether to wield the whole stack. Or you can give an explicit count when picking any stack in inventory to wield. Both 'w' and 'Q' probably ought to handle the alternate/secondary weapon similarly when it contains a stack. This doesn't address that. --- doc/fixes37.0 | 4 ++- src/wield.c | 76 +++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 68 insertions(+), 12 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 0ffbc69b6..5d0d80083 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.27 $ $NHDT-Date: 1577050470 2019/12/22 21:34:30 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.29 $ $NHDT-Date: 1577055058 2019/12/22 22:50:58 $ General Fixes and Modified Features ----------------------------------- @@ -15,6 +15,8 @@ function calls made from mapglyph based on dungeon level are now called once fix accessing mons[-1] when trying to gate in a non-valid demon fast hero could have random clairvoyance happen more than once on same turn urealtime.realtime was being incorrectly calculated +using 'Q' on wielded weapon would offer to split stack; make using 'w' on a + quivered stack behave similarly Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository diff --git a/src/wield.c b/src/wield.c index 1264987d1..c08934f91 100644 --- a/src/wield.c +++ b/src/wield.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wield.c $NHDT-Date: 1559670611 2019/06/04 17:50:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.59 $ */ +/* NetHack 3.6 wield.c $NHDT-Date: 1577055058 2019/12/22 22:50:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.68 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2009. */ /* NetHack may be freely redistributed. See license for details. */ @@ -245,7 +245,7 @@ register struct obj *obj; /*** Commands to change particular slot(s) ***/ static NEARDATA const char wield_objs[] = { - ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, TOOL_CLASS, 0 + ALLOW_COUNT, ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, TOOL_CLASS, 0 }; static NEARDATA const char ready_objs[] = { ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, 0 @@ -258,7 +258,9 @@ static NEARDATA const char bullets[] = { /* (note: different from dothrow.c) */ int dowield() { - register struct obj *wep, *oldwep; + char qbuf[QBUFSZ]; + struct obj *wep, *oldwep; + boolean finish_splitting = FALSE; int result; /* May we attempt this? */ @@ -269,10 +271,22 @@ dowield() } /* Prompt for a new weapon */ - if (!(wep = getobj(wield_objs, "wield"))) + clear_splitobjs(); + if (!(wep = getobj(wield_objs, "wield"))) { /* Cancelled */ return 0; - else if (wep == uwep) { + } else if (wep->o_id == g.context.objsplit.child_oid) { + /* if wep is the result of supplying a count to getobj() + we don't want to split something already wielded; for + any other item, we need to give it its own inventory slot */ + if (uwep && uwep->o_id == g.context.objsplit.parent_oid) { + unsplitobj(wep); + goto already_wielded; + } + finish_splitting = TRUE; + goto wielding; + } else if (wep == uwep) { + already_wielded: You("are already wielding that!"); if (is_weptool(wep) || is_wet_towel(wep)) g.unweapon = FALSE; /* [see setuwep()] */ @@ -285,17 +299,57 @@ dowield() } /* Handle no object, or object in other slot */ - if (wep == &cg.zeroobj) + if (wep == &cg.zeroobj) { wep = (struct obj *) 0; - else if (wep == uswapwep) + } else if (wep == uswapwep) { return doswapweapon(); - else if (wep == uquiver) + } else if (wep == uquiver) { + /* offer to split stack if multiple are quivered */ + if (uquiver->quan > 1L && inv_cnt(FALSE) < 52 && splittable(uquiver)) { + Sprintf(qbuf, "You have %ld %s readied. Wield one?", + uquiver->quan, simpleonames(uquiver)); + switch (ynq(qbuf)) { + case 'q': + return 0; + case 'y': + /* leave N-1 quivered, split off 1 to wield */ + wep = splitobj(uquiver, 1L); + finish_splitting = TRUE; + goto wielding; + default: + break; + } + Strcpy(qbuf, "Wield all of them instead?"); + } else { + boolean use_plural = (is_plural(uquiver) || pair_of(uquiver)); + + Sprintf(qbuf, "You have %s readied. Wield %s instead?", + !use_plural ? "that" : "those", + !use_plural ? "it" : "them"); + } + /* require confirmation to wield the quivered weapon */ + if (ynq(qbuf) != 'y') { + (void) Shk_Your(qbuf, uquiver); /* replace qbuf[] contents */ + pline("%s%s %s readied.", qbuf, + simpleonames(uquiver), otense(uquiver, "remain")); + return 0; + } + /* wielding whole readied stack, so no longer quivered */ setuqwep((struct obj *) 0); - else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) { + } else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) { You("cannot wield that!"); return 0; } + wielding: + if (finish_splitting) { + /* wep was split off from something; give it its own invlet */ + freeinv(wep); + wep->nomerge = 1; + addinv(wep); + wep->nomerge = 0; + } + /* Set your new primary weapon */ oldwep = uwep; result = ready_weapon(wep); @@ -363,7 +417,7 @@ dowieldquiver() /* will_weld(), touch_petrifies(), etc. */ g.multi = 0; /* forget last splitobj() before calling getobj() with ALLOW_COUNT */ - g.context.objsplit.child_oid = g.context.objsplit.parent_oid = 0; + clear_splitobjs(); /* Prompt for a new quiver: "What do you want to ready?" (Include gems/stones as likely candidates if either primary @@ -398,7 +452,7 @@ dowieldquiver() } finish_splitting = TRUE; } else if (newquiver == uquiver) { - already_quivered: + already_quivered: pline("That ammunition is already readied!"); return 0; } else if (newquiver->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) { From 308943aea44d31b5b46afac1ed2a81528acbdcb2 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Dec 2019 18:28:24 -0500 Subject: [PATCH 13/35] groundwork for window port interface change to add_menu groundwork only - window port interface change This changes the last parameter for add_menu() from a boolean to an unsigned int, to allow additional itemflags in future beyond just the "preselected" that the original boolean offered. There shouldn't be any functionality changes with this groundwork-only change, and if there are it is unintentional and should be reported. --- doc/window.doc | 6 +- include/hack.h | 3 - include/macwin.h | 2 +- include/winX.h | 2 +- include/wincurs.h | 2 +- include/wingem.h | 2 +- include/winprocs.h | 6 +- include/wintty.h | 17 ++--- include/wintype.h | 9 ++- src/apply.c | 6 +- src/artifact.c | 2 +- src/botl.c | 49 +++++++------- src/cmd.c | 107 ++++++++++++++++++------------ src/do_name.c | 14 ++-- src/dungeon.c | 4 +- src/end.c | 3 +- src/invent.c | 30 ++++----- src/nhlua.c | 3 +- src/o_init.c | 10 +-- src/options.c | 140 +++++++++++++++++++++------------------- src/pager.c | 18 +++--- src/pickup.c | 56 ++++++++-------- src/restore.c | 12 ++-- src/role.c | 10 +-- src/spell.c | 10 +-- src/teleport.c | 4 +- src/weapon.c | 10 +-- src/windows.c | 12 ++-- sys/amiga/winami.c | 28 ++++---- sys/amiga/winami.p | 2 +- sys/amiga/winmenu.c | 7 +- sys/amiga/winproto.h | 2 +- sys/mac/macwin.c | 3 +- sys/wince/mhmsg.h | 2 +- sys/wince/mswproc.c | 34 +++++----- sys/wince/winMS.h | 2 +- win/Qt/qt_bind.cpp | 3 +- win/Qt/qt_bind.h | 2 +- win/Qt3/qt3_win.cpp | 3 +- win/Qt3/qt3_win.h | 2 +- win/chain/wc_chainin.c | 7 +- win/chain/wc_chainout.c | 6 +- win/chain/wc_trace.c | 14 ++-- win/curses/cursinit.c | 6 +- win/curses/cursmain.c | 7 +- win/curses/cursmesg.c | 9 ++- win/gem/wingem.c | 31 ++++----- win/gnome/gnbind.c | 10 +-- win/share/safeproc.c | 4 +- win/tty/wintty.c | 56 +++++++++------- win/win32/mhmenu.c | 2 + win/win32/mhmsg.h | 1 + win/win32/mswproc.c | 34 +++++----- win/win32/winMS.h | 2 +- 54 files changed, 446 insertions(+), 382 deletions(-) diff --git a/doc/window.doc b/doc/window.doc index 3758bf55b..5d82c613d 100644 --- a/doc/window.doc +++ b/doc/window.doc @@ -310,7 +310,7 @@ start_menu(window) be used for menus. add_menu(windid window, int glyph, const anything identifier, char accelerator, char groupacc, - int attr, char *str, boolean preselected) + int attr, char *str, unsigned itemflags) -- Add a text line str to the given menu window. If identifier is 0, then the line cannot be selected (e.g. a title). Otherwise, identifier is the value returned if the line is @@ -337,8 +337,8 @@ add_menu(windid window, int glyph, const anything identifier, the menu command (or their user defined aliases), it loses. The menu commands and aliases take care not to interfere with the default object class symbols. - -- If you want this choice to be preselected when the - menu is displayed, set preselected to TRUE. + -- itemflags on this item (such as MENU_ITEMFLAGS_UNSELECTED, + MENU_ITEMFLAGS_PRESELECTED, etc.). end_menu(window, prompt) -- Stop adding entries to the menu and flushes the window diff --git a/include/hack.h b/include/hack.h index d22197b61..baedf773a 100644 --- a/include/hack.h +++ b/include/hack.h @@ -490,9 +490,6 @@ enum bodypart_types { #define MENU_FULL 2 #define MENU_PARTIAL 3 -#define MENU_SELECTED TRUE -#define MENU_UNSELECTED FALSE - /* * Option flags * Each higher number includes the characteristics of the numbers diff --git a/include/macwin.h b/include/macwin.h index b9b6ede14..3e33c847f 100644 --- a/include/macwin.h +++ b/include/macwin.h @@ -227,7 +227,7 @@ E void FDECL(mac_curs, (winid, int, int)); E void FDECL(mac_putstr, (winid, int, const char *)); E void FDECL(mac_start_menu, (winid)); E void FDECL(mac_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); + const char *, unsigned int)); E void FDECL(mac_end_menu, (winid, const char *)); E int FDECL(mac_select_menu, (winid, int, menu_item **)); #ifdef CLIPPING diff --git a/include/winX.h b/include/winX.h index a1a560528..93a3c1096 100644 --- a/include/winX.h +++ b/include/winX.h @@ -418,7 +418,7 @@ E void FDECL(X11_putstr, (winid, int, const char *)); E void FDECL(X11_display_file, (const char *, BOOLEAN_P)); E void FDECL(X11_start_menu, (winid)); E void FDECL(X11_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); + const char *, unsigned int)); E void FDECL(X11_end_menu, (winid, const char *)); E int FDECL(X11_select_menu, (winid, int, MENU_ITEM_P **)); E void NDECL(X11_update_inventory); diff --git a/include/wincurs.h b/include/wincurs.h index 8ae45e10e..07da384ac 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -82,7 +82,7 @@ extern void curses_display_file(const char *filename, BOOLEAN_P must_exist); extern void curses_start_menu(winid wid); extern void curses_add_menu(winid wid, int glyph, const ANY_P * identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel); + const char *str, unsigned int itemflags); extern void curses_end_menu(winid wid, const char *prompt); extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected); extern void curses_update_inventory(void); diff --git a/include/wingem.h b/include/wingem.h index 61c7e7c87..376b732d9 100644 --- a/include/wingem.h +++ b/include/wingem.h @@ -71,7 +71,7 @@ E void FDECL(Gem_putstr, (winid, int, const char *)); E void FDECL(Gem_display_file, (const char *, BOOLEAN_P)); E void FDECL(Gem_start_menu, (winid)); E void FDECL(Gem_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); + const char *, unsigned int)); E void FDECL(Gem_end_menu, (winid, const char *)); E int FDECL(Gem_select_menu, (winid, int, MENU_ITEM_P **)); E char FDECL(Gem_message_menu, (CHAR_P, int, const char *)); diff --git a/include/winprocs.h b/include/winprocs.h index 55b2b0611..8c266e4ff 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -32,7 +32,7 @@ struct window_procs { void FDECL((*win_display_file), (const char *, BOOLEAN_P)); void FDECL((*win_start_menu), (winid)); void FDECL((*win_add_menu), (winid, int, const ANY_P *, CHAR_P, CHAR_P, - int, const char *, BOOLEAN_P)); + int, const char *, unsigned int)); void FDECL((*win_end_menu), (winid, const char *)); int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **)); char FDECL((*win_message_menu), (CHAR_P, int, const char *)); @@ -331,7 +331,7 @@ struct chain_procs { void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P)); void FDECL((*win_start_menu), (CARGS, winid)); void FDECL((*win_add_menu), (CARGS, winid, int, const ANY_P *, CHAR_P, - CHAR_P, int, const char *, BOOLEAN_P)); + CHAR_P, int, const char *, unsigned int)); void FDECL((*win_end_menu), (CARGS, winid, const char *)); int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **)); char FDECL((*win_message_menu), (CARGS, CHAR_P, int, const char *)); @@ -405,7 +405,7 @@ extern void FDECL(safe_putmixed, (winid, int, const char *)); extern void FDECL(safe_display_file, (const char *, BOOLEAN_P)); extern void FDECL(safe_start_menu, (winid)); extern void FDECL(safe_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, - int, const char *, BOOLEAN_P)); + int, const char *, unsigned int)); extern void FDECL(safe_end_menu, (winid, const char *)); extern int FDECL(safe_select_menu, (winid, int, MENU_ITEM_P **)); extern char FDECL(safe_message_menu, (CHAR_P, int, const char *)); diff --git a/include/wintty.h b/include/wintty.h index a42ed22d4..30e257e97 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -13,13 +13,14 @@ /* menu structure */ typedef struct tty_mi { struct tty_mi *next; - anything identifier; /* user identifier */ - long count; /* user count */ - char *str; /* description string (including accelerator) */ - int attr; /* string attribute */ - boolean selected; /* TRUE if selected by user */ - char selector; /* keyboard accelerator */ - char gselector; /* group accelerator */ + anything identifier; /* user identifier */ + long count; /* user count */ + char *str; /* description string (including accelerator) */ + int attr; /* string attribute */ + boolean selected; /* TRUE if selected by user */ + unsigned int itemflags; /* */ + char selector; /* keyboard accelerator */ + char gselector; /* group accelerator */ } tty_menu_item; /* descriptor for tty-based windows */ @@ -191,7 +192,7 @@ E void FDECL(tty_putstr, (winid, int, const char *)); E void FDECL(tty_display_file, (const char *, BOOLEAN_P)); E void FDECL(tty_start_menu, (winid)); E void FDECL(tty_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); + const char *, unsigned int)); E void FDECL(tty_end_menu, (winid, const char *)); E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **)); E char FDECL(tty_message_menu, (CHAR_P, int, const char *)); diff --git a/include/wintype.h b/include/wintype.h index 26afbca3f..550afad3a 100644 --- a/include/wintype.h +++ b/include/wintype.h @@ -54,8 +54,9 @@ enum any_types { /* menu return list */ typedef struct mi { - anything item; /* identifier */ - long count; /* count */ + anything item; /* identifier */ + long count; /* count */ + unsigned itemflags; /* item flags */ } menu_item; #define MENU_ITEM_P struct mi @@ -105,6 +106,10 @@ typedef struct mi { #define MENU_UNSELECT_PAGE '\\' #define MENU_INVERT_PAGE '~' #define MENU_SEARCH ':' + +#define MENU_ITEMFLAGS_NONE 0x0000000 +#define MENU_ITEMFLAGS_SELECTED 0x0000001 + /* clang-format on */ #endif /* WINTYPE_H */ diff --git a/src/apply.c b/src/apply.c index 6451187e9..2eb8c2372 100644 --- a/src/apply.c +++ b/src/apply.c @@ -3178,14 +3178,14 @@ struct obj *obj; any.a_int++; Sprintf(buf, "an object on the %s", surface(cc.x, cc.y)); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int++; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "a monster", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int++; Sprintf(buf, "the %s", surface(cc.x, cc.y)); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); end_menu(tmpwin, "Aim for what?"); tohit = rn2(4); if (select_menu(tmpwin, PICK_ONE, &selected) > 0 diff --git a/src/artifact.c b/src/artifact.c index e25fedb24..b0a81989d 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1524,7 +1524,7 @@ struct obj *obj; continue; any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - g.dungeons[i].dname, MENU_UNSELECTED); + g.dungeons[i].dname, MENU_ITEMFLAGS_NONE); num_ok_dungeons++; last_ok_dungeon = i; } diff --git a/src/botl.c b/src/botl.c index d5454aa82..37594ff7c 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1930,7 +1930,7 @@ int arrmin, arrmax; any = cg.zeroany; any.a_int = i + adj; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - arr[i], MENU_UNSELECTED); + arr[i], MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, querystr); @@ -2305,7 +2305,7 @@ query_conditions() any = cg.zeroany; any.a_ulong = valid_conditions[i].bitmask; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - valid_conditions[i].id, MENU_UNSELECTED); + valid_conditions[i].id, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Choose status conditions"); @@ -2874,7 +2874,7 @@ status_hilite_menu_choose_field() any = cg.zeroany; any.a_int = (i + 1); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - initblstats[i].fldname, MENU_UNSELECTED); + initblstats[i].fldname, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select a hilite field:"); @@ -2913,7 +2913,7 @@ int fld; any.a_int = onlybeh = BL_TH_ALWAYS_HILITE; Sprintf(buf, "Always highlight %s", initblstats[fld].fldname); add_menu(tmpwin, NO_GLYPH, &any, 'a', 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); nopts++; } @@ -2921,7 +2921,7 @@ int fld; any = cg.zeroany; any.a_int = onlybeh = BL_TH_CONDITION; add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, - "Bitmask of conditions", MENU_UNSELECTED); + "Bitmask of conditions", MENU_ITEMFLAGS_NONE); nopts++; } @@ -2930,7 +2930,7 @@ int fld; any.a_int = onlybeh = BL_TH_UPDOWN; Sprintf(buf, "%s value changes", initblstats[fld].fldname); add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); nopts++; } @@ -2939,7 +2939,7 @@ int fld; any = cg.zeroany; any.a_int = onlybeh = BL_TH_VAL_ABSOLUTE; add_menu(tmpwin, NO_GLYPH, &any, 'n', 0, ATR_NONE, - "Number threshold", MENU_UNSELECTED); + "Number threshold", MENU_ITEMFLAGS_NONE); nopts++; } @@ -2947,7 +2947,7 @@ int fld; any = cg.zeroany; any.a_int = onlybeh = BL_TH_VAL_PERCENTAGE; add_menu(tmpwin, NO_GLYPH, &any, 'p', 0, ATR_NONE, - "Percentage threshold", MENU_UNSELECTED); + "Percentage threshold", MENU_ITEMFLAGS_NONE); nopts++; } @@ -2957,7 +2957,7 @@ int fld; any.a_int = onlybeh = BL_TH_TEXTMATCH; Sprintf(buf, "%s text match", initblstats[fld].fldname); add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); nopts++; } @@ -3004,7 +3004,7 @@ boolean ltok, gtok; any = cg.zeroany; any.a_int = 10 + LT_VALUE; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); if (str) { Sprintf(buf, "%s or %s", @@ -3012,7 +3012,7 @@ boolean ltok, gtok; any = cg.zeroany; any.a_int = 10 + LE_VALUE; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } } @@ -3023,7 +3023,7 @@ boolean ltok, gtok; any = cg.zeroany; any.a_int = 10 + EQ_VALUE; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); if (gtok) { if (str) { @@ -3032,7 +3032,7 @@ boolean ltok, gtok; any = cg.zeroany; any.a_int = 10 + GE_VALUE; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } if (str) @@ -3043,7 +3043,7 @@ boolean ltok, gtok; any = cg.zeroany; any.a_int = 10 + GT_VALUE; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } Sprintf(buf, "Select field %s value:", initblstats[fld].fldname); end_menu(tmpwin, buf); @@ -3545,25 +3545,28 @@ int fld; any = cg.zeroany; any.a_int = hlstr->id; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - hlstr->str, MENU_UNSELECTED); + hlstr->str, MENU_ITEMFLAGS_NONE); } hlstr = hlstr->next; } } else { any = cg.zeroany; Sprintf(buf, "No current hilites for %s", initblstats[fld].fldname); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); } /* separator line */ any = cg.zeroany; - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", + MENU_ITEMFLAGS_NONE); if (count) { any = cg.zeroany; any.a_int = -1; add_menu(tmpwin, NO_GLYPH, &any, 'X', 0, ATR_NONE, - "Remove selected hilites", MENU_UNSELECTED); + "Remove selected hilites", + MENU_ITEMFLAGS_NONE); } #ifndef SCORE_ON_BOTL @@ -3579,7 +3582,7 @@ int fld; any = cg.zeroany; any.a_int = -2; add_menu(tmpwin, NO_GLYPH, &any, 'Z', 0, ATR_NONE, - "Add a new hilite", MENU_UNSELECTED); + "Add a new hilite", MENU_ITEMFLAGS_NONE); } Sprintf(buf, "Current %s hilites:", initblstats[fld].fldname); @@ -3675,10 +3678,12 @@ shlmenu_redo: any = cg.zeroany; any.a_int = -1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "View all hilites in config format", MENU_UNSELECTED); + "View all hilites in config format", + MENU_ITEMFLAGS_NONE); any = cg.zeroany; - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", + MENU_ITEMFLAGS_NONE); } for (i = 0; i < MAXBLSTATS; i++) { @@ -3699,7 +3704,7 @@ shlmenu_redo: if (count) Sprintf(eos(buf), " (%d defined)", count); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Status hilites:"); diff --git a/src/cmd.c b/src/cmd.c index fa9e4cae6..542574a64 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -378,9 +378,10 @@ doextlist(VOID_ARGS) any = cg.zeroany; start_menu(menuwin); add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Extended Commands List", MENU_UNSELECTED); + "Extended Commands List", + MENU_ITEMFLAGS_NONE); add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "", MENU_UNSELECTED); + "", MENU_ITEMFLAGS_NONE); Strcpy(buf, menumode ? "Show" : "Hide"); Strcat(buf, " commands that don't autocomplete"); @@ -388,7 +389,7 @@ doextlist(VOID_ARGS) Strcat(buf, " (those not marked with [A])"); any.a_int = 1; add_menu(menuwin, NO_GLYPH, &any, 'a', 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); if (!*searchbuf) { any.a_int = 2; @@ -398,7 +399,8 @@ doextlist(VOID_ARGS) having ':' as an explicit selector overrides the default menu behavior for it; we retain 's' as a group accelerator */ add_menu(menuwin, NO_GLYPH, &any, ':', 's', ATR_NONE, - "Search extended commands", MENU_UNSELECTED); + "Search extended commands", + MENU_ITEMFLAGS_NONE); } else { Strcpy(buf, "Show all, clear search"); if (strlen(buf) + strlen(searchbuf) + strlen(" (\"\")") < QBUFSZ) @@ -410,18 +412,18 @@ doextlist(VOID_ARGS) work for interfaces which support ':' to search; use as a general menu command takes precedence over group accelerator */ add_menu(menuwin, NO_GLYPH, &any, 's', ':', ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } if (wizard) { any.a_int = 4; add_menu(menuwin, NO_GLYPH, &any, 'z', 0, ATR_NONE, onelist ? "Show debugging commands in separate section" : "Show all alphabetically, including debugging commands", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } any = cg.zeroany; add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "", MENU_UNSELECTED); + "", MENU_ITEMFLAGS_NONE); menushown[0] = menushown[1] = 0; n = 0; for (pass = 0; pass <= 1; ++pass) { @@ -463,7 +465,8 @@ doextlist(VOID_ARGS) if (!menushown[pass]) { Strcpy(buf, headings[pass]); add_menu(menuwin, NO_GLYPH, &any, 0, 0, - iflags.menu_headings, buf, MENU_UNSELECTED); + iflags.menu_headings, buf, + MENU_ITEMFLAGS_NONE); menushown[pass] = 1; } Sprintf(buf, " %-14s %-3s %s", @@ -471,16 +474,16 @@ doextlist(VOID_ARGS) (efp->flags & AUTOCOMPLETE) ? "[A]" : " ", efp->ef_desc); add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); ++n; } if (n) add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "", MENU_UNSELECTED); + "", MENU_ITEMFLAGS_NONE); } if (*searchbuf && !n) add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "no matches", MENU_UNSELECTED); + "no matches", MENU_ITEMFLAGS_NONE); end_menu(menuwin, (char *) 0); n = select_menu(menuwin, PICK_ONE, &selected); @@ -617,7 +620,7 @@ extcmd_via_menu() Sprintf(buf, fmtstr, prompt); any.a_char = prevaccelerator; add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE, - buf, FALSE); + buf, MENU_ITEMFLAGS_NONE); acount = 0; if (!(accelerator != prevaccelerator || one_per_line)) wastoolong = TRUE; @@ -641,7 +644,7 @@ extcmd_via_menu() Sprintf(buf, fmtstr, prompt); any.a_char = prevaccelerator; add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE, buf, - FALSE); + MENU_ITEMFLAGS_NONE); } Sprintf(prompt, "Extended Command: %s", cbuf); end_menu(win, prompt); @@ -1488,7 +1491,8 @@ wiz_intrinsic(VOID_ARGS) } if (p == FIRE_RES) { any.a_int = 0; - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "--", FALSE); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "--", + MENU_ITEMFLAGS_NONE); } any.a_int = i + 1; /* +1: avoid 0 */ oldtimeout = u.uprops[p].intrinsic & TIMEOUT; @@ -1496,7 +1500,8 @@ wiz_intrinsic(VOID_ARGS) Sprintf(buf, "%-27s [%li]", propname, oldtimeout); else Sprintf(buf, "%s", propname); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); } end_menu(win, "Which intrinsics?"); n = select_menu(win, PICK_ANY, &pick_list); @@ -1623,29 +1628,29 @@ doterrain(VOID_ARGS) any.a_int = 1; add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, "known map without monsters, objects, and traps", - MENU_SELECTED); + MENU_ITEMFLAGS_SELECTED); any.a_int = 2; add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, "known map without monsters and objects", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = 3; add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, "known map without monsters", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); if (discover || wizard) { any.a_int = 4; add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, "full map without monsters, objects, and traps", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); if (wizard) { any.a_int = 5; add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, "internal levl[][].typ codes in base-36", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = 6; add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, "legend of base-36 levl[][].typ codes", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } } end_menu(men, "View which?"); @@ -1715,7 +1720,8 @@ const char *buf; anything any; any = cg.zeroany; - add_menu(g.en_win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(g.en_win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); } else putstr(g.en_win, 0, buf); } @@ -3163,64 +3169,78 @@ minimal_enlightenment() tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - "Starting", FALSE); + "Starting", MENU_ITEMFLAGS_NONE); /* Starting name, race, role, gender */ Sprintf(buf, fmtstr, "name", g.plname); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); Sprintf(buf, fmtstr, "race", g.urace.noun); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); Sprintf(buf, fmtstr, "role", (flags.initgend && g.urole.name.f) ? g.urole.name.f : g.urole.name.m); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); /* Starting alignment */ Sprintf(buf, fmtstr, "alignment", align_str(u.ualignbase[A_ORIGINAL])); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); /* Current name, race, role, gender */ - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", + MENU_ITEMFLAGS_NONE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - "Current", FALSE); + "Current", MENU_ITEMFLAGS_NONE); Sprintf(buf, fmtstr, "race", Upolyd ? g.youmonst.data->mname : g.urace.noun); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); if (Upolyd) { Sprintf(buf, fmtstr, "role (base)", (u.mfemale && g.urole.name.f) ? g.urole.name.f : g.urole.name.m); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); } else { Sprintf(buf, fmtstr, "role", (flags.female && g.urole.name.f) ? g.urole.name.f : g.urole.name.m); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); } /* don't want poly_gender() here; it forces `2' for non-humanoids */ genidx = is_neuter(g.youmonst.data) ? 2 : flags.female; Sprintf(buf, fmtstr, "gender", genders[genidx].adj); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); if (Upolyd && (int) u.mfemale != genidx) { Sprintf(buf, fmtstr, "gender (base)", genders[u.mfemale].adj); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); } /* Current alignment */ Sprintf(buf, fmtstr, "alignment", align_str(u.ualign.type)); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); /* Deity list */ - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", + MENU_ITEMFLAGS_NONE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - "Deities", FALSE); + "Deities", MENU_ITEMFLAGS_NONE); Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC), (u.ualignbase[A_ORIGINAL] == u.ualign.type && u.ualign.type == A_CHAOTIC) ? " (s,c)" : (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (s)" : (u.ualign.type == A_CHAOTIC) ? " (c)" : ""); Sprintf(buf, fmtstr, "Chaotic", buf2); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL), (u.ualignbase[A_ORIGINAL] == u.ualign.type @@ -3228,7 +3248,8 @@ minimal_enlightenment() : (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (s)" : (u.ualign.type == A_NEUTRAL) ? " (c)" : ""); Sprintf(buf, fmtstr, "Neutral", buf2); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL), (u.ualignbase[A_ORIGINAL] == u.ualign.type @@ -3236,7 +3257,8 @@ minimal_enlightenment() : (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (s)" : (u.ualign.type == A_LAWFUL) ? " (c)" : ""); Sprintf(buf, fmtstr, "Lawful", buf2); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + MENU_ITEMFLAGS_NONE); end_menu(tmpwin, "Base Attributes"); n = select_menu(tmpwin, PICK_NONE, &selected); @@ -5443,7 +5465,8 @@ const char *text; if ((ch = cmd_from_func(func)) != '\0') { any = cg.zeroany; any.a_nfunc = func; - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, text, MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, text, + MENU_ITEMFLAGS_NONE); } } diff --git a/src/do_name.c b/src/do_name.c index cf812daa3..57cb551c8 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -601,7 +601,7 @@ int gloc; Sprintf(fullbuf, "%s%s%s", firstmatch, (*tmpbuf ? " " : ""), tmpbuf); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, fullbuf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } } @@ -1352,26 +1352,26 @@ docallcmd() any = cg.zeroany; any.a_char = 'm'; /* group accelerator 'C' */ add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'C', ATR_NONE, - "a monster", MENU_UNSELECTED); + "a monster", MENU_ITEMFLAGS_NONE); if (g.invent) { /* we use y and n as accelerators so that we can accept user's response keyed to old "name an individual object?" prompt */ any.a_char = 'i'; /* group accelerator 'y' */ add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'y', ATR_NONE, - "a particular object in inventory", MENU_UNSELECTED); + "a particular object in inventory", MENU_ITEMFLAGS_NONE); any.a_char = 'o'; /* group accelerator 'n' */ add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'n', ATR_NONE, - "the type of an object in inventory", MENU_UNSELECTED); + "the type of an object in inventory", MENU_ITEMFLAGS_NONE); } any.a_char = 'f'; /* group accelerator ',' (or ':' instead?) */ add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, ',', ATR_NONE, - "the type of an object upon the floor", MENU_UNSELECTED); + "the type of an object upon the floor", MENU_ITEMFLAGS_NONE); any.a_char = 'd'; /* group accelerator '\' */ add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, '\\', ATR_NONE, - "the type of an object on discoveries list", MENU_UNSELECTED); + "the type of an object on discoveries list", MENU_ITEMFLAGS_NONE); any.a_char = 'a'; /* group accelerator 'l' */ add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'l', ATR_NONE, - "record an annotation for the current level", MENU_UNSELECTED); + "record an annotation for the current level", MENU_ITEMFLAGS_NONE); end_menu(win, "What do you want to name?"); if (select_menu(win, PICK_ONE, &pick_list) > 0) { ch = pick_list[0].item.a_char; diff --git a/src/dungeon.c b/src/dungeon.c index 54a13c9ae..f07f375f1 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1978,7 +1978,7 @@ boolean unreachable; any.a_int = lchoices->idx + 1; } add_menu(win, NO_GLYPH, &any, lchoices->menuletter, 0, ATR_NONE, entry, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); /* this assumes there are at most 52 interesting levels */ if (lchoices->menuletter == 'z') lchoices->menuletter = 'A'; @@ -2090,7 +2090,7 @@ xchar *rdgn; if (bymenu) { any = cg.zeroany; add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } else putstr(win, 0, buf); diff --git a/src/end.c b/src/end.c index c35677ed2..74d1bdf53 100644 --- a/src/end.c +++ b/src/end.c @@ -1815,7 +1815,8 @@ set_vanq_order() continue; any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, vanqorders[i], - (i == g.vanq_sortmode) ? MENU_SELECTED : MENU_UNSELECTED); + (i == g.vanq_sortmode) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Sort order for vanquished monster counts"); diff --git a/src/invent.c b/src/invent.c index cc6bd353c..8ca20b3e1 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2654,11 +2654,11 @@ long *out_cnt; Sprintf(eos(prompt), " -- unidentified or partially identified item%s", plur(unid_cnt)); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, MENU_ITEMFLAGS_NONE); if (!unid_cnt) { add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "(all items are permanently identified already)", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); gotsomething = TRUE; } else { any.a_obj = &wizid_fakeobj; @@ -2673,17 +2673,17 @@ long *out_cnt; Sprintf(eos(prompt), " (%s for all)", visctrl(iflags.override_ID)); add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE, - prompt, MENU_UNSELECTED); + prompt, MENU_ITEMFLAGS_NONE); gotsomething = TRUE; } } else if (xtra_choice) { /* wizard override ID and xtra_choice are mutually exclusive */ if (flags.sortpack) add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - "Miscellaneous", MENU_UNSELECTED); + "Miscellaneous", MENU_ITEMFLAGS_NONE); any.a_char = HANDS_SYM; /* '-' */ add_menu(win, NO_GLYPH, &any, HANDS_SYM, 0, ATR_NONE, - xtra_choice, MENU_UNSELECTED); + xtra_choice, MENU_ITEMFLAGS_NONE); gotsomething = TRUE; } nextclass: @@ -2700,7 +2700,7 @@ long *out_cnt; add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, let_to_name(*invlet, FALSE, (want_reply && iflags.menu_head_objsym)), - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); classcount++; } if (wizid) @@ -2709,7 +2709,7 @@ long *out_cnt; any.a_char = ilet; add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng), &any, ilet, wizid ? def_oc_syms[(int) otmp->oclass].sym : 0, - ATR_NONE, doname(otmp), MENU_UNSELECTED); + ATR_NONE, doname(otmp), MENU_ITEMFLAGS_NONE); gotsomething = TRUE; } } @@ -2724,10 +2724,10 @@ long *out_cnt; if (iflags.force_invmenu && lets && want_reply) { any = cg.zeroany; add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - "Special", MENU_UNSELECTED); + "Special", MENU_ITEMFLAGS_NONE); any.a_char = '*'; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, - "(list everything)", MENU_UNSELECTED); + "(list everything)", MENU_ITEMFLAGS_NONE); gotsomething = TRUE; } unsortloot(&sortedinvent); @@ -2738,7 +2738,7 @@ long *out_cnt; if (iflags.perm_invent && !lets && !gotsomething) { any = cg.zeroany; add_menu(win, NO_GLYPH, &any, 0, 0, 0, - not_carrying_anything, MENU_UNSELECTED); + not_carrying_anything, MENU_ITEMFLAGS_NONE); want_reply = FALSE; } end_menu(win, query && *query ? query : (char *) 0); @@ -2824,13 +2824,13 @@ char avoidlet; add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, let_to_name(*invlet, FALSE, FALSE), - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); classcount++; } any.a_char = ilet; add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng), &any, ilet, 0, ATR_NONE, - doname(otmp), MENU_UNSELECTED); + doname(otmp), MENU_ITEMFLAGS_NONE); } } if (flags.sortpack && *++invlet) @@ -4275,9 +4275,9 @@ const char *hdr, *txt; win = create_nhwindow(NHW_MENU); start_menu(win); add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, hdr, - MENU_UNSELECTED); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, txt, MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, txt, MENU_ITEMFLAGS_NONE); end_menu(win, (char *) 0); if (select_menu(win, PICK_NONE, &selected) > 0) free((genericptr_t) selected); diff --git a/src/nhlua.c b/src/nhlua.c index edbde987e..b6afc2e59 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -482,7 +482,8 @@ lua_State *L; if (*key) any.a_char = key[0]; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, str, - (*defval && *key && defval[0] == key[0]) ? MENU_SELECTED : MENU_UNSELECTED); + (*defval && *key && defval[0] == key[0]) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); lua_pop(L, 1); /* removes 'value'; keeps 'key' for next iteration */ } diff --git a/src/o_init.c b/src/o_init.c index 7f9931ae8..3c15a0e71 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -532,7 +532,7 @@ doclassdisco() if (!traditional) { any.a_int = 'u'; add_menu(tmpwin, NO_GLYPH, &any, menulet++, 0, ATR_NONE, - unique_items, MENU_UNSELECTED); + unique_items, MENU_ITEMFLAGS_NONE); } break; } @@ -543,7 +543,7 @@ doclassdisco() if (!traditional) { any.a_int = 'a'; add_menu(tmpwin, NO_GLYPH, &any, menulet++, 0, ATR_NONE, - artifact_items, MENU_UNSELECTED); + artifact_items, MENU_ITEMFLAGS_NONE); } } @@ -565,7 +565,7 @@ doclassdisco() any.a_int = c; add_menu(tmpwin, NO_GLYPH, &any, menulet++, c, ATR_NONE, oclass_to_name(oclass, buf), - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } } } @@ -707,12 +707,12 @@ rename_disco() any.a_int = 0; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, let_to_name(oclass, FALSE, FALSE), - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); prev_class = oclass; } any.a_int = dis; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - obj_typename(dis), MENU_UNSELECTED); + obj_typename(dis), MENU_ITEMFLAGS_NONE); } } if (ct == 0) { diff --git a/src/options.c b/src/options.c index d6129dd97..5a9c90fae 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 options.c $NHDT-Date: 1577050473 2019/12/22 21:34:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.422 $ */ +/* NetHack 3.7 options.c $NHDT-Date: 1575245078 2019/12/02 00:04:38 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.391 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -184,7 +184,6 @@ static const struct Bool_Opt { { "popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME }, /*WC*/ { "preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME }, /*WC*/ { "pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME }, - { "quick_farsight", &flags.quick_farsight, FALSE, SET_IN_GAME }, #if defined(MICRO) && !defined(AMIGA) { "rawio", &iflags.rawio, FALSE, DISP_IN_GAME }, #else @@ -1451,8 +1450,8 @@ const char *prompt; break; any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name, - (colornames[i].color == NO_COLOR) ? MENU_SELECTED - : MENU_UNSELECTED); + (colornames[i].color == NO_COLOR) ? MENU_ITEMFLAGS_SELECTED + : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick a color"); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); @@ -1498,8 +1497,8 @@ const char *prompt; any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr, attrnames[i].name, - (attrnames[i].attr == default_attr) ? MENU_SELECTED - : MENU_UNSELECTED); + (attrnames[i].attr == default_attr) ? MENU_ITEMFLAGS_SELECTED + : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick an attribute"); pick_cnt = select_menu(tmpwin, allow_many ? PICK_ANY : PICK_ONE, &picks); @@ -1595,7 +1594,7 @@ query_msgtype() if (msgtype_names[i].descr) { any.a_int = msgtype_names[i].msgtyp + 1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - msgtype_names[i].descr, MENU_UNSELECTED); + msgtype_names[i].descr, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "How to show the message"); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); @@ -4340,7 +4339,7 @@ int indexoffset; /* value to add to index in compopt[], or zero value); else Sprintf(buf, fmtstr_doset_tab, option, value); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); } static void @@ -4364,7 +4363,7 @@ int nset; name, buf2); else Sprintf(buf, fmtstr_doset_tab, name, buf2); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); } int @@ -4462,7 +4461,7 @@ doset() /* changing options via menu by Per Liboriussen */ any = cg.zeroany; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - "Booleans (selecting will toggle value):", MENU_UNSELECTED); + "Booleans (selecting will toggle value):", MENU_ITEMFLAGS_NONE); any.a_int = 0; /* first list any other non-modifiable booleans, then modifiable ones */ for (pass = 0; pass <= 1; pass++) @@ -4486,16 +4485,16 @@ doset() /* changing options via menu by Per Liboriussen */ Sprintf(buf, fmtstr_doset_tab, name, *bool_p ? "true" : "false"); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } boolcount = i; indexoffset = boolcount; any = cg.zeroany; - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, "Compounds (selecting will prompt for new value):", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); /* deliberately put playmode, name, role+race+gender+align first */ doset_add_menu(tmpwin, "playmode", 0); @@ -4521,9 +4520,9 @@ doset() /* changing options via menu by Per Liboriussen */ } any = cg.zeroany; - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - "Other settings:", MENU_UNSELECTED); + "Other settings:", MENU_ITEMFLAGS_NONE); for (i = 0; (name = othropt[i].name) != 0; i++) { if ((is_wc_option(name) && !wc_supported(name)) @@ -4535,9 +4534,9 @@ doset() /* changing options via menu by Per Liboriussen */ #ifdef PREFIXES_IN_USE any = cg.zeroany; - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - "Variable playground locations:", MENU_UNSELECTED); + "Variable playground locations:", MENU_ITEMFLAGS_NONE); for (i = 0; i < PREFIX_COUNT; i++) doset_add_menu(tmpwin, fqn_prefix_names[i], 0); #endif @@ -4649,7 +4648,7 @@ int numtotal; Sprintf(tmpbuf, action_titles[i].desc, (i == 1) ? makeplural(optname) : optname); add_menu(tmpwin, NO_GLYPH, &any, action_titles[i].letr, 0, ATR_NONE, - tmpbuf, (i == 3) ? MENU_SELECTED : MENU_UNSELECTED); + tmpbuf, (i == 3) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Do what?"); if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) { @@ -4691,7 +4690,7 @@ boolean setinitial, setfromfile; to avoid an optimizer bug in VAX C V2.3 */ any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, *style_name, 0, ATR_NONE, - style_name, MENU_UNSELECTED); + style_name, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select menustyle:"); if (select_menu(tmpwin, PICK_ONE, &style_pick) > 0) { @@ -4712,8 +4711,8 @@ boolean setinitial, setfromfile; add_menu(tmpwin, NO_GLYPH, &any, *paranoia[i].argname, 0, ATR_NONE, paranoia[i].explain, (flags.paranoia_bits & paranoia[i].flagmask) - ? MENU_SELECTED - : MENU_UNSELECTED); + ? MENU_ITEMFLAGS_SELECTED + : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Actions requiring extra confirmation:"); i = select_menu(tmpwin, PICK_ANY, ¶noia_picks); @@ -4741,7 +4740,7 @@ boolean setinitial, setfromfile; burden_name = burdentype[i]; any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, burden_letters[i], 0, ATR_NONE, - burden_name, MENU_UNSELECTED); + burden_name, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select encumbrance level:"); if (select_menu(tmpwin, PICK_ONE, &burden_pick) > 0) { @@ -4773,7 +4772,7 @@ boolean setinitial, setfromfile; flags.end_disclose[i], disclosure_options[i]); any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, disclosure_options[i], 0, - ATR_NONE, buf, MENU_UNSELECTED); + ATR_NONE, buf, MENU_ITEMFLAGS_NONE); disc_cat[i] = 0; } end_menu(tmpwin, "Change which disclosure options categories:"); @@ -4800,32 +4799,32 @@ boolean setinitial, setfromfile; any.a_char = DISCLOSE_NO_WITHOUT_PROMPT; add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, "Never disclose, without prompting", - (c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED); + (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = DISCLOSE_YES_WITHOUT_PROMPT; add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, "Always disclose, without prompting", - (c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED); + (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); if (*disclosure_names[i] == 'v') { any.a_char = DISCLOSE_SPECIAL_WITHOUT_PROMPT; /* '#' */ add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, "Always disclose, pick sort order from menu", - (c == any.a_char) ? MENU_SELECTED - : MENU_UNSELECTED); + (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED + : MENU_ITEMFLAGS_NONE); } any.a_char = DISCLOSE_PROMPT_DEFAULT_NO; add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, "Prompt, with default answer of \"No\"", - (c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED); + (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = DISCLOSE_PROMPT_DEFAULT_YES; add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, "Prompt, with default answer of \"Yes\"", - (c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED); + (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); if (*disclosure_names[i] == 'v') { any.a_char = DISCLOSE_PROMPT_DEFAULT_SPECIAL; /* '?' */ add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, "Prompt, with default answer of \"Ask\" to request sort menu", - (c == any.a_char) ? MENU_SELECTED - : MENU_UNSELECTED); + (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED + : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, buf); n = select_menu(tmpwin, PICK_ONE, &disclosure_pick); @@ -4849,7 +4848,7 @@ boolean setinitial, setfromfile; mode_name = runmodes[i]; any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, *mode_name, 0, ATR_NONE, - mode_name, MENU_UNSELECTED); + mode_name, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select run/travel display mode:"); if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) { @@ -4868,33 +4867,38 @@ boolean setinitial, setfromfile; any.a_char = GPCOORDS_COMPASS; add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMPASS, 0, ATR_NONE, "compass ('east' or '3s' or '2n,4w')", - (gp == GPCOORDS_COMPASS) ? MENU_SELECTED : MENU_UNSELECTED); + (gp == GPCOORDS_COMPASS) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = GPCOORDS_COMFULL; add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMFULL, 0, ATR_NONE, "full compass ('east' or '3south' or '2north,4west')", - (gp == GPCOORDS_COMFULL) ? MENU_SELECTED : MENU_UNSELECTED); + (gp == GPCOORDS_COMFULL) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = GPCOORDS_MAP; add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_MAP, 0, ATR_NONE, "map ", - (gp == GPCOORDS_MAP) ? MENU_SELECTED : MENU_UNSELECTED); + (gp == GPCOORDS_MAP) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = GPCOORDS_SCREEN; add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_SCREEN, 0, ATR_NONE, "screen [row,column]", - (gp == GPCOORDS_SCREEN) ? MENU_SELECTED : MENU_UNSELECTED); + (gp == GPCOORDS_SCREEN) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = GPCOORDS_NONE; add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_NONE, 0, ATR_NONE, "none (no coordinates displayed)", - (gp == GPCOORDS_NONE) ? MENU_SELECTED : MENU_UNSELECTED); + (gp == GPCOORDS_NONE) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_long = 0L; - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); Sprintf(buf, "map: upper-left: <%d,%d>, lower-right: <%d,%d>%s", 1, 0, COLNO - 1, ROWNO - 1, flags.verbose ? "; column 0 unused, off left edge" : ""); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); if (strcmp(windowprocs.name, "tty")) /* only show for non-tty */ add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "screen: row is offset to accommodate tty interface's use of top line", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); #if COLNO == 80 #define COL80ARG flags.verbose ? "; column 80 is not used" : "" #else @@ -4903,8 +4907,8 @@ boolean setinitial, setfromfile; Sprintf(buf, "screen: upper-left: [%02d,%02d], lower-right: [%d,%d]%s", 0 + 2, 1, ROWNO - 1 + 2, COLNO - 1, COL80ARG); #undef COL80ARG - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); end_menu(tmpwin, "Select coordinate display when auto-describing a map position:"); if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) { @@ -4927,15 +4931,18 @@ boolean setinitial, setfromfile; any.a_char = (GFILTER_NONE + 1); add_menu(tmpwin, NO_GLYPH, &any, 'n', 0, ATR_NONE, "no filtering", - (gf == GFILTER_NONE) ? MENU_SELECTED : MENU_UNSELECTED); + (gf == GFILTER_NONE) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = (GFILTER_VIEW + 1); add_menu(tmpwin, NO_GLYPH, &any, 'v', 0, ATR_NONE, "in view only", - (gf == GFILTER_VIEW) ? MENU_SELECTED : MENU_UNSELECTED); + (gf == GFILTER_VIEW) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = (GFILTER_AREA + 1); add_menu(tmpwin, NO_GLYPH, &any, 'a', 0, ATR_NONE, "in same area", - (gf == GFILTER_AREA) ? MENU_SELECTED : MENU_UNSELECTED); + (gf == GFILTER_AREA) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); end_menu(tmpwin, "Select location filtering when going for next/previous map position:"); if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) { @@ -4959,17 +4966,17 @@ boolean setinitial, setfromfile; if (!WINDOWPORT("curses")) { any.a_char = 's'; add_menu(tmpwin, NO_GLYPH, &any, 's', 0, ATR_NONE, - "single", MENU_UNSELECTED); + "single", MENU_ITEMFLAGS_NONE); any.a_char = 'c'; add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE, - "combination", MENU_UNSELECTED); + "combination", MENU_ITEMFLAGS_NONE); } any.a_char = 'f'; add_menu(tmpwin, NO_GLYPH, &any, 'f', 0, ATR_NONE, "full", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_char = 'r'; add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "reversed", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); end_menu(tmpwin, "Select message history display type:"); if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) { iflags.prevmsg_window = window_pick->item.a_char; @@ -4992,7 +4999,7 @@ boolean setinitial, setfromfile; any.a_char = *sortl_name; add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0, ATR_NONE, sortl_name, (flags.sortloot == *sortl_name) - ? MENU_SELECTED : MENU_UNSELECTED); + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select loot sorting type:"); n = select_menu(tmpwin, PICK_ONE, &sortl_pick); @@ -5016,16 +5023,16 @@ boolean setinitial, setfromfile; any = cg.zeroany; any.a_int = ALIGN_TOP; add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, "top", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = ALIGN_BOTTOM; add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, "bottom", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = ALIGN_LEFT; add_menu(tmpwin, NO_GLYPH, &any, 'l', 0, ATR_NONE, "left", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = ALIGN_RIGHT; add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "right", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(abuf, "Select %s window placement relative to the map:", msg ? "message" : "status"); end_menu(tmpwin, abuf); @@ -5052,7 +5059,7 @@ boolean setinitial, setfromfile; for (i = 0; i < SIZE(npchoices); i++) { any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, 'a' + i, 0, ATR_NONE, - npchoices[i], MENU_UNSELECTED); + npchoices[i], MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select number_pad mode:"); if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) { @@ -5137,7 +5144,7 @@ boolean setinitial, setfromfile; else Strcat(strcat(mtbuf, tmp->pattern), "\""); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); tmp = tmp->next; } Sprintf(mtbuf, "%s message types", @@ -5226,7 +5233,7 @@ boolean setinitial, setfromfile; /* combine main string and suffix */ Strcat(mcbuf, &buf[1]); /* skip buf[]'s initial quote */ add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mcbuf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); tmp = tmp->next; } Sprintf(mcbuf, "%s menu colors", @@ -5284,7 +5291,7 @@ boolean setinitial, setfromfile; any = cg.zeroany; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, "Always pickup '<'; never pickup '>'", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); for (i = 0; i < numapes && ape; i++) { any.a_void = (opt_idx == 1) ? 0 : ape; /* length of pattern plus quotes (plus '<'/'>') is @@ -5292,7 +5299,7 @@ boolean setinitial, setfromfile; Sprintf(apebuf, "\"%c%s\"", ape->grab ? '<' : '>', ape->pattern); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, apebuf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); ape = ape->next; } } @@ -5371,8 +5378,8 @@ boolean setinitial, setfromfile; defindx = any.a_int; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "Default Symbols", - (any.a_int == defindx) ? MENU_SELECTED - : MENU_UNSELECTED); + (any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED + : MENU_ITEMFLAGS_NONE); for (sl = g.symset_list; sl; sl = sl->next) { /* check restrictions */ @@ -5391,8 +5398,8 @@ boolean setinitial, setfromfile; defindx = any.a_int; Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : ""); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, - (any.a_int == defindx) ? MENU_SELECTED - : MENU_UNSELECTED); + (any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED + : MENU_ITEMFLAGS_NONE); } } Sprintf(buf, "Select %ssymbol set:", @@ -6422,7 +6429,8 @@ char *class_select; } any.a_int = *class_list; add_menu(win, NO_GLYPH, &any, accelerator, category ? *class_list : 0, - ATR_NONE, buf, selected); + ATR_NONE, buf, + selected ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ++class_list; if (category > 0) { ++next_accelerator; @@ -6435,13 +6443,13 @@ char *class_select; if (category == 1 && next_accelerator <= 'z') { /* for objects, add "A - ' ' all classes", after a separator */ any = cg.zeroany; - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); any.a_int = (int) ' '; Sprintf(buf, "%c %s", (char) any.a_int, "all classes of objects"); /* we won't preselect this even if the incoming list is empty; having it selected means that it would have to be explicitly de-selected in order to select anything else */ - add_menu(win, NO_GLYPH, &any, 'A', 0, ATR_NONE, buf, MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 'A', 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); } end_menu(win, prompt); n = select_menu(win, way ? PICK_ANY : PICK_ONE, &pick_list); diff --git a/src/pager.c b/src/pager.c index f29cedadb..f6ed84da3 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1167,19 +1167,19 @@ coord *click_cc; versions: "Specify unknown object by cursor?" */ add_menu(win, NO_GLYPH, &any, flags.lootabc ? 0 : any.a_char, 'y', ATR_NONE, - "something on the map", MENU_UNSELECTED); + "something on the map", MENU_ITEMFLAGS_NONE); any.a_char = 'i'; add_menu(win, NO_GLYPH, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "something you're carrying", MENU_UNSELECTED); + "something you're carrying", MENU_ITEMFLAGS_NONE); any.a_char = '?'; add_menu(win, NO_GLYPH, &any, flags.lootabc ? 0 : any.a_char, 'n', ATR_NONE, - "something else (by symbol or name)", MENU_UNSELECTED); + "something else (by symbol or name)", MENU_ITEMFLAGS_NONE); if (!u.uswallow && !Hallucination) { any = cg.zeroany; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - "", MENU_UNSELECTED); + "", MENU_ITEMFLAGS_NONE); /* these options work sensibly for the swallowed case, but there's no reason for the player to use them then; objects work fine when hallucinating, but screen @@ -1188,19 +1188,19 @@ coord *click_cc; any.a_char = 'm'; add_menu(win, NO_GLYPH, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "nearby monsters", MENU_UNSELECTED); + "nearby monsters", MENU_ITEMFLAGS_NONE); any.a_char = 'M'; add_menu(win, NO_GLYPH, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "all monsters shown on map", MENU_UNSELECTED); + "all monsters shown on map", MENU_ITEMFLAGS_NONE); any.a_char = 'o'; add_menu(win, NO_GLYPH, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "nearby objects", MENU_UNSELECTED); + "nearby objects", MENU_ITEMFLAGS_NONE); any.a_char = 'O'; add_menu(win, NO_GLYPH, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "all objects shown on map", MENU_UNSELECTED); + "all objects shown on map", MENU_ITEMFLAGS_NONE); } end_menu(win, "What do you want to look at:"); if (select_menu(win, PICK_ONE, &pick_list) > 0) { @@ -2053,7 +2053,7 @@ dohelp() } any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - helpbuf, MENU_UNSELECTED); + helpbuf, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select one item:"); n = select_menu(tmpwin, PICK_ONE, &selected); diff --git a/src/pickup.c b/src/pickup.c index 6d932912d..b79c17d27 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -901,7 +901,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ let_to_name(*pack, FALSE, ((how != PICK_NONE) && iflags.menu_head_objsym)), - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); printed_type_name = TRUE; } @@ -910,7 +910,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ (qflags & USE_INVLET) ? curr->invlet : (first && curr->oclass == COIN_CLASS) ? '$' : 0, def_oc_syms[(int) objects[curr->otyp].oc_class].sym, - ATR_NONE, doname_with_price(curr), MENU_UNSELECTED); + ATR_NONE, doname_with_price(curr), MENU_ITEMFLAGS_NONE); first = FALSE; } } @@ -926,7 +926,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ Sprintf(buf, "%s Creatures", is_animal(u.ustuck->data) ? "Swallowed" : "Engulfed"); add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } fake_hero_object = cg.zeroobj; fake_hero_object.quan = 1L; /* not strictly necessary... */ @@ -934,7 +934,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ add_menu(win, mon_to_glyph(&g.youmonst, rn2_on_display_rng), &any, /* fake inventory letter, no group accelerator */ CONTAINED_SYM, 0, ATR_NONE, an(self_lookat(buf)), - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } end_menu(win, qstr); @@ -1071,10 +1071,10 @@ int how; /* type of query */ add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, (qflags & WORN_TYPES) ? "Auto-select every item being worn" : "Auto-select every item", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any = cg.zeroany; - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); } if ((qflags & ALL_TYPES) && (ccount > 1)) { @@ -1083,7 +1083,7 @@ int how; /* type of query */ any.a_int = ALL_TYPES_SELECTED; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, (qflags & WORN_TYPES) ? "All worn types" : "All types", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); invlet = 'b'; } else invlet = 'a'; @@ -1102,7 +1102,7 @@ int how; /* type of query */ ATR_NONE, let_to_name(*pack, FALSE, (how != PICK_NONE) && iflags.menu_head_objsym), - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); collected_type_name = TRUE; } } @@ -1118,7 +1118,7 @@ int how; /* type of query */ if (do_unpaid || (qflags & BILLED_TYPES) || do_blessed || do_cursed || do_uncursed || do_buc_unknown) { any = cg.zeroany; - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); } /* unpaid items if there are any */ @@ -1127,7 +1127,7 @@ int how; /* type of query */ any = cg.zeroany; any.a_int = 'u'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, "Unpaid items", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } /* billed items: checked by caller, so always include if BILLED_TYPES */ if (qflags & BILLED_TYPES) { @@ -1135,7 +1135,7 @@ int how; /* type of query */ any = cg.zeroany; any.a_int = 'x'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Unpaid items already used up", MENU_UNSELECTED); + "Unpaid items already used up", MENU_ITEMFLAGS_NONE); } /* items with b/u/c/unknown if there are any; @@ -1146,28 +1146,28 @@ int how; /* type of query */ any = cg.zeroany; any.a_int = 'B'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Items known to be Blessed", MENU_UNSELECTED); + "Items known to be Blessed", MENU_ITEMFLAGS_NONE); } if (do_cursed) { invlet = 'C'; any = cg.zeroany; any.a_int = 'C'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Items known to be Cursed", MENU_UNSELECTED); + "Items known to be Cursed", MENU_ITEMFLAGS_NONE); } if (do_uncursed) { invlet = 'U'; any = cg.zeroany; any.a_int = 'U'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Items known to be Uncursed", MENU_UNSELECTED); + "Items known to be Uncursed", MENU_ITEMFLAGS_NONE); } if (do_buc_unknown) { invlet = 'X'; any = cg.zeroany; any.a_int = 'X'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Items of unknown Bless/Curse status", MENU_UNSELECTED); + "Items of unknown Bless/Curse status", MENU_ITEMFLAGS_NONE); } end_menu(win, qstr); n = select_menu(win, how, pick_list); @@ -1820,7 +1820,7 @@ doloot() if (Is_container(cobj)) { any.a_obj = cobj; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - doname(cobj), MENU_UNSELECTED); + doname(cobj), MENU_ITEMFLAGS_NONE); } end_menu(win, "Loot which containers?"); n = select_menu(win, PICK_ANY, &pick_list); @@ -2888,47 +2888,47 @@ boolean outokay, inokay, alreadyused, more_containers; any.a_int = 1; /* ':' */ Sprintf(buf, "Look inside %s", thesimpleoname(obj)); add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); if (outokay) { any.a_int = 2; /* 'o' */ Sprintf(buf, "take %s out", something); add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } if (inokay) { any.a_int = 3; /* 'i' */ Sprintf(buf, "put %s in", something); add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } if (outokay) { any.a_int = 4; /* 'b' */ Sprintf(buf, "%stake out, then put in", inokay ? "both; " : ""); add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } if (inokay) { any.a_int = 5; /* 'r' */ Sprintf(buf, "%sput in, then take out", outokay ? "both reversed; " : ""); add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); any.a_int = 6; /* 's' */ Sprintf(buf, "stash one item into %s", thesimpleoname(obj)); add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } any.a_int = 0; - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); if (more_containers) { any.a_int = 7; /* 'n' */ add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, - "loot next container", MENU_SELECTED); + "loot next container", MENU_ITEMFLAGS_SELECTED); } any.a_int = 8; /* 'q' */ Strcpy(buf, alreadyused ? "done" : "do nothing"); add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, buf, - more_containers ? MENU_UNSELECTED : MENU_SELECTED); + more_containers ? MENU_ITEMFLAGS_NONE : MENU_ITEMFLAGS_SELECTED); end_menu(win, prompt); n = select_menu(win, PICK_ONE, &pick_list); @@ -2988,18 +2988,18 @@ dotip() ++i; any.a_obj = cobj; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - doname(cobj), MENU_UNSELECTED); + doname(cobj), MENU_ITEMFLAGS_NONE); } if (g.invent) { any = cg.zeroany; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - "", MENU_UNSELECTED); + "", MENU_ITEMFLAGS_NONE); any.a_obj = &dummyobj; /* use 'i' for inventory unless there are so many containers that it's already being used */ i = (i <= 'i' - 'a' && !flags.lootabc) ? 'i' : 0; add_menu(win, NO_GLYPH, &any, i, 0, ATR_NONE, - "tip something being carried", MENU_SELECTED); + "tip something being carried", MENU_ITEMFLAGS_SELECTED); } end_menu(win, "Tip which container?"); n = select_menu(win, PICK_ONE, &pick_list); diff --git a/src/restore.c b/src/restore.c index 635286cc0..7217718f1 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1435,25 +1435,25 @@ winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */ /* COPYRIGHT_BANNER_[ABCD] */ for (k = 1; k <= 4; ++k) add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - copyright_banner_line(k), MENU_UNSELECTED); + copyright_banner_line(k), MENU_ITEMFLAGS_NONE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Select one of your saved games", MENU_UNSELECTED); + "Select one of your saved games", MENU_ITEMFLAGS_NONE); for (k = 0; saved[k]; ++k) { any.a_int = k + 1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, saved[k], - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } clet = (k <= 'n' - 'a') ? 'n' : 0; /* new game */ any.a_int = -1; /* not >= 0 */ add_menu(tmpwin, NO_GLYPH, &any, clet, 0, ATR_NONE, - "Start a new character", MENU_UNSELECTED); + "Start a new character", MENU_ITEMFLAGS_NONE); clet = (k + 1 <= 'q' - 'a') ? 'q' : 0; /* quit */ any.a_int = -2; add_menu(tmpwin, NO_GLYPH, &any, clet, 0, ATR_NONE, - "Never mind (quit)", MENU_SELECTED); + "Never mind (quit)", MENU_ITEMFLAGS_SELECTED); /* no prompt on end_menu, as we've done our own at the top */ end_menu(tmpwin, (char *) 0); if (select_menu(tmpwin, PICK_ONE, &chosen_game) > 0) { diff --git a/src/role.c b/src/role.c index a62d042a7..bda974187 100644 --- a/src/role.c +++ b/src/role.c @@ -1902,24 +1902,24 @@ boolean preselect; /* use four spaces of padding to fake a grayed out menu choice */ Sprintf(buf, "%4s%s forces %s", "", constrainer, forcedvalue); add_menu(where, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } else if (what) { any.a_int = RS_menu_arg(which); Sprintf(buf, "Pick%s %s first", (f >= 0) ? " another" : "", what); add_menu(where, NO_GLYPH, &any, RS_menu_let[which], 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } else if (which == RS_filter) { any.a_int = RS_menu_arg(RS_filter); add_menu(where, NO_GLYPH, &any, '~', 0, ATR_NONE, - "Reset role/race/&c filtering", MENU_UNSELECTED); + "Reset role/race/&c filtering", MENU_ITEMFLAGS_NONE); } else if (which == ROLE_RANDOM) { any.a_int = ROLE_RANDOM; add_menu(where, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - preselect ? MENU_SELECTED : MENU_UNSELECTED); + preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } else if (which == ROLE_NONE) { any.a_int = ROLE_NONE; add_menu(where, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - preselect ? MENU_SELECTED : MENU_UNSELECTED); + preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } else { impossible("role_menu_extra: bad arg (%d)", which); } diff --git a/src/spell.c b/src/spell.c index 0cee8580b..4b5e03594 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1565,13 +1565,13 @@ spellsortmenu() /* separate final choice from others with a blank line */ any.a_int = 0; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } else { let = 'a' + i; } any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, let, 0, ATR_NONE, spl_sortchoices[i], - (i == g.spl_sortmode) ? MENU_SELECTED : MENU_UNSELECTED); + (i == g.spl_sortmode) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "View known spells list sorted"); @@ -1658,7 +1658,7 @@ int *spell_no; fmt = "%s\t%-d\t%s\t%-d%%\t%s"; } add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) { splnum = !g.spl_orderindx ? i : g.spl_orderindx[i]; Sprintf(buf, fmt, spellname(splnum), spellev(splnum), @@ -1668,7 +1668,7 @@ int *spell_no; any.a_int = splnum + 1; /* must be non-zero */ add_menu(tmpwin, NO_GLYPH, &any, spellet(splnum), 0, ATR_NONE, buf, - (splnum == splaction) ? MENU_SELECTED : MENU_UNSELECTED); + (splnum == splaction) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } how = PICK_ONE; if (splaction == SPELLMENU_VIEW) { @@ -1679,7 +1679,7 @@ int *spell_no; /* more than 1 spell, add an extra menu entry */ any.a_int = SPELLMENU_SORT + 1; add_menu(tmpwin, NO_GLYPH, &any, '+', 0, ATR_NONE, - "[sort spells]", MENU_UNSELECTED); + "[sort spells]", MENU_ITEMFLAGS_NONE); } } end_menu(tmpwin, prompt); diff --git a/src/teleport.c b/src/teleport.c index 8c6af94b6..34707085d 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -607,8 +607,8 @@ dotelecmd() any.a_int = (int) tports[i].menulet; add_menu(win, NO_GLYPH, &any, (char) any.a_int, 0, ATR_NONE, tports[i].menudesc, - (tports[i].menulet == 'w') ? MENU_SELECTED - : MENU_UNSELECTED); + (tports[i].menulet == 'w') ? MENU_ITEMFLAGS_SELECTED + : MENU_ITEMFLAGS_NONE); } end_menu(win, "Which way do you want to teleport?"); i = select_menu(win, PICK_ONE, &picks); diff --git a/src/weapon.c b/src/weapon.c index d15ee550f..be0393397 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -1195,17 +1195,17 @@ enhance_weapon_skill() ? "when you're more experienced" : "if skill slots become available"); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } if (maxxed_cnt > 0) { Sprintf(buf, "(Skill%s flagged by \"#\" cannot be enhanced any further.)", plur(maxxed_cnt)); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } /* List the skills, making ones that could be advanced @@ -1219,7 +1219,7 @@ enhance_weapon_skill() any = cg.zeroany; if (i == skill_ranges[pass].first) add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, - skill_ranges[pass].name, MENU_UNSELECTED); + skill_ranges[pass].name, MENU_ITEMFLAGS_NONE); if (P_RESTRICTED(i)) continue; @@ -1261,7 +1261,7 @@ enhance_weapon_skill() } any.a_int = can_advance(i, speedy) ? i + 1 : 0; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } Strcpy(buf, (to_advance > 0) ? "Pick a skill to advance:" diff --git a/src/windows.c b/src/windows.c index e51929a57..5b0555189 100644 --- a/src/windows.c +++ b/src/windows.c @@ -68,7 +68,7 @@ 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)); + CHAR_P, int, const char *, unsigned int)); 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 *)); @@ -495,7 +495,7 @@ static void FDECL(hup_exit_nhwindows, (const char *)); static winid FDECL(hup_create_nhwindow, (int)); static int FDECL(hup_select_menu, (winid, int, MENU_ITEM_P **)); static void FDECL(hup_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, - int, const char *, BOOLEAN_P)); + int, const char *, unsigned int)); static void FDECL(hup_end_menu, (winid, const char *)); static void FDECL(hup_putstr, (winid, int, const char *)); static void FDECL(hup_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int)); @@ -681,13 +681,13 @@ struct mi **menu_list UNUSED; /*ARGSUSED*/ static void -hup_add_menu(window, glyph, identifier, sel, grpsel, attr, txt, preselected) +hup_add_menu(window, glyph, identifier, sel, grpsel, attr, txt, itemflags) winid window UNUSED; int glyph UNUSED, attr UNUSED; const anything *identifier UNUSED; char sel UNUSED, grpsel UNUSED; const char *txt UNUSED; -boolean preselected UNUSED; +unsigned int itemflags UNUSED; { return; } @@ -1307,7 +1307,7 @@ winid win UNUSED; /*ARGSUSED*/ static void -dump_add_menu(win, glyph, identifier, ch, gch, attr, str, preselected) +dump_add_menu(win, glyph, identifier, ch, gch, attr, str, itemflags) winid win UNUSED; int glyph; const anything *identifier UNUSED; @@ -1315,7 +1315,7 @@ char ch; char gch UNUSED; int attr UNUSED; const char *str; -boolean preselected UNUSED; +unsigned int itemflags UNUSED; { if (dumplog_file) { if (glyph == NO_GLYPH) diff --git a/sys/amiga/winami.c b/sys/amiga/winami.c index 8a595640a..b6f21672a 100644 --- a/sys/amiga/winami.c +++ b/sys/amiga/winami.c @@ -776,7 +776,7 @@ amii_get_ext_cmd(void) sprintf(buf, "%-10s - %s ", extcmdlist[i].ef_txt, extcmdlist[i].ef_desc); amii_add_menu(win, NO_GLYPH, &id, extcmdlist[i].ef_txt[0], 0, 0, - buf, MENU_UNSELECTED); + buf, MENU_ITEMFLAGS_NONE); } amii_end_menu(win, (char *) 0); @@ -837,7 +837,7 @@ amii_get_ext_cmd(void) sprintf(buf, "%-10s - %s ", extcmdlist[i].ef_txt, extcmdlist[i].ef_desc); amii_add_menu(win, NO_GLYPH, &id, extcmdlist[i].ef_txt[0], 0, - 0, buf, MENU_UNSELECTED); + 0, buf, MENU_ITEMFLAGS_NONE); } amii_end_menu(win, (char *) 0); @@ -1413,7 +1413,7 @@ amii_player_selection() Strcpy(rolenamebuf, roles[i].name.m); } add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, - an(rolenamebuf), MENU_UNSELECTED); + an(rolenamebuf), MENU_ITEMFLAGS_NONE); lastch = thisch; } } @@ -1422,10 +1422,10 @@ amii_player_selection() if (any.a_int == 0) /* must be non-zero */ any.a_int = randrole(FALSE) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick a role for your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -1488,17 +1488,17 @@ amii_player_selection() any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, ATR_NONE, races[i].noun, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } any.a_int = pick_race(flags.initrole, flags.initgend, flags.initalign, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randrace(flags.initrole) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the race of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -1560,17 +1560,17 @@ amii_player_selection() flags.initalign)) { any.a_int = i + 1; add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, - ATR_NONE, genders[i].adj, MENU_UNSELECTED); + ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_gend(flags.initrole, flags.initrace, flags.initalign, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randgend(flags.initrole, flags.initrace) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the gender of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -1631,17 +1631,17 @@ amii_player_selection() flags.initgend, i)) { any.a_int = i + 1; add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, - ATR_NONE, aligns[i].adj, MENU_UNSELECTED); + ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_align(flags.initrole, flags.initrace, flags.initgend, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randalign(flags.initrole, flags.initrace) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the alignment of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); diff --git a/sys/amiga/winami.p b/sys/amiga/winami.p index 7d24a2cee..d1aebf126 100644 --- a/sys/amiga/winami.p +++ b/sys/amiga/winami.p @@ -5,7 +5,7 @@ void FDECL(amii_raw_print, (const char *)); void FDECL(amii_raw_print_bold, (const char *)); void FDECL(amii_start_menu, (winid )); -void FDECL(amii_add_menu, (winid , char , int , const char *)); +void FDECL(amii_add_menu, (winid , char , int , const char *, unsigned int)); void FDECL(amii_end_menu, (winid , char , const char * , const char *)); char FDECL(amii_select_menu, (winid )); void NDECL(amii_update_inventory ); diff --git a/sys/amiga/winmenu.c b/sys/amiga/winmenu.c index 1506f88cc..a4b0954df 100644 --- a/sys/amiga/winmenu.c +++ b/sys/amiga/winmenu.c @@ -56,7 +56,7 @@ register winid window; /* Add a string to a menu */ void -amii_add_menu(window, glyph, id, ch, gch, attr, str, preselected) +amii_add_menu(window, glyph, id, ch, gch, attr, str, itemflags) register winid window; register int glyph; register const anything *id; @@ -64,9 +64,10 @@ register char ch; register char gch; register int attr; register const char *str; -register BOOLEAN_P preselected; +register unsigned int itemflags; { register struct amii_WinDesc *cw; + boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); amii_menu_item *mip; char buf[4 + BUFSZ]; @@ -143,7 +144,7 @@ register const char *morestr; #endif any.a_void = 0; amii_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, morestr, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); #ifdef PROMPTFIRST /* Do some shuffling. Last first, push others one forward \ */ mip->next = NULL; diff --git a/sys/amiga/winproto.h b/sys/amiga/winproto.h index 9c249b0a0..bcb68132f 100644 --- a/sys/amiga/winproto.h +++ b/sys/amiga/winproto.h @@ -41,7 +41,7 @@ void amii_getret(void); /* winmenu.c */ void amii_start_menu(winid window); void FDECL(amii_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, int, - const char *, BOOLEAN_P)); + const char *, unsigned int)); void FDECL(amii_end_menu, (winid, const char *)); int FDECL(amii_select_menu, (winid, int, menu_item **)); int DoMenuScroll(int win, int blocking, int how, menu_item **); diff --git a/sys/mac/macwin.c b/sys/mac/macwin.c index aec93d0b0..3a48d3279 100644 --- a/sys/mac/macwin.c +++ b/sys/mac/macwin.c @@ -1937,7 +1937,7 @@ mac_start_menu(winid win) void mac_add_menu(winid win, int glyph, const anything *any, CHAR_P menuChar, - CHAR_P groupAcc, int attr, const char *inStr, int preselected) + CHAR_P groupAcc, int attr, const char *inStr, unsigned int itemflags) { #if defined(__SC__) || defined(__MRC__) #pragma unused(glyph) @@ -1946,6 +1946,7 @@ mac_add_menu(winid win, int glyph, const anything *any, CHAR_P menuChar, const char *str; char locStr[4 + BUFSZ]; MacMHMenuItem *item; + int preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); if (!inStr) return; diff --git a/sys/wince/mhmsg.h b/sys/wince/mhmsg.h index 55e0d3ce9..4fa42f48b 100644 --- a/sys/wince/mhmsg.h +++ b/sys/wince/mhmsg.h @@ -46,7 +46,7 @@ typedef struct mswin_nhmsg_add_menu { CHAR_P group_accel; int attr; const char *str; - BOOLEAN_P presel; + unsigned int itemflags; } MSNHMsgAddMenu, *PMSNHMsgAddMenu; typedef struct mswin_nhmsg_cursor { diff --git a/sys/wince/mswproc.c b/sys/wince/mswproc.c index 8133ea2eb..5351a450d 100644 --- a/sys/wince/mswproc.c +++ b/sys/wince/mswproc.c @@ -390,7 +390,7 @@ prompt_for_player_selection(void) Strcpy(rolenamebuf, roles[i].name.m); } add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, - an(rolenamebuf), MENU_UNSELECTED); + an(rolenamebuf), MENU_ITEMFLAGS_NONE); lastch = thisch; } } @@ -399,10 +399,10 @@ prompt_for_player_selection(void) if (any.a_int == 0) /* must be non-zero */ any.a_int = randrole(FALSE) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick a role for your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -465,17 +465,17 @@ prompt_for_player_selection(void) flags.initalign)) { any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, - ATR_NONE, races[i].noun, MENU_UNSELECTED); + ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE); } any.a_int = pick_race(flags.initrole, flags.initgend, flags.initalign, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randrace(flags.initrole) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the race of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -539,17 +539,17 @@ prompt_for_player_selection(void) flags.initalign)) { any.a_int = i + 1; add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, - ATR_NONE, genders[i].adj, MENU_UNSELECTED); + ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_gend(flags.initrole, flags.initrace, flags.initalign, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randgend(flags.initrole, flags.initrace) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the gender of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -612,17 +612,17 @@ prompt_for_player_selection(void) flags.initgend, i)) { any.a_int = i + 1; add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, - ATR_NONE, aligns[i].adj, MENU_UNSELECTED); + ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_align(flags.initrole, flags.initrace, flags.initgend, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randalign(flags.initrole, flags.initrace) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the alignment of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -1026,7 +1026,7 @@ mswin_start_menu(winid wid) /* add_menu(windid window, int glyph, const anything identifier, char accelerator, char groupacc, - int attr, char *str, boolean preselected) + int attr, char *str, unsigned int itemflags) -- Add a text line str to the given menu window. If identifier is 0, then the line cannot be selected (e.g. a title). @@ -1058,11 +1058,13 @@ identifier void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel) + const char *str, unsigned int itemflags) { - logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %d)\n", wid, glyph, + boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); + + logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %u)\n", wid, glyph, identifier, (char) accelerator, (char) group_accel, attr, str, - presel); + itemflags); if ((wid >= 0) && (wid < MAXWINDOWS) && (GetNHApp()->windowlist[wid].win != NULL)) { MSNHMsgAddMenu data; diff --git a/sys/wince/winMS.h b/sys/wince/winMS.h index e9b78bd99..c0c1d03c4 100644 --- a/sys/wince/winMS.h +++ b/sys/wince/winMS.h @@ -131,7 +131,7 @@ void mswin_display_file(const char *filename, BOOLEAN_P must_exist); void mswin_start_menu(winid wid); void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel); + const char *str, unsigned int itemflags); void mswin_end_menu(winid wid, const char *prompt); int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); void mswin_update_inventory(void); diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index 842daf9d9..9926ee70b 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -376,8 +376,9 @@ void NetHackQtBind::qt_start_menu(winid wid) void NetHackQtBind::qt_add_menu(winid wid, int glyph, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, - const char *str, BOOLEAN_P presel) + const char *str, unsigned int itemflags) { + boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); NetHackQtWindow* window=id_to_window[(int)wid]; window->AddMenu(glyph, identifier, ch, gch, attr, QString::fromLatin1(str), diff --git a/win/Qt/qt_bind.h b/win/Qt/qt_bind.h index 04d2a43d7..7d9c32c1d 100644 --- a/win/Qt/qt_bind.h +++ b/win/Qt/qt_bind.h @@ -54,7 +54,7 @@ public: static void qt_start_menu(winid wid); static void qt_add_menu(winid wid, int glyph, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, - const char *str, BOOLEAN_P presel); + const char *str, unsigned int itemflags); static void qt_end_menu(winid wid, const char *prompt); static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); static void qt_update_inventory(); diff --git a/win/Qt3/qt3_win.cpp b/win/Qt3/qt3_win.cpp index 9fe0e81ab..d8443cc83 100644 --- a/win/Qt3/qt3_win.cpp +++ b/win/Qt3/qt3_win.cpp @@ -4817,8 +4817,9 @@ void NetHackQtBind::qt_start_menu(winid wid) void NetHackQtBind::qt_add_menu(winid wid, int glyph, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, - const char *str, BOOLEAN_P presel) + const char *str, unsigned int itemflags) { + boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); NetHackQtWindow* window=id_to_window[wid]; window->AddMenu(glyph, identifier, ch, gch, attr, str, presel); } diff --git a/win/Qt3/qt3_win.h b/win/Qt3/qt3_win.h index 8de29d92f..825fa918b 100644 --- a/win/Qt3/qt3_win.h +++ b/win/Qt3/qt3_win.h @@ -854,7 +854,7 @@ class NetHackQtBind : NetHackQtBindBase static void qt_start_menu(winid wid); static void qt_add_menu(winid wid, int glyph, const ANY_P *identifier, CHAR_P ch, CHAR_P gch, int attr, const char *str, - BOOLEAN_P presel); + unsigned int itemflags); static void qt_end_menu(winid wid, const char *prompt); static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); static void qt_update_inventory(); diff --git a/win/chain/wc_chainin.c b/win/chain/wc_chainin.c index 00cd7e75f..92347114a 100644 --- a/win/chain/wc_chainin.c +++ b/win/chain/wc_chainin.c @@ -182,7 +182,7 @@ winid window; } void -chainin_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) +chainin_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) winid window; /* window to use, must be of type NHW_MENU */ int glyph; /* glyph to display with item (unused) */ const anything *identifier; /* what to return if selected */ @@ -190,10 +190,11 @@ char ch; /* keyboard accelerator (0 = pick our own) */ char gch; /* group accelerator (0 = no group) */ int attr; /* attribute for string (like tty_putstr()) */ const char *str; /* menu string */ -boolean preselected; /* item is marked as selected */ +unsigned int itemflags; /* flags such as item is marked as selected + MENU_ITEMFLAGS_SELECTED */ { (*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyph, identifier, - ch, gch, attr, str, preselected); + ch, gch, attr, str, itemflags); } void diff --git a/win/chain/wc_chainout.c b/win/chain/wc_chainout.c index 18af49e17..8ada327f7 100644 --- a/win/chain/wc_chainout.c +++ b/win/chain/wc_chainout.c @@ -224,7 +224,7 @@ winid window; void chainout_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, - preselected) + itemflags) void *vp; winid window; /* window to use, must be of type NHW_MENU */ int glyph; /* glyph to display with item (unused) */ @@ -233,12 +233,12 @@ char ch; /* keyboard accelerator (0 = pick our own) */ char gch; /* group accelerator (0 = no group) */ int attr; /* attribute for string (like tty_putstr()) */ const char *str; /* menu string */ -boolean preselected; /* item is marked as selected */ +unsigned int itemflags; /* itemflags such as marked as selected */ { struct chainout_data *tdp = vp; (*tdp->nprocs->win_add_menu)(window, glyph, identifier, ch, gch, attr, - str, preselected); + str, itemflags); } void diff --git a/win/chain/wc_trace.c b/win/chain/wc_trace.c index 6da9a9b83..acde19d2f 100644 --- a/win/chain/wc_trace.c +++ b/win/chain/wc_trace.c @@ -370,7 +370,7 @@ winid window; } void -trace_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, preselected) +trace_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, itemflags) void *vp; winid window; /* window to use, must be of type NHW_MENU */ int glyph; /* glyph to display with item (unused) */ @@ -379,7 +379,7 @@ char ch; /* keyboard accelerator (0 = pick our own) */ char gch; /* group accelerator (0 = no group) */ int attr; /* attribute for string (like tty_putstr()) */ const char *str; /* menu string */ -boolean preselected; /* item is marked as selected */ +unsigned int itemflags; /* itemflags such as marked as selected */ { struct trace_data *tdp = vp; @@ -400,19 +400,19 @@ boolean preselected; /* item is marked as selected */ if (str) { fprintf(wc_tracelogf, - "%sadd_menu(%d, %d, %p, %s, %s, %d, '%s'(%d), %d)\n", INDENT, + "%sadd_menu(%d, %d, %p, %s, %s, %d, '%s'(%d), %u)\n", INDENT, window, glyph, (void *) identifier, buf_ch, buf_gch, attr, - str, (int) strlen(str), preselected); + str, (int) strlen(str), itemflags); } else { fprintf(wc_tracelogf, - "%sadd_menu(%d, %d, %p, %s, %s, %d, NULL, %d)\n", INDENT, + "%sadd_menu(%d, %d, %p, %s, %s, %d, NULL, %u)\n", INDENT, window, glyph, (void *) identifier, buf_ch, buf_gch, attr, - preselected); + itemflags); } PRE; (*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyph, identifier, ch, - gch, attr, str, preselected); + gch, attr, str, itemflags); POST; } diff --git a/win/curses/cursinit.c b/win/curses/cursinit.c index 1b07395c6..2c8840ba2 100644 --- a/win/curses/cursinit.c +++ b/win/curses/cursinit.c @@ -744,19 +744,19 @@ curses_character_dialog(const char **choices, const char *prompt) identifier.a_int = (count + 1); /* Must be non-zero */ curses_add_menu(wid, NO_GLYPH, &identifier, curletter, 0, - A_NORMAL, choices[count], FALSE); + A_NORMAL, choices[count], MENU_ITEMFLAGS_NONE); used_letters[count] = curletter; } /* Random Selection */ identifier.a_int = ROLE_RANDOM; curses_add_menu(wid, NO_GLYPH, &identifier, '*', 0, A_NORMAL, "Random", - FALSE); + MENU_ITEMFLAGS_NONE); /* Quit prompt */ identifier.a_int = ROLE_NONE; curses_add_menu(wid, NO_GLYPH, &identifier, 'q', 0, A_NORMAL, "Quit", - FALSE); + MENU_ITEMFLAGS_NONE); curses_end_menu(wid, prompt); ret = curses_select_menu(wid, PICK_ONE, &selected); if (ret == 1) { diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 434d85c55..bab6d0808 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -491,7 +491,7 @@ curses_start_menu(winid wid) /* add_menu(winid wid, int glyph, const anything identifier, char accelerator, char groupacc, - int attr, char *str, boolean preselected) + int attr, char *str, unsigned int itemflags) -- Add a text line str to the given menu window. If identifier is 0, then the line cannot be selected (e.g. a title). Otherwise, identifier is the value returned if the line is @@ -517,14 +517,15 @@ add_menu(winid wid, int glyph, const anything identifier, The menu commands and aliases take care not to interfere with the default object class symbols. -- If you want this choice to be preselected when the - menu is displayed, set preselected to TRUE. + menu is displayed, set bit MENU_ITEMFLAGS_SELECTED. */ void curses_add_menu(winid wid, int glyph, const ANY_P * identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel) + const char *str, unsigned int itemflags) { int curses_attr; + boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); attr &= ~(ATR_URGENT | ATR_NOHISTORY); curses_attr = curses_convert_attr(attr); diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 6e625aef3..ab2ceb587 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -373,14 +373,17 @@ curses_prev_mesg() for (count = 0; count < num_messages; ++count) { mesg = get_msg_line(do_lifo, count); if (turn != mesg->turn && count != 0) { - curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---", FALSE); + curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---", + MENU_ITEMFLAGS_NONE); } - curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str, FALSE); + curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str, + MENU_ITEMFLAGS_NONE); turn = mesg->turn; } if (!count) curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, - "[No past messages available.]", FALSE); + "[No past messages available.]", + MENU_ITEMFLAGS_NONE); curses_end_menu(wid, ""); if (!do_lifo) diff --git a/win/gem/wingem.c b/win/gem/wingem.c index d215a7ae3..76ea26cb9 100644 --- a/win/gem/wingem.c +++ b/win/gem/wingem.c @@ -251,7 +251,7 @@ Gem_player_selection() if (currch == lastch) currch = highc(currch); add_menu(win, roles[i].malenum, &any, currch, 0, ATR_NONE, - an(roles[i].name.m), MENU_UNSELECTED); + an(roles[i].name.m), MENU_ITEMFLAGS_NONE); lastch = currch; } } @@ -260,10 +260,10 @@ Gem_player_selection() if (any.a_int == 0) /* must be non-zero */ any.a_int = randrole(FALSE) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); end_menu(win, "Pick a role"); n = select_menu(win, PICK_ONE, &selected); destroy_nhwindow(win); @@ -320,17 +320,17 @@ Gem_player_selection() flags.initalign)) { any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, - ATR_NONE, races[i].noun, MENU_UNSELECTED); + ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE); } any.a_int = pick_race(flags.initrole, flags.initgend, flags.initalign, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randrace(flags.initrole) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the race of your %s", roles[flags.initrole].name.m); end_menu(win, pbuf); @@ -389,17 +389,17 @@ Gem_player_selection() flags.initalign)) { any.a_int = i + 1; add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, - ATR_NONE, genders[i].adj, MENU_UNSELECTED); + ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_gend(flags.initrole, flags.initrace, flags.initalign, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randgend(flags.initrole, flags.initrace) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the gender of your %s %s", races[flags.initrace].adj, roles[flags.initrole].name.m); @@ -458,17 +458,17 @@ Gem_player_selection() flags.initgend, i)) { any.a_int = i + 1; add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, - ATR_NONE, aligns[i].adj, MENU_UNSELECTED); + ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_align(flags.initrole, flags.initrace, flags.initgend, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randalign(flags.initrole, flags.initrace) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the alignment of your %s %s %s", genders[flags.initgend].adj, races[flags.initrace].adj, @@ -754,7 +754,7 @@ boolean complain; * later. */ void -Gem_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) +Gem_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) winid window; /* window to use, must be of type NHW_MENU */ int glyph; /* glyph to display with item (unused) */ const anything *identifier; /* what to return if selected */ @@ -762,8 +762,9 @@ char ch; /* keyboard accelerator (0 = pick our own) */ char gch; /* group accelerator (0 = no group) */ int attr; /* attribute for string (like Gem_putstr()) */ const char *str; /* menu string */ -boolean preselected; /* item is marked as selected */ +unsigned int itemflags; /* itemflags such as marked as selected */ { + boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); Gem_menu_item *G_item; const char *newstr; char buf[QBUFSZ]; @@ -1014,7 +1015,7 @@ Gem_get_ext_cmd() too_much = FALSE; tmp_acc = *ptr; Gem_add_menu(wind, NO_GLYPH, &any, accelerator, 0, ATR_NONE, ptr, - FALSE); + MENU_ITEMFLAGS_NONE); } Gem_end_menu(wind, "What extended command?"); count = Gem_select_menu(wind, PICK_ONE, &selected); diff --git a/win/gnome/gnbind.c b/win/gnome/gnbind.c index 1ba8005d1..fbd9107e8 100644 --- a/win/gnome/gnbind.c +++ b/win/gnome/gnbind.c @@ -681,10 +681,9 @@ gnome_start_menu(winid wid) /* add_menu(windid window, int glyph, const anything identifier, char accelerator, char groupacc, - int attr, char *str, boolean preselected) + int attr, char *str, unsigned int itemflags) -- Add a text line str to the given menu window. If -identifier - is 0, then the line cannot be selected (e.g. a title). + identifier is 0, then the line cannot be selected (e.g. a title). Otherwise, identifier is the value returned if the line is selected. Accelerator is a keyboard key that can be used to select the line. If the accelerator of a selectable @@ -708,13 +707,14 @@ identifier The menu commands and aliases take care not to interfere with the default object class symbols. -- If you want this choice to be preselected when the - menu is displayed, set preselected to TRUE. + menu is displayed, set bit MENU_ITEMFLAGS_SELECTED. */ void gnome_add_menu(winid wid, int glyph, const ANY_P *identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel) + const char *str, unsigned int itemflags) { + boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); GHackMenuItem item; item.glyph = glyph; item.identifier = identifier; diff --git a/win/share/safeproc.c b/win/share/safeproc.c index 927744c4e..5c54961ca 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -242,7 +242,7 @@ winid window; * later. */ void -safe_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) +safe_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) winid window; /* window to use, must be of type NHW_MENU */ int glyph UNUSED; /* glyph to display with item (not used) */ const anything *identifier; /* what to return if selected */ @@ -250,7 +250,7 @@ char ch; /* keyboard accelerator (0 = pick our own) */ char gch; /* group accelerator (0 = no group) */ int attr; /* attribute for string (like safe_putstr()) */ const char *str; /* menu string */ -boolean preselected; /* item is marked as selected */ +unsigned int itemflags; /* itemflags such as marked as selected */ { return; } diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 2c61f07e7..8f7ddc9e2 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -578,7 +578,7 @@ tty_player_selection() role_menu_extra(ROLE_RANDOM, win, TRUE); any = cg.zeroany; /* separator, not a choice */ add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE); @@ -677,7 +677,7 @@ tty_player_selection() role_menu_extra(ROLE_RANDOM, win, TRUE); any.a_int = 0; /* separator, not a choice */ add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE); @@ -770,7 +770,7 @@ tty_player_selection() role_menu_extra(ROLE_RANDOM, win, TRUE); any.a_int = 0; /* separator, not a choice */ add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE); @@ -859,7 +859,7 @@ tty_player_selection() role_menu_extra(ROLE_RANDOM, win, TRUE); any.a_int = 0; /* separator, not a choice */ add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE); @@ -947,25 +947,25 @@ tty_player_selection() (GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f : roles[ROLE].name.m); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, pbuf, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); /* blank separator */ any.a_int = 0; - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); /* [ynaq] menu choices */ any.a_int = 1; add_menu(win, NO_GLYPH, &any, 'y', 0, ATR_NONE, "Yes; start game", - MENU_SELECTED); + MENU_ITEMFLAGS_SELECTED); any.a_int = 2; add_menu(win, NO_GLYPH, &any, 'n', 0, ATR_NONE, - "No; choose role again", MENU_UNSELECTED); + "No; choose role again", MENU_ITEMFLAGS_NONE); if (iflags.renameallowed) { any.a_int = 3; add_menu(win, NO_GLYPH, &any, 'a', 0, ATR_NONE, - "Not yet; choose another name", MENU_UNSELECTED); + "Not yet; choose another name", MENU_ITEMFLAGS_NONE); } any.a_int = -1; add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Is this ok? [yn%sq]", iflags.renameallowed ? "a" : ""); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -1040,22 +1040,22 @@ reset_role_filtering() /* no extra blank line preceding this entry; end_menu supplies one */ add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Unacceptable roles", MENU_UNSELECTED); + "Unacceptable roles", MENU_ITEMFLAGS_NONE); setup_rolemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Unacceptable races", MENU_UNSELECTED); + "Unacceptable races", MENU_ITEMFLAGS_NONE); setup_racemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Unacceptable genders", MENU_UNSELECTED); + "Unacceptable genders", MENU_ITEMFLAGS_NONE); setup_gendmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); - add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Unacceptable alignments", MENU_UNSELECTED); + "Unacceptable alignments", MENU_ITEMFLAGS_NONE); setup_algnmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); end_menu(win, "Pick all that apply"); @@ -1118,7 +1118,8 @@ int race, gend, algn; /* all ROLE_NONE for !filtering case */ /* !filtering implies reset_role_filtering() where we want to mark this role as preseleted if current filter excludes it */ add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, an(rolenamebuf), - (!filtering && !role_ok) ? MENU_SELECTED : MENU_UNSELECTED); + (!filtering && !role_ok) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); lastch = thisch; } } @@ -1152,7 +1153,8 @@ int role, gend, algn; filtering ? this_ch : highc(this_ch), filtering ? highc(this_ch) : 0, ATR_NONE, races[i].noun, - (!filtering && !race_ok) ? MENU_SELECTED : MENU_UNSELECTED); + (!filtering && !race_ok) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } } @@ -1183,7 +1185,8 @@ int role, race, algn; filtering ? this_ch : highc(this_ch), filtering ? highc(this_ch) : 0, ATR_NONE, genders[i].adj, - (!filtering && !gend_ok) ? MENU_SELECTED : MENU_UNSELECTED); + (!filtering && !gend_ok) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } } @@ -1214,7 +1217,8 @@ int role, race, gend; filtering ? this_ch : highc(this_ch), filtering ? highc(this_ch) : 0, ATR_NONE, aligns[i].adj, - (!filtering && !algn_ok) ? MENU_SELECTED : MENU_UNSELECTED); + (!filtering && !algn_ok) + ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } } @@ -2900,7 +2904,7 @@ winid window; * later. */ void -tty_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) +tty_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) winid window; /* window to use, must be of type NHW_MENU */ int glyph UNUSED; /* glyph to display with item (not used) */ const anything *identifier; /* what to return if selected */ @@ -2908,8 +2912,9 @@ char ch; /* keyboard accelerator (0 = pick our own) */ char gch; /* group accelerator (0 = no group) */ int attr; /* attribute for string (like tty_putstr()) */ const char *str; /* menu string */ -boolean preselected; /* item is marked as selected */ +unsigned int itemflags; /* itemflags such as MENU_ITEMFLAGS_SELECTED */ { + boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); register struct WinDesc *cw = 0; tty_menu_item *item; const char *newstr; @@ -2944,6 +2949,7 @@ boolean preselected; /* item is marked as selected */ item->identifier = *identifier; item->count = -1L; item->selected = preselected; + item->itemflags = itemflags; item->selector = ch; item->gselector = gch; item->attr = attr; @@ -2999,9 +3005,9 @@ const char *prompt; /* prompt to for menu */ any = cg.zeroany; /* not selectable */ tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, "", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); } /* 52: 'a'..'z' and 'A'..'Z'; avoids selector duplication within a page */ diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index ffc164908..14fa263f9 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -34,6 +34,7 @@ typedef struct mswin_menu_item { int attr; char str[NHMENU_STR_SIZE]; BOOLEAN_P presel; + unsigned int itemflags; int count; BOOL has_focus; } NHMenuItem, *PNHMenuItem; @@ -627,6 +628,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) /* prevent & being interpreted as a mnemonic start */ strNsubst(data->menu.items[new_item].str, "&", "&&", 0); data->menu.items[new_item].presel = msg_data->presel; + data->menu.items[new_item].itemflags = msg_data->itemflags; /* calculate tabstop size */ hDC = GetDC(hWnd); diff --git a/win/win32/mhmsg.h b/win/win32/mhmsg.h index 4fd04af01..3962fb608 100644 --- a/win/win32/mhmsg.h +++ b/win/win32/mhmsg.h @@ -53,6 +53,7 @@ typedef struct mswin_nhmsg_add_menu { int attr; const char *str; BOOLEAN_P presel; + unsigned int itemflags; } MSNHMsgAddMenu, *PMSNHMsgAddMenu; typedef struct mswin_nhmsg_cursor { diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 4b23b5b4f..6da8f82c0 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -429,7 +429,7 @@ prompt_for_player_selection(void) Strcpy(rolenamebuf, roles[i].name.m); } add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, - an(rolenamebuf), MENU_UNSELECTED); + an(rolenamebuf), MENU_ITEMFLAGS_NONE); lastch = thisch; } } @@ -438,10 +438,10 @@ prompt_for_player_selection(void) if (any.a_int == 0) /* must be non-zero */ any.a_int = randrole(FALSE) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick a role for your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -504,17 +504,17 @@ prompt_for_player_selection(void) flags.initalign)) { any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, - ATR_NONE, races[i].noun, MENU_UNSELECTED); + ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE); } any.a_int = pick_race(flags.initrole, flags.initgend, flags.initalign, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randrace(flags.initrole) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the race of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -578,17 +578,17 @@ prompt_for_player_selection(void) flags.initalign)) { any.a_int = i + 1; add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, - ATR_NONE, genders[i].adj, MENU_UNSELECTED); + ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_gend(flags.initrole, flags.initrace, flags.initalign, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randgend(flags.initrole, flags.initrace) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the gender of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -651,17 +651,17 @@ prompt_for_player_selection(void) flags.initgend, i)) { any.a_int = i + 1; add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, - ATR_NONE, aligns[i].adj, MENU_UNSELECTED); + ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_align(flags.initrole, flags.initrace, flags.initgend, PICK_RANDOM) + 1; if (any.a_int == 0) /* must be non-zero */ any.a_int = randalign(flags.initrole, flags.initrace) + 1; add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", - MENU_UNSELECTED); + MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the alignment of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -1095,7 +1095,7 @@ mswin_start_menu(winid wid) /* add_menu(windid window, int glyph, const anything identifier, char accelerator, char groupacc, - int attr, char *str, boolean preselected) + int attr, char *str, unsigned int itemflags) -- Add a text line str to the given menu window. If identifier is 0, then the line cannot be selected (e.g. a title). @@ -1127,11 +1127,12 @@ identifier void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel) + const char *str, unsigned int itemflags) { - logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %d)\n", wid, glyph, + boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); + logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %u)\n", wid, glyph, identifier, (char) accelerator, (char) group_accel, attr, str, - presel); + itemflags); if ((wid >= 0) && (wid < MAXWINDOWS) && (GetNHApp()->windowlist[wid].win != NULL)) { MSNHMsgAddMenu data; @@ -1143,6 +1144,7 @@ mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, data.attr = attr; data.str = str; data.presel = presel; + data.itemflags = itemflags; SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND, (WPARAM) MSNH_MSG_ADDMENU, (LPARAM) &data); diff --git a/win/win32/winMS.h b/win/win32/winMS.h index c5ee77368..287093676 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -155,7 +155,7 @@ void mswin_display_file(const char *filename, BOOLEAN_P must_exist); void mswin_start_menu(winid wid); void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel); + const char *str, unsigned int itemflags); void mswin_end_menu(winid wid, const char *prompt); int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); void mswin_update_inventory(void); From e323a68dc78ff193742fec367acf5564f5cd6e7d Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Dec 2019 18:53:39 -0500 Subject: [PATCH 14/35] unintended change fix --- src/options.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/options.c b/src/options.c index 5a9c90fae..df5add42d 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 options.c $NHDT-Date: 1575245078 2019/12/02 00:04:38 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.391 $ */ +/* NetHack 3.7 options.c $NHDT-Date: 1577050473 2019/12/22 21:34:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.422 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -184,6 +184,7 @@ static const struct Bool_Opt { { "popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME }, /*WC*/ { "preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME }, /*WC*/ { "pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME }, + { "quick_farsight", &flags.quick_farsight, FALSE, SET_IN_GAME }, #if defined(MICRO) && !defined(AMIGA) { "rawio", &iflags.rawio, FALSE, DISP_IN_GAME }, #else From d48f2a62ba60105c1b103abe7abb4c04aa4121c9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Dec 2019 19:04:35 -0500 Subject: [PATCH 15/35] doc bit --- doc/window.doc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/window.doc b/doc/window.doc index 5d82c613d..46b00ad90 100644 --- a/doc/window.doc +++ b/doc/window.doc @@ -337,8 +337,7 @@ add_menu(windid window, int glyph, const anything identifier, the menu command (or their user defined aliases), it loses. The menu commands and aliases take care not to interfere with the default object class symbols. - -- itemflags on this item (such as MENU_ITEMFLAGS_UNSELECTED, - MENU_ITEMFLAGS_PRESELECTED, etc.). + -- itemflags on this item (such as MENU_ITEMFLAGS_SELECTED etc.). end_menu(window, prompt) -- Stop adding entries to the menu and flushes the window From 6e136b19c4f2ef1bfe4abb5249f5d0b33b00a163 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 22 Dec 2019 17:05:42 -0800 Subject: [PATCH 16/35] X11_add_menu() --- win/X11/winX.c | 4 ++-- win/X11/winmenu.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/win/X11/winX.c b/win/X11/winX.c index 8378fa568..05d82e0eb 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 winX.c $NHDT-Date: 1552441031 2019/03/13 01:37:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.73 $ */ +/* NetHack 3.6 winX.c $NHDT-Date: 1577063125 2019/12/23 01:05:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.79 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -1965,7 +1965,7 @@ boolean complain; any = cg.zeroany; while (dlb_fgets(line, LLEN, fp)) { X11_add_menu(newwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - line, MENU_UNSELECTED); + line, MENU_ITEMFLAGS_NONE); } (void) dlb_fclose(fp); diff --git a/win/X11/winmenu.c b/win/X11/winmenu.c index 7ac8d2491..b86e02ae3 100644 --- a/win/X11/winmenu.c +++ b/win/X11/winmenu.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 winmenu.c $NHDT-Date: 1542245161 2018/11/15 01:26:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.33 $ */ +/* NetHack 3.6 winmenu.c $NHDT-Date: 1577063136 2019/12/23 01:05:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -628,7 +628,7 @@ winid window; /*ARGSUSED*/ void -X11_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) +X11_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) winid window; int glyph; /* unused (for now) */ const anything *identifier; @@ -636,10 +636,11 @@ char ch; char gch; /* group accelerator (0 = no group) */ int attr; const char *str; -boolean preselected; +unsigned itemflags; { x11_menu_item *item; struct menu_info_t *menu_info; + boolean preselected = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0; nhUse(glyph); From e0c67f49fcfb01ca5545d0caa69fe6511812f1dd Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 22 Dec 2019 17:22:07 -0800 Subject: [PATCH 17/35] fix mysterious force bug Subtracting one dungeon depth value from another had the subtraction backwards and that yielded a negative value where a positive one is expected. If NH_RELEASE_STATUS were to be set to NH_STATUS_RELEASED then this was at risk of crashing (if the bad subtraction yields -2, rn2(diff+2) would divide by 0) since rn2()'s argument isn't validated for released version. fixes37.0 was confused, listing a couple of things that aren't bugs in 3.6 as general fixes. I suspect that the DLB one was fixed before being exposed via git, so shouldn't be there at all. --- doc/fixes37.0 | 10 ++++++---- src/do.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 5d0d80083..a66d896c4 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,8 +1,7 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.29 $ $NHDT-Date: 1577055058 2019/12/22 22:50:58 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.30 $ $NHDT-Date: 1577063925 2019/12/23 01:18:45 $ General Fixes and Modified Features ----------------------------------- -fix compile when DLB isn't defined hero polymorphed into a vampire can use #monster to shape-shift rather than just do a one-shot polymorph into bat/cloud/wolf and shifted vampire hero can use #monster again to take on another form (randomly chosen @@ -14,13 +13,16 @@ function calls made from mapglyph based on dungeon level are now called once per level fix accessing mons[-1] when trying to gate in a non-valid demon fast hero could have random clairvoyance happen more than once on same turn -urealtime.realtime was being incorrectly calculated using 'Q' on wielded weapon would offer to split stack; make using 'w' on a quivered stack behave similarly -Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository +Fixes to 3.7.0-x Problems that Were Exposed Via git Repository ------------------------------------------------------------------ +fix compile when DLB isn't defined +urealtime.realtime was being incorrectly calculated +revised "mysterious force" when climbing out of gehennom could generate + warnings about "rn2(0) attempted" or "rn2(-n) attempted" Platform- and/or Interface-Specific Fixes diff --git a/src/do.c b/src/do.c index 98a8ff3f2..0f0a08a30 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1576638499 2019/12/18 03:08:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.198 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1577063925 2019/12/23 01:18:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.220 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1311,7 +1311,7 @@ boolean at_stairs, falling, portal; if (diff != 0) { assign_rnd_level(newlevel, &u.uz, diff); /* assign_rnd_level() may have used a value less than diff */ - diff = u.uz.dlevel - newlevel->dlevel; /* actual descent */ + diff = newlevel->dlevel - u.uz.dlevel; /* actual descent */ /* if inside the tower, stay inside */ if (was_in_W_tower && !On_W_tower_level(newlevel)) diff = 0; From 181470bf66b21b779e0f8c7719106f15308712e2 Mon Sep 17 00:00:00 2001 From: nhw_cron Date: Sun, 22 Dec 2019 17:17:11 -0500 Subject: [PATCH 18/35] This is cron-daily v1-Dec-12-2019. guidebook updated: doc/Guidebook.txt --- doc/Guidebook.txt | 380 +++++++++++++++++++++++----------------------- 1 file changed, 190 insertions(+), 190 deletions(-) diff --git a/doc/Guidebook.txt b/doc/Guidebook.txt index 9abbba24b..4720b5317 100644 --- a/doc/Guidebook.txt +++ b/doc/Guidebook.txt @@ -3934,6 +3934,15 @@ off). Likewise for the `a' (apply) command if it causes the applied item to become wielded. Persistent. + quick_farsight + When set, usually prevents the "you sense your surroundings" + message where play pauses to allow you to browse the map when- + ever clairvoyance randomly activates. Some situations, such as + being underwater or engulfed, ignore this option. It does not + affect the clairvoyance spell where pausing to examine revealed + objects or monsters is less intrusive. Default is off. Per- + sistent. + race Selects your race (for example, "race:human"). Default is ran- dom. If you prefix the value with `!' or "no", you will ex- @@ -3944,15 +3953,6 @@ Make the space bar a synonym for the `.' (#wait) command (de- fault off). Persistent. - role - Pick your type of character (for example "role:Samurai"); syn- - onym for "character". See "name" for an alternate method of - specifying your role. Normally only the first letter of the - value is examined; `r' is an exception with "Rogue", "Ranger", - and "random" values. If you prefix the value with `!' or "no", - you will exclude that role from being picked randomly. Cannot - be set with the `O' command. Persistent. - NetHack 3.7 December 18, 2019 @@ -3964,6 +3964,15 @@ + role + Pick your type of character (for example "role:Samurai"); syn- + onym for "character". See "name" for an alternate method of + specifying your role. Normally only the first letter of the + value is examined; `r' is an exception with "Rogue", "Ranger", + and "random" values. If you prefix the value with `!' or "no", + you will exclude that role from being picked randomly. Cannot + be set with the `O' command. Persistent. + roguesymset This option may be used to select one of the named symbol sets found within "symbols" to alter the symbols displayed on the @@ -4009,15 +4018,6 @@ Show your accumulated experience points on bottom line (default off). Persistent. - showrace - Display yourself as the glyph for your race, rather than the - glyph for your role (default off). Note that this setting af- - fects only the appearance of the display, not the way the game - treats you. Persistent. - - showscore - Show your approximate accumulated score on bottom line (default - off). Persistent. NetHack 3.7 December 18, 2019 @@ -4030,6 +4030,16 @@ + showrace + Display yourself as the glyph for your race, rather than the + glyph for your role (default off). Note that this setting af- + fects only the appearance of the display, not the way the game + treats you. Persistent. + + showscore + Show your approximate accumulated score on bottom line (default + off). Persistent. + silent Suppress terminal beeps (default on). Persistent. @@ -4075,16 +4085,6 @@ screen. Use "symset:default" to explicitly select the default symbols. - time - Show the elapsed game time in turns on bottom line (default - off). Persistent. - - timed_delay - When pausing momentarily for display effect, such as with ex- - plosions and moving objects, use a timer rather than sending - extra characters to the screen. (Applies to "tty" interface - only; "X11" interface always uses a timer based delay. The - NetHack 3.7 December 18, 2019 @@ -4096,7 +4096,16 @@ - default is on if configured into the program.) Persistent. + time + Show the elapsed game time in turns on bottom line (default + off). Persistent. + + timed_delay + When pausing momentarily for display effect, such as with ex- + plosions and moving objects, use a timer rather than sending + extra characters to the screen. (Applies to "tty" interface + only; "X11" interface always uses a timer based delay. The de- + fault is on if configured into the program.) Persistent. tombstone Draw a tombstone graphic upon your death (default on). Persis- @@ -4141,15 +4150,6 @@ through next and previous targets, allows filtering the possi- ble targets. - n - no filtering [default] - v - in view only - a - in same area only - - The area-filter tries to be slightly predictive -- if you're - standing on a doorway, it will consider the area on the side of - the door you were last moving towards. - - NetHack 3.7 December 18, 2019 @@ -4162,6 +4162,14 @@ + n - no filtering [default] + v - in view only + a - in same area only + + The area-filter tries to be slightly predictive -- if you're + standing on a doorway, it will consider the area on the side of + the door you were last moving towards. + Filtering can also be changed when getting a location with the "getpos.filter" key. @@ -4208,14 +4216,6 @@ ing to suit your preferences, it will attempt to do so. If it can't it will silently ignore it. You can find out if an option is supported by the window port that you are currently using by - checking to see if it shows up in the Options list. Some options - are dynamic and can be specified during the game with the `O' - command. - - align_message - Where to align or place the message window (top, bottom, left, - or right) - NetHack 3.7 December 18, 2019 @@ -4228,6 +4228,14 @@ + checking to see if it shows up in the Options list. Some options + are dynamic and can be specified during the game with the `O' + command. + + align_message + Where to align or place the message window (top, bottom, left, + or right) + align_status Where to align or place the status window (top, bottom, left, or right). @@ -4274,14 +4282,6 @@ font_size_message If NetHack can, it should use this size font for the message - window. - - font_size_status - If NetHack can, it should use this size font for the status - window. - - font_size_text - If NetHack can, it should use this size font for text windows. NetHack 3.7 December 18, 2019 @@ -4294,6 +4294,15 @@ + window. + + font_size_status + If NetHack can, it should use this size font for the status + window. + + font_size_text + If NetHack can, it should use this size font for text windows. + fullscreen If NetHack can, it should try and display on the entire screen rather than in a window. @@ -4338,16 +4347,7 @@ games for the player to choose from at game startup, if it can. Not all ports support this option. - softkeyboard - Display an onscreen keyboard. Handhelds are most likely to - support this option. - splash_screen - If NetHack can, it should display an opening splash screen when - it starts up (default yes). - - statuslines - Number of lines for traditional below-the-map status display. NetHack 3.7 December 18, 2019 @@ -4360,6 +4360,16 @@ + softkeyboard + Display an onscreen keyboard. Handhelds are most likely to + support this option. + + splash_screen + If NetHack can, it should display an opening splash screen when + it starts up (default yes). + + statuslines + Number of lines for traditional below-the-map status display. Acceptable values are 2 and 3 (default is 2). Curses and tty interfaces only. @@ -4405,16 +4415,6 @@ 1 - on, always show borders 2 - auto, on if display is at least (24+2)x(80+2) (default) - (The 26x82 size threshold for `2' refers to number of rows and - columns of the display. A width of at least 110 columns - (80+2+26+2) is needed for align_status set to left or right.) - - windowcolors - If NetHack can, it should display windows with the specified - foreground/background colors. Windows GUI only. The format is - - - NetHack 3.7 December 18, 2019 @@ -4426,6 +4426,14 @@ + (The 26x82 size threshold for `2' refers to number of rows and + columns of the display. A width of at least 110 columns + (80+2+26+2) is needed for align_status set to left or right.) + + windowcolors + If NetHack can, it should display windows with the specified + foreground/background colors. Windows GUI only. The format is + OPTION=windowcolors:wintype foreground/background where wintype is one of "menu", "message", "status", or @@ -4472,14 +4480,6 @@ abort the count by typing ESC will leave NetHack waiting for another character to complete the two character sequence. Type a second ESC to finish cancelling such a count. At other - prompts a single ESC suffices. - - BIOS - Use BIOS calls to update the screen display quickly and to read - the keyboard (allowing the use of arrow keys to move) on ma- - chines with an IBM PC compatible BIOS ROM (default off, OS/2, - PC, and ST NetHack only). - NetHack 3.7 December 18, 2019 @@ -4492,6 +4492,14 @@ + prompts a single ESC suffices. + + BIOS + Use BIOS calls to update the screen display quickly and to read + the keyboard (allowing the use of arrow keys to move) on ma- + chines with an IBM PC compatible BIOS ROM (default off, OS/2, + PC, and ST NetHack only). + flush (default off, Amiga NetHack only). @@ -4538,14 +4546,6 @@ not correct the problem, try !color. Cannot be set with the `O' command. - 9.7. Regular Expressions - - Regular expressions are normally POSIX extended regular ex- - pressions. It is possible to compile NetHack without regular ex- - pression support on a platform where there is no regular expres- - sion library. While this is not true of any modern platform, if - your NetHack was built this way, patterns are instead glob pat- - terns. This applies to Autopickup exceptions, Message types, Menu NetHack 3.7 December 18, 2019 @@ -4558,6 +4558,14 @@ + 9.7. Regular Expressions + + Regular expressions are normally POSIX extended regular ex- + pressions. It is possible to compile NetHack without regular ex- + pression support on a platform where there is no regular expres- + sion library. While this is not true of any modern platform, if + your NetHack was built this way, patterns are instead glob pat- + terns. This applies to Autopickup exceptions, Message types, Menu colors, and User sounds. 9.8. Configuring Autopickup Exceptions @@ -4601,16 +4609,8 @@ any corpse from autopickup. The last example results in the ex- clusion of items known to be cursed from autopickup. - 9.9. Changing Key Bindings - It is possible to change the default key bindings of some - special commands, menu accelerator keys, and extended commands, - by using BIND stanzas in the configuration file. Format is key, - followed by the command to bind to, separated by a colon. The - key can be a single character ("x"), a control key ("^X", "C-x"), - a meta key ("M-x"), or a three-digit decimal ASCII code. - For example: @@ -4624,6 +4624,17 @@ + 9.9. Changing Key Bindings + + It is possible to change the default key bindings of some + special commands, menu accelerator keys, and extended commands, + by using BIND stanzas in the configuration file. Format is key, + followed by the command to bind to, separated by a colon. The + key can be a single character ("x"), a control key ("^X", "C-x"), + a meta key ("M-x"), or a three-digit decimal ASCII code. + + For example: + BIND=^X:getpos.autodescribe BIND={:menu_first_page BIND=v:loot @@ -4668,17 +4679,6 @@ When asked for a direction, the key to target yourself. De- fault is `.'. - getdir.self2 - When asked for a direction, the key to target yourself. De- - fault is `s'. - - getpos.autodescribe - When asked for a location, the key to toggle autodescribe. De- - fault is `#'. - - getpos.all.next - When asked for a location, the key to go to next closest - NetHack 3.7 December 18, 2019 @@ -4690,7 +4690,17 @@ - interesting thing. Default is `a'. + getdir.self2 + When asked for a direction, the key to target yourself. De- + fault is `s'. + + getpos.autodescribe + When asked for a location, the key to toggle autodescribe. De- + fault is `#'. + + getpos.all.next + When asked for a location, the key to go to next closest inter- + esting thing. Default is `a'. getpos.all.prev When asked for a location, the key to go to previous closest @@ -4734,16 +4744,6 @@ or meta-digit keys to fast-move around, move by skipping the same glyphs instead of by 8 units. Default is `*'. - getpos.filter - When asked for a location, change the filtering mode when using - one of the next or previous keys to cycle through targets. - Toggles between no filtering, in view only, and in the same - area only. Default is `"'. - - getpos.pick - When asked for a location, the key to choose the location, and - possibly ask for more info. Default is `.'. - NetHack 3.7 December 18, 2019 @@ -4756,6 +4756,16 @@ + getpos.filter + When asked for a location, change the filtering mode when using + one of the next or previous keys to cycle through targets. + Toggles between no filtering, in view only, and in the same + area only. Default is `"'. + + getpos.pick + When asked for a location, the key to choose the location, and + possibly ask for more info. Default is `.'. + getpos.pick.once When asked for a location, the key to choose the location, and skip asking for more info. Default is `,'. @@ -4799,16 +4809,6 @@ redraw Key to redraw the screen. Default is `^R'. - redraw.numpad - Key to redraw the screen. With number_pad only. Default is - `^L'. - - repeat - Key to repeat previous command. Default is `^A'. - - reqmenu - Prefix key to request menu from some commands. Default is `m'. - @@ -4822,6 +4822,16 @@ + redraw.numpad + Key to redraw the screen. With number_pad only. Default is + `^L'. + + repeat + Key to repeat previous command. Default is `^A'. + + reqmenu + Prefix key to request menu from some commands. Default is `m'. + run Prefix key to run towards a direction. Default is `G'. @@ -4867,16 +4877,6 @@ the user is prompted with more-prompt, and a message matching "You displaced ." is not shown at all. - The order of the defined MSGTYPE lines is important; the last - matching rule is used. Put the general case first, exceptions - below them. - - 9.11. Configuring Menu Colors - - Some platforms allow you to define colors used in menu lines - when the line matches a user-defined pattern. At this time the - tty, curses, win32tty and win32gui interfaces support this. - NetHack 3.7 December 18, 2019 @@ -4888,6 +4888,16 @@ + The order of the defined MSGTYPE lines is important; the last + matching rule is used. Put the general case first, exceptions + below them. + + 9.11. Configuring Menu Colors + + Some platforms allow you to define colors used in menu lines + when the line matches a user-defined pattern. At this time the + tty, curses, win32tty and win32gui interfaces support this. + In general, the configuration file entries to describe the menu color mappings look like this: @@ -4932,16 +4942,6 @@ Note that if you intend to have one or more color specifica- tions match " uncursed ", you will probably want to turn the im- plicit_uncursed option off so that all items known to be uncursed - are actually displayed with the "uncursed" description. - - 9.12. Configuring User Sounds - - Some platforms allow you to define sound files to be played - when a message that matches a user-defined pattern is delivered - to the message window. At this time the Qt port and the win32tty - and win32gui ports support the use of user sounds. - - NetHack 3.7 December 18, 2019 @@ -4954,6 +4954,15 @@ + are actually displayed with the "uncursed" description. + + 9.12. Configuring User Sounds + + Some platforms allow you to define sound files to be played + when a message that matches a user-defined pattern is delivered + to the message window. At this time the Qt port and the win32tty + and win32gui ports support the use of user sounds. + The following configuration file entries are relevant to mapping user sounds to messages: @@ -4999,15 +5008,6 @@ OPTION=hilite_status:wisdom/down/red/up/green - Allowed colors are black, red, green, brown, blue, magenta, - cyan, gray, orange, light-green, yellow, light-blue, light-magen- - ta, light-cyan, and white. And "no-color", the default fore- - ground color on the display, which is not necessarily the same as - black or white or any of the other colors. - - Allowed attributes are none, bold, dim, underline, blink, - and inverse. "Normal" is a synonym for "none"; they should not - be used in combination with any of the other attributes. NetHack 3.7 December 18, 2019 @@ -5020,6 +5020,16 @@ + Allowed colors are black, red, green, brown, blue, magenta, + cyan, gray, orange, light-green, yellow, light-blue, light-magen- + ta, light-cyan, and white. And "no-color", the default fore- + ground color on the display, which is not necessarily the same as + black or white or any of the other colors. + + Allowed attributes are none, bold, dim, underline, blink, + and inverse. "Normal" is a synonym for "none"; they should not + be used in combination with any of the other attributes. + To specify both a color and an attribute, use `&' to combine them. To specify multiple attributes, use `+' to combine those. For example: "magenta&inverse+dim". @@ -5064,16 +5074,6 @@ * "always" will set the default attributes for that field. - * "up", "down" set the field attributes for when the field - value changes upwards or downwards. This attribute times - out after statushilites turns. - - * "changed" sets the field attribute for when the field val- - ue changes. This attribute times out after statushilites - turns. (If a field has both a "changed" rule and an "up" - or "down" rule which matches a change in the field's val- - ue, the "up" or "down" one takes precedence.) - NetHack 3.7 December 18, 2019 @@ -5086,6 +5086,16 @@ + * "up", "down" set the field attributes for when the field + value changes upwards or downwards. This attribute times + out after statushilites turns. + + * "changed" sets the field attribute for when the field val- + ue changes. This attribute times out after statushilites + turns. (If a field has both a "changed" rule and an "up" + or "down" rule which matches a change in the field's val- + ue, the "up" or "down" one takes precedence.) + * percentage sets the field attribute when the field value matches the percentage. It is specified as a number be- tween 0 and 100, followed by `%' (percent sign). If the @@ -5129,16 +5139,6 @@ The whole feature can be disabled by setting option sta- tushilites to 0. - Example hilites: - - - - - - - - - @@ -5152,6 +5152,8 @@ + Example hilites: + OPTION=hilite_status: gold/up/yellow/down/brown OPTION=hilite_status: characteristics/up/green/down/red OPTION=hilite_status: hitpoints/100%/gray&normal @@ -5203,8 +5205,6 @@ B S_bat (bat or bird) ^ S_bear_trap (bear trap) - S_blcorn (bottom left corner) - b S_blob (blob) - + S_book (spellbook) @@ -5218,6 +5218,8 @@ + b S_blob (blob) + + S_book (spellbook) ) S_boomleft (boomerang open left) ( S_boomright (boomerang open right) ` S_boulder (boulder) @@ -5269,8 +5271,6 @@ . S_hodbridge (horizontal lowered drawbridge) | S_hodoor (open door in horizontal wall) ^ S_hole (hole) - @ S_human (human or elf) - h S_humanoid (humanoid) @@ -5284,6 +5284,8 @@ + @ S_human (human or elf) + h S_humanoid (humanoid) - S_hwall (horizontal wall) . S_ice (ice) i S_imp (imp or minor demon) @@ -5335,8 +5337,6 @@ s S_spider (arachnid or centipede) ^ S_spiked_pit (spiked pit) ^ S_squeaky_board (squeaky board) - 0 S_ss1 (magic shield 1 of 4) - # S_ss2 (magic shield 2 of 4) @@ -5350,6 +5350,8 @@ + 0 S_ss1 (magic shield 1 of 4) + # S_ss2 (magic shield 2 of 4) @ S_ss3 (magic shield 3 of 4) * S_ss4 (magic shield 4 of 4) ^ S_statue_trap (statue trap) @@ -5401,8 +5403,6 @@ x S_xan (xan or other extraordinary insect) X S_xorn (xorn) Y S_yeti (apelike creature) - Z S_zombie (zombie) - z S_zruty (zruty) @@ -5416,6 +5416,8 @@ + Z S_zombie (zombie) + z S_zruty (zruty) S_pet_override (any pet if ACCESSIBILITY=1 is set) S_hero_override (hero if ACCESSIBILITY=1 is set) @@ -5468,8 +5470,6 @@ ficial distributions of NetHack is a symset called NHAccess. Se- lecting that symset in your configuration file will cause the game to run in a manner accessible to the blind. After you have - gained some experience with the game and with editing files, you - may want to alter settings via SYMBOLS= and ROGUESYMBOLS= in your NetHack 3.7 December 18, 2019 @@ -5482,6 +5482,8 @@ + gained some experience with the game and with editing files, you + may want to alter settings via SYMBOLS= and ROGUESYMBOLS= in your configuration file to better suit your preferences. See the pre- vious section for the special symbols S_pet_override to force a consistent symbol for all pets and S_hero_override to force a @@ -5536,8 +5538,6 @@ formation can be seen via the "#attributes" command. - - NetHack 3.7 December 18, 2019 From c9bc2f5a2a9fc231e3a34a5845e3e480f9c9c8e2 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 23 Dec 2019 02:26:59 -0800 Subject: [PATCH 19/35] github issue #267 - giant {beetle,spider} Increase weight of giant spider from 100 to 200; leave nutrition at 100. Increase weight of giant beetle from 10 to 200; increase nutrition from 10 to 50. Both are still size 'large'. I've left giant ant with weight 10, nutrition 10, size 'tiny' so that it doesn't become bigger than soldier and fire ants. Fixes #267 --- src/monst.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/monst.c b/src/monst.c index 23af5d298..9702d33f4 100644 --- a/src/monst.c +++ b/src/monst.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 monst.c $NHDT-Date: 1547118631 2019/01/10 11:10:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.62 $ */ +/* NetHack 3.6 monst.c $NHDT-Date: 1577096800 2019/12/23 10:26:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.70 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -131,7 +131,7 @@ NEARDATA struct permonst mons_init[] = { MON("giant beetle", S_ANT, LVL(5, 6, 4, 0, 0), (G_GENO | 3), A(ATTK(AT_BITE, AD_PHYS, 3, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), - SIZ(10, 10, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON, + SIZ(200, 50, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON, M1_ANIMAL | M1_NOHANDS | M1_POIS | M1_CARNIVORE, M2_HOSTILE, 0, 6, CLR_BLACK), MON("queen bee", S_ANT, LVL(9, 24, -4, 0, 0), (G_GENO | G_NOGEN), @@ -787,7 +787,7 @@ NEARDATA struct permonst mons_init[] = { MON("giant spider", S_SPIDER, LVL(5, 15, 4, 0, 0), (G_GENO | 1), A(ATTK(AT_BITE, AD_DRST, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), - SIZ(100, 100, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON, + SIZ(200, 100, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON, M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_POIS | M1_CARNIVORE, M2_HOSTILE | M2_STRONG, 0, 7, CLR_MAGENTA), MON("scorpion", S_SPIDER, LVL(5, 15, 3, 0, 0), (G_GENO | 2), From 7012e7046f7d57da820de9c16d2841736558e81d Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 23 Dec 2019 08:36:44 -0500 Subject: [PATCH 20/35] add support for MENU_ITEMFLAGS_SKIPINVERT Able to test: win/tty win/win32 win/curses Unable to test: win/X11 win/Qt win/Qt3 win/gem win/gnome --- include/wintty.h | 16 ++++++++-------- include/wintype.h | 5 +++-- win/Qt/qt_bind.cpp | 5 ++--- win/Qt/qt_menu.cpp | 4 +++- win/Qt/qt_menu.h | 5 +++-- win/Qt3/qt3_win.cpp | 6 ++++-- win/Qt3/qt3_win.h | 8 ++++---- win/X11/winmenu.c | 7 +++++-- win/curses/cursdial.c | 10 +++++++--- win/curses/cursdial.h | 2 +- win/curses/cursmain.c | 4 ++-- win/curses/curswins.c | 3 ++- win/gem/wingem.c | 1 + win/gem/wingem1.c | 5 ++++- win/gnome/gnbind.c | 1 + win/gnome/gnmenu.h | 1 + win/tty/wintty.c | 9 ++++++++- win/win32/mhmenu.c | 6 ++++-- 18 files changed, 63 insertions(+), 35 deletions(-) diff --git a/include/wintty.h b/include/wintty.h index 30e257e97..3cf4cb77c 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -13,14 +13,14 @@ /* menu structure */ typedef struct tty_mi { struct tty_mi *next; - anything identifier; /* user identifier */ - long count; /* user count */ - char *str; /* description string (including accelerator) */ - int attr; /* string attribute */ - boolean selected; /* TRUE if selected by user */ - unsigned int itemflags; /* */ - char selector; /* keyboard accelerator */ - char gselector; /* group accelerator */ + anything identifier; /* user identifier */ + long count; /* user count */ + char *str; /* description string (including accelerator) */ + int attr; /* string attribute */ + boolean selected; /* TRUE if selected by user */ + unsigned itemflags; /* item flags */ + char selector; /* keyboard accelerator */ + char gselector; /* group accelerator */ } tty_menu_item; /* descriptor for tty-based windows */ diff --git a/include/wintype.h b/include/wintype.h index 550afad3a..217b314a5 100644 --- a/include/wintype.h +++ b/include/wintype.h @@ -107,8 +107,9 @@ typedef struct mi { #define MENU_INVERT_PAGE '~' #define MENU_SEARCH ':' -#define MENU_ITEMFLAGS_NONE 0x0000000 -#define MENU_ITEMFLAGS_SELECTED 0x0000001 +#define MENU_ITEMFLAGS_NONE 0x0000000U +#define MENU_ITEMFLAGS_SELECTED 0x0000001U +#define MENU_ITEMFLAGS_SKIPINVERT 0x0000002U /* clang-format on */ diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index 9926ee70b..81ffacc82 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -376,13 +376,12 @@ void NetHackQtBind::qt_start_menu(winid wid) void NetHackQtBind::qt_add_menu(winid wid, int glyph, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, - const char *str, unsigned int itemflags) + const char *str, unsigned itemflags) { - boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); NetHackQtWindow* window=id_to_window[(int)wid]; window->AddMenu(glyph, identifier, ch, gch, attr, QString::fromLatin1(str), - presel); + itemflags); } void NetHackQtBind::qt_end_menu(winid wid, const char *prompt) diff --git a/win/Qt/qt_menu.cpp b/win/Qt/qt_menu.cpp index 8a0106b4d..b91b056c3 100644 --- a/win/Qt/qt_menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -160,8 +160,9 @@ NetHackQtMenuWindow::MenuItem::~MenuItem() } void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, - char ch, char gch, int attr, const QString& str, bool presel) + char ch, char gch, int attr, const QString& str, unsigned itemflags) { + bool presel = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0; if (!ch && identifier->a_void!=0) { // Supply a keyboard accelerator. Limited supply. static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -180,6 +181,7 @@ void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, itemlist[itemcount].attr=attr; itemlist[itemcount].str=str; itemlist[itemcount].selected=presel; + itemlist[itemcount].itemflags=itemflags; itemlist[itemcount].count=-1; itemlist[itemcount].color = -1; // Display the boulder symbol correctly diff --git a/win/Qt/qt_menu.h b/win/Qt/qt_menu.h index 1b278a89f..7aa5c2b8d 100644 --- a/win/Qt/qt_menu.h +++ b/win/Qt/qt_menu.h @@ -55,7 +55,7 @@ public: virtual void StartMenu(); virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const QString& str, bool presel); + const QString& str, unsigned itemflags); virtual void EndMenu(const QString& prompt); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); @@ -85,6 +85,7 @@ private: char ch; char gch; bool selected; + unsigned itemflags; unsigned color; bool Selectable() const { return identifier.a_void!=0; } @@ -172,7 +173,7 @@ public: // Menu virtual void StartMenu(); virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const QString& str, bool presel); + const QString& str, unsigned itemflags); virtual void EndMenu(const QString& prompt); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); diff --git a/win/Qt3/qt3_win.cpp b/win/Qt3/qt3_win.cpp index d8443cc83..fdde1daf2 100644 --- a/win/Qt3/qt3_win.cpp +++ b/win/Qt3/qt3_win.cpp @@ -1447,7 +1447,7 @@ void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } void NetHackQtWindow::PutStr(int attr, const char* text) { puts("unexpected PutStr"); } void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const char* str, bool presel) { puts("unexpected AddMenu"); } + const char* str, unsigned itemflags) { puts("unexpected AddMenu"); } void NetHackQtWindow::EndMenu(const char* prompt) { puts("unexpected EndMenu"); } int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } @@ -2788,8 +2788,9 @@ NetHackQtMenuWindow::MenuItem::~MenuItem() #define STR_MARGIN 4 void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, - char ch, char gch, int attr, const char* str, bool presel) + char ch, char gch, int attr, const char* str, unsigned itemflags) { + bool presel = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0; if (!ch && identifier->a_void!=0) { // Supply a keyboard accelerator. Limited supply. static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; @@ -2807,6 +2808,7 @@ void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, item[itemcount].attr=attr; item[itemcount].str=strdup(str); item[itemcount].selected=presel; + item[itemcount].itemflags=itemflags; item[itemcount].count=-1; ++itemcount; diff --git a/win/Qt3/qt3_win.h b/win/Qt3/qt3_win.h index 825fa918b..e9b6dbef0 100644 --- a/win/Qt3/qt3_win.h +++ b/win/Qt3/qt3_win.h @@ -258,7 +258,7 @@ class NetHackQtWindow virtual void PutStr(int attr, const char *text); virtual void StartMenu(); virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, - char gch, int attr, const char *str, bool presel); + char gch, int attr, const char *str, unsigned itemflags); virtual void EndMenu(const char *prompt); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual void ClipAround(int x, int y); @@ -550,7 +550,7 @@ class NetHackQtMenuWindow : public QTableView, public NetHackQtWindow virtual void StartMenu(); virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, - char gch, int attr, const char *str, bool presel); + char gch, int attr, const char *str, unsigned itemflags); virtual void EndMenu(const char *prompt); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); @@ -699,7 +699,7 @@ class NetHackQtMenuOrTextWindow : public NetHackQtWindow // Menu virtual void StartMenu(); virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, - char gch, int attr, const char *str, bool presel); + char gch, int attr, const char *str, unsigned itemflags); virtual void EndMenu(const char *prompt); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); }; @@ -854,7 +854,7 @@ class NetHackQtBind : NetHackQtBindBase static void qt_start_menu(winid wid); static void qt_add_menu(winid wid, int glyph, const ANY_P *identifier, CHAR_P ch, CHAR_P gch, int attr, const char *str, - unsigned int itemflags); + unsigned itemflags); static void qt_end_menu(winid wid, const char *prompt); static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); static void qt_update_inventory(); diff --git a/win/X11/winmenu.c b/win/X11/winmenu.c index b86e02ae3..36f60829c 100644 --- a/win/X11/winmenu.c +++ b/win/X11/winmenu.c @@ -542,10 +542,12 @@ struct xwindow *wp; reset_menu_count(wp->menu_information); for (count = 0, curr = wp->menu_information->curr_menu.base; curr; - curr = curr->next, count++) + curr = curr->next, count++) { + if ((curr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0) + continue; if (curr->identifier.a_void != 0) invert_line(wp, curr, count, -1L); - + } } static void @@ -655,6 +657,7 @@ unsigned itemflags; item->next = (x11_menu_item *) 0; item->identifier = *identifier; item->attr = attr; + item->itemflags = itemflags; item->selected = item->preselected = preselected; item->pick_count = -1L; item->window = window; diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index cf88c022b..8210c3523 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -586,6 +586,7 @@ curs_new_menu_item(winid wid, const char *str) new_item->str = new_str; new_item->presel = FALSE; new_item->selected = FALSE; + new_item->itemflags = MENU_ITEMFLAGS_NONE; new_item->page_num = 0; new_item->line_num = 0; new_item->num_lines = 0; @@ -598,10 +599,11 @@ curs_new_menu_item(winid wid, const char *str) void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel) + const char *str, unsigned itemflags) { nhmenu_item *new_item, *current_items, *menu_item_ptr; nhmenu *current_menu = get_menu(wid); + boolean presel = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0; if (current_menu == NULL) { impossible( @@ -620,7 +622,7 @@ curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier, new_item->group_accel = group_accel; new_item->attr = attr; new_item->presel = presel; - + new_item->itemflags = itemflags; current_items = current_menu->entries; menu_item_ptr = current_items; @@ -1549,7 +1551,9 @@ menu_operation(WINDOW * win, nhmenu *menu, menu_op } if (menu_item_ptr->identifier.a_void != NULL) { - menu_select_deselect(win, menu_item_ptr, operation, current_page); + if (operation != INVERT + || (menu_item_ptr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) == 0) + menu_select_deselect(win, menu_item_ptr, operation, current_page); } menu_item_ptr = menu_item_ptr->next_item; diff --git a/win/curses/cursdial.h b/win/curses/cursdial.h index acc6f855b..08b9f2948 100644 --- a/win/curses/cursdial.h +++ b/win/curses/cursdial.h @@ -15,7 +15,7 @@ int curses_ext_cmd(void); void curses_create_nhmenu(winid wid); void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel); + const char *str, unsigned itemflags); void curs_menu_set_bottom_heavy(winid); void curses_finalize_nhmenu(winid wid, const char *prompt); int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected); diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index bab6d0808..9d1bfe62b 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -522,7 +522,7 @@ add_menu(winid wid, int glyph, const anything identifier, void curses_add_menu(winid wid, int glyph, const ANY_P * identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, unsigned int itemflags) + const char *str, unsigned itemflags) { int curses_attr; boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); @@ -537,7 +537,7 @@ curses_add_menu(winid wid, int glyph, const ANY_P * identifier, } curses_add_nhmenu_item(wid, glyph, identifier, accelerator, group_accel, - curses_attr, str, presel); + curses_attr, str, itemflags); } /* diff --git a/win/curses/curswins.c b/win/curses/curswins.c index 5dc6fc3fa..901320b0c 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -509,7 +509,8 @@ curses_puts(winid wid, int attr, const char *text) return; } Id = cg.zeroany; - curses_add_nhmenu_item(wid, NO_GLYPH, &Id, 0, 0, attr, text, FALSE); + curses_add_nhmenu_item(wid, NO_GLYPH, &Id, 0, 0, attr, text, + MENU_ITEMFLAGS_NONE); } else { waddstr(win, text); wnoutrefresh(win); diff --git a/win/gem/wingem.c b/win/gem/wingem.c index 76ea26cb9..7eecde401 100644 --- a/win/gem/wingem.c +++ b/win/gem/wingem.c @@ -788,6 +788,7 @@ unsigned int itemflags; /* itemflags such as marked as selected */ G_item->Gmi_selected = preselected ? 1 : 0; G_item->Gmi_accelerator = ch; G_item->Gmi_groupacc = gch; + G_item->Gmi_itemflags = itemflags; G_item->Gmi_attr = attr; G_item->Gmi_str = copy_of(newstr); mar_add_menu(window, G_item); diff --git a/win/gem/wingem1.c b/win/gem/wingem1.c index 08473853f..e25e60ae3 100644 --- a/win/gem/wingem1.c +++ b/win/gem/wingem1.c @@ -1783,7 +1783,9 @@ char acc; for (curr = invent_list; start-- && curr; curr = curr->Gmi_next) ; - for (; page-- && curr; curr = curr->Gmi_next) + for (; page-- && curr; curr = curr->Gmi_next) { + if ((curr->Gmi_itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0) + continue; if (curr->Gmi_identifier && (acc == 0 || curr->Gmi_groupacc == acc)) { if (curr->Gmi_selected) { curr->Gmi_selected = FALSE; @@ -1791,6 +1793,7 @@ char acc; } else curr->Gmi_selected = TRUE; } + } } /************************* Inv_Handler and Inv_Init diff --git a/win/gnome/gnbind.c b/win/gnome/gnbind.c index fbd9107e8..0b99c2453 100644 --- a/win/gnome/gnbind.c +++ b/win/gnome/gnbind.c @@ -723,6 +723,7 @@ gnome_add_menu(winid wid, int glyph, const ANY_P *identifier, item.attr = attr; item.str = str; item.presel = presel; + item.itemflags = itemflags; if (wid != -1 && gnome_windowlist[wid].win != NULL) { gtk_signal_emit(GTK_OBJECT(gnome_windowlist[wid].win), diff --git a/win/gnome/gnmenu.h b/win/gnome/gnmenu.h index f6ba3231d..b8bd140b1 100644 --- a/win/gnome/gnmenu.h +++ b/win/gnome/gnmenu.h @@ -18,6 +18,7 @@ struct _GHackMenuItem { CHAR_P accelerator; CHAR_P group_accel; int attr; + unsigned itemflags; const char *str; BOOLEAN_P presel; }; diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 8f7ddc9e2..9e41688ed 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1773,7 +1773,10 @@ char acc; /* group accelerator, 0 => all */ tty_menu_item *curr; int n; - for (n = 0, curr = page_start; curr != page_end; n++, curr = curr->next) + for (n = 0, curr = page_start; curr != page_end; n++, curr = curr->next) { + if ((curr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0) + continue; + if (curr->identifier.a_void && (acc == 0 || curr->gselector == acc)) { if (curr->selected) { curr->selected = FALSE; @@ -1782,6 +1785,7 @@ char acc; /* group accelerator, 0 => all */ curr->selected = TRUE; set_item_state(window, n, curr); } + } } /* @@ -1801,6 +1805,9 @@ char acc; /* group accelerator, 0 => all */ /* invert the rest */ for (on_curr_page = FALSE, curr = cw->mlist; curr; curr = curr->next) { + if ((curr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0) + continue; + if (curr == page_start) on_curr_page = TRUE; else if (curr == page_end) diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index 14fa263f9..ab76d41ad 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -1306,7 +1306,8 @@ onListChar(HWND hWnd, HWND hwndList, WORD ch) if (data->how == PICK_ANY) { reset_menu_count(hwndList, data); for (i = 0; i < data->menu.size; i++) { - SelectMenuItem(hwndList, data, i, + if (!(data->menu.items[i].itemflags & MENU_ITEMFLAGS_SKIPINVERT)) + SelectMenuItem(hwndList, data, i, NHMENU_IS_SELECTED(data->menu.items[i]) ? 0 : -1); } @@ -1353,7 +1354,8 @@ onListChar(HWND hWnd, HWND hwndList, WORD ch) from = max(0, topIndex); to = min(data->menu.size, from + pageSize); for (i = from; i < to; i++) { - SelectMenuItem(hwndList, data, i, + if (!(data->menu.items[i].itemflags & MENU_ITEMFLAGS_SKIPINVERT)) + SelectMenuItem(hwndList, data, i, NHMENU_IS_SELECTED(data->menu.items[i]) ? 0 : -1); } From 83fdda56fe95c32d4d04fe4bbe20557ebe0badd8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 23 Dec 2019 08:53:58 -0500 Subject: [PATCH 21/35] curses updates --- include/wincurs.h | 2 +- src/.gitignore | 2 ++ win/curses/cursdial.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/wincurs.h b/include/wincurs.h index 07da384ac..bc670975e 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -177,7 +177,7 @@ extern void curses_create_nhmenu(winid wid); extern void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, - const char *str, BOOLEAN_P presel); + const char *str, unsigned itemflags); extern void curs_menu_set_bottom_heavy(winid); extern void curses_finalize_nhmenu(winid wid, const char *prompt); extern int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected); diff --git a/src/.gitignore b/src/.gitignore index df4310a30..dfe1014db 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -11,3 +11,5 @@ tiles.bmp graphicschk nhdat o +nhdat370 + diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 8210c3523..a33ef530b 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -66,6 +66,7 @@ typedef struct nhmi { const char *str; /* Text of menu item */ BOOLEAN_P presel; /* Whether menu item should be preselected */ boolean selected; /* Whether item is currently selected */ + unsigned itemflags; int page_num; /* Display page number for entry */ int line_num; /* Line number on page where entry begins */ int num_lines; /* Number of lines entry uses on page */ From 510d8514b6e84153603ff1b3294112259fa64a68 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 23 Dec 2019 09:05:01 -0500 Subject: [PATCH 22/35] tty update --- win/tty/wintty.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 9e41688ed..96be7acbf 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1805,9 +1805,6 @@ char acc; /* group accelerator, 0 => all */ /* invert the rest */ for (on_curr_page = FALSE, curr = cw->mlist; curr; curr = curr->next) { - if ((curr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0) - continue; - if (curr == page_start) on_curr_page = TRUE; else if (curr == page_end) @@ -1815,11 +1812,13 @@ char acc; /* group accelerator, 0 => all */ if (!on_curr_page && curr->identifier.a_void && (acc == 0 || curr->gselector == acc)) { - if (curr->selected) { - curr->selected = FALSE; - curr->count = -1; - } else - curr->selected = TRUE; + if ((curr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) == 0) { + if (curr->selected) { + curr->selected = FALSE; + curr->count = -1; + } else + curr->selected = TRUE; + } } } } From f3987d6d703fe77df7593bc08d06ed71725c3270 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 23 Dec 2019 09:26:08 -0500 Subject: [PATCH 23/35] add a use of MENU_ITEMFLAGS_SKIPINVERT to pickup.c --- src/pickup.c | 16 ++++++++++------ win/tty/wintty.c | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pickup.c b/src/pickup.c index b79c17d27..d1c0ae0ba 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1014,6 +1014,7 @@ int how; /* type of query */ boolean do_blessed = FALSE, do_cursed = FALSE, do_uncursed = FALSE, do_buc_unknown = FALSE; int num_buc_types = 0; + unsigned itemflags = MENU_ITEMFLAGS_NONE; *pick_list = (menu_item *) 0; if (!olist) @@ -1068,10 +1069,11 @@ int how; /* type of query */ invlet = 'A'; any = cg.zeroany; any.a_int = 'A'; + itemflags = MENU_ITEMFLAGS_SKIPINVERT; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, (qflags & WORN_TYPES) ? "Auto-select every item being worn" : "Auto-select every item", - MENU_ITEMFLAGS_NONE); + itemflags); any = cg.zeroany; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); @@ -1081,9 +1083,10 @@ int how; /* type of query */ invlet = 'a'; any = cg.zeroany; any.a_int = ALL_TYPES_SELECTED; + itemflags = MENU_ITEMFLAGS_SKIPINVERT; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, (qflags & WORN_TYPES) ? "All worn types" : "All types", - MENU_ITEMFLAGS_NONE); + itemflags); invlet = 'b'; } else invlet = 'a'; @@ -1141,33 +1144,34 @@ int how; /* type of query */ /* items with b/u/c/unknown if there are any; this cluster of menu entries is in alphabetical order, reversing the usual sequence of 'U' and 'C' in BUCX */ + itemflags = MENU_ITEMFLAGS_SKIPINVERT; if (do_blessed) { invlet = 'B'; any = cg.zeroany; any.a_int = 'B'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Items known to be Blessed", MENU_ITEMFLAGS_NONE); + "Items known to be Blessed", itemflags); } if (do_cursed) { invlet = 'C'; any = cg.zeroany; any.a_int = 'C'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Items known to be Cursed", MENU_ITEMFLAGS_NONE); + "Items known to be Cursed", itemflags); } if (do_uncursed) { invlet = 'U'; any = cg.zeroany; any.a_int = 'U'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Items known to be Uncursed", MENU_ITEMFLAGS_NONE); + "Items known to be Uncursed", itemflags); } if (do_buc_unknown) { invlet = 'X'; any = cg.zeroany; any.a_int = 'X'; add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, - "Items of unknown Bless/Curse status", MENU_ITEMFLAGS_NONE); + "Items of unknown Bless/Curse status", itemflags); } end_menu(win, qstr); n = select_menu(win, how, pick_list); diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 96be7acbf..aaba49f41 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1818,7 +1818,7 @@ char acc; /* group accelerator, 0 => all */ curr->count = -1; } else curr->selected = TRUE; - } + } } } } From 370cfad85a353798b82345e12b5de844e312a0b7 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 23 Dec 2019 16:45:25 +0200 Subject: [PATCH 24/35] Fix X11 compile --- include/winX.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/winX.h b/include/winX.h index 93a3c1096..5681f61a5 100644 --- a/include/winX.h +++ b/include/winX.h @@ -133,6 +133,7 @@ typedef struct x11_mi { int attr; /* Attribute for the line. */ boolean selected; /* Been selected? */ boolean preselected; /* in advance? */ + unsigned itemflags; /* MENU_ITEMFLAGS_foo */ char selector; /* Char used to select this entry. */ char gselector; /* Group selector. */ Widget w; From fc0596d5293ba6678979e0d80927271a6b9784aa Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 23 Dec 2019 17:24:41 +0200 Subject: [PATCH 25/35] Fix Qt compile --- win/Qt/qt_menu.cpp | 7 +++++-- win/Qt/qt_win.cpp | 2 +- win/Qt/qt_win.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/win/Qt/qt_menu.cpp b/win/Qt/qt_menu.cpp index b91b056c3..8be6abaaf 100644 --- a/win/Qt/qt_menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -534,6 +534,9 @@ void NetHackQtMenuWindow::Invert() return; for (int i=0; iitem(i, 0); if (count != NULL) count->setText(""); @@ -813,10 +816,10 @@ void NetHackQtMenuOrTextWindow::StartMenu() actual->StartMenu(); } void NetHackQtMenuOrTextWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const QString& str, bool presel) + const QString& str, unsigned itemflags) { if (!actual) impossible("AddMenu called before we know if Menu or Text"); - actual->AddMenu(glyph,identifier,ch,gch,attr,str,presel); + actual->AddMenu(glyph,identifier,ch,gch,attr,str,itemflags); } void NetHackQtMenuOrTextWindow::EndMenu(const QString& prompt) { diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index 664591834..8c4ecac04 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -125,7 +125,7 @@ void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); } void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const QString& str, bool presel) { puts("unexpected AddMenu"); } + const QString& str, unsigned itemflags) { puts("unexpected AddMenu"); } void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); } int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } diff --git a/win/Qt/qt_win.h b/win/Qt/qt_win.h index b85104414..486bf4ec6 100644 --- a/win/Qt/qt_win.h +++ b/win/Qt/qt_win.h @@ -34,7 +34,7 @@ public: } virtual void StartMenu(); virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const QString& str, bool presel); + const QString& str, unsigned itemflags); virtual void EndMenu(const QString& prompt); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual void ClipAround(int x,int y); From 11e003cb47d2acd4a4b0b8047f8306e016708acb Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 23 Dec 2019 10:44:07 -0500 Subject: [PATCH 26/35] add a requested interface adjustment for menu invert operations Originally requested by one of the hardfought admins Adjust all active window ports (tty, curses, win32, Qt, X11) to store the itemflags that they receive with each item. Also, make those active window ports understand the new MENU_ITEMFLAGS_SKIPINVERT flag by skipping any menu items with that setting during invert_all and invert_page operations. Build testing and rudimentary functionality testing was carried out on each of the window ports listed above. The code was also modified on some non-active window ports (Qt3, gem, gnome) but it was not tested for build or function there. The desired functionality expressed was to be able to select a single object category, and use the @ "invert all" function to exclude that one and select all the others. The "invert all" function's behavior of also including things like "select all" and BUCX menu items made the feature unuseful for that purpose. --- doc/fixes37.0 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index a66d896c4..1cb010f4b 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -15,6 +15,8 @@ fix accessing mons[-1] when trying to gate in a non-valid demon fast hero could have random clairvoyance happen more than once on same turn using 'Q' on wielded weapon would offer to split stack; make using 'w' on a quivered stack behave similarly +leave some menu items out of "invert all" via '@' when their inclusion would + degrade the usefulness of that interface feature Fixes to 3.7.0-x Problems that Were Exposed Via git Repository @@ -68,4 +70,5 @@ remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR old Qt moved from win/Qt to win/Qt3 and files renamed to use qt3_ prefix more current Qt for Qt version 4 and 5 moved from win/Qt4 to win/Qt; qt4 moniker changed to qt_ - +window-port-interface: add_menu() modified to take a more general itemflags + parameter to support uses beyond just 'preselected' From 6f9e7b6b97dfe3b5319245501acca1c193eeb82b Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Mon, 23 Dec 2019 18:03:26 -0500 Subject: [PATCH 27/35] Fixes to build NetHack 3.7.0 on FreeDOS --- sys/msdos/Makefile.GCC | 152 +++++++++++++++++------------------------ sys/msdos/nhlua.h | 6 ++ 2 files changed, 67 insertions(+), 91 deletions(-) create mode 100644 sys/msdos/nhlua.h diff --git a/sys/msdos/Makefile.GCC b/sys/msdos/Makefile.GCC index cfe9b28d3..1b0521b7c 100644 --- a/sys/msdos/Makefile.GCC +++ b/sys/msdos/Makefile.GCC @@ -295,7 +295,7 @@ VOBJ07 = $(O)getline.o $(O)hack.o $(O)hacklib.o $(O)invent.o $(O)lock.o VOBJ08 = $(O)mail.o $(O)main.o $(O)makemon.o $(O)mapglyph.o $(O)mcastu.o $(O)mhitm.o VOBJ09 = $(O)mhitu.o $(O)minion.o $(O)mkmap.o $(O)mklev.o $(O)mkmaze.o VOBJ10 = $(O)mkobj.o $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o -VOBJ11 = $(O)monst.o $(O)monstr.o $(O)mplayer.o $(O)mthrowu.o $(O)muse.o +VOBJ11 = $(O)monst.o $(O)mplayer.o $(O)mthrowu.o $(O)muse.o VOBJ12 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o $(O)options.o VOBJ13 = $(O)pickup.o $(O)pline.o $(O)polyself.o $(O)potion.o $(O)quest.o VOBJ14 = $(O)questpgr.o $(O)pager.o $(O)pray.o $(O)priest.o $(O)read.o @@ -357,14 +357,15 @@ LUASRCFILES = lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c \ ltable.c ltablib.c ltm.c lundump.c lutf8lib.c \ lvm.c lzio.c -LUAOBJFILES = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \ +LUAOBJFILES1 = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \ $(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o \ - $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \ - $(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \ + $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o +LUAOBJFILES2 = $(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \ $(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \ - $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o \ - $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \ + $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o +LUAOBJFILES3 = $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \ $(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o +LUAOBJFILES = $(LUAOBJFILES1) $(LUAOBJFILES2) $(LUAOBJFILES3) endif ifeq "$(ADD_CURSES)" "Y" @@ -376,14 +377,17 @@ 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 \ +PDCLIBOBJS1 = $(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 + $(O)getch.o +PDCLIBOBJS2 = $(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 +PDCLIBOBJS3 = $(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 +PDCLIBOBJS4 = $(O)touch.o $(O)util.o $(O)window.o $(O)debug.o +PDCLIBOBJS = $(PDCLIBOBJS1) $(PDCLIBOBJS2) $(PDCLIBOBJS3) $(PDCLIBOBJS4) PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o \ $(O)pdcscrn.o $(O)pdcsetsc.o $(O)pdcutil.o @@ -586,7 +590,7 @@ else LEVCOMPEXE = endif $(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \ - $(INCL)/pm.h monstr.c vis_tab.c $(TILEUTIL) + $(INCL)/pm.h vis_tab.c $(TILEUTIL) $(subst /,\,echo utilities made > $@) tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe @@ -620,6 +624,7 @@ endif -@$(subst /,\,touch $(GAMEDIR)/record) @$(subst /,\,copy $(DOC)/guideb*.txt $(GAMEDIR)) @$(subst /,\,copy ../sys/winnt/sysconf $(GAMEDIR)) + @$(subst /,\,if not exist $(GAMEDIR)/sysconf touch $(GAMEDIR)/sysconf) @$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR)) ifdef CWSDPMI @$(subst /,\,if exist $(CWSDPMI) copy $(CWSDPMI) $(GAMEDIR)) @@ -633,86 +638,50 @@ endif #========================================== $(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) $(LUATARGETS) \ - $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk + $(O)utility.tag $(ALLOBJ) @if exist temp.a del temp.a - @ar ru temp.a $(VOBJ01) - @ar ru temp.a $(VOBJ02) - @ar ru temp.a $(VOBJ03) - @ar ru temp.a $(VOBJ04) - @ar ru temp.a $(VOBJ05) - @ar ru temp.a $(VOBJ06) - @ar ru temp.a $(VOBJ07) - @ar ru temp.a $(VOBJ08) - @ar ru temp.a $(VOBJ09) - @ar ru temp.a $(VOBJ10) - @ar ru temp.a $(VOBJ11) - @ar ru temp.a $(VOBJ12) - @ar ru temp.a $(VOBJ13) - @ar ru temp.a $(VOBJ14) - @ar ru temp.a $(VOBJ15) - @ar ru temp.a $(VOBJ16) - @ar ru temp.a $(VOBJ17) - @ar ru temp.a $(VOBJ18) - @ar ru temp.a $(VOBJ19) - @ar ru temp.a $(VOBJ20) - @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) + @ar ruS temp.a $(VOBJ01) + @ar ruS temp.a $(VOBJ02) + @ar ruS temp.a $(VOBJ03) + @ar ruS temp.a $(VOBJ04) + @ar ruS temp.a $(VOBJ05) + @ar ruS temp.a $(VOBJ06) + @ar ruS temp.a $(VOBJ07) + @ar ruS temp.a $(VOBJ08) + @ar ruS temp.a $(VOBJ09) + @ar ruS temp.a $(VOBJ10) + @ar ruS temp.a $(VOBJ11) + @ar ruS temp.a $(VOBJ12) + @ar ruS temp.a $(VOBJ13) + @ar ruS temp.a $(VOBJ14) + @ar ruS temp.a $(VOBJ15) + @ar ruS temp.a $(VOBJ16) + @ar ruS temp.a $(VOBJ17) + @ar ruS temp.a $(VOBJ18) + @ar ruS temp.a $(VOBJ19) + @ar ruS temp.a $(VOBJ20) + @ar ruS temp.a $(VOBJ21) + @ar ruS temp.a $(VOBJ22) + @ar ruS temp.a $(VOBJ23) + @ar ruS temp.a $(VOBJ24) + @ar ruS temp.a $(VOBJ25) + @ar ruS temp.a $(SOBJ) + @ar ruS temp.a $(TILOBJ) + @ar ruS temp.a $(TILOBJ2) + @ar ruS temp.a $(VVOBJ) ifeq "$(ADD_LUA)" "Y" - @ar ru temp.a $(LUAOBJ) + @ar ruS temp.a $(LUAOBJ) endif ifeq "$(ADD_CURSES)" "Y" - @ar ru temp.a $(CURSESOBJ) + @ar ruS temp.a $(CURSESOBJ) endif + @ranlib temp.a $(LINK) $(LFLAGS) -o$(GAME).exe temp.a \ $(PDCLIB) $(LUALIB) $(LIBRARIES) $(ZLIB) @$(subst /,\,stubedit $(GAME).exe minstack=2048K) @$(subst /,\,copy $(GAME).exe $(GAMEFILE)) @$(subst /,\,del $(GAME).exe) -$(O)$(GAME).lnk: $(ALLOBJ) - echo $(VOBJ01) > $(subst /,\,$@) - echo $(VOBJ02) >> $(subst /,\,$@) - echo $(VOBJ03) >> $(subst /,\,$@) - echo $(VOBJ04) >> $(subst /,\,$@) - echo $(VOBJ05) >> $(subst /,\,$@) - echo $(VOBJ06) >> $(subst /,\,$@) - echo $(VOBJ07) >> $(subst /,\,$@) - echo $(VOBJ08) >> $(subst /,\,$@) - echo $(VOBJ09) >> $(subst /,\,$@) - echo $(VOBJ10) >> $(subst /,\,$@) - echo $(VOBJ11) >> $(subst /,\,$@) - echo $(VOBJ12) >> $(subst /,\,$@) - echo $(VOBJ13) >> $(subst /,\,$@) - echo $(VOBJ14) >> $(subst /,\,$@) - echo $(VOBJ15) >> $(subst /,\,$@) - echo $(VOBJ16) >> $(subst /,\,$@) - echo $(VOBJ17) >> $(subst /,\,$@) - echo $(VOBJ18) >> $(subst /,\,$@) - echo $(VOBJ19) >> $(subst /,\,$@) - echo $(VOBJ20) >> $(subst /,\,$@) - 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 /,\,$@) -ifeq "$(ADD_LUA)" "Y" - echo $(LUAOBJ) >> $(subst /,\,$@) -endif -ifeq "$(ADD_CURSES)" "Y" - echo $(CURSESOBJ) >> $(subst /,\,$@) -endif - #========================================== #=========== SECONDARY TARGETS ============ #========================================== @@ -732,9 +701,6 @@ $(INCL)/onames.h: $(U)makedefs.exe $(INCL)/pm.h: $(U)makedefs.exe -$(subst /,\,$(U)makedefs -p) -monstr.c: $(U)makedefs.exe - -$(subst /,\,$(U)makedefs -m) - $(INCL)/vis_tab.h: $(U)makedefs.exe -$(subst /,\,$(U)makedefs -z) @@ -1030,11 +996,14 @@ $(O)sp_lev.tag: $(O)utility.tag #note that dir below assumes bin/dir.exe from djgpp distribution # +ifndef LUA_QTEXT_FILE +QUEST_DAT = $(DAT)/quest.dat +else +QUEST_DAT = +endif $(DAT)/nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/rumors \ $(DAT)/oracles \ -ifndef LUA_QTEXT_FILE - $(DAT)/quest.dat \ -endif + $(QUEST_DAT) \ $(O)sp_lev.tag \ $(DAT)/bogusmon $(DAT)/engrave $(DAT)/epitaph $(DAT)/tribute @$(subst /,\,echo dat done >$(O)dat.tag) @@ -1135,7 +1104,9 @@ $(O)lua535.a: $(LUAOBJFILES) -Wl,--add-stdcall-alias -o $@ $< $(O)lua535s.a: $(LUAOBJFILES) - ar rcs $@ $(LUAOBJFILES) + ar rcS $@ $(LUAOBJFILES1) + ar rcS $@ $(LUAOBJFILES2) + ar rcs $@ $(LUAOBJFILES3) $(O)lua.o: $(LUASRC)/lua.c $(O)luac.o: $(LUASRC)/luac.c @@ -1169,7 +1140,6 @@ spotless: clean $(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 $(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) diff --git a/sys/msdos/nhlua.h b/sys/msdos/nhlua.h new file mode 100644 index 000000000..cf2883a86 --- /dev/null +++ b/sys/msdos/nhlua.h @@ -0,0 +1,6 @@ +/* nhlua.h - generated by top Makefile */ +#include "../lib/lua535/src/lua.h" +LUA_API int (lua_error) (lua_State *L) NORETURN; +#include "../lib/lua535/src/lualib.h" +#include "../lib/lua535/src/lauxlib.h" +/*nhlua.h*/ From 8eca3a99abc157d5a320aab1d3bedd80ce3bb2ca Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 23 Dec 2019 16:35:12 -0800 Subject: [PATCH 28/35] giant {spider,beetle} fixes entry --- doc/fixes37.0 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 1cb010f4b..9de5bc9a2 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.30 $ $NHDT-Date: 1577063925 2019/12/23 01:18:45 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.32 $ $NHDT-Date: 1577147706 2019/12/24 00:35:06 $ General Fixes and Modified Features ----------------------------------- @@ -15,6 +15,8 @@ fix accessing mons[-1] when trying to gate in a non-valid demon fast hero could have random clairvoyance happen more than once on same turn using 'Q' on wielded weapon would offer to split stack; make using 'w' on a quivered stack behave similarly +weight for giant spider was too low for creature of size 'large'; + weight for giant beetle was much too low for 'large' leave some menu items out of "invert all" via '@' when their inclusion would degrade the usefulness of that interface feature From 7401931b020649234771863da42766813b0caafb Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 23 Dec 2019 17:24:17 -0800 Subject: [PATCH 29/35] curses_add_menu warning suppression --- win/curses/cursmain.c | 1 - 1 file changed, 1 deletion(-) diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 9d1bfe62b..82645cee2 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -525,7 +525,6 @@ curses_add_menu(winid wid, int glyph, const ANY_P * identifier, const char *str, unsigned itemflags) { int curses_attr; - boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); attr &= ~(ATR_URGENT | ATR_NOHISTORY); curses_attr = curses_convert_attr(attr); From a034e8200c802355bd2c16e2f13acb5dea13c1d2 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 23 Dec 2019 21:44:34 -0500 Subject: [PATCH 30/35] centralize the invert decision logic to avoid updates to 7 ports This will make it easier to tinker for best results. --- include/extern.h | 1 + include/flag.h | 2 ++ src/mapglyph.c | 22 ++++++++++++++++++++++ src/options.c | 23 ++++++++++++++++++++++- win/Qt/qt_menu.cpp | 3 ++- win/X11/winmenu.c | 2 +- win/curses/cursdial.c | 3 ++- win/gem/wingem1.c | 3 ++- win/tty/wintty.c | 6 +++--- win/win32/mhmenu.c | 6 ++++-- 10 files changed, 61 insertions(+), 10 deletions(-) diff --git a/include/extern.h b/include/extern.h index 8c5a2cbd2..2d7947e62 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1217,6 +1217,7 @@ E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int, unsigned)); E char *FDECL(encglyph, (int)); E char *FDECL(decode_mixed, (char *, const char *)); E void FDECL(genl_putmixed, (winid, int, const char *)); +E boolean FDECL(menuitem_invert_test, (int, unsigned, BOOLEAN_P)); /* ### mcastu.c ### */ diff --git a/include/flag.h b/include/flag.h index e1091a562..446f15e5d 100644 --- a/include/flag.h +++ b/include/flag.h @@ -243,6 +243,8 @@ struct instance_flags { */ unsigned msg_history; /* hint: # of top lines to save */ int getpos_coords; /* show coordinates when getting cursor position */ + int menuinvertmode; /* 0 = invert toggles every item; + 1 = invert skips 'all items' item */ int menu_headings; /* ATR for menu headings */ int *opt_booldup; /* for duplication of boolean opts in config file */ int *opt_compdup; /* for duplication of compound opts in conf file */ diff --git a/src/mapglyph.c b/src/mapglyph.c index 74492cc74..59d01010b 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -438,4 +438,26 @@ const char *str; putstr(window, attr, decode_mixed(buf, str)); } +/* + * Window port helper function for menu invert routines to move the decision + * logic into one place instead of 7 different window-port routines. + */ +boolean +menuitem_invert_test(mode, itemflags, is_selected) +int mode; +unsigned itemflags; /* The itemflags for the item */ +boolean is_selected; /* The current selection status of the item */ +{ + boolean skipinvert = (itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0; + + if ((iflags.menuinvertmode == 1 || iflags.menuinvertmode == 2) + && !mode && skipinvert && !is_selected) + return FALSE; + else if (iflags.menuinvertmode == 2 + && !mode && skipinvert && is_selected) + return TRUE; + else + return TRUE; +} + /*mapglyph.c*/ diff --git a/src/options.c b/src/options.c index df5add42d..253ec29fa 100644 --- a/src/options.c +++ b/src/options.c @@ -311,6 +311,7 @@ static struct Comp_Opt { { "horsename", "the name of your (first) horse (e.g., horsename:Silver)", PL_PSIZ, DISP_IN_GAME }, { "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/ + { "menuinvertmode", "behaviour of menu iverts", 5, SET_IN_GAME }, { "menustyle", "user interface for object selection", MENUTYPELEN, SET_IN_GAME }, { "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE }, @@ -2362,6 +2363,24 @@ boolean tinitial, tfrom_file; return retval; } + /* menuinvertmode=0 or 1 or 2 (2 is experimental) */ + fullname = "menuinvertmode"; + if (match_optname(opts, fullname, 5, TRUE)) { + if (negated) { + bad_negation(fullname, FALSE); + return FALSE; + } else { + int mode = atoi(op); + + if (mode < 0 || mode > 2) { + config_error_add("Illegal %s parameter '%s'", fullname, op); + return FALSE; + } + iflags.menuinvertmode = mode; + } + return retval; + } + fullname = "msghistory"; if (match_optname(opts, fullname, 3, TRUE)) { if (duplicate) @@ -5614,7 +5633,9 @@ char *buf; : (i == MAP_MODE_ASCII_FIT_TO_SCREEN) ? "fit_to_screen" : defopt); - } else if (!strcmp(optname, "menustyle")) + } else if (!strcmp(optname, "menuinvertmode")) + Sprintf(buf, "%d", iflags.menuinvertmode); + else if (!strcmp(optname, "menustyle")) Sprintf(buf, "%s", menutype[(int) flags.menu_style]); else if (!strcmp(optname, "menu_deselect_all")) Sprintf(buf, "%s", to_be_done); diff --git a/win/Qt/qt_menu.cpp b/win/Qt/qt_menu.cpp index 8be6abaaf..b959ad5d0 100644 --- a/win/Qt/qt_menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -534,7 +534,8 @@ void NetHackQtMenuWindow::Invert() return; for (int i=0; iitem(i, 0); diff --git a/win/X11/winmenu.c b/win/X11/winmenu.c index 36f60829c..9d0e8a4a7 100644 --- a/win/X11/winmenu.c +++ b/win/X11/winmenu.c @@ -543,7 +543,7 @@ struct xwindow *wp; reset_menu_count(wp->menu_information); for (count = 0, curr = wp->menu_information->curr_menu.base; curr; curr = curr->next, count++) { - if ((curr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0) + if (!menuitem_invert_test(0, curr->itemflags, curr->selected)) continue; if (curr->identifier.a_void != 0) invert_line(wp, curr, count, -1L); diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index a33ef530b..e18ccdc57 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -1553,7 +1553,8 @@ menu_operation(WINDOW * win, nhmenu *menu, menu_op if (menu_item_ptr->identifier.a_void != NULL) { if (operation != INVERT - || (menu_item_ptr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) == 0) + || menuitem_invert_test(0, menu_item_ptr->itemflags, + menu_item_ptr->selected)) menu_select_deselect(win, menu_item_ptr, operation, current_page); } diff --git a/win/gem/wingem1.c b/win/gem/wingem1.c index e25e60ae3..ecf979a1d 100644 --- a/win/gem/wingem1.c +++ b/win/gem/wingem1.c @@ -1784,8 +1784,9 @@ char acc; for (curr = invent_list; start-- && curr; curr = curr->Gmi_next) ; for (; page-- && curr; curr = curr->Gmi_next) { - if ((curr->Gmi_itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0) + if (!menuitem_invert_test(0, curr->Gmi_itemflags, curr->Gmi_selected) continue; + if (curr->Gmi_identifier && (acc == 0 || curr->Gmi_groupacc == acc)) { if (curr->Gmi_selected) { curr->Gmi_selected = FALSE; diff --git a/win/tty/wintty.c b/win/tty/wintty.c index aaba49f41..0fbe47648 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1774,7 +1774,7 @@ char acc; /* group accelerator, 0 => all */ int n; for (n = 0, curr = page_start; curr != page_end; n++, curr = curr->next) { - if ((curr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0) + if (!menuitem_invert_test(0, curr->itemflags, curr->selected)) continue; if (curr->identifier.a_void && (acc == 0 || curr->gselector == acc)) { @@ -1812,12 +1812,12 @@ char acc; /* group accelerator, 0 => all */ if (!on_curr_page && curr->identifier.a_void && (acc == 0 || curr->gselector == acc)) { - if ((curr->itemflags & MENU_ITEMFLAGS_SKIPINVERT) == 0) { + if (menuitem_invert_test(0, curr->itemflags, curr->selected)) { if (curr->selected) { curr->selected = FALSE; curr->count = -1; } else - curr->selected = TRUE; + curr->selected = TRUE; } } } diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index ab76d41ad..0150e559c 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -1306,7 +1306,8 @@ onListChar(HWND hWnd, HWND hwndList, WORD ch) if (data->how == PICK_ANY) { reset_menu_count(hwndList, data); for (i = 0; i < data->menu.size; i++) { - if (!(data->menu.items[i].itemflags & MENU_ITEMFLAGS_SKIPINVERT)) + if (menuitem_invert_test(0, data->menu.items[i].itemflags, + NHMENU_IS_SELECTED(data->menu.items[i]))) SelectMenuItem(hwndList, data, i, NHMENU_IS_SELECTED(data->menu.items[i]) ? 0 : -1); @@ -1354,7 +1355,8 @@ onListChar(HWND hWnd, HWND hwndList, WORD ch) from = max(0, topIndex); to = min(data->menu.size, from + pageSize); for (i = from; i < to; i++) { - if (!(data->menu.items[i].itemflags & MENU_ITEMFLAGS_SKIPINVERT)) + if (menuitem_invert_test(0, data->menu.items[i].itemflags, + NHMENU_IS_SELECTED(data->menu.items[i]))) SelectMenuItem(hwndList, data, i, NHMENU_IS_SELECTED(data->menu.items[i]) ? 0 : -1); From 578f09563955bd4604cf3173d71999c5cad2cd97 Mon Sep 17 00:00:00 2001 From: nhw_cron Date: Mon, 23 Dec 2019 23:17:11 -0500 Subject: [PATCH 31/35] This is cron-daily v1-Dec-12-2019. files updated: Files --- Files | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Files b/Files index c609cd478..66e0b84bd 100644 --- a/Files +++ b/Files @@ -163,13 +163,13 @@ sys/msdos: Install.dos Makefile.BC Makefile.GCC Makefile.MSC Makefile1.cross Makefile2.cross SCHEMA35.MSC moveinit.pat msdos-cross-compile.sh -msdos.c msdoshlp.txt ovlinit.c -pckeys.c pctiles.c pctiles.h -pcvideo.h portio.h schema1.BC -schema2.BC schema3.MSC setup.bat -sysconf tile2bin.c vesa.h -video.c vidtxt.c vidvesa.c -vidvga.c +msdos.c msdoshlp.txt nhlua.h +ovlinit.c pckeys.c pctiles.c +pctiles.h pcvideo.h portio.h +schema1.BC schema2.BC schema3.MSC +setup.bat sysconf tile2bin.c +vesa.h video.c vidtxt.c +vidvesa.c vidvga.c (files for running MSDOS binary under Windows) nhico.uu nhpif.uu From 60ec7256ab5ddcaf47ef79aa27b24ab586cccff6 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 24 Dec 2019 02:41:19 -0800 Subject: [PATCH 32/35] fix github issue #268 - worm tooth & crysknife Change the composition of worm tooth from none-of-the-above to bone and crysknife from mineral to bone, same as is used for unicorn horn. I think the only significant difference will be that worm teeth used up during polypiling will produce skeletons rather than flesh golems. Fixes #268 --- doc/fixes37.0 | 3 ++- src/objects.c | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 9de5bc9a2..bfd32a24a 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.32 $ $NHDT-Date: 1577147706 2019/12/24 00:35:06 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.33 $ $NHDT-Date: 1577184069 2019/12/24 10:41:09 $ General Fixes and Modified Features ----------------------------------- @@ -19,6 +19,7 @@ weight for giant spider was too low for creature of size 'large'; weight for giant beetle was much too low for 'large' leave some menu items out of "invert all" via '@' when their inclusion would degrade the usefulness of that interface feature +change crysknife from mineral to bone and worm tooth from unspecified to bone Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/objects.c b/src/objects.c index adb86dc80..5261a3422 100644 --- a/src/objects.c +++ b/src/objects.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objects.c $NHDT-Date: 1535422421 2018/08/28 02:13:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.51 $ */ +/* NetHack 3.6 objects.c $NHDT-Date: 1577184069 2019/12/24 10:41:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.59 $ */ /* Copyright (c) Mike Threepoint, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -173,10 +173,11 @@ WEAPON("stiletto", None, /* 3.6: worm teeth and crysknives now stack; when a stack of teeth is enchanted at once, they fuse into one crysknife; when a stack of crysknives drops, the whole stack reverts to teeth */ +/* 3.7: change crysknife from MINERAL to BONE and worm tooth from 0 to BONE */ WEAPON("worm tooth", None, - 1, 1, 0, 0, 20, 2, 2, 2, 0, 0, P_KNIFE, 0, CLR_WHITE), + 1, 1, 0, 0, 20, 2, 2, 2, 0, 0, P_KNIFE, BONE, CLR_WHITE), WEAPON("crysknife", None, - 1, 1, 0, 0, 20, 100, 10, 10, 3, P, P_KNIFE, MINERAL, CLR_WHITE), + 1, 1, 0, 0, 20, 100, 10, 10, 3, P, P_KNIFE, BONE, CLR_WHITE), /* axes */ WEAPON("axe", None, From 6aabc78c83d1886e0db612252980291730a5bd35 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 24 Dec 2019 03:26:34 -0800 Subject: [PATCH 33/35] 'w-' object lost panic After the "make 'w' parallel with 'Q'" patch, wielding bare hands was erroneously treating object id 0 as a split of zeroobj. That isn't in inventory so seems 'lost'. Fixed by testing for nonzero. There was another bug: you could wield a partial stack even if your current weapon was cursed. Fixed by reordering if/else-if/end-if. --- doc/fixes37.0 | 4 +++- src/wield.c | 25 ++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index bfd32a24a..ba76408b8 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.33 $ $NHDT-Date: 1577184069 2019/12/24 10:41:09 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.34 $ $NHDT-Date: 1577186790 2019/12/24 11:26:30 $ General Fixes and Modified Features ----------------------------------- @@ -28,6 +28,8 @@ fix compile when DLB isn't defined urealtime.realtime was being incorrectly calculated revised "mysterious force" when climbing out of gehennom could generate warnings about "rn2(0) attempted" or "rn2(-n) attempted" +after 'w' on split stack patch, wielding '-' would cause an object_lost panic +same patch allowed partial stack from getobj to replace cursed wielded weapon Platform- and/or Interface-Specific Fixes diff --git a/src/wield.c b/src/wield.c index c08934f91..44277e829 100644 --- a/src/wield.c +++ b/src/wield.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wield.c $NHDT-Date: 1577055058 2019/12/22 22:50:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.68 $ */ +/* NetHack 3.6 wield.c $NHDT-Date: 1577186790 2019/12/24 11:26:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2009. */ /* NetHack may be freely redistributed. See license for details. */ @@ -275,16 +275,6 @@ dowield() if (!(wep = getobj(wield_objs, "wield"))) { /* Cancelled */ return 0; - } else if (wep->o_id == g.context.objsplit.child_oid) { - /* if wep is the result of supplying a count to getobj() - we don't want to split something already wielded; for - any other item, we need to give it its own inventory slot */ - if (uwep && uwep->o_id == g.context.objsplit.parent_oid) { - unsplitobj(wep); - goto already_wielded; - } - finish_splitting = TRUE; - goto wielding; } else if (wep == uwep) { already_wielded: You("are already wielding that!"); @@ -295,7 +285,20 @@ dowield() weldmsg(uwep); /* previously interrupted armor removal mustn't be resumed */ reset_remarm(); + /* if player chose a partial stack but can't wield it, undo split */ + if (wep->o_id && wep->o_id == g.context.objsplit.child_oid) + unsplitobj(wep); return 0; + } else if (wep->o_id && wep->o_id == g.context.objsplit.child_oid) { + /* if wep is the result of supplying a count to getobj() + we don't want to split something already wielded; for + any other item, we need to give it its own inventory slot */ + if (uwep && uwep->o_id == g.context.objsplit.parent_oid) { + unsplitobj(wep); + goto already_wielded; + } + finish_splitting = TRUE; + goto wielding; } /* Handle no object, or object in other slot */ From 7ea7058c0181291f681b477d3ad54714ffa72608 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 24 Dec 2019 04:31:41 -0800 Subject: [PATCH 34/35] fix github issue #272 - meat rings, +0 protection Meat rings were causing increased hunger even though they don't do anything. Not mentioned in the report, but cheap plastic imitation amulets increased hunger too and they don't do anything either. Trickier to fix, +0 rings of protection were excluded from hunger on the grounds that +0 rings don't do anything, but since 3.6.0 +0 protection provides +1 to magic cancellation if protection isn't coming from anywhere else. Two +0 rings of protection are trickier still since only one of them provides the MC bonus. Fixes #272 --- doc/fixes37.0 | 5 ++++- src/eat.c | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index ba76408b8..9273e04a8 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.34 $ $NHDT-Date: 1577186790 2019/12/24 11:26:30 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ $NHDT-Date: 1577190687 2019/12/24 12:31:27 $ General Fixes and Modified Features ----------------------------------- @@ -20,6 +20,9 @@ weight for giant spider was too low for creature of size 'large'; leave some menu items out of "invert all" via '@' when their inclusion would degrade the usefulness of that interface feature change crysknife from mineral to bone and worm tooth from unspecified to bone +worn meat ring shouldn't cause increased hunger; neither should fake Amulet +worn +0 ring of protection should cause increased hunger if it is the only + source of extrinsic Protection Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/eat.c b/src/eat.c index 7144eecf2..a628ebb80 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 eat.c $NHDT-Date: 1574900825 2019/11/28 00:27:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.206 $ */ +/* NetHack 3.6 eat.c $NHDT-Date: 1577190688 2019/12/24 12:31:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.222 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2810,19 +2810,47 @@ gethungry() /* Conflict uses up food too */ if (HConflict || (EConflict & (~W_ARTI))) u.uhunger--; - /* +0 charged rings don't do anything, so don't affect hunger. - Slow digestion cancels move hunger but still causes ring hunger. */ + /* + * +0 charged rings don't do anything, so don't affect hunger. + * Slow digestion cancels movement and melee hunger but still + * causes ring hunger. + * Possessing the real Amulet imposes a separate hunger penalty + * from wearing an amulet (so gets a double penalty when worn). + * + * 3.7.0: Worn meat rings don't affect hunger. + * Same with worn cheap plastic imitation of the Amulet. + * +0 ring of protection might do something (enhanced "magical + * cancellation") if hero doesn't have protection from some + * other source (cloak or second ring). + */ switch ((int) (g.moves % 20)) { /* note: use even cases only */ case 4: - if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged)) + if (uleft && uleft->otyp != MEAT_RING + /* more hungry if +/- is nonzero or +/- doesn't apply or + +0 ring of protection is only source of protection; + need to check whether both rings are +0 protection or + they'd both slip by the "is there another source?" test, + but don't do that for both rings or they will both be + treated as supplying "MC" when only one matters */ + && (uleft->spe + || !objects[uleft->otyp].oc_charged + || (uleft->otyp == RIN_PROTECTION + && ((EProtection & ~W_RINGL) == 0L + || ((EProtection & ~W_RINGL) == W_RINGR + && uright && uright->otyp == RIN_PROTECTION + && !uright->spe))))) u.uhunger--; break; case 8: - if (uamul) + if (uamul && uamul->otyp != FAKE_AMULET_OF_YENDOR) u.uhunger--; break; case 12: - if (uright && (uright->spe || !objects[uright->otyp].oc_charged)) + if (uright && uright->otyp != MEAT_RING + && (uright->spe + || !objects[uright->otyp].oc_charged + || (uright->otyp == RIN_PROTECTION + && (EProtection & ~W_RINGR) == 0L))) u.uhunger--; break; case 16: From 6d8d3a9557ab9de89b200a7ff1bded083ab5f33d Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 26 Dec 2019 18:43:39 +0200 Subject: [PATCH 35/35] Add lua object references Whenever a lua script references a core struct obj, increment a counter in the obj struct. Core code will not free the obj, if there are any lua references pointing to it, just makes it free-floating. When lua script ends, the lua gc will free the free-floating objects. Also exposes u.inventory to lua. Breaks save and bones compat. --- include/extern.h | 1 + include/obj.h | 1 + include/patchlevel.h | 2 +- src/mkobj.c | 8 +++++++- src/nhlobj.c | 16 ++++++++++++++-- src/nhlua.c | 5 +++++ src/restore.c | 1 + 7 files changed, 30 insertions(+), 4 deletions(-) diff --git a/include/extern.h b/include/extern.h index 2d7947e62..75463909b 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1675,6 +1675,7 @@ E int FDECL(l_selection_register, (lua_State *)); /* ### nhlobj.c ### */ #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +E void FDECL(nhl_push_obj, (lua_State *, struct obj *)); E int FDECL(l_obj_register, (lua_State *)); #endif diff --git a/include/obj.h b/include/obj.h index 1a1a5b418..3f8784309 100644 --- a/include/obj.h +++ b/include/obj.h @@ -119,6 +119,7 @@ struct obj { unsigned oeaten; /* nutrition left in food, if partly eaten */ long age; /* creation date */ long owornmask; + unsigned lua_ref_cnt; /* # of lua script references for this object */ struct oextra *oextra; /* pointer to oextra struct */ }; diff --git a/include/patchlevel.h b/include/patchlevel.h index 8fd411eb1..e69cf51f8 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 5 +#define EDITLEVEL 6 #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019" #define COPYRIGHT_BANNER_B \ diff --git a/src/mkobj.c b/src/mkobj.c index 54416100e..dbbd9c974 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -444,6 +444,7 @@ long num; obj->owt = weight(obj); otmp->quan = num; otmp->owt = weight(otmp); /* -= obj->owt ? */ + otmp->lua_ref_cnt = 0; g.context.objsplit.parent_oid = obj->o_id; g.context.objsplit.child_oid = otmp->o_id; @@ -797,6 +798,7 @@ boolean artif; otmp->lknown = 0; otmp->cknown = 0; otmp->corpsenm = NON_PM; + otmp->lua_ref_cnt = 0; if (init) { switch (let) { @@ -2178,8 +2180,10 @@ struct obj *obj; * list must track all objects that can have a light source * attached to it (and also requires lamplit to be set). */ - if (obj_sheds_light(obj)) + if (obj_sheds_light(obj)) { del_light_source(LS_OBJECT, obj_to_any(obj)); + obj->lamplit = 0; + } if (obj == g.thrownobj) g.thrownobj = 0; @@ -2188,6 +2192,8 @@ struct obj *obj; if (obj->oextra) dealloc_oextra(obj); + if (obj->lua_ref_cnt) + return; /* obj is referenced from a lua script, let lua gc free it */ free((genericptr_t) obj); } diff --git a/src/nhlobj.c b/src/nhlobj.c index f7c9b5637..1223603b8 100644 --- a/src/nhlobj.c +++ b/src/nhlobj.c @@ -43,8 +43,10 @@ lua_State *L; struct _lua_obj *lo = l_obj_check(L, 1); if (lo && lo->obj) { - /* free-floating objects are deallocated */ - if (lo->obj->where == OBJ_FREE) { + if (lo->obj->lua_ref_cnt > 0) + lo->obj->lua_ref_cnt--; + /* free-floating objects with no other refs are deallocated. */ + if (lo->obj->where == OBJ_FREE && !lo->obj->lua_ref_cnt) { if (Has_contents(lo->obj)) { struct obj *otmp; while ((otmp = lo->obj->cobj) != 0) { @@ -71,10 +73,20 @@ struct obj *otmp; lo->state = 0; lo->obj = otmp; + if (otmp) + otmp->lua_ref_cnt++; return lo; } +void +nhl_push_obj(L, otmp) +lua_State *L; +struct obj *otmp; +{ + (void) l_obj_push(L, otmp); +} + /* local o = obj.new("large chest"); local cobj = o:contents(); */ static int diff --git a/src/nhlua.c b/src/nhlua.c index b6afc2e59..a4c7e0473 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -839,6 +839,11 @@ lua_State *L; return nhl_push_anything(L, ustruct[i].type, ustruct[i].ptr); } + if (!strcmp(tkey, "inventory")) { + nhl_push_obj(L, g.invent); + return 1; + } + nhl_error(L, "Unknown u table index"); return 0; } diff --git a/src/restore.c b/src/restore.c index 7217718f1..297080abc 100644 --- a/src/restore.c +++ b/src/restore.c @@ -201,6 +201,7 @@ struct obj *otmp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) otmp, sizeof(struct obj)); + otmp->lua_ref_cnt = 0; /* next object pointers are invalid; otmp->cobj needs to be left as is--being non-null is key to restoring container contents */ otmp->nobj = otmp->nexthere = (struct obj *) 0;