]> granicus.if.org Git - nethack/log
nethack
4 years agoMove other options into the options array
Pasi Kallinen [Sat, 30 Jan 2021 16:02:48 +0000 (18:02 +0200)]
Move other options into the options array

4 years agoremove an old #pragma from sp_lev.c that isn't actually accomplishing anything
nhmall [Sat, 30 Jan 2021 16:25:27 +0000 (11:25 -0500)]
remove an old #pragma from sp_lev.c that isn't actually accomplishing anything

4 years agoDisable warning for LUA files in Visual Studio builds.
Bart House [Sat, 30 Jan 2021 04:49:37 +0000 (20:49 -0800)]
Disable warning for LUA files in Visual Studio builds.

4 years agoa couple of curses warnings on one compiler
nhmall [Sat, 30 Jan 2021 04:14:16 +0000 (23:14 -0500)]
a couple of curses warnings on one compiler

4 years agoFixing azure pipeline build to use correct project.
Bart House [Sat, 30 Jan 2021 00:56:05 +0000 (16:56 -0800)]
Fixing azure pipeline build to use correct project.

4 years agoextcmdlist[] bit
PatR [Fri, 29 Jan 2021 20:33:20 +0000 (12:33 -0800)]
extcmdlist[] bit

4 years agoazure-pipelines overrode a recent gcc change in the cross-compile
nhmall [Fri, 29 Jan 2021 19:29:38 +0000 (14:29 -0500)]
azure-pipelines overrode a recent gcc change in the cross-compile

this makes it match, but doesn't fix the stray

4 years agoextcmdlist[] formatting
PatR [Fri, 29 Jan 2021 18:48:35 +0000 (10:48 -0800)]
extcmdlist[] formatting

Reformat the list of commands, making all of them take two lines
(except for a couple that need more) even if they fit on one.

Put "#wizmgender" into alphabetical order.  I don't think we need
it anymore, but if we keep the functionality then it should be
demoted from a command to a wizard mode boolean option.

Also wrap a handful of lines wider than the formatting threshold.

4 years agodeal with some win/win32 warnings
nhmall [Fri, 29 Jan 2021 18:00:00 +0000 (13:00 -0500)]
deal with some win/win32 warnings

win/win32/mhdlg.c(137)   : warning C4456: declaration of 'wbuf' hides
                           previous local declaration
win/win32/mhdlg.c(62)    : note: see declaration of 'wbuf'
win/win32/mhdlg.c(875)   : warning C4189: 'gender': local variable is
                           initialized but not referenced
win/win32/mhdlg.c(874)   : warning C4189: 'race': local variable is
                           initialized but not referenced
win/win32/mhdlg.c(876)   : warning C4189: 'alignment': local variable is
                           initialized but not referenced
win/win32/mhdlg.c(873)   : warning C4189: 'role': local variable is
                           initialized but not referenced
win/win32/mhinput.h(24)  : warning C4201: nonstandard extension used:
                           nameless struct/union
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/mhinput.h(24)  : warning C4201: nonstandard extension used:
                           nameless struct/union
win/win32/mhinput.h(24)  : warning C4201: nonstandard extension used:
                           nameless struct/union
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/mhmenu.c(62)   : warning C4201: nonstandard extension used:
                           nameless struct/union
win/win32/mhmenu.c(1082) : warning C4456: declaration of 'monitorScale'
                           hides previous local declaration
win/win32/mhmenu.c(995)  : note: see declaration of 'monitorScale'
win/win32/mhmenu.c(1142) : warning C4456: declaration of 'wbuf' hides
                           previous local declaration
win/win32/mhmenu.c(986)  : note: see declaration of 'wbuf'
win/win32/mhmenu.c(1082) : warning C4189: 'monitorScale': local variable
                           is initialized but not referenced
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/mhmsgwnd.c(700): warning C4701: potentially uninitialized
                           local variable 'size' used
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/mhsplash.c(158): warning C4189: 'verstrsize': local variable
                           is initialized but not referenced
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/mhstatus.c(353): warning C4057: 'function':
                           'const unsigned char *' differs in indirection
                           to slightly different base types from 'const char *'
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/mhmsg.h(70)    : warning C4200: nonstandard extension used:
                           zero-sized array in struct/union
win/win32/NetHackW.c(181): warning C4456: declaration of 'buf' hides
                           previous local declaration
win/win32/NetHackW.c(90) : note: see declaration of 'buf'
win/win32/NetHackW.c(189): warning C4456: declaration of 'buf' hides
                           previous local declaration
win/win32/NetHackW.c(90) : note: see declaration of 'buf'

4 years agoAdd missing fields in shown_stats[] in winstat.c
Dean Luick [Fri, 29 Jan 2021 16:19:27 +0000 (10:19 -0600)]
Add missing fields in shown_stats[] in winstat.c

This eliminates a compiler initializer warning.

4 years agoAdd missing fields in extcmdlist[] in cmd.c
Dean Luick [Fri, 29 Jan 2021 15:58:16 +0000 (09:58 -0600)]
Add missing fields in extcmdlist[] in cmd.c

This eliminates a compiler initializer warning.

