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.
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"
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
PatR [Fri, 27 May 2022 22:28:49 +0000 (15:28 -0700)]
couple of is_clinger bits
The grounded() macro wasn't fully handling is_clinger(). Not sure
what impact this fix will have.
Add ability to cling to the ceiling to enlightenment feedback. If
it gets fixed up to a state where it is useable while polymorphed,
some or all of it should be moved to non-magic ^X feedback.
nhmall [Fri, 27 May 2022 20:41:46 +0000 (16:41 -0400)]
writing type-named scrolls pr#551
entrez commented in https://github.com/NetHack/NetHack/pull/551 on Jul 16,
2021:
"When using a marker, it is possible to write a scroll based on the
type-name assigned to it by the user. Somewhat unintuitively, this
system broke down if the assigned name was identical to the real name of
a scroll type: trying to write a scroll by its previously-assigned name
'scare mon' or 'id' would be guaranteed to succeed, but this wouldn't be
the case if the user-assigned name was 'scare monster' or 'identify'.
Revise dowrite(write.c) to prefer a user-assigned type-name to the
real name of a scroll that isn't already formally known, while
continuing to prefer the real name of an identified scroll to both."
Michael Meyer [Fri, 27 May 2022 18:54:35 +0000 (14:54 -0400)]
Fix: mdisplacem stoning and gloves
Apparently this is a bug that's existed since mon-vs-mon displacement
was introduced in 2003 (in 89c785e): if a monster displaced a footrice,
having gloves on would make it vulnerable to being stoned, while having
bare hands would protect it. Switch it around so wearing gloves blocks
petrification, as it does under other circumstances.
Also add a message explaining why the displacing monster was stoned (if
the displacement attempt is visible to the hero), so the "Foo turns to
stone!" message has some context.
PatR [Wed, 25 May 2022 19:38:07 +0000 (12:38 -0700)]
github pull request #772 - displaying new glob
If a monster killed a pudding, the resulting glob was dropped on
the map but might now be shown depending upon interaction--or lack
of such--with nearby globs.
The commit also changed the indentation of a label; I've reversed
that. Having labels always be indented one space means there's
no need to look into nested blocks to find them. But having no
indentation at all interferes with GNU diff (which is used for git
diff) showing the function that a band of changes occurs in (done
by augmenting the change bars in front of the band). That is based
on the most recent preceding line having a letter in the leftmost
column. Back when we had K&R-style function definitions which
didn't indent their arguments, that diff feature wasn't useful.
But after switching to ANSI-style definitions it is--except when an
unindented label interferes.
Michael Meyer [Wed, 25 May 2022 17:24:47 +0000 (13:24 -0400)]
Fix: invisible pudding globs
When a pudding was killed by a monster (player-caused deaths were exempt
because of a 'backup' newsym call in xkilled), and the resulting glob
ended up on the pudding's square (whether because there were no adjacent
globs, or because the adjacent glob merged into the new one rather than
vice-versa), the glob wouldn't be drawn onto the map until the squre was
redrawn with ^R or similar. This was because the early return for globs
in make_corpse skipped the typical newsym call near the end of the
function.
In this commit I just added a newsym call to the glob case in
make_corpse, but adding a newsym call to monkilled as a guard against
similar cases (equivalent to the one in xkilled) seems like a possible
extension. I wasn't sure if there's a particular reason it's not
included in monkilled, so I didn't mess with it.
PatR [Wed, 25 May 2022 19:30:48 +0000 (12:30 -0700)]
timer code readability
Something else noticed while looking for something unrelated. The
original code is correct but I think the revised code is a little
easier to take in when looking at it.
PatR [Wed, 25 May 2022 19:20:48 +0000 (12:20 -0700)]
maybe_finished_meal() comment bit
An end of line comment that spans multiple lines needs to start the
continuation line(s) with '*' or clang-format will convert it into
a block comment that follows the initial line.
foo(); /* call foo
but not bar */
would become
foo();
/*
* call foo but not bar
*/
however
foo(); /* call foo
* but not bar */
would stay as-is.
All that for a one-line change, and then I've changed this particular
instance to be
/* call foo but not bar */
foo();
There are lots of these that should eventually be fixed. I just
happened to notice this one when looking for something else.
PatR [Tue, 24 May 2022 00:49:37 +0000 (17:49 -0700)]
more github issue #771 - feedback for oil potion \
explosion that reveals a secret door
Make the fix to feedback when an exploding potion of oil reveals a
door and then destroys it not affect other zap_over_floor feedback.
This incorporates the followup comment from entrez.
PatR [Mon, 23 May 2022 18:31:48 +0000 (11:31 -0700)]
named fruit vs glob bit
3.7 has a new size prefix for globs that 3.6 didn't. The code that
decides whether player is naming slime molds after an actual object
needs to know about it.
PatR [Mon, 23 May 2022 18:19:38 +0000 (11:19 -0700)]
zap.c non-zap buglets
A couple of things I noticed when trying--and failing, so far--to figure
out the revive panic:
1) revive() treated y==0 as out of map bounds (x==0 is out of bounds
but y==0 isn't);
2) get_mon_location() might yield stale coordinates for steed (but
moot since that's only used for mobile lights and no light emitting
monster can wear a saddle; didn't affect light emitting objects
carried or worn by monsters).
PatR [Sun, 22 May 2022 07:21:58 +0000 (00:21 -0700)]
tweak #wizkill
When using 'm #wizkill' to kill monster(s) off without giving the
hero any credit or blame, temporarily force context.mon_moving On
so that collateral damage (other monsters killed by targetted gas
spore's explosion) also don't give the hero any credit or blame.
Make sure that some message identifying the monster is given when
targetted monster is killed even if hero can't see or sense it.
PatR [Sun, 22 May 2022 00:40:52 +0000 (17:40 -0700)]
add new #wizkill command
Add a way to get rid of specific monsters in wizard mode without
fighting, zapping, &c. #wizkill command lets you kill creatures by
picking them with getpos().
You can pick multiple monsters by targetting them one after another.
You don't have to be able to see or sense them but if you target a
spot that has no monster, the command ends.
By default, the hero gets credit or blame as if having killed the
targets but #wizkill can be preceded by 'm' prefix to treat their
deaths as if they had been caused by a monster.
PatR [Sat, 21 May 2022 22:19:48 +0000 (15:19 -0700)]
wizard mode wishing bit
I meant to wish for a "wand of cold" and accidentally typed "wand of
ice". Instead of being told that there's no such thing or receiving
a random wand, the spot I was standing on was changed to ice.
Only check for a terrain-change wish if an object class hasn't been
stripped from the wish text.
Michael Meyer [Fri, 20 May 2022 20:40:57 +0000 (16:40 -0400)]
Handle -eaux plurals in makeplural/makesingular
I noticed a comment about -eau pluralizing as -eaux, e.g. "gateau" ->
"gateaux", was not consistent with the actual output of makeplural.
Same thing with "VAX" -> "VAXen" in the line below it; they're very old
comments, so maybe they were originally meant to point out some plurals
makeplural got wrong? Since they predate the addition of "oxen" and
"geese" to one_off[] (and the array itself), it seems like the other
special cases mentioned in the comments would also have been wrong at
the time they were written.
Address this horrifying pastry-related oversight by adding handling for
'-eaux' plurals to makeplural, with an exception for 'bureau' (plural
'bureaus'; according to the dictionary, 'bureaux' is an acceptable
variant but 'bureaus' is more common, at least in American English).
There's also an exception for 'Bordeaux' (as in a bottle of the wine),
since the singular and plural are the same.
A bit surprised this wasn't already in there, since 'gateau' is a real
food item and seems like a much more likely fruit name than some of the
inedible items makeplural has special rules for.
Also add " au " to compounds[] in singplur_compound, so that 'gateau au
chocolat' will pluralize correctly to 'gateaux au chocolat'. Without
that change, the result is 'gateau au chocolats'.
PatR [Thu, 19 May 2022 21:40:27 +0000 (14:40 -0700)]
lua 'index'
Having the preprocessor rename a variable called 'index' to one
called 'strchr' is not the source of any bugs (in execution; it can
cause pain when trying to ask a debugger to display the value and
then be told no such thing exists). Change the name to 'indx' to
avoid any confusion.
If we switch to strchr() we should still avoid using 'index' as a
variable name.
PatR [Wed, 18 May 2022 08:17:14 +0000 (01:17 -0700)]
context-sensitive inventory item-action split
When picking an item from inventory and then picking 'I - adjust
inventory by splitting this stack' in the item-action menu,
yn_function("Split off how many?") is used to start getting the
count without needing to wait for <return>. It includes the response
in message history (so review of history will see that first digit).
The code then uses get_count() to obtain any additional digits. Tell
the latter to store "Count: N" in message history if N is different
from the first digit.
That's not as good as updating message history to replace the entry
showing the prompt with the first digit with one that shows the full
count but at least it's accurate when the count is 10 or more.
PatR [Tue, 17 May 2022 23:52:06 +0000 (16:52 -0700)]
restoring in Gehennom
When a game is restored while hero is Gehennom, give the "It is hot
here. You smell smoke..." message after the welcome back message.
For both entering Gehennom and restoring there, switch from "smell" to
"sense" in the second part of that message if poly'd into a form that
doesn't have sense of smell.
Some unrelated stuff that got caught up in this diff:
1) move welcome()'s call to l_nhcore_call() to the start of the routine
instead of placing that after a potential early return;
2) remove a redundant glyphmap flags reset line; the routine being
called starts by setting its flags field to 0 for level change so
caller doesn't need to do that;
3) look_here() is just a formatting bit.