PatR [Sun, 31 Jan 2021 01:19:17 +0000 (17:19 -0800)]
fix #K3257 - lichens' sticky attack holds hero
in the air. can_reach_floor() was changed relatively recently
to return False if hero was held by a monster. It wasn't
necessarily because the monster was lifting him or her off the
floor though. Restricted movement could produce same effect.
Change the new behavior to only happen when holder has used a
hug attack, so that being held by a fungus or mimic doesn't
prevent access to the floor.
This may need to be revisited because the idea that the hero's
arms have been pinned by a hugging monster contradicts the
ability to attack that monster. However, it matches the long-
standing inability to attack any other adjacent monster in
that circumstance.
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.
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.
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
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.
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.
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;
| ^~~~~~~~~~
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.
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.
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.
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.
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.
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
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;
| ^~~~~
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.
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
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.
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.)
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.
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.
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.
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.
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.
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.
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.
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.
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".
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.
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.
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.