4 years agoFix align type mixup wth align mask
Dean Luick [Sun, 17 Jan 2021 20:25:08 +0000 (14:25 -0600)]
Fix align type mixup wth align mask

Fix two cases of missed conversion of an alignment to an align mask.

Change induced_align()'s return type to unsigned int since it returns
an align mask (unsigned), not an align type (signed).

4 years agoUpdate code style for ANSI function prototypes
Dean Luick [Fri, 29 Jan 2021 15:01:15 +0000 (09:01 -0600)]
Update code style for ANSI function prototypes

4 years agoFix X11 warnings
Dean Luick [Mon, 18 Jan 2021 00:17:13 +0000 (18:17 -0600)]
Fix X11 warnings

4 years agoFix set but not used warnings
Dean Luick [Fri, 29 Jan 2021 03:09:28 +0000 (21:09 -0600)]
Fix set but not used warnings

4 years agofix class discovery for fully discovered class
PatR [Fri, 29 Jan 2021 01:10:18 +0000 (17:10 -0800)]
fix class discovery for fully discovered class

This was caused by a post-3.6 change I made when adding sorting
capability to '`' (and to '\' but that wasn't affected).  Cited
case was lack of "water" when all potions had been discovered.
Some other classes (but not all) were vulnerable too.

4 years agofix #K3255 - "death wand"
PatR [Fri, 29 Jan 2021 01:00:13 +0000 (17:00 -0800)]
fix #K3255 - "death wand"

Prevent a wish request of "death wand" (as alternate spelling
for "wand of death") from matching "Death" monster and yielding
a random wand.

"death finger" and "death finger spellbook" produce a "spellbook
of finger of death" even without a similar fix.

4 years agofix some warnings seen by Microsoft Visual Studio compiler
nhmall [Thu, 28 Jan 2021 14:45:16 +0000 (09:45 -0500)]
fix some warnings seen by Microsoft Visual Studio compiler

../src/nhlsel.c(467) : warning C4701: potentially uninitialized local variable 'x1' used
../src/nhlsel.c(591) : warning C4701: potentially uninitialized local variable 'x' used
../src/nhlsel.c(467) : warning C4701: potentially uninitialized local variable 'y1' used
../src/nhlsel.c(591) : warning C4701: potentially uninitialized local variable 'y' used
../src/nhlsel.c(469) : warning C4701: potentially uninitialized local variable 'x2' used
../src/nhlsel.c(469) : warning C4701: potentially uninitialized local variable 'y2' used

4 years agoupdate msdos djgpp cross-compiler gcc version
nhmall [Thu, 28 Jan 2021 13:02:45 +0000 (08:02 -0500)]
update msdos djgpp cross-compiler gcc version

4 years agoremove more FDECL, NDECL macro usage
nhmall [Thu, 28 Jan 2021 12:55:34 +0000 (07:55 -0500)]
remove more FDECL, NDECL macro usage

4 years agoRemove leftover variables
Pasi Kallinen [Thu, 28 Jan 2021 10:44:45 +0000 (12:44 +0200)]
Remove leftover variables

4 years agoWindows Makefile.msc update
nhmall [Thu, 28 Jan 2021 04:07:52 +0000 (23:07 -0500)]
Windows Makefile.msc update

4 years agoa couple of old-style function declarations in Windows code
nhmall [Thu, 28 Jan 2021 02:52:55 +0000 (21:52 -0500)]
a couple of old-style function declarations in Windows code

4 years agofollow-up bits
nhmall [Thu, 28 Jan 2021 02:04:51 +0000 (21:04 -0500)]
follow-up bits

4 years agoswitch source tree from k&r to c99
nhmall [Wed, 27 Jan 2021 02:06:16 +0000 (21:06 -0500)]
switch source tree from k&r to c99

4 years agoX11 fancy status coloring cleanup
PatR [Tue, 26 Jan 2021 21:54:43 +0000 (13:54 -0800)]
X11 fancy status coloring cleanup

Fix a couple of warnings and do some reformatting.

Also tracks current color and attributes for each status field
and only updates them if they're being changed instead of every
time the value changes.  Not very thoroughly tested so far.

The only attribute being supported is inverse but tty-style
status supports the full set.  Also, changed values are always
highlighted in inverse even if there is no highlight rule.
That should probably only apply when 'statushilites' is 0,
giving the old fancy status highlighting when regular hilites
are turned off.

4 years agopull request #443 - X11 color status highlighting
PatR [Tue, 26 Jan 2021 21:39:50 +0000 (13:39 -0800)]
pull request #443 - X11 color status highlighting

for 'fancy status'.  This is from an emailed diff rather than
directly from git, and the git code has a bunch of commits,
so this may or may not match the latest.  It needs formatting
cleanup and triggers a couple of warnings on OSX.  Fix to follow.

Status highlight colors use the same names as menu coloring
but this uses different X11 colors for the two sets.  That
will have to be changed so that yellow either means yellow all
the time or goldenrod all the time instead of sometimes yellow
and sometimes goldenrod.

Adopts #443

4 years agoX11 warning on macOS
nhmall [Tue, 26 Jan 2021 15:27:51 +0000 (10:27 -0500)]
X11 warning on macOS

