Bart House [Sun, 27 Oct 2019 03:09:14 +0000 (20:09 -0700)]
Modified travis builds to deploy the x86 windows build to github if tagged.
Moved the travis visual studio build bash script to live outside of
the travis YML file. Updated the script to use powershell to generate
ZIP file form the binary results.
Deploy Windows build ZIP file to github releases if build has commit
has been tagged. Build will be marked pre-release.
PatR [Sun, 27 Oct 2019 02:01:49 +0000 (19:01 -0700)]
paranoid_query bulletproofing
Make paranoid_query() (yn question requiring explicit "yes" answer)
protect itself from overly long prompt strings. I'm not aware of
any specific overflowing queries so I temporary reduced QBUFSZ within
paranoid_query() in order to test.
For EDIT_GETLIN, don't use previous response as default if we loop
after neither "yes" nor "no" was given for paranoid confirm.
PatR [Sat, 26 Oct 2019 06:11:06 +0000 (23:11 -0700)]
fix github issue #238 - 'scores' option
Fixes #238
For the three fields in the 'scores' option's argument: top, around,
and own, if any was separated from preceding one by space(s) rather
than slash and lacked a count prefix, the argument parsing skipped
over it. So "10t/3a/o" and "10t 3a 1o" worked but "10t 3a o" ignored
the 'o'. The issue report was about 'own' but there's nothing special
about 'own' itself; just that it doesn't warrant a count prefix and is
usually last (in other words, normally preceded by one or both of the
other two) so more likely to trip over this.
[I thought there was another report about 'scores' misbehaving (from
quite a while ago) but couldn't find one. If it exists, it might have
been about the same thing.]
PatR [Sun, 20 Oct 2019 00:38:27 +0000 (17:38 -0700)]
mimicking slime molds
Mimic-as-slime_mold needs to keep track of the fruit index the same
way that mimic-as-corpse keeps track of corpse's monster type. The
mimic description was changing (for '/' and ';' feedback) whenever
the player assiged a new fruit name.
That wasn't noticeable when applying a stethoscope because
mimic-as-slime_mold always yielded "that fruit is really a mimic".
Change it to report the fruit's type instead of generic "fruit".
PatR [Sat, 19 Oct 2019 01:23:47 +0000 (18:23 -0700)]
symset and roguesymset options
For 'O's menu, make the current symbol set be pre-selected so that
the set in use is clearly marked while contemplating changing it.
Using Return or Enter will pick it again; Escape is now needed to
deliberately not make any selection.
Also, change several symbol set initializations to use the new method
of deciding whether the default symbols are still in place.
PatR [Fri, 18 Oct 2019 22:00:16 +0000 (15:00 -0700)]
containers in shops
Fix a couple of bugs I stumbled across while testing something else.
The sell prompt for a container dropped in a shop had phrasing issues.
This fixes a couple but there are more. The message composition
assumes that contents fall into two categories: those already owned
by the shop and those the shopkeeper is offering to buy from the hero.
But there is a third: stuff the shopkeeper doesn't care about so
won't buy. The count_contents() routine can supply total contents or
shop-owned contents. Subtracting one from the other yields combined
hero-owned without any way to separate out shk-cares and don't-care.
PatR [Fri, 18 Oct 2019 01:45:56 +0000 (18:45 -0700)]
fix #H9312 - partly eaten food in bones shop
Dying in a shop while carrying partly eaten food would place that food
on the floor without marking it no_charge. But marking it that way
wouldn't have helped because as bones data gets saved, every object on
the level has its no_charge flag cleared. So 'no_charge' needs to be
explicitly set for partly eaten food in tended shops as a bones level
gets loaded.
Most of the shk.c diff is reformatting, but it does change the
get_pricing_units() routine to lie that the quantity is zero for
partly eaten food so that when multiplying with price it won't matter
whether the price has been forced to zero or been left non-zero.
PatR [Thu, 17 Oct 2019 22:50:33 +0000 (15:50 -0700)]
zap colors
One of the comments for pull request #234 mentions that the colors
for sleep and poison are backwards. Yellow dragons had green breath.
Green dragons would have had yellow breath if they used the normal
zap symbols, but they use the poison cloud one which is green so
they had green breath. I rarely have color enabled and had never
noticed. (At the moment I can't find where the switch from zap to
cloud is being done.)
Pull request #234 is based on #231, about control of the shield
effect animation when resisting. But it changes struct flags so
would break 3.6.x save file compatibility.
PatR [Thu, 17 Oct 2019 21:38:45 +0000 (14:38 -0700)]
github pull request #235 - curses symbol set init
Fixes #235
For initial options under curses, specifying 'DECgraphics' as a
boolean rather than as 'symset:DECgraphics' wasn't overriding the
new default 'symset:curses'. Since previously DECgraphics was
rejected for curses, it's possible that no one noticed.
PatR [Thu, 17 Oct 2019 12:07:03 +0000 (05:07 -0700)]
couple of curses symbol handling bits
Primary and rogue symbols were being set to default if primary hadn't
been given a value, possibly clobbering rogue symbols if those had
been given a value. Initialize them independenly.
Return early from curses_convert_glyph() if the value doesn't have
the 8th bit set since it now deals exclusively with DECgraphics
handling. Force a sane value for returning early on rogue level.
PatR [Thu, 17 Oct 2019 12:00:58 +0000 (05:00 -0700)]
symbol set reorganization
Change the way symbol sets are loaded to make them have the same order
as they appear in the symbols file rather than being reversed.
Revise dat/symbols so that the new ordering yields a result similar
to the old ordering, more or less. I've added a few set descriptions.
The only substantive change is marking DECgraphics as primary-only
(not available on rogue level) and adding new set DECgraphics_2 which
is commented out near the end.
Define symbol handling H_MAC since one of the sets specifies
'handling: MAC'. All H_MAC is used for now is to avoid showing
MACgraphics as a symset when compiled without MAC_GRAPHICS_ENV (which
was used for pre-OSX Mac by the old code in sys/mac/), so it will be
hidden for everyone.
I left handling H_CURS even though curses doesn't implement anything
for it. It could do something when rendering the map or assign a
function to 'cursesgraphics_mode_callback' for special init or both
but hasn't needed to. Since curses is now supporting DECgraphics,
define 'decgraphics_mode_callback' for it. No value is being
assigned so that doesn't do anything; curses seems to be setting up
the primary character set as text and secondary one as line-drawing
without the need for that hook.
With the added set descriptions, 'O's symset menu looked horrible for
curses due to the way curses decides to set the width of menus and
the resulting line wrapping which took place because of a too-narrow
menu. I've added a chunk of code to the options handling code which
shouldn't really be there but makes the menu much easier to read.
PatR [Mon, 14 Oct 2019 09:28:27 +0000 (02:28 -0700)]
fix use_inverse (aka wc_inverse) for curses
Highlighting for monsters shown due to extended monster detection and
for lava shown in black and white didn't work because that keys off
of 'iflags.use_inverse' (actually a macro for 'iflags.wc_inverse') and
curses wasn't enabling that window-capability option. To be fair, it
was probably unconditional at the time the curses interface was first
developed. It checked for whether a monster was supposed to be drawn
with inverse highlighting but wouldn't draw it that way because the
flag was always false. Inverse b&w lava is relatively new and curses
hadn't been taught about it.
Various other things such as pets (if hilite_pet is on) and object
piles (if hilite_pile is on) get highlighted with inverse video when
use_color is off, regardless of whether use_inverse is on or off.
That's probably a bug.
PatR [Mon, 14 Oct 2019 00:41:24 +0000 (17:41 -0700)]
pull request 229/#H9299 - DECgraphics for curses
Fixes #230
Incorporate github pull request #230, support for DECgraphics-style
line drawing in the curses interface. I've rewritten the
curses_convert_glyph() part so that it doesn't require C99 and
doesn't reinitialize its pair of arrays for every character written
to the map. The DECgraphics conversion is now a straight char for
char one, DEC line drawing code to ACS, without regard to what map
symbol is intended or what 'cursesgraphics' uses for that symbol.
Pasi Kallinen [Sun, 13 Oct 2019 17:40:54 +0000 (20:40 +0300)]
Fix launched object accessing a deleted trap
In launch_obj, the code first got the trap, then called ohitmon
(which can delete the trap by doing mondied -> fill_pit ->
flooreffects -> deltrap), then after that used the trap variable.
Pasi Kallinen [Sun, 13 Oct 2019 16:16:38 +0000 (19:16 +0300)]
Fix hero hiding under a statue shattered by land mine
Trigger a land mine while being polymorphed into a monster that
automatically hides (eg. scorpion). Have the statue on the land mine
shatter and all items on that square scatter away. Avoid falling
into the pit left by the land mine.
PatR [Sat, 12 Oct 2019 22:33:57 +0000 (15:33 -0700)]
fix part of #H9299 - DECgraphics symset comments
For the DECgraphics symbol set, down ladder is the greater-than-or-
equal-to character as intended and up ladder is less-than-or-equal-to,
but comments in dat/symbols had their descriptions transposed.
PatR [Sat, 12 Oct 2019 09:31:47 +0000 (02:31 -0700)]
fix #H9298 - corpse mismatch
Corpses for dying monsters were being created with the wrong type,
caused by incorrect block nesting for 'if (ptr)' from commit ad302fb8a99a5795c4d206870ea6573349b2d92a (Oct 10).
PatR [Sat, 12 Oct 2019 01:33:32 +0000 (18:33 -0700)]
South Park reference - gnomes' business plan
If you chat with a peaceful gnome while hallucinating, you might
get a silly message from the TV show South Park.
To make it work for non-gnome characters, I changed the speech of
monsters who normally just grunt (gnomes, orcs, ogres, a couple
of other groups) to full humanoid when the hero is hallucinating.
(It already does that for orcs if the hero--hallucinating or not--
is an orc and for gnomes when the hero is a gnome.)
Pasi Kallinen [Fri, 11 Oct 2019 17:11:24 +0000 (20:11 +0300)]
Fix vault guard impossible
... when the guard is angry, and he's in the vault or in his corridor,
you're not in the vault nor in his corridor, and the level is full
so the guard cannot relocate.
PatR [Fri, 11 Oct 2019 00:43:31 +0000 (17:43 -0700)]
mksobj failure
If mksobj() was told to initialize the object it's creating and the
object class was something it didn't understand, it would issue a
warning and return Null. But an unknown object class is a severe
internal error and very few callers were prepared to deal with a
Null result, so change mksobj() to panic instead. Also eliminate the
few attempts to deal with Null result that are present in mkobj.c;
I didn't go looking elsewhere.
PatR [Wed, 9 Oct 2019 20:18:34 +0000 (13:18 -0700)]
curses on unix - terminal reset needed after abort
Noticed while investigating the message loop. If I had level files
from an interrupted game and was asked "Destroy old game?" when
starting a new one, answering 'n' left the terminal in an unusable
state. Executing 'stty sane' (invisibly since input echo was off)
repaired things but the user shouldn't have to do that.
Change unixtty.c's error() to shut down windowing if that has been
initialized. This might need some tweaking for tty, which will now
clear the screen before showing the startup error message. Other
systems besides unix use unixtty.c so are affected, but I think the
change doesn't introduce anything that should cause trouble (aside
from the potential screen erasure).
PatR [Tue, 8 Oct 2019 21:23:27 +0000 (14:23 -0700)]
fix #H9266 - redundant obj init
Sword given to angels used obj->spe = max(obj->spe, rn2(4)) [except
using a temporary to sanely work with max() macro]. But the obj was
explicitly created as no-init, so obj->spe was always 0 and the max()
was pointless. Shield given to angels was manipulating bless/curse
state directly instead of using the functions intended for that, a
no-no and also pointless to be clearing 'cursed' for a no-init item.
Mace for priests had useless handling for object creation failure.
Object creation failure could only happen if the mksobj() call had a
valid entry in objects[] (or out of bounds access that didn't crash)
for an object class that it doesn't know how to handle. That can't
happen unless somebody screws up big time. If it ever did happen,
it would have produced a memory leak.
PatR [Tue, 8 Oct 2019 20:26:39 +0000 (13:26 -0700)]
W_WEAPON -> W_WEAPONS
Report #H9243 misinterpreted W_WEAPON as W_WEP and attributed a
hypothetical ball and chain sanity checking problem to that.
Rename the former to W_WEAPONS to emphasize that it includes
alternate/secondary weapon and quivered stack as well as wielded
weapon.
Pasi Kallinen [Tue, 8 Oct 2019 16:44:51 +0000 (19:44 +0300)]
Fix ball and chain sanity
Scatter did not consider the ball or chain, and moved them around, causing
ball and chain sanity error.
One way to trigger was being punished, with chain on a land mine and having
a monster trigger the mine. Now the chain will shatter, unpunishing the hero.
PatR [Mon, 7 Oct 2019 21:44:32 +0000 (14:44 -0700)]
more unix username (#26 - validating #explore)
I had this in place at one point but must have accidentally undone it
before deciding that yesterday's patch was finished. Defer fetching
'pw' until it's needed.
PatR [Mon, 7 Oct 2019 00:30:18 +0000 (17:30 -0700)]
fix github pull request #26 - validating #explore
Fixes #26
Report stated that the attempt to look up the player's username
(on Unix) failed (reason unknown) and nethack refused to allow the
player to execute the #explore command even though sysconf was set
to use character names (CHECK_PLNAME=1) instead of user names.
Setting EXPLORERS to "*" overcomes this glitch, but the fix moves
a bit of code around to honor CHECK_PLNAME before fetching username
so that that isn't necessary.
I ended up doing some formattng clean up (replace tabs with spaces,
whitespace cleanup in 'port_insert_pastebuf()'). The actual change
to fix #26 is only a few lines.
nhmall [Sun, 6 Oct 2019 02:17:48 +0000 (22:17 -0400)]
tty condition_size() name and return value
the return value from condition_size() was unused so
eliminate an unused variable warning and rename the function
to better reflect that it updates tty_status[NOW][BL_CONDITION].lth
PatR [Sat, 5 Oct 2019 23:49:34 +0000 (16:49 -0700)]
tty xputc()
Another part of github issue 227. Casting a function pointer when
passing it to another function is iffy when lying about the return
type. tputs() expects a routine which returns int, so give it one.
Other xputc() usage is equivalent to putchar(), so define xputc()
with the same function signature as that has.
The tputs() declarations in system.h should probably be changed
(third argument is a function which takes an int rather than
unspecified parameters) but I've left them alone. I made that change
to tputs() in sys/share/tclib.c though.
NT and MSDOS changes are untested. tclib.c compiles ok with clang-
as-gcc on OSX but hasn't been tested with the port that uses it (VMS).
PatR [Sat, 5 Oct 2019 23:42:13 +0000 (16:42 -0700)]
fix pull request #227 - running over engravings
Fixes #227
Travel, <ctrl><direction>, <g|G><direction> all stop on engravings,
but <shift><direction> told the player what the engraving said and
kept going. The message output is buffered until map update or
another message, so player couldn't tell where hero was at the time
the engraving got shown. Make <shift> running stop on engravings.
PatR [Sat, 5 Oct 2019 06:55:49 +0000 (23:55 -0700)]
no-return usage in dlb_main.c
More from github issue 229: mark routines in util/dlb_main.c which
don't return as such and add some 'break' statements for compilers
that don't have support for that.
PatR [Sat, 5 Oct 2019 00:28:32 +0000 (17:28 -0700)]
potion mixing - healing vs "bad" potions
Another part of github issue 229, mixtype() didn't have either 'break'
or '/*FALLTHRU*/' separating healing from extra healing, extra healing
from full healing, and full healing from unicorn horn. So dipping
"bad" potions (sickness, confusion, blindness, hallucination) into
healing/extra healing/full healing or vice versa operated the same as
dipping a unicorn horn into the bad potion (producing fruit juice for
sickness and water for the others). It wasn't clear from the code
whether or not that was intentional. It actually seems reasonable
(albeit suboptimal use of {plain, extra, full} healing), so continue
to allow it and make the code clear that it's intentional.
PatR [Fri, 4 Oct 2019 23:37:14 +0000 (16:37 -0700)]
sortloot of tools
Fix the first part of github issue 229. sortloot_classify() tries to
group musical instruments separately from other tools, but missing
'break' in a 'switch' prevented that from happening--they were mixed
together.
Since that grouping isn't documented anywhere, only source divers
would ever notice that it wasn't working as intended.
PatR [Fri, 4 Oct 2019 23:12:08 +0000 (16:12 -0700)]
fix #H9272 - "object lost" panic
when polymorph causes loss of levitation boots or water walking boots
while over water. If discarding stuff while trying to crawl out got
rid of the taken-off boots, they wouldn't be in inventory any more
when break_armor() tried to drop them after taking them off.
PatR [Fri, 4 Oct 2019 22:16:51 +0000 (15:16 -0700)]
fix 'b&c distance' sanity check warning
when attempting to crawl out of water fails and hero is life-saved
or wizard-/explore-mode player declines to die. If the hero is saved
by positioning him/her one step further away from ball and chain,
teleds() tries to drag them, but if 'emergency disrobe' left the hero
stressed or worse, dragging fails. Ball and chain were being left
where they were, with chain no longer being adjacent to hero.
If drag_ball() fails, have teleds() teleport ball and chain to hero's
new spot, same as when that isn't within range of a one step drag.
PatR [Thu, 3 Oct 2019 22:45:43 +0000 (15:45 -0700)]
fix #H9269 - potential panic due to window slots
A couple of early returns could result in temporary windows getting
left around instead of being released for re-use, which in turn might
lead to a panic due to lack of available window slots. The first
one is accompanied by an 'impossible' warning which no one has ever
reported and the second one could only happen if data file 'keyhelp'
was missing, so panic due to either of these is hypothetical as far
as released versions go. Somebody making modifications could run
afoul of either of them though.
query_category() - switch from early return to 'goto' so that the
temporary window used for a menu will always be destroyed;
whatdoes_help() - defer creating the display window until after the
data file has been successfully opened so that early return won't
need any window cleanup.
One major limitation of the autopickup exception system is that you can't
define an exception from an exception, despite both menucolors and msgtypes
prioritizing rules based on the order they are defined in .nethackrc. This
is because the "always pickup" and "never pickup" exceptions are tracked in
different lists, and at runtime, when the player steps over an object, the
game checks these lists seperately, with "never pickup" taking precedence.
This means that if you want to pick up some but not all items matching a
given expression, you may need to write a long and kludgy list of regexes
to get the behavior you want.
I've edited the autopickup exception code to remove this necessity: now
the exceptions are stored in one list, and conflicts between them are
resolved based on their relative position in that list. Whether an
exception was inclusive or exclusive was already tracked individually;
I don't know why they were stored separately in the first place. This
edit makes the system both more convenient and more consistent with the
semantics of menucolors and msgtypes.
With these changes, the 33 autopickup exception rules in the wiki article
linked above may be replaced with the following 7 much simpler rules for
the exact same effect:
fix errant verb tense in some messages if pet or mon name ends in 's'
Report stated:
"Poes deliberately slither onto a polymorph trap!" ... it's only one cat, er,
black naga. Why does the parser treat the name as plural? There are lots of
singular words and names that end in -s or -es!
Reported directly to devteam rather than via the web contact form:
throwing wielded aklys while swallowed would hit the engulfer and
return to the hero's hand but leave a stale 'thrownobj' pointer if
the monster survived. Under usual circumstances, throwing anything
else or throwing the aklys again when not engulfed would clear that
pointer, putting things back to normal. However, killing any engulfer
with the same weapon would try to add it to engulfer's inventory to
be dropped as it died. If the killing blow was via melee rather than
another throw, the object in question would still be in hero's
inventory instead of free, hence panic.
The initial returning-aklys implementation shared Mjollnir's code
which doesn't have this issue. This reverts from having attached
aklys always returning successfully when thrown while swallowed to
Mjollnir's 99% chance of return and 99% to be caught when it does
come back. (That was already the case if the engulfer was killed by
the throw, where hero wasn't swallowed anymore after the damage was
inflicted.)
Zapping wand of opening or spell of knock at self while trapped:
"You are released from pit."
ought to be
"You are released from the pit."
Likewise for most of the other held-in-place situations.
Also, when released like that vision wasn't being recalculated right
away to update line of sight to reach beyond the edge of the pit.
The touchstone code treated all rings as if they had gemstones, but
quite a few don't and feedback could be unexpected. Cited case was
an iron ring yielding a cyan (hi_metal) streak instead of the normal
iron result ("scritch, scritch"). A gold ring yielded a yellow
streak rather than a golden scratch. I didn't test silver ring but
suspect it yielded a silver streak rather than a silvery scratch.
This changes touchstones to treat non-gemstone rings like other
classes of objects instead of like gems. I made mineral rings keep
acting like gemstone rings--I'm not sure whether that's right.
Routine unfixeable_trouble_count() is used for both applying a unicorn
horn (possibly internally via #monster if poly'd into a unicorn) and
drinking a blessed potion of restore ability. For the latter case, it
always gave the wrong answer (unless the hero happened to be all of
Sick and Stunned and Confused and Hallucinating and Vomiting and Deaf).
Since the actual count wasn't used to decide whether hero felt "great"
or just "good", having any of those conditions would hide the problem.
A github pull request changed one of the fake mail messages so that
our web site's URL is added at compile time instead of being hard-
coded. However, it wouldn't compile with a pre-ANSI compiler since
it relied on concatenating adjacent string literals. This is more
complex but achieves the same result, and also makes the existing
run-time subsitution be a bit clearer.
use faster method to write characters to VGA in msdos port
chasonr's comments in github pull request #220:
It was necessary, when updating the MS-DOS port for 3.6, to revise the
screen-clearing and character-drawing functions, because the background
color is no longer zero. But the 3.6.1 method is rather slow, using
write mode 2 and a lot more calls to outportb.
outportb is expensive when running under a virtual machine, the typical
use case for the MS-DOS port these days, because it traps to the
hypervisor rather than actually writing to hardware.
This change restores the speed of the 3.4.3 version. The adapter is left
in write mode 0. Clearing is accomplished by writing zero to planes where
the background color has a zero bit, and 0xFF where the background color
has a one bit. Characters are drawn by writing 0x00, 0xFF, the font data,
or the inverse of the font data, as appropriate, to each plane.
When testing, be sure to use OPTIONS=videomode:vga, because autodetect
will go to VESA mode if it can.
Hallucinating hero has 75% to be unaffected by a gaze counterattack
that paralyzes. Check for that before checking free action (100%
chance to be unaffected). The only change is that player might get
different feedback when both forms of protection against the gaze.
Subject was 'Bad loop condition in sp_lev.c'. Some object creation
code had handling for something that couldn't happen due to the logic
leading up to it. I couldn't figure out any way to make it useful so
just remove the dead code.
Feedback when spellcasting monster aimed at the wrong spot due to not
being able to see an invisible hero only gave the intended message if
hero couldn't see self. The code was using 'if (Invisible)' which
checks whether the hero is invisible and can't see invisible, when it
should have been using 'if (Invis)' which just tests whether the hero
is invisible.
It wouldn't surprise if the same problem occurs elsewhere. Those
macros are rather error prone.
The issue report mentions that one of the affected messages might be
unreachable. I didn't investigate that.
Have the 'menucolors' option control menu color pattern matching
(instead of curses-specific 'guicolor') for all menus, not just for
the persistent inventory window.