]> granicus.if.org Git - nethack/log
nethack
3 years agog++-12 bits, mostly Qt5 related
nhmall [Sat, 11 Jun 2022 17:52:58 +0000 (13:52 -0400)]
g++-12 bits, mostly Qt5 related

I forced a test compile to -std=c++20 mostly to see what we would
be up against. There was only a small number of things and they
are corrected in this commit.

c++20 has some issues with comparisons and bit twiddling between
different enums.

The vendor-supplied Qt5 header files triggered some of those issues as
well, so the qt_pre.h and qt_post.h NetHack header files were adjusted
to make those new warnings go away.  I have not tested Qt6 under the
new compiler and c++ version yet.

Because there are multiple pragmas in qt_pre.h now, the conditional
ifdef structure in there was modified a little to make maintenance
simpler and have a single pragma push at the top. The pragma pop
comes after the Qt vendor-supplied header files, and is done
in qt_post.h.

The display.h macro cmap_to_glyph() was used in
a Qt c++ file and triggered a series of warnings because of that.
Rather than write c++20-friendly versions of those macros, the
simple fix is to provide a function on the C side of things
to front the cmap_to_glyph() macro, so fn_cmap_to_glyph()
was added.

Also thrown into this commit, PatR picked up on the fact that for
yesterday's new warning in qt_menu.cpp, the compiler had correctly
picked up on the fact that the format range of the variable 'cash'
had been correctly upper-capped at 999999999L in the warning message
because of an assignment prior. He suggested that perhaps by also adding
    if (cash < 0)
       cash = 0;
the warning might be eliminated altogether.
After a test, that was proven to be correct, so yesterday's
more-kludgy change is reverted and replaced with that variable
variable restriction ahead of the snprintf().

3 years agoMerge branch 'pr791' into NetHack-3.7
nhmall [Sat, 11 Jun 2022 15:07:42 +0000 (11:07 -0400)]
Merge branch 'pr791' into NetHack-3.7

3 years agocleaning-up on gd_move() pr #791
nhmall [Sat, 11 Jun 2022 15:06:08 +0000 (11:06 -0400)]
cleaning-up on gd_move() pr #791

Closes #791

3 years agoMerge branch 'fix-vault' of https://github.com/argrath/NetHack into pr791
nhmall [Sat, 11 Jun 2022 15:02:23 +0000 (11:02 -0400)]
Merge branch 'fix-vault' of https://github.com/argrath/NetHack into pr791

3 years agofix warnings
SHIRAKATA Kentaro [Sat, 11 Jun 2022 08:18:34 +0000 (17:18 +0900)]
fix warnings

3 years agosimplify unpunish()
PatR [Sat, 11 Jun 2022 07:11:48 +0000 (00:11 -0700)]
simplify unpunish()

unpunish() duplicated much of delobj() in order to use dealloc_obj().
Switch to delobj().  That required a fix to feel_location() when it
was called by savebones() after vision is turned disabled.

3 years agoSome cleanup for saving bones
PatR [Sat, 11 Jun 2022 07:09:14 +0000 (00:09 -0700)]
Some cleanup for saving bones

3 years agosaving/freeing ball and chain
PatR [Sat, 11 Jun 2022 07:08:17 +0000 (00:08 -0700)]
saving/freeing ball and chain

Reported by entrez:  fix memory being accessed after having been
freed by trying to keep ball&chain data up to date when they're
processed by the save code.  This fix is a little more elaborate
than this suggested one.  I'm crossing my fingers on this one....

3 years agonew warnings showed up in old code
nhmall [Sat, 11 Jun 2022 04:18:27 +0000 (00:18 -0400)]
new warnings showed up in old code

A test build with gcc-12 cause two new warnings to appear.

mkmaze.c: In function ‘makemaz’:
mkmaze.c:983:44: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
983 |                 Sprintf(protofile, "%s%d-%d", g.dungeons[u.uz.dnum].proto,
    |                                            ^
In file included from ../include/config.h:665,
                 from ../include/hack.h:10,
                 from mkmaze.c:6:
../include/global.h:262:24: note: ‘sprintf’ output between 4 and 31 bytes into a destination of size 20
262 | #define Sprintf (void) sprintf
mkmaze.c:983:17: note: in expansion of macro ‘Sprintf’
983 |                 Sprintf(protofile, "%s%d-%d", g.dungeons[u.uz.dnum].proto,
    |                 ^~~~~~~-+

As usual, that one can easily be rectified by replacing it with an Snprintf() call.
There were several Sprintf calls in the vicinity, targeting the same destination
buffer, so I figured that I might as well replace the several.

../win/Qt/qt_menu.cpp: In member function
‘virtual void nethack_qt_::NetHackQtTextWindow::UseRIP(int, time_t)’:
../win/Qt/qt_menu.cpp:1082:63: warning:
‘%ld’ directive output may be truncated writing between 1 and 20 bytes into a region
of size 17 [-Wformat-truncation=]
1082 |     (void) snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN + 1, "%ld Au", cash);
     |                                                               ^~~
../win/Qt/qt_menu.cpp:1082:62: note: directive argument in the range [-9223372036854775808999999999]
1082 |     (void) snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN + 1, "%ld Au", cash);
     |                                                              ^~~~~~~~