4 years agofix warning differently mklev.c
nhmall [Tue, 26 Jan 2021 13:48:38 +0000 (08:48 -0500)]
fix warning differently mklev.c

4 years agoclear five warnings for "set but not used" variables
nhmall [Mon, 25 Jan 2021 17:57:47 +0000 (12:57 -0500)]
clear five warnings for "set but not used" variables

Note: the line numbers referenced in the warning messages below are not in sync
with the NetHack-3.7 branch and should be disregarded

files.c: In function 'get_saved_games':
files.c:1168:9: warning: unused variable 'n' [-Wunused-variable]
 1168 |     int n, j = 0;
      |         ^

mhitm.c: In function 'mdamagem':
mhitm.c:843:13: warning: variable 'cancelled' set but not used [-Wunused-but-set-variable]
  843 |     boolean cancelled;
      |             ^~~~~~~~~

mhitu.c: In function 'hitmu':
mhitu.c:943:9: warning: variable 'uncancelled' set but not used [-Wunused-but-set-variable]
  943 |     int uncancelled;
      |         ^~~~~~~~~~~

mklev.c: In function 'place_branch':
mklev.c:1214:20: warning: variable 'br_room' set but not used [-Wunused-but-set-variable]
 1214 |     struct mkroom *br_room;
      |                    ^~~~~~~

monmove.c: In function 'm_move':
monmove.c:874:43: warning: variable 'doorbuster' set but not used [-Wunused-but-set-variable]
  874 |     boolean can_open = 0, can_unlock = 0, doorbuster = 0;
      |                                           ^~~~~~~~~~

4 years ago\#wizintrinsic timeout values
PatR [Sun, 24 Jan 2021 21:55:19 +0000 (13:55 -0800)]
\#wizintrinsic timeout values

Tell/remind wizard mode player how to specify timeout amounts
when using #wizintrinsic to set temporary timeouts.

4 years agofix github issue #447 - casting area-effect spell
PatR [Sun, 24 Jan 2021 21:00:44 +0000 (13:00 -0800)]
fix github issue #447 - casting area-effect spell

at self when blind.  Spell targetting would let player pick
hero's own spot but casting would reject it when blind because
hero didn't sense any monster there.  The player wanted to cast
skilled fireball at self to cure being turned into slime but
wasn't allowed.  (Targetting an adjacent spot would work for
fireball, but is only feasible when telepathy reveals a monster
there.)

While testing the one-line fix, I noticed that the message line
(tty) showed stale data (autodescribe info for target spot) as
the fireball I cast (when not blind) bounced around the vicinity.
Normally that's cleared when a message is issued or the when the
next command is requested, but skilled fireball causes multiple
explosion animations before either of those situations.

4 years agooptions parsing one more time
PatR [Sun, 24 Jan 2021 02:46:03 +0000 (18:46 -0800)]
options parsing one more time

Manually created and maintained prototypes for optfn_FOO()
aren't needed once the conditionals in optlist.h and options.c
match each other.

4 years agocouple of missing Qt prototypes
PatR [Sat, 23 Jan 2021 23:58:23 +0000 (15:58 -0800)]
couple of missing Qt prototypes

Shut up two missing prototype warnings.

4 years agooptions parsing madness
PatR [Sat, 23 Jan 2021 23:42:00 +0000 (15:42 -0800)]
options parsing madness

I should have reenabled curses before committing an earlier change;
it broke compile.

Make all optfn_FOO() be static in options.c;
fix newly added prototype for optfn_cursesgraphics();
fix conditionals for optfn_palette(), both prototype and function.

Also, add missing prototype for a sound routine.

4 years agoSELECTSAVED handling
PatR [Sat, 23 Jan 2021 23:02:11 +0000 (15:02 -0800)]
SELECTSAVED handling

By default, enable the SELECTSAVED option for everyone instead
of just for Windows or Qt.  And make Qt obey the 'selectsaved'
run-time option.

It can be disabled in config.h if necessary.

4 years agocursesgraphics
PatR [Sat, 23 Jan 2021 22:58:28 +0000 (14:58 -0800)]
cursesgraphics

Not sure whether it was because I hadn't build without curses
in a long time or because of recent changes in warning settings
in the hints, but optfn_cursesgraphics() first drew a complaint
about lack of prototype, then after I added one and made it be
static, about a static routine not being used.

4 years agoNetHackW: fix rendering of animations
Bart House [Sat, 23 Jan 2021 20:04:16 +0000 (12:04 -0800)]
NetHackW: fix rendering of animations

Animations render by changing map state and calling delay.  When we delay,
we must ensure map windoow has been updated to show latest state before
we delay.

4 years agoNetHackW: fix focus flashing when using far look
Bart House [Sat, 23 Jan 2021 19:44:35 +0000 (11:44 -0800)]
NetHackW: fix focus flashing when using far look

Changed when we update the map window back buffer.  We now defer all
back buffer renderig until mswin_map_update is called.  We update
the window only within the main message loop thus we should only
get fully coherent map state rendered prior to getting input.

