Commit Graph

8637 Commits

Author SHA1 Message Date
PatR
32e2d7cfc5 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.
2019-10-14 02:28:27 -07:00
PatR
027ce7c8b9 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.
2019-10-13 17:41:24 -07:00
Pasi Kallinen
f200397689 Fix monster triggering land mine accessing deleted trap
mintrap -> thitm -> mondied -> relobj -> mdrop_obj ->
flooreffects -> deltrap

after calling thitm, the mintrap code was trying to access the trap.
2019-10-13 20:52:38 +03:00
Pasi Kallinen
346ebbce10 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.
2019-10-13 20:40:58 +03:00
Pasi Kallinen
1f7095e226 Fix addressing deleted trap when helping monster out of a pit
Move reward_untrap before fill_pit, as the trap may get deleted.
2019-10-13 19:58:27 +03:00
Pasi Kallinen
9e9ee59ca7 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.
2019-10-13 19:30:32 +03:00
PatR
d058b9679c 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.
2019-10-12 15:33:57 -07:00
PatR
1fc8d7528c 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
ad302fb8a9 (Oct 10).
2019-10-12 02:31:47 -07:00
PatR
6cbf10d974 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.)
2019-10-11 18:33:32 -07:00
Pasi Kallinen
46adb312e7 Fix priests and shopkeepers moving on other monsters 2019-10-11 20:24:17 +03:00
Pasi Kallinen
ab30c3d79d 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.
2019-10-11 20:11:28 +03:00
Pasi Kallinen
02b9368dba Fix fired iron ball sanity error
When hero was punished and swallowed, and fired the attached
iron ball from a quiver, thrownobj was not cleared.
2019-10-11 20:02:06 +03:00
PatR
ad302fb8a9 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.
2019-10-10 17:43:31 -07:00
PatR
e4f3559acc 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).
2019-10-09 13:18:34 -07:00
nhmall
bab05ea680 remove one band from a recent attempted warning correction 2019-10-08 20:17:01 -04:00
PatR
3c6303b34e 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.
2019-10-08 14:23:27 -07:00
PatR
ba3004d6e2 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.
2019-10-08 13:26:39 -07:00
Pasi Kallinen
e92445810f 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.
2019-10-08 19:47:51 +03:00
nhmall
2172c5e7ff more github 229 warning 2019-10-07 22:02:26 -04:00
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