../win/Qt/qt_menu.cpp:1082:20: note: ‘snprintf’ output between 5 and 24 bytes into a destination of size 17
1082 |     (void) snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN + 1, "%ld Au", cash);
     |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That one was a little different. It wasn't complaining about the destination buffer
size in the way -Wformat-overflow was on the previous warning from gcc, and it
was already using snprintf().

It looks like what the C++ compiler was warning about there, was that snprintf()
informs you after-the-call that the destination buffer was too small for the
result string to be fully written. It informs the developer of that by returning
the number of characters that would have been written if the buffer had been big
enough. Presumably, the C++ compiler picked up on the fact that the return value
was being cast to void, thus throwing away that truncation information from the
return value.

Worked around it by putting the return value into a variable, and flagging the
variable with nhUse(variable) so as not to exchange the -Wformat-truncation
warning with a variable-set-but-not-used warning.

3 years ago\#wizkill while engulfed
PatR [Fri, 10 Jun 2022 22:19:01 +0000 (15:19 -0700)]
\#wizkill while engulfed

Targetting any of the eight surrounding spots while swallowed will
kill the engulfer.  Picking a spot farther away reports "no monster
there" even if there does happen to be one at the chosen spot.

3 years agoleft out of commit e2d694ed32
PatR [Fri, 10 Jun 2022 21:36:55 +0000 (14:36 -0700)]
left out of commit e2d694ed32

3 years agofix github issue #769 - revive panic
PatR [Fri, 10 Jun 2022 18:35:07 +0000 (11:35 -0700)]
fix github issue #769 - revive panic

Issue #769, reported by k2 and diagnosed by entrez:  eating a troll
corpse that revives on the last turn of the meal was using up the
corpse while the revival was in progress (unless the hero couldn't
observe the resulting monster), leading to a panic when trying to
use it up at the end of revival.  Brought on by a recent change to
interrupt an occupied hero who can observe a hostile monster being
created nearby.

The fix isn't perfect.  If revival fails because there's no place
to put the revived troll, the meal will be interrupted with one bite
left instead of finishing.  If that happens, the interruption will
include a "you stop eating" message, just with no explanation why.
The partly eaten--almost completely eaten--corpse will remain.

Closes #769

3 years agoobject splitting bit
PatR [Fri, 10 Jun 2022 17:14:06 +0000 (10:14 -0700)]
object splitting bit

Something else noticed while hunting for the revive() panic.  Like
the zap.c change (56b791f7cc), doesn't fix that or impact its
eventual fix.

3 years agocouple of revive() bits
PatR [Fri, 10 Jun 2022 17:11:10 +0000 (10:11 -0700)]
couple of revive() bits

Noticed while hunting for the panic.  They don't fix it but also
won't interfere with the eventual fix.

3 years agosuppress warnings during vs 3rd party x64 builds
nhmall [Fri, 10 Jun 2022 00:02:19 +0000 (20:02 -0400)]
suppress warnings during vs 3rd party x64 builds

These warning are in 3rd party library builds (one
in Lua relating to padding due to alignment), and
a few in pdcurses. We won't be addressing the code
in  those.

3 years agogranular verbose message suppression mechanics updated
nhmall [Thu, 9 Jun 2022 19:16:28 +0000 (15:16 -0400)]
granular verbose message suppression mechanics updated

update the macro definition

[re-do full commit message due to errors in last one]

Switch to using a macro invocation Verbos(n, s) in place of the
flags.verbose checks.

Provide the mechanics for individual suppression of any of the
existing messages that were considered verbose.

Mechanics only - this code update does not provide any means of
setting the suppression bits.

flags.verbose = 0
is still a master suppression of all the verbose messages.

flags.verbose = 1
turns on the verbose messages only for those whose suppression
bit is 0 (not set).

3 years agogranular verbose message suppression mechanics
nhmall [Thu, 9 Jun 2022 17:53:20 +0000 (13:53 -0400)]
granular verbose message suppression mechanics

Switch to using a macro invocation Verbos(n, s) in place of the
flags.verbose checks.

Provide the mechanics for individual suppression of any of the
existing messages that were considered verbose.

Mechanics only - this code update does not provide any means of
setting the suppression bits.

iflags.verbose = 0
is still a master suppression of all the verbose messages.

iflags.verbose = 1
turns on the verbose messages only for those whose suppression
bit is 0 (not set).

3 years agocorrect an assignment value in restore.c
nhmall [Thu, 9 Jun 2022 12:16:58 +0000 (08:16 -0400)]
correct an assignment value in restore.c

3 years agoadd reset_justpicked() comment
PatR [Thu, 9 Jun 2022 07:37:14 +0000 (00:37 -0700)]
add reset_justpicked() comment

3 years agoutf8 warning fix
PatR [Thu, 9 Jun 2022 07:28:44 +0000 (00:28 -0700)]
utf8 warning fix