4 years agofix missing prototype warning for Qt SELECTSAVED
nhmall [Sat, 23 Jan 2021 14:37:47 +0000 (09:37 -0500)]
fix missing prototype warning for Qt SELECTSAVED

For whatever reason, Qt relies on late #define of SELECTSAVED
inside files.c.

The prototype in extern.h is therefore not picked up with
as a result of #include "hack.h"

Options were:
1. remove the conditional #if defined(SELECTSAVED) around the
   prototype in extern.h entirely
2. Move the forced #define of SELECTSAVED above the #include "hack.h"
3. Alter the conditional in extern.h to also include the condition for
   the forced #define of SELECTSAVED inside files.c

This goes with option #3.

4 years agofix warning in restore.c
nhmall [Sat, 23 Jan 2021 14:15:15 +0000 (09:15 -0500)]
fix warning in restore.c

restore.c:909:1: warning: no previous prototype for â€˜rest_stairs’ [-Wmissing-prototypes]
  909 | rest_stairs(nhfp)
      | ^~~~~~~~~~~

4 years agofix warning in invent.c
nhmall [Sat, 23 Jan 2021 14:07:33 +0000 (09:07 -0500)]
fix warning in invent.c

invent.c:1459:1: warning: no previous prototype for â€˜mime_action’ [-Wmissing-prototypes]
 1459 | mime_action(word)
      | ^~~~~~~~~~~

4 years agounused variable in files.c
nhmall [Sat, 23 Jan 2021 13:58:59 +0000 (08:58 -0500)]
unused variable in files.c

4 years agofix a warning in display.c
nhmall [Sat, 23 Jan 2021 13:49:04 +0000 (08:49 -0500)]
fix a warning in display.c

display.c: In function â€˜redraw_map’:
display.c:1460:15: warning: variable â€˜glyph’ set but not used [-Wunused-but-set-variable]
 1460 |     int x, y, glyph;
      |               ^~~~~

4 years agoRemove unused function
Pasi Kallinen [Sat, 23 Jan 2021 13:19:34 +0000 (15:19 +0200)]
Remove unused function

4 years agoFix leftover variables from trap refactor
Pasi Kallinen [Sat, 23 Jan 2021 09:32:54 +0000 (11:32 +0200)]
Fix leftover variables from trap refactor

4 years agoFix article used for steed when stepping on trap
Pasi Kallinen [Sat, 23 Jan 2021 09:25:50 +0000 (11:25 +0200)]
Fix article used for steed when stepping on trap

This was caused by the trap code refactor I did a month ago.

4 years agoFix missing proto
Pasi Kallinen [Sat, 23 Jan 2021 08:56:56 +0000 (10:56 +0200)]
Fix missing proto

