Commit Graph

8618 Commits

Author SHA1 Message Date
PatR
659b3ce9a7 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.
2019-10-07 14:44:32 -07:00
PatR
80d3abcf00 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.
2019-10-06 17:30:18 -07:00
nhmall
193f8c39bd clear up some reported curses warnings 2019-10-06 09:07:49 -04:00
nhmall
57d87db92c 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
2019-10-05 22:17:48 -04:00
PatR
0d76f68f2c 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).
2019-10-05 16:49:34 -07:00
PatR
f7bf56555e 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.
2019-10-05 16:42:13 -07:00
PatR
a9e8348dfa 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.
2019-10-04 23:55:49 -07:00
PatR
8443f73265 glob pricing
get_pricing_units() returns a long, so use long for intermediate steps
of the calculation.  Part of github issue 229, about mixing signed and
unsigned.
2019-10-04 17:53:01 -07:00
PatR
c6b7540712 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.
2019-10-04 17:28:32 -07:00
PatR
f11f4de057 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.
2019-10-04 16:37:14 -07:00
PatR
f3bc5e5c78 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.
2019-10-04 16:12:08 -07:00
PatR
8fa38ec8fb 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.
2019-10-04 15:16:51 -07:00
PatR
d9a1bbb203 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.
2019-10-03 15:45:43 -07:00
nhmall
455c3fbf62 update README.linux
closes #118
2019-10-02 15:22:14 -04:00
nhmall
5400c6796a yet more orc obj init 2019-10-02 14:58:21 -04:00
nhmall
c10bd97e1a more orc obj init 2019-10-02 14:55:28 -04:00
nhmall
acf45be503 Guidebook.txt update 2019-10-02 10:56:39 -04:00
nhmall
59effabd73 Revert "Guidebook.txt update"
This reverts commit df7e6a0f2a.

stamped with incorrect version
2019-10-02 10:50:04 -04:00
nhmall
df7e6a0f2a Guidebook.txt update 2019-10-02 10:47:47 -04:00
nhmall
38b529c3e7 fix a Guidebook.tex bit just noticed 2019-10-02 09:46:30 -04:00
nhmall
1df652683e allow orctown booty items to be initialized in mksobj 2019-10-01 21:06:07 -04:00
nhmall
e520071f52 update guidebook 2019-10-01 19:57:04 -04:00
nhmall
72252d5dc6 follow-on bits 2019-10-01 17:47:45 -04:00
nhmall
29946b551b autopickup exception priority in pull request 226
The pull request #226 commentary follows:

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:

AUTOPICKUP_EXCEPTION=">.* corpse.*"
AUTOPICKUP_EXCEPTION="<.* newt corpse.*"
AUTOPICKUP_EXCEPTION="<.* lichen corpse.*"
AUTOPICKUP_EXCEPTION="<.* lizard corpse.*"
AUTOPICKUP_EXCEPTION="<.* floating eye corpse.*"
AUTOPICKUP_EXCEPTION="<.* wraith corpse.*
AUTOPICKUP_EXCEPTION=">.*\>.*"

closes #226
2019-09-30 10:54:03 -04:00
nhmall
657b65bd3c Merge https://github.com/Vivit-R/NetHack into Vivit-autopickup-exceptions-3.6 2019-09-30 10:48:18 -04:00
HMM
ca95246903 Remove redundant function "count_ape_maps" 2019-09-30 02:12:06 -04:00
HMM
1f5e619887 Delete unusued local variable 2019-09-27 15:42:50 -04:00
HMM
f68561fbe1 Fix check_autopickup_exceptions to return null pointer if no exception is found 2019-09-27 15:17:53 -04:00
nhmall
da6c393e43 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!

H9249 1780
2019-09-26 11:49:15 -04:00
HMM
234e5f38f2 Clean up stray comments 2019-09-24 20:05:37 -04:00
HMM
098e3e5b3e Merging in autopickup exception rework 2019-09-24 19:12:54 -04:00
HMM
2fb9cf7a1c Rework autopickup exceptions to override one another like menucolors 2019-09-24 18:20:49 -04:00
nhmall
9361e872b2 fix uarmh null pointer dereference
uarmh null pointer dereference if a helm of opposite alignment came off due
to being polymorphed

fixes #225
2019-09-24 12:32:58 -04:00
PatR
348f968132 fix add_to_minv panic when aklys kills enfulger
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.)
2019-09-23 15:16:39 -07:00
nhmall
bd26d2edbe correct spelling mistake on stupefied
As reported in github issue 224

Fixes #224
2019-09-23 14:19:15 -04:00
PatR
0434437e99 fix #H9232 - message phrasing for openholdingtrap
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.
2019-09-22 15:03:52 -07:00
PatR
b1154399f1 fix github issue 223 - rubbing ring on touchstone
Fixes #223

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.
2019-09-19 12:48:41 -07:00
PatR
6569631180 fix github issue 221 - unfixable troubles
Fixes #221

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.
2019-09-18 11:37:11 -07:00
PatR
fd03a1b310 github pull request - man page typo
Fixes #205

"at last" should be "at least".  doc/nethack.txt is now out of date.
2019-09-14 18:04:33 -07:00
PatR
5589a16d74 github pull request - "You are <a foo>[.]"
Fixes #215

A post-3.6.2 change added a message for life-saving which lack its end
of sentence punctuation.
2019-09-14 18:00:39 -07:00
PatR
7c2b7d4417 github pull request - fake mail
Fixes #216

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.

Testing was a hassle but eventually successful.
2019-09-14 17:52:02 -07:00
nhmall
2a66ce54ad 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.

closes #220
2019-09-13 00:38:04 -04:00
nhmall
d4bd4f2413 Merge branch 'chasonr-msdos-vga' into NetHack-3.6 2019-09-13 00:36:32 -04:00
Ray Chason
d5104c622f Use faster method to write to VGA 2019-09-12 23:04:15 -04:00
PatR
1a97dce727 fix github issue 218 = hallu vs passive gaze
Fixes #218

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.
2019-09-06 14:39:25 -07:00
PatR
c53a72162c fix github issue 210 - dead code in sp_lev.c
Fixes #210

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.
2019-09-06 14:27:40 -07:00
Pasi Kallinen
6426e61860 Prevent a possible impossible when guard relocated a monster 2019-09-06 22:09:03 +03:00
PatR
8cf70f7771 fix github issue 217 - monster spellcasting feedback
Fixes #217

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.
2019-09-02 02:59:09 -07:00
PatR
301a558a9c curses menu coloring
Have the 'menucolors' option control menu color pattern matching
(instead of curses-specific 'guicolor') for all menus, not just for
the persistent inventory window.
2019-08-31 23:51:59 -07:00
PatR
e9aac25922 fix #H9164 - menu colors for curses perm_invent
Commit e3af33c9db in June changed
curses handling for perm_invent to strip off doname()'s "a ", "an ",
or "the " prefix in order to shorten inventory entries and get a
couple of significant extra characters before end-of-line truncation.
That had an unintended impact on menu colors pattern matching for
patterns which expected the article prefix.  Do the matching before
stripping off the prefix instead of after so that the matching gives
the same results as when used on a normal inventory menu (even though
this means that from the user's perspective most perm_invent entries
will have invisible text at the start).

Also for menu colors, don't require curses-specific 'guicolor' option
be enabled when the general, more-specific 'menucolors' option exists
to control menu coloring.  (curses was requiring that both be True.)
2019-08-31 10:46:35 -07:00