Avoid gcc/clang warning about mixing || with && without parentheses.
The code already worked as intended despite the warning.

3 years agoremove extraneous file
nhmall [Thu, 9 Jun 2022 04:46:49 +0000 (00:46 -0400)]
remove extraneous file

3 years agoMerge branch 'argrath-20220609' into NetHack-3.7
nhmall [Thu, 9 Jun 2022 04:45:59 +0000 (00:45 -0400)]
Merge branch 'argrath-20220609' into NetHack-3.7

3 years agoa couple of argrath pull requests
nhmall [Thu, 9 Jun 2022 04:43:35 +0000 (00:43 -0400)]
a couple of argrath pull requests

Closes #777 https://github.com/NetHack/NetHack/pull/777
Closes #793 https://github.com/NetHack/NetHack/pull/793

3 years agoMerge branch 'fix-symbols' of https://github.com/argrath/NetHack into argrath-20220609
nhmall [Thu, 9 Jun 2022 04:41:34 +0000 (00:41 -0400)]
Merge branch 'fix-symbols' of https://github.com/argrath/NetHack into argrath-20220609

3 years agoMerge branch 'fix-cmd-3' of https://github.com/argrath/NetHack into argrath-20220609
nhmall [Thu, 9 Jun 2022 04:39:13 +0000 (00:39 -0400)]
Merge branch 'fix-cmd-3' of https://github.com/argrath/NetHack into argrath-20220609

3 years agoMerge branch 'pr794' into NetHack-3.7
nhmall [Thu, 9 Jun 2022 04:36:57 +0000 (00:36 -0400)]
Merge branch 'pr794' into NetHack-3.7

3 years agofixes entry: vampire shapeshifting in a door #794
nhmall [Thu, 9 Jun 2022 04:35:00 +0000 (00:35 -0400)]
fixes entry: vampire shapeshifting in a door #794

Closes #794

3 years agoMerge branch 'vampire-door' of https://github.com/entrez/NetHack into pr794
nhmall [Thu, 9 Jun 2022 04:33:13 +0000 (00:33 -0400)]
Merge branch 'vampire-door' of https://github.com/entrez/NetHack into pr794

3 years agofixes entry for pr #783
nhmall [Thu, 9 Jun 2022 03:45:02 +0000 (23:45 -0400)]
fixes entry for pr #783

Resolves #783