4 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhmall [Fri, 22 Jan 2021 21:52:55 +0000 (16:52 -0500)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

4 years agoThis is cron-daily v1-Jan-20-2020. files updated: Files
nhw_cron [Fri, 22 Jan 2021 21:24:07 +0000 (16:24 -0500)]
This is cron-daily v1-Jan-20-2020.  files updated: Files

4 years agocompiler settings alignment between macOS.2020 and linux.2020
nhmall [Fri, 22 Jan 2021 21:05:30 +0000 (16:05 -0500)]
compiler settings alignment between macOS.2020 and linux.2020

get the warning flags on linux and macOS into better alignment

move the compiler flags into hints/include/compiler.2020 so that
maintenance changes can be made there and take effect for both
linux and macOS

this will likely trigger some initial new code warnings to be
investigated on either or both platforms

4 years agoAllow custom increment amounts in #wizintrinsic
Michael Meyer [Fri, 22 Jan 2021 19:14:12 +0000 (14:14 -0500)]
Allow custom increment amounts in #wizintrinsic

Let users of #wizintrinsic set a specific amount by which they want to
increment each particular timeout, by entering a count/typing in
numerals before selecting the item in the list.  I think doing it this
way should be pretty intuitive to players who are familiar with the
'enter count -> make selection' flow of normal inventory menus in
NetHack, and is simpler than using a separate prompt, as was mentioned
as a possibility in a comment.

When an intrinsic is selected without entering a count, the increment
will continue to default to the previous value of 30; this value is set
via the DEFAULT_TIMEOUT_INCR macro.

I also deleted a redundant declaration of wiz_intrinsic; the duplicate
seems to have been added by mistake in ff6139c6c5.

4 years agoFix unused param
Pasi Kallinen [Fri, 22 Jan 2021 16:16:08 +0000 (18:16 +0200)]
Fix unused param

4 years agoFix uninitialized variable
Pasi Kallinen [Fri, 22 Jan 2021 15:58:54 +0000 (17:58 +0200)]
Fix uninitialized variable

4 years agoBones levels information in xlogfile and enlightenment
Patric Mueller [Thu, 21 Jan 2021 23:07:03 +0000 (00:07 +0100)]
Bones levels information in xlogfile and enlightenment

  - record number of encountered bones levels in xlogfile
  - add bonesless to extended conducts field in xlogfile
  - show bones levels information in enlightenment at end of game or in
    explore and wizmode

4 years agoCurses: Select menu items via mouse
Pasi Kallinen [Thu, 21 Jan 2021 10:53:02 +0000 (12:53 +0200)]
Curses: Select menu items via mouse

4 years agoAdd a missing fall-through comment
Dean Luick [Sun, 17 Jan 2021 20:23:12 +0000 (14:23 -0600)]
Add a missing fall-through comment

This eliminates a gcc warning.

4 years agoFix text replacement warning
Dean Luick [Sun, 17 Jan 2021 20:12:58 +0000 (14:12 -0600)]
Fix text replacement warning

Using strncpy to cut off copying a terminating NUL yields a gcc
warning.  Just use memcpy instead.

4 years agoRemove left-over valid file checking
Dean Luick [Sun, 17 Jan 2021 18:52:30 +0000 (12:52 -0600)]
Remove left-over valid file checking

Commit 7054e06e42 ("NetHack minor release checklist items - savefiles")
consolidated valid file checking into the function viable_nhfile().  This
commit removes unused variables left over from that change.

4 years agoUpdate nhUse
Dean Luick [Fri, 15 Jan 2021 22:34:21 +0000 (16:34 -0600)]
Update nhUse

There is no longer any compiler reason to disable nhUse - remove
nhUse's conditional definition.

Update the nhUse definition to "use" a variable without it needing
to be an integer.

This change removes some gcc compiler unused variable and parameter
warnings.

4 years agofix #K3251 - "some bugs: empty lamp catching fire"
PatR [Wed, 20 Jan 2021 22:37:49 +0000 (14:37 -0800)]
fix #K3251 - "some bugs: empty lamp catching fire"

If an empty lamp was hit by fire, the feedback was "the lamp
catches fire!" even though it wouldn't light.

ingite_items() imperfectly duplicated catch_lit().  Just call
the latter.  The resulting message will be slightly different
but that's insignificant.

4 years agoRemove Aztec C workaround from core
Pasi Kallinen [Wed, 20 Jan 2021 17:19:40 +0000 (19:19 +0200)]
Remove Aztec C workaround from core

Aztec C is closed-source and dead for more than 20 years.

4 years agoFix delayed rendering of cursor with farlook in NetHackW.
Bart House [Wed, 20 Jan 2021 03:09:40 +0000 (19:09 -0800)]
Fix delayed rendering of cursor with farlook in NetHackW.

4 years agoX11 selectsaved followup
PatR [Wed, 20 Jan 2021 01:15:51 +0000 (17:15 -0800)]
X11 selectsaved followup

4 years agoX11: selectsaved
PatR [Wed, 20 Jan 2021 00:59:36 +0000 (16:59 -0800)]
X11: selectsaved

Implement the 'selectsaved' option for X11.  Requires that
SELECTSAVED be defined at compile time.

Behaves the same as for tty and curses except that if you
choose 'quit', the intended "until next time..." message doesn't
get delivered anywhere.

4 years agoyet more obj->spe documentation (lamps, candles)
PatR [Tue, 19 Jan 2021 23:07:58 +0000 (15:07 -0800)]
yet more obj->spe documentation (lamps, candles)

Another mystery.  Candles and oil lamps have obj->spe set to 1
but that isn't used by begin_burn() and such so I don't know why.

Magic lamp has spe set to 1 to indicate that there is a djinni
inside, but letting the djinni out converts it into an oil lamp.
I don't know if there is any case where it might actually be 0.
(Wishing yields an oil lamp rather than an empty magic lamp so
that isn't it.  Cancellation magic doesn't affect it either.)

4 years agonew code accidentally swapped dishwashers
nhmall [Mon, 18 Jan 2021 21:15:02 +0000 (16:15 -0500)]
new code accidentally swapped dishwashers

Fixes #449

4 years agoanother Microsoft compiler warning
nhmall [Mon, 18 Jan 2021 04:14:13 +0000 (23:14 -0500)]
another Microsoft compiler warning

win/curses/cursmain.c(760): warning C4189: 'win': local variable is initialized but not referenced

4 years agosome Microsoft compiler warnings
nhmall [Mon, 18 Jan 2021 03:58:52 +0000 (22:58 -0500)]
some Microsoft compiler warnings
src/muse.c(2255) : warning C4702: unreachable code
src/options.c(2549) : warning C4702: unreachable code
src/restore.c(930) : warning C4701: potentially uninitialized local variable 'stway' used
src/sp_lev.c(5118) : warning C4701: potentially uninitialized local variable 'x' used
src/sp_lev.c(5118) : warning C4701: potentially uninitialized local variable 'y' used
src/trap.c(2979) : warning C4701: potentially uninitialized local variable 'cc' used
src/trap.c(2985) : warning C4701: potentially uninitialized local variable 'bcc' used

4 years agoFix gcc sprintf warnings
Dean Luick [Sat, 9 Jan 2021 02:33:39 +0000 (20:33 -0600)]
Fix gcc sprintf warnings

Gcc 9 has become more vocal with sprintf buffer overflow
checking.  Remove these sprintf warnings by changing the
offending calls to a snprintf wrapper that will explicitly
check the result.

4 years agoCreate and use a snprintf wrapper in the core code
Dean Luick [Fri, 15 Jan 2021 17:30:02 +0000 (11:30 -0600)]
Create and use a snprintf wrapper in the core code

Use a wrapper around snprintf to consilidate all use, add
error checking, and remove gcc 9 warnings about not checking
the result.

Replace the prevous use of snprintf added to weapon.c with the
new scheme.

Update a second spot that has a gcc sprintf warning.  While
there, simplify the code.

4 years agopartial fix for #K3242 - kops dismissed twice
PatR [Thu, 14 Jan 2021 23:45:27 +0000 (15:45 -0800)]
partial fix for #K3242 - kops dismissed twice

when taming is used to pacify hostile shopkeeper.  I haven't
figured out how to reproduce and eliminate the double dismissal,
but this will prevent the second one from issuing duplicate "the
Kops (disappointed) vanish into thin air" and also from trigging
the warning "dmonsfree: N removed doesn't match 2N pending."

The first dismissal leaves defunct Kops on the monster list, as
expected; second dismissal found them still there and sent them
away again instead of skipping them as already gone.

4 years agofix github issue #400 - Qt text windows hanging
PatR [Thu, 14 Jan 2021 23:10:41 +0000 (15:10 -0800)]
fix github issue #400 - Qt text windows hanging

Text windows only accept a few keys (<escape>, <return>, ':', now
<space>) and if they got other keys they passed those up the call
chain, arriving at the map where they were treated as commands
and were executed while the text window was still displayed.  The
cited example was ',' for pickup while the "things that are here"
popup was shown.  The 'foreign' key's command might be executed
successfully but the undismissed popup could become hung.

This fixes that ('foreign' keys will be ignored).  It also lets
<space> be used to dismiss text windows.

Slightly better but far from perfect:  if you perform a search,
then after it runs you need to type <escape> once, or <return>
or <space> twice, or else search again and pick [done] on the
search popup and then <return> or <space> once, to dismiss a
text window via keyboard.  (Prior to this, typing <escape> or
searching again and picking [done] followed by <return> were the
only ways.)  Also, searching for an empty string will now be
treated as if [done] had been picked.

Fixes #400

4 years ago'selectsaved' bug fix
PatR [Thu, 14 Jan 2021 01:24:27 +0000 (17:24 -0800)]
'selectsaved' bug fix

I have to manually uncompress save files before running nethack
under gdb control or they can't be opened.  Normally that works ok,
but if the 'selectsaved' option is enabled, the code to look up
character names from their save files was mangling the file names
when stripping off the non-existent compression suffix, so couldn't
open them.

4 years agoGive barrow wights a cold touch
Pasi Kallinen [Wed, 13 Jan 2021 19:29:03 +0000 (21:29 +0200)]
Give barrow wights a cold touch

Their attack is described as "the icy touch froze his bones"
in Lord of the Rings

4 years agofix #K3241 - potion dip drop due to pickup_burden
PatR [Tue, 12 Jan 2021 00:19:50 +0000 (16:19 -0800)]
fix #K3241 - potion dip drop due to pickup_burden

Dipping a unicorn horn to transform a potion causes that potion
to be removed from and re-inserted into inventory.  If the hero
was above 'pickup_burden' threshold prior to dipping and
removing the old potion brought encumbrance back under that,
attempting to add the new one back would drop it instead of
re-exceeding the threshold.

4 years agoFix sprintf warnings in weapon.c
Dean Luick [Sat, 9 Jan 2021 01:00:11 +0000 (19:00 -0600)]
Fix sprintf warnings in weapon.c

4 years agotribute feedback tidbit
PatR [Sat, 9 Jan 2021 00:51:46 +0000 (16:51 -0800)]
tribute feedback tidbit

After reading a passage from a novel,
 [<title>, by Terry Pratchett]
gets added to message history.  Change that to be
 [<title>, by Terry Pratchett; passage #n]
to make tracking down the seemingly endless mistakes a tiny bit
easier.

4 years agoanother tribute typo: A Hat Full of Sky #9
PatR [Sat, 9 Jan 2021 00:43:27 +0000 (16:43 -0800)]
another tribute typo: A Hat Full of Sky #9

4 years agoobj->spe usage again
PatR [Fri, 8 Jan 2021 23:45:04 +0000 (15:45 -0800)]
obj->spe usage again

uball->spe used to be used during restore way back in 2.3e.
There hasn't been any any point in setting it when starting
punishment and clearing it when ending punishment for decades
so get rid of that.

Nearly as ancient--but not quite--back in 3.10 patchlevel N,
obj->spe was set to -1 when the Amulet of Yendor was saved in
a bones file.  That was to flag it as fake, before the cheap
plastic imitation got added as a separate object.

So obj->spe isn't "special for uball and amulet" any more.

4 years ago\#include "fnamesiz.h"
PatR [Fri, 8 Jan 2021 22:59:36 +0000 (14:59 -0800)]
\#include "fnamesiz.h"

The inclusion shouldn't really come before *conf.h because the
things it sets up could depend on those.  This is better, but
having Amiga 90% dead and 10% comatose seems to be more trouble
that it's worth.

4 years agocurses: fix unused label 'bail'
PatR [Fri, 8 Jan 2021 21:57:52 +0000 (13:57 -0800)]
curses: fix unused label 'bail'

when SELECTSAVED isn't defined by using a goto for it even when
an 'if' was easily avoiding the need for that.

4 years agounix Makefile.src update
PatR [Fri, 8 Jan 2021 21:51:08 +0000 (13:51 -0800)]
unix Makefile.src update

'make depend' found a bunch of stuff besides Qt headers not
being up to date.

4 years agoQt key handling
PatR [Fri, 8 Jan 2021 21:47:34 +0000 (13:47 -0800)]
Qt key handling

Fix the popup versions of qt_yn_function() to handle control
characters by using the same key press event decoding routine
and menus and extended commands.  Moves 'keyValue()' to
qt_key.cpp and its declaration to qt_key.h, requring several
files to start using #include "qt_key.h".

'make depend' update to follow.

4 years ago'make depend' fix
PatR [Fri, 8 Jan 2021 21:33:27 +0000 (13:33 -0800)]
'make depend' fix

The gone but still referenced state of amiconf.h broke 'make depend'.
Fixing that turns it into a comment in the generated dependencies
but that ran into a problem with it being followed by fnamesiz.h
instead of being last in the list containing it.  So in addition to
the depend fix, move #include "fnamesiz.h" from config.h to global.h
in order to have it come before amiconf.h.

4 years agodowhatdoes ('&') vs prefix characters
PatR [Fri, 8 Jan 2021 20:44:45 +0000 (12:44 -0800)]
dowhatdoes ('&') vs prefix characters

I noticed that the & command was claiming that ^A is an unknown
command.  Unlike the old static version, or the replaced-before-
ever-released conditional version, the fully dynamic variation
of '&' didn't know about any of the special commands:  prefix
letters, ESC, and ^A.

4 years agoQt: ^V on OSX
PatR [Fri, 8 Jan 2021 09:37:38 +0000 (01:37 -0800)]
Qt: ^V on OSX

I can't take credit for this and still have no idea why it is
needed, but it fixes use of ^V as a command and as input to
to the regular version of yn_function().  In particular, '&'
command reports it as ^V.  Unfortunately when 'popup_dialog' is
set, no control characters seem to be accepted by the part of
NetHackQtYnDialog(Exec+KeyPressEvent) responsible for arbitrary
input.

It also causes getlin() to terminate but I can't think of any
situation where ^V would be considered to be valid input for
getlin() so won't worry about that.

I put it in as '#if MACOSX' because I don't know whether any
other Qt platforms need it.

4 years agoAdd missing flag for count support with drop command
Patric Mueller [Fri, 8 Jan 2021 00:39:56 +0000 (01:39 +0100)]
Add missing flag for count support with drop command

The recent getobj refactoring missed the flag GETOBJ_ALLOWCNT for the drop
command.

4 years agomore Guidebook.tex
nhmall [Thu, 7 Jan 2021 23:28:33 +0000 (18:28 -0500)]
more Guidebook.tex

4 years agoTeX corrections in Guidebook
nhmall [Thu, 7 Jan 2021 23:18:14 +0000 (18:18 -0500)]
TeX corrections in Guidebook

4 years agoThis is cron-daily v1-Jan-20-2020. guidebook updated: doc/Guidebook.txt
nhw_cron [Thu, 7 Jan 2021 03:24:05 +0000 (22:24 -0500)]
This is cron-daily v1-Jan-20-2020.  guidebook updated: doc/Guidebook.txt

4 years agoobj.h - expand documentation of obj->spe uses
PatR [Thu, 7 Jan 2021 22:02:52 +0000 (14:02 -0800)]
obj.h - expand documentation of obj->spe uses

Started out adding spe==2 for eggs but ended up changing other
things too.

FIXME?  The line "special for uball and amulet" baffles me:

    uball->spe is set to 1 during punishment (with an ambiguous
comment "special ball (see save)"), and back to 0 afterwards, but
otherwise seems to be unused.

    "and amulet" is ambiguous; it should either be "and the Amulet"
or "and amulets".  I assume it probably referred to the former but
it doesn't seem to be used for either kind as far as I can tell.

4 years agofix another regression in pager.c
nhmall [Thu, 7 Jan 2021 20:52:38 +0000 (15:52 -0500)]
fix another regression in pager.c

4 years agoFix glyph lookup
Pasi Kallinen [Thu, 7 Jan 2021 19:53:53 +0000 (21:53 +0200)]
Fix glyph lookup

Seems to have been a mistake in c9673b3d9e

4 years agoAdd Sokoban penalty for dismounting onto a boulder
Michael Meyer [Thu, 24 Dec 2020 20:07:10 +0000 (15:07 -0500)]
Add Sokoban penalty for dismounting onto a boulder

Because landing_spot will select a square containing a boulder as a
last-resort option, provided no other squares are accessible, it is
possible for the player to maneuver into a place where this could be
exploited when completing Sokoban (e.g. to get into a corner that would
normally be inaccessible, from which position an otherwise-blocked
boulder can be pushed away). This behavior should incur the same penalty
as exploitation of other Sokoban 'loopholes'.

4 years agoPrevent inappropriate diagonal dismounts
Michael Meyer [Thu, 24 Dec 2020 19:52:59 +0000 (14:52 -0500)]
Prevent inappropriate diagonal dismounts

Dismounting a steed checked whether the target spot was accessible and
whether there was a monster on it, but not whether it could actually be
accessed by the hero through normal movement. As a result, dismounting
allowed the hero to pass between diagonal gaps that would normally cause
a "you are carrying too much to get through" pline; this could leave
them in a position where they are effectively stuck, unable to remount
their steed or move away without dropping their inventory.

This also could be abused by dismounting in Sokoban to squeeze between
boulders in a way that would normally be impossible.

Using a successful result test_move as one of the requirements for a
spot to be valid prevents this and limits valid dismount targets to
squares that would normally be accessible through standard movement.

4 years agoRefactor getobj() to use callbacks on candidate objects
copperwater [Thu, 7 Jan 2021 16:05:59 +0000 (11:05 -0500)]
Refactor getobj() to use callbacks on candidate objects

This replaces the arcane system previously used by getobj where the
caller would pass in a "string" whose characters were object class
numbers, with the first up to four characters being special constants
that effectively acted as flags and had to be in a certain order.
Because there are many places where getobj must behave more granularly
than just object class filtering, this was supplemented by over a
hundred lines enumerating all these special cases and "ugly checks", as
well as other ugly code spread around in getobj callers that formatted
the "string".

Now, getobj callers pass in a callback which will return one of five
possible values for any given object in the player's inventory. The
logic of determining the eligibility of a given object is handled in the
caller, which greatly simplifies the code and makes it clearer to read.
Particularly since there's no real need to cram everything into one if
statement.

This is related to pull request #77 by FIQ; it's largely a
reimplementation of its callbacks system, without doing a bigger than
necessary refactor of getobj or adding the ability to select a
floor/trap/dungeon feature with getobj. Differences in implementation
are mostly minor:
- using enum constants for returns instead of magic numbers
- 5 possible return values for callbacks instead of 3, due to trying to
  make it behave exactly as it did previously. PR #77 would sometimes
  outright exclude objects because it lacked semantics for invalid
  objects that should be selectable anyway, or give slightly different
  messages.
- passing a bitmask of flags to getobj rather than booleans (easier to
  add more flags later - such as FIQ's "allow floor features" flag, if
  that becomes desirable)
- renaming some of getobj's variables to clearer versions
- naming all callbacks consistently with "_ok"
- generally more comments explaining things

The callbacks use the same logic from getobj_obj_exclude,
getobj_obj_exclude_too and getobj_obj_acceptable_unlisted (and in a few
cases, from special cases still within getobj). In a number of them, I
added comments suggesting possible further refinements to what is and
isn't eligible (e.g. should a bullwhip really be presented as a
candidate for readying a thrown weapon?)

This also removed ALLOW_COUNT and ALLOW_NONE, relics of the old system,
and moved ALLOW_ALL's definition into detect.c which is the only place
it's used now (unrelated to getobj). The ALLOW_ALL functionality still
exists as the GETOBJ_PROMPT flag, because its main use is to force
getobj to prompt for input even if nothing is valid.

I did not refactor ggetobj() as part of this change.

4 years agoGuidebook update
PatR [Thu, 7 Jan 2021 02:54:42 +0000 (18:54 -0800)]
Guidebook update

Document m\ and m`.

Several years ago there was a suggestion--aka complaint--that
"menustyle:Traditional was the only alternative for early versions"
was too vague and requested that the version be included.  It was
probably accurate at the time it was included, but I've changed it
from "early versions" to "very early versions" now.  :-}

4 years agocurses line-of-input prompting
PatR [Wed, 6 Jan 2021 23:59:55 +0000 (15:59 -0800)]
curses line-of-input prompting

Redo the fake ESC handling for curses' wgetnstr() so that it
applies to all popup prompts rather than just to "Who are you?",
in case the player sets the 'popup_dialog' option.

4 years agoAdd liquid flow to land mine explosions
Michael Meyer [Thu, 19 Nov 2020 17:42:09 +0000 (12:42 -0500)]
Add liquid flow to land mine explosions

Land mine explosions did not call liquid_flow(dig.c), and as a result
the pit created by an exploding land mine would never fill with adjacent
water or lava, as pits created by other sources -- digging, breaking a
wand, and earthquake -- can do.

This commit adds the appropriate calls to liquid_flow and fillholetyp to
blow_up_landmine so that land mine explosions may fill with water like
other pits do.

The call to losehp in dotrap had to be moved from after to before
blow_up_landmine, since waiting to call losehp when the pit can fill
with water could lead to silly messages (``That was a close one. You
die...''). After this change, a land mine that killed a character would
be retained unexploded in a bones file, because death would occur before
the call to blow_up_landmine. To avoid this issue, the land mine is
converted to a pit before calling losehp; blow_up_landmine does not
check whether the target trap is in fact a landmine so works as usual
even if the trap is converted to a pit, and will delete the pit in cases
where it should not exist.