Pasi Kallinen [Wed, 5 Jan 2022 15:35:30 +0000 (17:35 +0200)]
Allocate rects dynamically
... instead of hard-coding them to 50. New allocated value is
(COLNO*ROWNO)/30, which is slightly higher (56), and that formula
seems to work for hypothetical larger maps too.
PatR [Tue, 4 Jan 2022 19:54:05 +0000 (11:54 -0800)]
Qt: more ant extermination
After the fairly recent glyph changes, the icons shown for roles and
races during the character selection dialog all were all depicted by
the giant ant tile. I might have noticed this sooner but usually
have '-@' on the command line to bypass selection.
nhmall [Tue, 4 Jan 2022 13:24:08 +0000 (08:24 -0500)]
work around ubuntu 20.10 build issue
NetHack was trying to suppress warn_unused_result
in include/tradstdc.h, by defining warn_unused_result
to an empty string. That began causing a build error
in a system-supplied header file cdefs.h
when using 20.10 ubuntu impish.
Try skipping that in tradstdc.h for any linux, unless
the NetHack build defines GCC_URWARN to force it into
play.
nhmall [Tue, 4 Jan 2022 01:44:45 +0000 (20:44 -0500)]
gcc-11 warnings in tilemap.c
../win/share/tilemap.c: In function ‘init_tilemap’:
../win/share/tilemap.c:705:61: warning: ‘%s’ directive writing up to 255 bytes into a region of size 122 [-Wformat-overflow=]
705 | Sprintf(tilemap[GLYPH_MON_MALE_OFF + i].name, "male %s", buf);
| ^~ ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 6 and 261 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:705:9: note: in expansion of macro ‘Sprintf’
705 | Sprintf(tilemap[GLYPH_MON_MALE_OFF + i].name, "male %s", buf);
| ^~~~~~~
../win/share/tilemap.c:706:64: warning: ‘%s’ directive writing up to 255 bytes into a region of size 118 [-Wformat-overflow=]
706 | Sprintf(tilemap[GLYPH_PET_MALE_OFF + i].name, "%s male %s", "pet", buf);
| ^~ ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 10 and 265 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:706:9: note: in expansion of macro ‘Sprintf’
706 | Sprintf(tilemap[GLYPH_PET_MALE_OFF + i].name, "%s male %s", "pet", buf);
| ^~~~~~~
../win/share/tilemap.c:707:67: warning: ‘%s’ directive writing up to 255 bytes into a region of size 113 [-Wformat-overflow=]
707 | Sprintf(tilemap[GLYPH_DETECT_MALE_OFF + i].name, "%s male %s", "detected", buf);
| ^~ ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 15 and 270 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:707:9: note: in expansion of macro ‘Sprintf’
707 | Sprintf(tilemap[GLYPH_DETECT_MALE_OFF + i].name, "%s male %s", "detected", buf);
| ^~~~~~~
../win/share/tilemap.c:708:67: warning: ‘%s’ directive writing up to 255 bytes into a region of size 115 [-Wformat-overflow=]
708 | Sprintf(tilemap[GLYPH_RIDDEN_MALE_OFF + i].name, "%s male %s", "ridden", buf);
| ^~ ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 13 and 268 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:708:9: note: in expansion of macro ‘Sprintf’
708 | Sprintf(tilemap[GLYPH_RIDDEN_MALE_OFF + i].name, "%s male %s", "ridden", buf);
| ^~~~~~~
../win/share/tilemap.c:709:55: warning: ‘%s’ directive writing up to 255 bytes into a region of size 119 [-Wformat-overflow=]
709 | Sprintf(tilemap[GLYPH_BODY_OFF + i].name, "%s %s", "body of", buf);
| ^~ ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 9 and 264 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:709:9: note: in expansion of macro ‘Sprintf’
709 | Sprintf(tilemap[GLYPH_BODY_OFF + i].name, "%s %s", "body of", buf);
| ^~~~~~~
../win/share/tilemap.c:710:63: warning: ‘%s’ directive writing up to 255 bytes into a region of size 111 [-Wformat-overflow=]
710 | Sprintf(tilemap[GLYPH_BODY_PILETOP_OFF + i].name, "%s %s", "piletop body of", buf);
| ^~ ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 17 and 272 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:710:9: note: in expansion of macro ‘Sprintf’
710 | Sprintf(tilemap[GLYPH_BODY_PILETOP_OFF + i].name, "%s %s", "piletop body of", buf);
| ^~~~~~~
../win/share/tilemap.c:732:62: warning: ‘%s’ directive writing up to 255 bytes into a region of size 120 [-Wformat-overflow=]
732 | Sprintf(tilemap[GLYPH_MON_FEM_OFF + i].name, "female %s", buf);
| ^~ ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 8 and 263 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:732:9: note: in expansion of macro ‘Sprintf’
732 | Sprintf(tilemap[GLYPH_MON_FEM_OFF + i].name, "female %s", buf);
| ^~~~~~~
../win/share/tilemap.c:733:65: warning: ‘%s’ directive writing up to 255 bytes into a region of size 116 [-Wformat-overflow=]
733 | Sprintf(tilemap[GLYPH_PET_FEM_OFF + i].name, "%s female %s", "pet",
| ^~
734 | buf);
| ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 12 and 267 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:733:9: note: in expansion of macro ‘Sprintf’
733 | Sprintf(tilemap[GLYPH_PET_FEM_OFF + i].name, "%s female %s", "pet",
| ^~~~~~~
../win/share/tilemap.c:735:68: warning: ‘%s’ directive writing up to 255 bytes into a region of size 111 [-Wformat-overflow=]
735 | Sprintf(tilemap[GLYPH_DETECT_FEM_OFF + i].name, "%s female %s",
| ^~
736 | "detected", buf);
| ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 17 and 272 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:735:9: note: in expansion of macro ‘Sprintf’
735 | Sprintf(tilemap[GLYPH_DETECT_FEM_OFF + i].name, "%s female %s",
| ^~~~~~~
../win/share/tilemap.c:737:68: warning: ‘%s’ directive writing up to 255 bytes into a region of size 113 [-Wformat-overflow=]
737 | Sprintf(tilemap[GLYPH_RIDDEN_FEM_OFF + i].name, "%s female %s",
| ^~
738 | "ridden", buf);
| ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 15 and 270 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:737:9: note: in expansion of macro ‘Sprintf’
737 | Sprintf(tilemap[GLYPH_RIDDEN_FEM_OFF + i].name, "%s female %s",
| ^~~~~~~
../win/share/tilemap.c:739:55: warning: ‘%s’ directive writing up to 255 bytes into a region of size 119 [-Wformat-overflow=]
739 | Sprintf(tilemap[GLYPH_BODY_OFF + i].name, "%s %s", "body of", buf);
| ^~ ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 9 and 264 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:739:9: note: in expansion of macro ‘Sprintf’
739 | Sprintf(tilemap[GLYPH_BODY_OFF + i].name, "%s %s", "body of", buf);
| ^~~~~~~
../win/share/tilemap.c:740:63: warning: ‘%s’ directive writing up to 255 bytes into a region of size 111 [-Wformat-overflow=]
740 | Sprintf(tilemap[GLYPH_BODY_PILETOP_OFF + i].name, "%s %s",
| ^~
741 | "piletop body of", buf);
| ~~~
In file included from ../include/config.h:643,
from ../include/hack.h:10,
from ../win/share/tilemap.c:20:
../include/global.h:254:24: note: ‘sprintf’ output between 17 and 272 bytes into a destination of size 127
254 | #define Sprintf (void) sprintf
../win/share/tilemap.c:740:9: note: in expansion of macro ‘Sprintf’
740 | Sprintf(tilemap[GLYPH_BODY_PILETOP_OFF + i].name, "%s %s",
| ^~~~~~~
cc -rdynamic -lm -o tilemap tilemap.o ../src/objects.o \
../src/monst.o ../src/drawing.o
PatR [Mon, 3 Jan 2022 21:44:05 +0000 (13:44 -0800)]
wounded legs fixes
Document 'HWounded_legs' vs 'EWounded_legs'; they aren't used the way
other properties use their intrinsic and extrinsic values. And they
switch from hero to steed when riding. (Can't start riding when
hero's legs are wounded and the steed's legs magically heal when hero
dismounts, so existing wounds never transfer from one to the other.)
Having one leg become injured when the other already was would cure
the other leg but keep the longer of their two timeouts for the new
injury. Eliminate that mystery cure. Since their timeouts aren't
tracked separately, the best that can be done is to make both legs
eventually recover at the same time.
Make ^X report which leg is the wounded one when only one of them is.
(It already implicitly reports the both-legs case by using plural.)
When zapping a wand of probing downward while riding, include wounded
leg feedback for the steed.
Simplify wounded leg feedback when probing self a little bit.
Make drinking blessed potions of full healing cure wounded legs for
hero when not mounted or for steed when mounted. (The latter is a
bit strange--hero drinks potion, steed gets affected--but it's magic.)
Make drinking uncursed potions of full healing or blessed potions of
extra healing cure wounded legs for hero (but not steed; the magic
either isn't that strong or maybe not that reliable...).
PatR [Sun, 2 Jan 2022 21:56:53 +0000 (13:56 -0800)]
Qt map
The second half of qt_map.cpp is suppressed by '#if 0'. Make the
same change to prevent a column of giant ants shown for map column 0
in that unused code as was made for the active code.
PatR [Sun, 2 Jan 2022 10:03:49 +0000 (02:03 -0800)]
remove duplicate code in set_option_mod_status()
Remove a duplicate option name lookup loop. At one time the first
loop checked boolean options and second checked compound options,
but that changed a couple of years ago so that both loops check all
options and the second one became redundant.
PatR [Sun, 2 Jan 2022 09:48:07 +0000 (01:48 -0800)]
Qt without tiles
When tiles fail to load, the Qt interface switches to the text map.
But it wasn't inhibiting the player from trying to switch to tiles
map. Also, when the text map was in use it was forcing the paper
doll inventory subset to be disabled regardless of whether the map
was by choice or because tiles wouldn't load. Allow the paper doll
in combination with the text map if tiles got loaded successfully.
PatR [Sun, 2 Jan 2022 08:35:52 +0000 (00:35 -0800)]
tiled_map option
It was possible to toggle ascii_map On (which toggles tiled_map Off)
and Off (so tiled_map On) during play, but tiled_map was marked as
config-file only so the converse pair of operations weren't allowed.
Allow tiled_map to be toggled On or Off during play.
PatR [Fri, 31 Dec 2021 23:02:35 +0000 (15:02 -0800)]
more NO_TILE_C
When USE_TILES is disabled, don't let wc_tiled_map be the default.
Qt is capable of showing an (ugly) ascii map, and will do so if built
with NO_TILE_C after this fix (it defaults to tiles without this),
but it requires that a tiles file be loaded because it displays tiles
in other places besides the map, like role selection. So it can't
skip them when wc_ascii_map is set.
PatR [Fri, 31 Dec 2021 21:49:43 +0000 (13:49 -0800)]
NO_TILE_C => no USE_TILES in tile.c
Compiling with NO_TILE_C defined results in preventing USE_TILES
from being defined and that causes display.c to use alternate code.
Construct src/tile.c such that nethack links successfully if the
configuration specifies NO_TILE_C but the Makefile goes ahead and
builds tile.c, compiles it, and links with it, otherwise it conflicts
with that alternate code. Prior to this, linking gave two complaints
about duplicate symbols and failed.
nhmall [Fri, 31 Dec 2021 21:06:30 +0000 (16:06 -0500)]
macOS homebrew qt@5
Once 'brew update' and 'brew upgrade' had been done, the qt@5
package did become available for installation and the original
line in the hints file worked, so put it back as it was.
PatR [Fri, 31 Dec 2021 09:53:46 +0000 (01:53 -0800)]
Qt splash code
Move the handling for the Qt interface's splash window into its own
routine to unclutter the constructor for QtBind. Also, don't load
nhsplash.xpm if OPTIONS=!splash has been specified.
PatR [Thu, 30 Dec 2021 22:07:59 +0000 (14:07 -0800)]
Qt map column 0
Column 0 ought to be suppressed like it is for tty and curses (not
sure about X11 or Windows GUI), but until that happens, display it as
'nothing'. The glyph overhaul not too long ago resulted in it being
shown as a column of giant ants.
We ought to have some special 'none of the above' tile #0 that will
stand out enough to be reported and fixed. Glyph #0 too.
nhmall [Thu, 30 Dec 2021 20:11:49 +0000 (15:11 -0500)]
qt6 support follow-up
encompass Qt6 support in the common hints file macOS.2020 instead
of a separate macOS.2020-qt6, which had already diverged and would
likely be a maintenance headache.
From the Makefile perspective:
WANT_WIN_QT=1 will default to Qt5
WANT_WIN_QT5=1 will assume Qt5
WANT_WIN_QT6=1 will assume Qt6
You must have the appropriate Qt installed, of course.
I expect some additional fine-tuning will be needed as this gets
tried out.
PatR [Thu, 30 Dec 2021 19:29:03 +0000 (11:29 -0800)]
Qt vs C() macro
Our C() macro conflicts with Qt6 usage, so #undef C has added. Move
that from nearly every qt_*.cpp into qt_pre.h where other similar
fixups are handled.
Michael Meyer [Thu, 30 Sep 2021 04:26:01 +0000 (00:26 -0400)]
Fix: chameleon quickmimic not reset after eating
finish_meating was checking whether the monster in question was a
chameleon/shapechanger, rather than whether it was a mimic, in deciding
which monsters should be allowed to maintain their current appearance
once they finish eating. This meant that true mimics had their
appearance reset, while a chameleon, vampire, etc, who ate a mimic
would maintain their appearance as a tripe ration even after they had
finished eating and resumed their normal behavior. The result? An
amazing living tripe ration which followed the hero around throughout
the level.
HMM [Mon, 18 Oct 2021 19:04:14 +0000 (15:04 -0400)]
Have the '$' command include gold in your pack
In verbose mode, the gold in your wallet is totaled separately from
that in containers in your pack, and the two are listed separately.
In terse mode, just print the total of both.
PatR [Thu, 30 Dec 2021 19:06:29 +0000 (11:06 -0800)]
fixes entry for Qt6 support
I had a minor merge issue when incorporating Ray's Qt6 port from
github.com/chasonr/NetHack/Qt6 but it got resolved. This still builds
with Qt5 (and that's the only aspect I've been able to test) but is
supposed to work with Qt6 too. It adds a new hints file for OSX and
someone might need to create a comparable one for linux. Or maybe
the differences can be folded into the existing hints as conditional.
HMM [Sun, 31 Oct 2021 20:12:25 +0000 (16:12 -0400)]
Don't erase Elbereth when monster steps into a pit or hole dug by you
Elbereth was fading when offscreen monsters stepped into
pits or holes dug elsewhere on the level. This was happening
because monsters falling into traps set by you were calling
setmangry() as if you had just attacked them. The behavior
made it unsafe to use Elbereth if you've dug down anywhere
else on the level, making it a bit harder to get archeologists
off the ground.
Pasi Kallinen [Thu, 30 Dec 2021 16:46:30 +0000 (18:46 +0200)]
Make extended commands return defined flags
Instead of returning 0 or 1, we'll now use ECMD_OK or ECMD_TURN.
These have the same meaning as the hardcoded numbers; ECMD_TURN
means the command uses a turn.
In future, could add eg. a flag denoting "user cancelled command"
or "command failed", and should clear eg. the cmdq.
Mostly this was simply replacing return values with the defines
in the extended commands, so hopefully I didn't break anything.
Pasi Kallinen [Wed, 29 Dec 2021 17:40:23 +0000 (19:40 +0200)]
Apply a wielded polearm with fire-command
Wield a polearm and use 'f'ire to automatically hit with it,
if there's a single valid target.
With fireassist-option, will swapweapon to a polearm.
This only applies if quiver is empty and autoquiver is off.
PatR [Wed, 29 Dec 2021 10:21:13 +0000 (02:21 -0800)]
no USED_SOUNDS option parsing bit
If the program is build without USER_SOUNDS and encounters any SOUND
or SOUNDDIR directive when parsing the run-time config file it only
issues an error message about the first one. When finished parsing,
have it include suppressed ones in the count of errors encountered.
PatR [Wed, 29 Dec 2021 10:13:34 +0000 (02:13 -0800)]
Qt paper doll fix for two-handed weapons
Allowing optional arguments can be risky. The recent glyph changes
added a new argument to the routine that constructs a mirror image
of a tile but not to the call to that routine. Because an existing
argument was optional, the compiler didn't complain about the new
one being missing.
Obsolete optional 'fem' argument ought to removed but this doesn't
tackle that.
PatR [Mon, 27 Dec 2021 22:27:35 +0000 (14:27 -0800)]
Qt misuse of Role_if()
The Qt paper doll highlights known blessed/uncursed/cursed items with
a color border. It was trying to force obj->bknown for non-blinded
priest[ess] but passed the old role letter argument to Role_if()
instead of the monster number that's used these days. It was also
potentially modifying an invent item in a way that's observable to
the player but not updating persistent inventory to show that.
Probably didn't matter though; I don't think the situation it checks
for can occur anymore. On the off chance that it could, move the
check-and-set out of #if ENHANCED_PAPERDOLL so that same inventory
update would occur for ordinary paper doll even though that doesn't
care about displayed items' bless/curse state.
PatR [Sun, 26 Dec 2021 22:57:29 +0000 (14:57 -0800)]
red dragon's sight
Since wearing red dragon scales/mail confers infravision, give that
ability to red dragons. Matters when the hero is polymorphed into one.
Also give it to the Chromatic Dragon, where I don't think it matters.
A giant that is carrying a boulder and standing on ice who drowns when
the ice gets melted could die a second time if the resulting pool gets
plugged by the boulder. It results in an impossible from dmonsfree()
about bookkeeping inconsistency when dead monsters are removed at the
end of the turn. The fuzzer escalates that to a panic.
PatR [Sun, 26 Dec 2021 08:43:24 +0000 (00:43 -0800)]
curses message management
Switch from 'moves' to 'hero_seq' for tracking whether consecutive
messages were issued on the same move and for whether current move
is still same one after played has responded to --More-- with ESC.
PatR [Sun, 26 Dec 2021 08:16:55 +0000 (00:16 -0800)]
hero_seq
'moves' is actually turns and there hasn't been any straightforward
way to track actual hero moves. Add hero_seq for that. It isn't a
counter but is distinct each time the hero makes a move. I wanted
it for curses ^P support but so far use it for checking stethoscope
usage and for shopkeeper behavior when items in a shop are broken by
the hero.
Increment EDITLEVEL due to change in save file contents.
PatR [Sat, 25 Dec 2021 22:31:33 +0000 (14:31 -0800)]
dragon armor fix
Fix a segfault when polymorphed into a dragon and using ^X.
One inconsistency I've spotted that I hadn't noticed earlier: if
you wear red dragon scales/mail you obtain infravision ability, but
if polymorph into a red dragon, you don't.
PatR [Sat, 25 Dec 2021 18:26:44 +0000 (10:26 -0800)]
dragon armor properties
Special abilities conferred by wearing dragon armor was implemented in
a somewhat half-assed fashion; extend it to 3/4-assed. Abilities came
from wearing dragon armor but not from being poly'd into a dragon or
for monsters that were wearing dragon armor or actually were dragons.
This covers much of that.
There are umpteen calls of 'resists_foo(mon)' and some are now
'resists_foo(mon) || defended(mon, AD_FOO)' but the second part ought
to be incorporated into update_mon_intrinics() so that the extra
'|| defended()' doesn't have to be spread all over the place and the
ones being put in now could/should be removed.
While testing, I noticed that a monster wielding Fire Brand did not
resist being hit by a wand of fire. This fixes that and should also
fix various comparable situations for other artifacts. But so far it
has only been done for zapping (and any other actions which use the
zapping code). Folding defended() checks into update_mon_intrinsics()
matters more than that probably sounds.
PatR [Thu, 23 Dec 2021 03:36:52 +0000 (19:36 -0800)]
sickness countdown
Give messages when sickness countdown has nearly expired to warn
player that hero is dying and also so that death at the end doesn't
seem so abrupt after an arbitrary period with just "TermIll" and/or
"FoodPois" on the status line.
Also, abuse constitution each turn when Sick (either variation, but
not a double amount if both).
PatR [Wed, 22 Dec 2021 20:23:50 +0000 (12:23 -0800)]
curses: urgent messages
This is comparable to the recent fix for tty. When messages aren't
currently being suppressed by use of ESC at --More-- (">>" for
curses), if an urgent message itself triggers --More--, don't start
suppressing messages if player dismisses it with ESC.
PatR [Wed, 22 Dec 2021 19:33:35 +0000 (11:33 -0800)]
curses: fix "---" separators in ^P output
This one has me baffled, first how/when it happened and then why no
one reported it. The line
current_mesg->turn = g.moves;
vanished from mesg_add_line() at some point. It is visible in diff
context of commit 99ed00012e076be07846edceb85e3e5e53f2bb02 from March,
2019 but I can't find any commit since that time which removed it.
[I've been using
git log --no-min-parents --no-max-parents --patch win/curses/cursmesg.c
and then searching within the pager. Maybe that's flaky, but if so,
things wouldn't be any less strange.]
The missing line resulted in mesg->turn being uninitialized, so when
^P compared consecutive messages to decide whether they were issued on
the same turn, arbitrary junk made them all seem to be from different
turns so "---" got inserted before every message. I suppose that if
someone uses a malloc that zeroes the memory it hands out, mesg->turn
field would always be 0 and ^P would behave as if all messages were
from the same turn, so not show any "---" separators. Then players
might not be aware that "---" between groups of messages was intended.
[The messages ought to be grouped by move rather than by turn, but
that's something the core would have to provide.]
PatR [Wed, 22 Dec 2021 08:18:37 +0000 (00:18 -0800)]
switch makedefs from malloc() to alloc()
Avoids any need for MONITOR_HEAP hackery. Link src/alloc.o and
util/panic.o into util/makedefs.
When replacing the realloc() call in fgetline(), I noticed that
fgetline() would miss the last line of an input file if it lacked a
terminating newline. This was hard to test because OSX seems to be
supplying one when it is missing (VMS would do that too). I had to
modify epitaph (my test bed) to take off the final character, run
'makedefs -s' under debugger control and strip away final newline
that stdio added back, build new nhdat and move it into place, then
run nethack and execute #wizrumorcheck all multiple times before
the fix and once more after it. Much effort for little gain...
Plus some of the recent reformatting: indent labels one space,
replace tabs with spaces, shorten or split wide lines.
PatR [Tue, 21 Dec 2021 10:56:59 +0000 (02:56 -0800)]
bullwhip and polearm attack feedback
When testing the urgent message for having weapon be snagged by a
bullwhip, in between the occasional weapon grabs (which mention
flicking the bullwhip) I saw lots of regular attacks that said
"<mon> swings his bullwhip." That is accurate but seems odd, so
change it to "<mon> lashes his bullwhip." Do same for the hero.
While working on that, I discovered that monsters using a polearm
for a ranged attack always showed "<mon> thrusts <a polearm>" even
for ones that aren't defined as piercing so should be swung rather
that thrust. And they're allowed to do that when adjacent where
there isn't enough room to thrust or swing a long polearm. Now it's
"<mon> bashes with <a polearm>" in that situation.
Pasi Kallinen [Tue, 21 Dec 2021 09:18:45 +0000 (11:18 +0200)]
Vampire in a genocided shape
When you genocided a monster a vampire was shapeshifted into,
the vampire might've stayed in the genocided form.
Always revert back to vampire form if we tried to pick a genocided form.
PatR [Mon, 20 Dec 2021 16:42:58 +0000 (08:42 -0800)]
additional urgent messages
Now I've remembered why I didn't follow through with these back when
I originally laid the groundwork. New urgent messages:
having an item of armor be destroyed
having weapon be grabbed by a monster's bullwhip
becoming engulfed
being grabbed by an eel
subsequently being drowned by an eel
dying of petrification
turning into slime then dying due to genocide
dying due to fatal illness
PatR [Mon, 20 Dec 2021 16:16:13 +0000 (08:16 -0800)]
fix for urgent messages for tty
If messages aren't currently being skipped due to --More--ESC when a
message flagged as urgent is issued and that urgent message itself
triggers --More-- to have the user acknowledge the previous message,
and the user types ESC at this new --More--, message suppression
starts. With the overly simplistic existing code from a few days
ago, it was too late for the current message to override that. Since
the urgent message gets buffered like any other (until another message
needs the top line or until input is needed), it wouldn't be shown
when the next message came along and discovered suppression in effect.
I'm not sure that all the changes here are necessary; there was some
flailing about involved. But it seems to behave as intended now.
PatR [Mon, 20 Dec 2021 03:31:19 +0000 (19:31 -0800)]
region save/restore
When shortening/splitting wide lines I noticed that the save and
restore code for regions had a bunch of those and they could be
shortened by using an intermediate variable. Easier to read too.
Also, change several 'unsigned int' to just 'unsigned' as is used in
most of the rest of the code.
At one point I omitted a (genericptr_t) cast (which should no longer
be necessary...) and discovered that bwrite() wasn't declaring the
input buffer it never modifies as 'const'.
PatR [Sun, 19 Dec 2021 17:30:07 +0000 (09:30 -0800)]
fix #K3496 - leash description when pet changes
If persistent inventory is displayed and contains an entry for a leash
attached to a pet and the pet's type or name changes, the perm_invent
window didn't get updated to reflect the new leash information:
x - leash (attached to <mon>)
Report was for polymorph but applied to growing into bigger form and
to being (re-/un-)christened as well.
PatR [Sun, 19 Dec 2021 12:54:34 +0000 (04:54 -0800)]
create_door() warning hackery
Redo the warning suppression in create_door(). The unreachable 'goto'
was unnecessary and without it there's no need to toggle unreachable
code warnings off and back on. Taking a step back, the whole 'default'
case is unnecessary since rn2(4) will always hit one of the 0..3 cases.
So instead of just getting rid of the unreachable 'goto', get rid of
the panic() too.