3 years agoRe: [NetHack/NetHack] Prompts can overwrite copyright notice on the
nhmall [Thu, 9 Jun 2022 03:41:45 +0000 (23:41 -0400)]
Re: [NetHack/NetHack] Prompts can overwrite copyright notice on the
starting screen (Issue #783)

On 2022-06-01 12:22 p.m., NetSysFire wrote:
> Steps to reproduce:
>
>1. Get any prompt and answer it. In my case it was a horribly old
>   save I forgot about or when I wiztested something and forgot
>   about that save, too.
>2. See that the copyright information got overwritten by the prompt:
>
>There is already a game in progress under your name. Destroy old game? [yn] (n)
>         By Stichting Mathematisch Centrum and M. Stephenson.
>         Version 3.7.0-59 Unix Work-in-progress, built May 31 2022 12:28:31.
>         See license for details.
>
>
> Shall I pick character's race, role, gender and alignment for you? [ynaq]
>
> Expected behavior:
>
> Redraw after a prompt was answered, so the prompt vanishes and the
> entirety of the starting screen will be shown.
>
> NetHack, Copyright 1985-2022
>          By Stichting Mathematisch Centrum and M. Stephenson.
>          Version 3.7.0-59 Unix Work-in-progress, built May 31 2022 12:28:31.
>          See license for details.
>
>
> Shall I pick character's race, role, gender and alignment for you? [ynaq]
>
> Proposed severity: low. Not gamebreaking, it is cosmetic only and does
> not have any other consequences.
>

The Copyright notice is placed by tty internal routines writing onto
the BASE_WINDOW fairly early in the startup sequence.

The prompt to "Destroy old game? [yn] (n)" is using the in-game
routine to write to the message window at the top of the screen and
prompt there, just like in-game prompts and messages.

If the player answered 'y' to that, the prompt for
"Shall I pick character's race, role, gender and alignment..."
appeared immediately after. That one, however, is written using
the BASE_WINDOW routines in tty, like the copyright notice.

This change does the following:

It moves the copyright lines down a little bit leaving room for the
"Destroy.." prompts.

It places the "Shall I pick characters's..." prompt further down the
screen by default, leaving some room for about 3 raw_print startup
messages after the copyright notice, just in case there are any.
The "Shall I pick character's..." prompt will still appear immediately
if there is a prompt such as "Destroy old game?..."

There were a couple of other issues around raw_print startup messages
too. Those are delivered using a raw_print mechanism to ensure they
are written even if the window-port is not fully operational. However,
they were only on the screen for the blink of an eye. This call
sequence in restore.c made them disappear almost immediately:
     docrt() -> cls()

Put in a mechanism to detect the presence of raw_print messages
from the early startup, and if there were some, wait for a
keypress before obliterating the unread notifications.

3 years agoFix: vampire shapeshifting in a door
Michael Meyer [Wed, 8 Jun 2022 23:50:48 +0000 (19:50 -0400)]
Fix: vampire shapeshifting in a door

Someone mentioned in #nethack today that a vampire had turned into a fog
cloud, moved under a door, then turned back into a vampire while still
sharing a space with a closed door.  There already existed some code
intended to prevent this in cases where the vampire is killed in one
form and revives in another, but voluntary transformations (from
decide_to_shapeshift) weren't included.  The existing code in mondead
and vamp_stone also apparently missed a minor edge case: because the
code between the definition of in_door and its use included an expels
call, it would be outdated/incorrect in cases where expels() placed the
fog cloud onto a closed door.

3 years agodeath from touching silver ring or wand
PatR [Wed, 8 Jun 2022 19:50:49 +0000 (12:50 -0700)]
death from touching silver ring or wand

From a reddit thread:  NAO's list of causes of death shows
|killed by handling a(n) ring of shock resistance
|killed by handling a(n) wand of fire
along with various other rings and wands and the poster wondered how
that could have killed characters.  Someone quickly figured out that
the heroes involved had lycanthropy and the items listed happened
to be silver in those games.

Avoid that sort of confusion in future by specifying "handling a
silver ring" or "handling a silver wand" instead of the specific
type of item when inflicting silver damage.  It still uses specific
item for other classes of objects where silver isn't shuffled among
potential items at start of game.

3 years agomagic portal traversal feedback
PatR [Wed, 8 Jun 2022 17:46:51 +0000 (10:46 -0700)]
magic portal traversal feedback

Replace the old message "you feel dizzy for a moment, but the sensation
passes" when going through a magic portal.  The sensation doesn't just
pass anymore; you arrived stunned these days.  Suggested by entrez.

3 years agoremove unnecessary null-check on parsesymbols()
SHIRAKATA Kentaro [Sun, 5 Jun 2022 07:22:21 +0000 (16:22 +0900)]
remove unnecessary null-check on parsesymbols()

`strval` here is always non-null,
because the null-check is done in earlier code.

3 years agoartifact name formatting bit
PatR [Mon, 6 Jun 2022 23:15:07 +0000 (16:15 -0700)]
artifact name formatting bit

All the quest artifacts are named "The <something> of <someone>".
Change xname() to force "the" instead of "The" when that occurs in
the middle of "a skeleton key named The Master Key of Thievery" or
"a pair of lenses named The Eyes of the Overworld".

This change isn't applied to user-assigned names; they're used as-is.

3 years agosplit cleaning-up on gd_move() into separate function
SHIRAKATA Kentaro [Sun, 22 May 2022 13:37:01 +0000 (22:37 +0900)]
split cleaning-up on gd_move() into separate function

3 years agomonpolycontrol bit
PatR [Sun, 5 Jun 2022 21:39:48 +0000 (14:39 -0700)]
monpolycontrol bit

I tried to polymorph a shopkeeper into a long worm (which isn't
allowed) and EDIT_GETLIN preserved "long worm" for default input
on the first retry.  I just pressed <return> without modifying the
preloaded input, so a cycle of repitition occurred until eventually
it returned Null.  But then the outer caller also retried, starting
it all over (at least without preserving the old failed input this
time).

Change it so that if the same unacceptible input is given twice in
a row, or empty input even once, preload the buffer for the next
retry with "random".  Player can still edit that but if <return> is
used then an acceptable random choice gets made.

Only applies to the "what type of monster?" for polymorph target
when monpolycontrol is On since that's where two levels of retrying
happens.

3 years agoatttempting to close a blocked door
PatR [Sun, 5 Jun 2022 21:37:00 +0000 (14:37 -0700)]
atttempting to close a blocked door

Simplify the message handling for trying to close a door when there's
a monster in the doorway.

3 years agofix a potential leak of monst struct in montraits
nhmall [Sat, 4 Jun 2022 13:33:36 +0000 (09:33 -0400)]
fix a potential leak of monst struct in montraits

Resolves #789

3 years agosynchronize some recent changes between linux.370 and macOS.370
nhmall [Sat, 4 Jun 2022 01:26:21 +0000 (21:26 -0400)]
synchronize some recent changes between linux.370 and macOS.370

3 years agocurses locale.h fix
PatR [Fri, 3 Jun 2022 20:12:27 +0000 (13:12 -0700)]
curses locale.h fix

3 years ago'make depend' update
PatR [Fri, 3 Jun 2022 20:02:40 +0000 (13:02 -0700)]
'make depend' update

3 years agofixes entry for PR #784 - reset just-picked-up
PatR [Fri, 3 Jun 2022 19:31:00 +0000 (12:31 -0700)]
fixes entry for PR #784 - reset just-picked-up

Pull request from entrez:  the just-picked-up flag on recently
picked up items was being reset when you stepped on other items
without picking anything else up.

Closes #784

3 years agoReset justpicked only when picking up items
Michael Meyer [Thu, 2 Jun 2022 19:23:04 +0000 (15:23 -0400)]
Reset justpicked only when picking up items

With reset_justpicked called unconditionally near the top of pickup, it
was impossible to pick up some items, walk over to a chest, and use 'P'
to deposit the items with autopickup on: pickup is called with every
move, and autopickup allowed execution to reach the reset_justpicked
call whenever the hero stepped on a square with an item in it.  As a
result, stepping onto a square with a container would clear all the
justpicked flags in inventory (pressing ',' and then declining to pick
anything up would have a similar effect).

Instead, call reset_justpicked only when the hero (or autopickup) has
actually selected an item to pick up.  This makes the code a bit more
complicated than before -- I don't think there's a way to do it with
just one reset_justpicked call any more, due to the structure of pickup
and the need to call reset_justpicked before actually putting any items
into inventory -- but it means that justpicked info will be much less
ephemeral and more useful when managing stashes, etc.

3 years agowished-for doors in wizmode always vertical
nhmall [Fri, 3 Jun 2022 19:30:18 +0000 (15:30 -0400)]
wished-for doors in wizmode always vertical

Closes #788

3 years agoMerge branch 'fix-doorwish-horizontal' of https://github.com/entrez/NetHack into...
nhmall [Fri, 3 Jun 2022 19:29:02 +0000 (15:29 -0400)]
Merge branch 'fix-doorwish-horizontal' of https://github.com/entrez/NetHack into pr788

3 years agoFix: wished-for doors in wizmode always vertical
Michael Meyer [Fri, 3 Jun 2022 19:12:16 +0000 (15:12 -0400)]
Fix: wished-for doors in wizmode always vertical

Wishing for a door is intended to retain the existing 'horizontal' value
of the surrounding wall or door (see comment in the wizterrainwish
'door' case).  However, the field was being reset by mistake, causing
all door wishes to create vertical doors.  Preserve it as intended.

3 years agogithub PR #787 - segfault for wizterrain wish
PatR [Fri, 3 Jun 2022 19:10:55 +0000 (12:10 -0700)]
github PR #787 - segfault for wizterrain wish

Pull request from entrez:  the change to show the result of a wish in
its gamelog/livelog event resulted in a segfault if that result was
&zeroobj.  It occurs for wizard mode wishes producing terrain changes
instead of objects.

Closes #787

3 years agoFix: segfault on wizmode terrain wish
Michael Meyer [Fri, 3 Jun 2022 18:34:40 +0000 (14:34 -0400)]
Fix: segfault on wizmode terrain wish

The new livelogging of wish results caused a segfault when attempting to
handle the results of a wizard mode terrain wish, since a successful
terrain wish returns a nonzero obj which nonetheless is just a dummy
object.  Move the existing check for that further up to skip all the
livelogging stuff entirely, since such wishes will never happen in a
real game and exist purely for debugging purposes.

3 years agoalter wording in last commit fixes entry
nhmall [Thu, 2 Jun 2022 23:24:52 +0000 (19:24 -0400)]
alter wording in last commit fixes entry

3 years agospelling in last fixes message
nhmall [Thu, 2 Jun 2022 23:22:18 +0000 (19:22 -0400)]
spelling in last fixes message

3 years agofix message when monster's two-handed weapon welds
nhmall [Thu, 2 Jun 2022 23:20:21 +0000 (19:20 -0400)]
fix message when monster's two-handed weapon welds

K3610 reported to devteam:
When you see a monster wield a cursed two-handed weapon,
the weapon "welds itself to the foo's hand" instead of its "hands."

Observed on hill orcs wielding a cursed two-handed sword.

3 years agofix #K3603 - multiple stacks of gold in container
PatR [Thu, 2 Jun 2022 21:44:30 +0000 (14:44 -0700)]
fix #K3603 - multiple stacks of gold in container

When taking stuff out of a container, specifying a subset count for
an item and getting the pickup_burden prompt, answering 'q' undid the
subset split but answering 'n' did not.  If the item in question was
a stack of gold, the container would end up with two stacks.  That
action could be repeated as long as any of the stacks was big enough
to trigger pickup_burden confirmation so an arbitrary number of gold
stacks could be produced.  (Eventually they would be too small for a
subset to cause an increase in encumbrance, or possibly all reduced
to just one gold piece, then no more stacks could be created.)

Situation occurred for all menustyles; traditional and via-menu needed
separate fixes.  It didn't occur for pickup off the floor.

Report was for 3.6.6 but the bug was still present in dev version.

3 years agoanother ncursesw follow-up
nhmall [Thu, 2 Jun 2022 21:14:42 +0000 (17:14 -0400)]
another ncursesw follow-up

3 years agoyet another follow-up for linux.370 ncursesw
nhmall [Thu, 2 Jun 2022 20:31:30 +0000 (16:31 -0400)]
yet another follow-up for linux.370 ncursesw

3 years agofix #K3608 - glob quantity
PatR [Thu, 2 Jun 2022 20:02:45 +0000 (13:02 -0700)]
fix #K3608 - glob quantity

Wishing for "N <size> globs [of pudding type]" produces 1 glob
starting at <size> and then multiples weight by N (so possibly
increasing <size>).  When not it wizard mode, N can be replaced by
a random amount to prevent the total weight from being huge.  When
N was less than 6, it was possible for that random amount to be
larger than what the player asked for.

Change the way the random amount is calculated so that it won't
ever be larger than what player specified.  Also for wizard mode
prompt whether to make the substitution so that the player can
choose to abide by the limit or to obtain a huge glob for whatever
testing is being conducted.

3 years agoanother follow-up for ncursesw and CURSES_UNICODE
nhmall [Thu, 2 Jun 2022 19:26:48 +0000 (15:26 -0400)]
another follow-up for ncursesw and CURSES_UNICODE

Don't define CURSES_UNICODE without ncursesw being available

3 years agofollow-up on linux.370 ncursesw
nhmall [Thu, 2 Jun 2022 19:10:15 +0000 (15:10 -0400)]
follow-up on linux.370 ncursesw

3 years agouse ncursesw on linux for curses support of enhanced1
nhmall [Thu, 2 Jun 2022 18:43:46 +0000 (14:43 -0400)]
use ncursesw on linux for curses support of enhanced1

3 years agomore wish logging - show the result
PatR [Thu, 2 Jun 2022 14:51:54 +0000 (07:51 -0700)]
more wish logging - show the result

Extend the log event for a wish to include what was produced.  It
would be better to show the item as fully ID'd but then #chronicle
gives away information.

The backslash+newline pairs were inserted for this log message.  In
the game and in dumplog those two lines are each one wide line.  The
turn numbers shown are actually arbitrary since ^W takes no time.

|Logged events:
| Turn
|    1: wizard the chaotic male orcish Wizard entered the dungeon
|    2: made his first wish - "protection", got "a tattered cape"
|    3: made his first artifact wish - "blessed +2 rustproof magicbane",\
 got "an athame named Magicbane"
|    4: wished for "master key of thievery", got "a key named The Master\
 Key of Thievery"

3 years agopull request #768 - log declined wish or genocide
PatR [Thu, 2 Jun 2022 13:58:19 +0000 (06:58 -0700)]
pull request #768 - log declined wish or genocide

Pull request from vultur-cadens:  if a wish is declined by asking
for "nothing" or "none" or "nil", log that for gamelog/livelog as a
declined wish.  Likewise when specifying monster species or class to
genocide as "none" or "nothing" or ESC, log it as declined genocide.

Closes #768

3 years agoLivelog declined wishes and (non-cursed) genocides
vultur-cadens [Sat, 21 May 2022 04:32:08 +0000 (21:32 -0700)]
Livelog declined wishes and (non-cursed) genocides

3 years agorestrict stunning effect to is_xport trap types
nhmall [Thu, 2 Jun 2022 13:41:47 +0000 (09:41 -0400)]
restrict stunning effect to is_xport trap types

The issue first arose in commit 6a65b412.
Reported to devteam via email by entrez.

3 years agoanother lua warning bit
PatR [Wed, 1 Jun 2022 20:45:57 +0000 (13:45 -0700)]
another lua warning bit

I forgot to do this with yesterday's post garbage collection fix
update.  Record lua warnings in paniclog during normal play too, not
just when in wizard mode.

3 years agoclarify fixes entry
nhkeni [Wed, 1 Jun 2022 18:02:13 +0000 (14:02 -0400)]
clarify fixes entry

3 years agoMerge branch 'pr782' into NetHack-3.7
nhmall [Wed, 1 Jun 2022 16:41:26 +0000 (12:41 -0400)]
Merge branch 'pr782' into NetHack-3.7

3 years agoMerge branch 'fix-splev' of https://github.com/argrath/NetHack into pr782
nhmall [Wed, 1 Jun 2022 16:41:00 +0000 (12:41 -0400)]
Merge branch 'fix-splev' of https://github.com/argrath/NetHack into pr782

3 years agofixes3-7-0.txt update for pull request 782
nhmall [Wed, 1 Jun 2022 16:40:17 +0000 (12:40 -0400)]
fixes3-7-0.txt update for pull request 782

3 years agobear trap vanishes when poly'd hero fails to eat
nhmall [Wed, 1 Jun 2022 16:31:32 +0000 (12:31 -0400)]
bear trap vanishes when poly'd hero fails to eat

Closes #781

3 years agofix memory leaks related to selection_new()
SHIRAKATA Kentaro [Wed, 1 Jun 2022 12:38:51 +0000 (21:38 +0900)]
fix memory leaks related to selection_new()

selection_new() returns an address of malloc()'ed buffer.
If ov is null, this value is discarded without freeing the buffer.
To avoid this, move null-checks before calling selection_new().

Also, remove null-check of the return value of selection_new()
because it always returns non-null.

3 years agosend lua warnings to paniclog instead to player
PatR [Wed, 1 Jun 2022 08:03:11 +0000 (01:03 -0700)]
send lua warnings to paniclog instead to player

Now that the garbage collection problem has been fixed, record lua
warnings in the paniclog file rather than showing them on the screen.

Move nhl_warn()'s warnbuf[] to struct g in case restart ever gets
implemented so that it can be cleared if the restart occurred while
a warning message was under construction.

3 years agopaniclog fix
PatR [Wed, 1 Jun 2022 07:37:52 +0000 (00:37 -0700)]
paniclog fix

Writing lua warnings to paniclog (coming soon; tested without the
garbage collection fix in order to have test data) could crash on
the last pair.  Those are written after the 'nomakedefs' structure
had been freed so version_string was Null.

The NAO PANICLOG_FMT2 code triggered a warning about the test for
g.plname; it is array so will never be Null.

3 years agofixes entry
nhmall [Wed, 1 Jun 2022 01:56:40 +0000 (21:56 -0400)]
fixes entry

3 years agopatch from ToxicFrog
Rebecca Kelly [Tue, 31 May 2022 23:09:52 +0000 (19:09 -0400)]
patch from ToxicFrog

3 years agoanother re_alloc() bit
PatR [Tue, 31 May 2022 17:36:12 +0000 (10:36 -0700)]
another re_alloc() bit

realloc(NULL, size) is legitimate usage and nhrealloc() shouldn't
log a "<  0x00000000 __FILE__ __LINE__" entry for it.  heaputil
would complain about freeing Null.

3 years agofix up a couple of realloc comments
PatR [Tue, 31 May 2022 13:10:22 +0000 (06:10 -0700)]
fix up a couple of realloc comments

3 years agoattempt to autodetect homebrew and macports
nhmall [Tue, 31 May 2022 12:17:29 +0000 (08:17 -0400)]
attempt to autodetect homebrew and macports

If homebrew is detected, and if the homebrew ncurses package
is installed, the set things up to use it.

Hopefully, this works okay for everyone right away, but it may need
some tweaking.

3 years agoimplement realloc() for MONITOR_HEAP or vice versa
PatR [Tue, 31 May 2022 06:19:35 +0000 (23:19 -0700)]
implement realloc() for MONITOR_HEAP or vice versa

Add new routine 're_alloc()' that functions as MONITOR_HEAP-aware
libc realloc().  'nhrealloc()' is the version that passes source
file and line info if built with MONITOR_HEAP enabled.  The heaplog
data might now contain '<' (freed by realloc), '>' (replacement
allocation by realloc), and '*' (resized by realloc) entries in
addition to the previous '+' (allocated) and '-' (freed) entries.
heaputil has already been updated in the NHinternal repository.

Move FITSint_() and FITSuint_() from hacklib.c to alloc.c so that
they can be accessed by miscellaneous utility programs.

Remove three or four copies of FITSint_() that were duplicated in
utility programs like dlb and tile2bmp due to those not having
access to src/hacklib.o.  They do have access to src/alloc.o (and
util/panic.o).

3 years agoreplace leading tabs in several more files
nhmall [Mon, 30 May 2022 16:38:22 +0000 (12:38 -0400)]
replace leading tabs in several more files

3 years agoreplace leading tabs in several files
nhmall [Mon, 30 May 2022 16:09:35 +0000 (12:09 -0400)]
replace leading tabs in several files

3 years agotypo fix in fixes
nhmall [Sun, 29 May 2022 00:39:09 +0000 (20:39 -0400)]
typo fix in fixes

3 years agopull request #774 - 'just-picked' pseudo obj class
PatR [Sat, 28 May 2022 23:49:30 +0000 (16:49 -0700)]
pull request #774 - 'just-picked' pseudo obj class

Pull request from entrez:  fixes the combination of A and P for
menustyle:Full.  For menustyle:Traditional, it fixes selecting P for
putting stuff into a container.  Using P for multi-drop (D) already
worked and I haven't tried to figure out why the two commands behave
differently with just-picked.

Closes #774

3 years agoFix: loot regression, auto-select with justpicked
Michael Meyer [Fri, 27 May 2022 23:36:26 +0000 (19:36 -0400)]
Fix: loot regression, auto-select with justpicked

When using 'A'/autopick with the 'items you just picked up' category,
instead of autoselecting all items within that category, it selected
every item in your inventory (like it used to work before 3.7).  Just
blew up a bag of holding because of this.

While testing the fix for that, I noticed 'P' wasn't working at all
with menustyle:traditional -- you could select it as a filter, but it
didn't actually get applied to anything, so it would end up prompting
you for every item in inventory.  Fix both those things.

3 years agoupdate fixes3-7-0.txt for newcham() changes
nhmall [Sat, 28 May 2022 23:48:13 +0000 (19:48 -0400)]
update fixes3-7-0.txt for newcham() changes

3 years agoMerge branch 'pr775' into NetHack-3.7
nhmall [Sat, 28 May 2022 23:42:21 +0000 (19:42 -0400)]
Merge branch 'pr775' into NetHack-3.7

3 years agoswitch to using a flag parameter on newcham()
nhmall [Sat, 28 May 2022 23:35:48 +0000 (19:35 -0400)]
switch to using a flag parameter on newcham()

3 years agoMerge branch 'cancel-revert-msg' of https://github.com/copperwater/NetHack into pr775
nhmall [Sat, 28 May 2022 23:33:11 +0000 (19:33 -0400)]
Merge branch 'cancel-revert-msg' of https://github.com/copperwater/NetHack into pr775

3 years agosplit "act_on_act" into separate function
SHIRAKATA Kentaro [Sat, 21 May 2022 15:52:13 +0000 (00:52 +0900)]
split "act_on_act" into separate function

3 years agomore PR #771 - blast vs spell
PatR [Sat, 28 May 2022 21:09:31 +0000 (14:09 -0700)]
more PR #771 - blast vs spell

Add the patch from entrez to describe the tower of flame effect from
a scroll of fire as "the blast" rather than "your spell" if it reveals
a secret door.

3 years agodisplay lua warnings instead of ignoring them
PatR [Sat, 28 May 2022 19:49:08 +0000 (12:49 -0700)]
display lua warnings instead of ignoring them

This will be an annoyance for wizard mode until someone actually
figures out and fixes the problem.  The complaints from lua during
garbage collection aren't new, they were just being ignored before.

3 years agolua sandbox code reformatting
PatR [Sat, 28 May 2022 19:35:44 +0000 (12:35 -0700)]
lua sandbox code reformatting

Remove a ton of tabs in nhlua.c and add missing whitespace to a bunch
of 'if(test){' lines and to a few casts.

Also simplify? obj handling during garbage collection (does not fix
the current gc problem) in nhlobj.c.

3 years agoMerge branch 'pr776' into NetHack-3.7
nhmall [Sat, 28 May 2022 17:53:31 +0000 (13:53 -0400)]
Merge branch 'pr776' into NetHack-3.7

3 years agoMerge branch 'little-fixups' of https://github.com/copperwater/NetHack into pr776
nhmall [Sat, 28 May 2022 17:53:12 +0000 (13:53 -0400)]
Merge branch 'little-fixups' of https://github.com/copperwater/NetHack into pr776

3 years agoRemove unused "mazeflag" parameter from mkfount()
copperwater [Sat, 28 May 2022 14:42:14 +0000 (10:42 -0400)]
Remove unused "mazeflag" parameter from mkfount()

This parameter appears to have been in the code for a very long time,
but never used, since no version of NetHack I can find had mazes with
randomly placed fountains in them. Certainly isn't used now, so this can
be reduced to the same call to find_okay_roompos used by similar
functions such as mksink.

3 years agoUse RANDOM_CLASS instead of magic number 0 for mksobj_at()
copperwater [Sat, 28 May 2022 01:42:25 +0000 (21:42 -0400)]
Use RANDOM_CLASS instead of magic number 0 for mksobj_at()

3 years agoCorrection and clarification for "balk" math comment
copperwater [Sat, 28 May 2022 01:35:05 +0000 (21:35 -0400)]
Correction and clarification for "balk" math comment

Andrio pointed out at some point that the "below 25% HP: pet will not
attack at all" mentioned in this comment was wrong. It will not attack
*peaceful monsters* at all, but will still attack hostile monsters.

Also, the math behind the balk variable has confused several people,
thinking it's off by one and allowing the pet to attack one level higher
than stated. This is not the case, since it's the lowest level they
*won't* attack. Clarify that.

3 years agoFix a stray magic number in pick_lock
copperwater [Sat, 28 May 2022 01:26:58 +0000 (21:26 -0400)]
Fix a stray magic number in pick_lock

3 years agoUse looted rather than doormask when it pertains to a throne
copperwater [Sat, 28 May 2022 01:25:18 +0000 (21:25 -0400)]
Use looted rather than doormask when it pertains to a throne

They're both just aliases for rm.flags, but "doormask" doesn't mean
anything conceptual for a throne.

3 years agoRemove pointless lighting statement in Val-strt
copperwater [Sat, 28 May 2022 01:23:31 +0000 (21:23 -0400)]
Remove pointless lighting statement in Val-strt

The whole level was already lit up, so lighting up a smaller area of it
does nothing.

3 years agoHave newcham() give messages when monsters polymorph in more cases
copperwater [Fri, 1 Dec 2017 21:36:34 +0000 (16:36 -0500)]
Have newcham() give messages when monsters polymorph in more cases

This is a descendent of an earlier patch I wrote. The main idea is still
to clearly communicate to the player *what* something is turning into,
without the need to farlook afterwards, and give them the opportunity to
add MSGTYPE for when something jumps on a polymorph trap and becomes an
arch-lich. If it happens out of sight, the player also might get a whiff
of the monster's smell, giving a bit of advance warning.

There is one new case in here, in normal_shape(), which came about
because I noticed a weird message sequence: "The magic-absorbing blade
cancels the python!  You kill the chameleon!" with no intervening
message indicating the python reverted to a chameleon.