Commit Graph

6656 Commits

Author SHA1 Message Date
nhmall
269363467c another msdos bit 2018-02-24 23:32:54 -05:00
nhmall
9773742e82 fix some msdos build errors 2018-02-24 23:26:25 -05:00
PatR
f44ff54c7f fix #H6861 - whatis behaves weirdly with plurals
Report indicated that looking up "more info?" for "kittens" would show
the data.base entry for "kitten" and then when the display window was
dismissed, another "--More--" prompt for a empty second display window
would occur.  Looking up "2 arrows" from a closely-seen object on the
map behaved similarly.  User correctly diagnosed that the two-pass
lookup left the 'found_in_file' flag set from the first pass during
the second but that just clearing that resulted in "I have no info
about such things" on the second pass.  The code is on the convoluted
side and needed an extra flag to handle 'seen on first pass' in
addition to clearing found flag after the first pass.  I also added a
check to skip the second display if primary and secondary keys don't
match each other but both find the same entry.  To test it, I tried
"a +0 aklys named aclys".  That found the aclys entry but failed to
find "+0 aklys", so I added another change to have the key massaging
remove +/-N after removing "a", "an", or "the".

If "Want to see more info \"" + lookup string + "\"?" was too long,
the prompt buffer passed to yn() was being left uninitialized.  Also,
test for too long was based on BUFSZ but yn() complains (to paniclog)
if the prompt is longer than QBUFSZ.  Make checkfile() construct a
truncated prompt if the lookup string is too long.

I untangled some spaghetti by making all the 'goto's be forward.  It
didn't help a lot but did simplify a few early returns by having them
jump to a common exit instead of replicating the file close.
2018-02-24 19:35:56 -08:00
PatR
5dd6c05322 switch docall() to safe_qbuf()
Simplify docall() for object types.  Adds some different complexity to
a new routine so the overall simplification is rather minimal, but we
already have a routine to construct prompt buffers involving formatted
object names without allowing overflow, so use it.

tty getlin() limits the input to COLNO characters, so 80 by default.
To get potential QBUFSZ overflow, I had to increase COLNO in global.h
and rebuild from scratch.  A value greater than 127 triggers a lot of
warnings.  I didn't try 127.  126 gets one warning, involving use of
FARAWAY (defined as COLNO+2) in dogmove.c.

We should change things to limit object names to much less than 80,
but this doesn't attempt to implement that.
2018-02-23 13:07:49 -08:00
PatR
7a3ff2be54 fix "wonky secret door" in Cav quest
The earlier fix for hoizontal vs vertical doors would have worked for
the Cav quest (lower left in leader's chamber) where door handling
occurs before wallification, but it wasn't working for minend-3 (east
wall of entry room) which already had walls.  The more recent fix
solved the second case but broke the first one.  I think this actually
solves both modes of door classification.  I hope....
2018-02-23 07:25:37 -08:00
PatR
094c7f5c1b fix #6870 - clairvoyance feedback
Forwarded to the contact form from a github "issue":  in some
circumtances clairvoyance lets you move the cursor around to examine
the revealed map, and when doing so starts with "for instructions
type '?'".  When extended clairvoyance periodically kicks in, as
opposed to explicitly casting the spell, there wasn't sufficient
context to figure out what it was prompting for (unless you actually
answer '?' to get instructions).  Depending upon the most recent
message, it could seem like quite a strange prompt.  Explicitly give
a clairvoyance-specific message prior to that.

Also, the getpos() help was including suggestions for targetting
monsters that aren't appropriate when it's being used for detection.

do_name.c has had quite a bit of formatting rot slip in since 3.6.0.
This fixes up the stuff I spotted by manual inspection.
2018-02-21 22:44:15 -08:00
PatR
964120266e pline() -> raw_print() -> dumplog()
Reorder some code in pline() so that early pline messages which use
raw_print() instead of putstr(WIN_MESSAGE) are included in the DUMPLOG
message buffer.  If the game ends soon enough they'll be shown in the
final log; otherwise they'll get pushed out of the buffer once enough
later messages are delivered.
2018-02-20 19:32:47 -08:00
Alex Smith
d4d0f9a69a Merge branch 'NetHack-3.6.0' into NetHack-3.6.0 2018-02-20 21:55:31 +00:00
Alex Smith
5558d62aa8 Wake up monsters, and let them stop eating, before angering them
If we do it the other way round, then mimics will forget what
they're mimicking without a seemimic() call, meaning that the
line-of-sight calculations can get confused if the mimic was
mimicking something opaque.
2018-02-20 21:53:27 +00:00
nhmall
25d17eb62c fix some typos mentioned downstream 2018-02-19 21:32:54 -05:00
nhmall
f72f72f863 update fixes36.1 with the docall() prompt string overrun 2018-02-19 15:42:18 -05:00
PatR
859ef823d6 fix #H6867 - mail buffer overrun
Web contact report of a github pull request.  A previous fix from
same user dealt with potential crash caused by freeing mailbox data
when the mailbox came from getenv("MAIL").  getenv() doesn't return
a value obtained by malloc so freeing it was bad.  The fix was to
allocate memory to hold a copy of getenv("MAIL") so that free() was
valid.  Unfortunately it didn't allocate enough space to hold the
terminating '\0' so potentially corrupted malloc/free bookkeeping
data.  And the alloc+copy was being performed every time the mailbox
was checked, resulting in leaked memory from the previous check (if
MAIL came from player's environment).  Fortunately the recheck only
takes place after new mail is actually detected and reported to the
player so the leak was probably small for most folks.

This compiles for the set of conditionals that apply to me (after
taking out -DNOMAIL that the hints put in my Makefile) but I can't
test that it actually works since mail is never delivered to this
machine.
2018-02-19 11:59:14 -08:00
nhmall
7a0ad0ff21 sync README and DEVEL/Developer re: repositories 2018-02-19 11:18:57 -05:00
nhmall
0301420fcb fix reported stack corruption bug during Call
Fix an issue reported as github #74.
Some guard code was required to prevent writing past end of qbuf
via a sprintf.
2018-02-19 10:19:44 -05:00
PatR
48af4fa259 static analyzer bit
I can't find the original message at the moment, but one of the things
that an analyzer complained about was the *s='\0' possibly assigning
to a Null pointer.  The superfluous test of 's' in the while condition
has fooled it into thinking that's possible when it's not.

if (s) {
  while (s && ...) {
    *s++ = ...
  }
  *s = '\0';
}
2018-02-17 18:54:52 -08:00
PatR
544b9015ff comment formatting
Fix a few mis-indented comments I stumbled across.
2018-02-17 01:58:14 -08:00
nhmall
1eb5919a85 I noticed makedefs was segfaulting when argc == 1 2018-02-16 14:52:02 -05:00
keni
12530cb155 infrastructure fixes:
- fix bug in git hooks that loses file permissions when doing variable expansion
- fix execute permissions on sys/unix/hints/macosx.sh
- explicitly call out perl as required for hooks in Developer.txt
2018-02-16 12:07:37 -05:00
PatR
2c21399a7e place_lregion() bug
Noticed while looking into the TROUBLE_STUCK_IN_WALL prayer bug,
place_lregion() has been using the wrong row for 'low y' in its
whole-level handling, presumeably ever since it was first introduced.
3.4.3 definitely had the same bug; I didn't check any further back.

For maze levels which only consider every other row and every other
column to be viable locations this probably didn't matter.  And even
non-maze levels usually don't have anything on row 0, so this fix
isn't likely to be noticeable.
2018-02-15 10:13:42 -08:00
PatR
687902d3ff fix #H4240 - linking on VAX/VMS
First reported two years ago, then again this week by someone else
who didn't go through the web contact page (so no new #H number or
bugzilla entry).  Using vmsbuild.com to build on VAX complains about
not being able to resolve a bunch of functions--it's basically
trying to build the full program using only the code supplied by
sys/vms/vmsmain.c.  The original report mentioned a workaround and
was also dealing with a second issue (already fixed post-3.6.0) that
I incorrectly guessed was responsible for the linking problem.  This
report had the correct linker magic to fix the linking issue.

I'm still not sure whether the order of /Library and /Include after
the name of an object library file on a LINK command line matters.
In a linker options file, which vmsbuild.com constructs and uses,
/Include needs to come first so that the contents of the library are
searched after the explicitly included object modules are processed.

Building with the Makefiles (using DEC's MMS or some versions of
freeware MMK) doesn't collect the object files into a library so was
never affected by this.  And the linker options ordering issue is
apparently specific to the VAX/VMS linker; vmsbuild.com run on Alpha
and on IA64 linked 3.6.0 successfully without this fix.
2018-02-14 18:38:35 -08:00
nhmall
e181f1acf9 command line Makefile update for vs compiler 2018-02-09 18:57:43 -05:00
PatR
b5b513fb44 'Iu' vs unknown container contents
An inventory of unpaid items where more than one was present would
show
|> bag's contents    N zorkmids
if any of the items were inside a container whose contents aren't
known.  But if there was only one item (so container must be owned
by hero) the 'Iu' output menu was skipped for pline and yielded
|> scroll of magic mapping   133 zorkmids
Force the menu display if the lone unpaid item is inside a container
whose contents are unknown.

I'm not sure whether a hero-owned container can have both unknown
contents and an unpaid item in normal play.  I managed it while
trying to fix a reported problem--except I can no longer find the
relevant report--where itemized shop billing also revealed unseen
container contents (for any number of items, not just 1).  That isn't
fixed yet, but I want to get the simpler 'Iu' part out of the way.
2018-02-07 17:31:44 -08:00
PatR
1b8df876c3 some more reformatting, dig.c
A bit more ambitious this time, but not much.
2018-02-06 02:41:31 -08:00
PatR
f4b2b39931 formatting bit for u_on_rndspot()
Something trivial I noticed while looking into the stuck-in-wall
situation.
2018-02-06 02:20:26 -08:00
PatR
e95a709663 fix #H4459 - shopkeeper/scare monster bug
Reported about 18 months ago:  standing on a scroll of scare monster
while next to a shopkeeper who was blocking the shop entrance because
hero was carrying unpaid shop goods would yield "<shk> turns to flee"
but <shk> wouldn't move.  This was a side-effect of making standing
on scrolls of scare monster be stronger than on "Elbereth" when the
latter was nerfed.  Make shopkeepers inside their own shops and temple
priests inside their own temples be immune to the effect of hero
standing on scare monster.

Also, make the Wizard, lawful minions, Angels of any alignment, the
Riders, and shopkeepers and priests in their own special rooms (ie,
all creatures that now ignore standing on scare monster) be immune to
the fright effect of tooled horns.  Innate magic resistance usually
prevented them from being scared anyway, but make it explicit.

Reading a scroll of scare monster or casting the spell of cause fear
still rely on innate resistance to avoid chasing away those monsters.
I'm not sure whether they should have the same adjustment.
2018-02-05 16:36:35 -08:00
PatR
baba2acb8d fix #6691 and a couple other twoweap issues
Report was for dual-wielding hitting an enchanter and assumed that
a resistant artifact as primary weapon was protecting vulnerable
secondary weapon.  Actual reason was simpler.

When in normal form, dual-wielding attacks against creatures which
cause erosion to the weapon which hits them would only inflict the
passive erosion damage to the primary weapon, even if it missed and
secondary hit.  Make primary attack always trigger passive counter-
attack--before second swing now, rather than after--even if it misses,
and secondary attack trigger another one if that hits.  Both weapons
are now subject to passive erosion (but only when they actually hit);
when secondary weapon hits, hero gets a double dose of counter-attack.

Hero poly'd into a monster with multiple weapon attacks (various
leaders:  dwarf lord, orc-captain, and so forth) would try to emulate
dual wielding and first hit with uwep then with uswapwep.  But it
would do that even if uswapwep was a bow or stack of darts that the
player had no itention of using for hand-to-hand.  Stick with repeat
hits by uwep when uswapwep seems inappropriate.

Splitting a pudding while dual-wielding would only do so when hit by
uwep of appropriate material, never when hit by uswapwep.  So silver
saber and longsword could split if longsword was primary but never
split if saber was primary.  Check material and splitting separately
for each hit.  It's now possible to split twice with one dual-weapon
attack if both weapons hit and both are made of the right material
(iron or 'metal'; among relevant objects the latter is only used for
tsurugi and scapel).
2018-01-28 00:38:08 -08:00
nhmall
d2245aab29 version output appearance bits 2018-01-26 17:25:21 -05:00
nhmall
9728616a21 fix branch placement of change 2018-01-26 08:06:23 -05:00
nhmall
fec245dba2 Only update dat/gitinfo.txt if the hash is new 2018-01-26 08:01:03 -05:00
nhmall
0ffde7e45f copyright notice to 2018 2018-01-25 23:23:16 -05:00
PatR
32890d1bc1 fix 'makedefs -z' for config using FILE_PREFIX
Apply user-contributed patch to make do_vision() handle FILE_PREFIX
correctly.  It was putting that value into the filename buffer, then
overwriting it with the ordinary filename instead of appending.

Deletion of just-made vis_tab.h when creation of vis_tab.c fails would
have failed too if FILE_PREFIX had been working.

The patch was against 3.4.3 and didn't apply cleanly to current code,
but it is a staightforward fix, although the file deletion case was
buggy (failed to clear "vis_tab.c" from buffer before reconstructing
"vis_tab.h" via appending stuff).  FILE_PREFIX seems to be Amiga-only
so I've only tested the usual case where it isn't defined.
2018-01-23 00:52:57 -08:00
PatR
a40f0788bc fix object pickup
Mentioned in the newsgroup:  picked up items have stopped merging with
compatible stacks in inventory.

The commit 0c51555849 by me on January 5
|
| fix #H6713 - unpaid_cost: object not on any bill
|
| Stealing a shop object from outside the shop with a grappling hook
| would result in that item being left marked 'unpaid' after the shop's
| bill was treated as being bought and not yet paid for.  This led to
| "unpaid_cost: object wasn't on any bill" every time inventory was
| examined.  The problem was caused by handling the shop robbery after
| removing the object from the floor but before adding it to inventory,
| so it couldn't be found to have its unpaid bit cleared.
|
inadvertently caused that.  The effect was actually deliberate but it
wasn't intended to be so widespread.  Handle extract/bill/addinv/rob
sequencing differently instead of overriding inventory merging.
2018-01-21 16:30:58 -08:00
PatR
c59f9512c7 T-shirt punctuation
'It reads:  "foo bar quux"' is a sentence so should have a terminating
period.  Technically that ought to be placed inside the quotes, but
putting it after distinguishes slogans which have their own punctuation
from ones which don't.

A couple of entries contain multiple sentences.  Some used two-space
separation between those sentences, some only one; make all use two.

Add a few new T-shirt messages, including a couple with pop culture
references which are only 10 years old instead of 20 or more....
2018-01-12 16:13:14 -08:00
keni
f9144fa576 build fixes for MacOSX:
- fix generation of sysconf when WANT_SOURCE_INSTALL=1
- use xcrun as main search for gdb
- turn gdb off in most cases
2018-01-09 20:59:26 -05:00
Alex Smith
03f8a487d1 Merge branch 'NetHack-3.6.0' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.0 2018-01-06 00:39:17 +00:00
Alex Smith
bad36c8672 Fix an exploit involving bags and potions of water
Discovered while writing the previous commit. If you dipped a sack
full of potions into an uncursed potion of water, the potions would
dilute but you wouldn't lose the original potion, letting you repeat
until all were diluted.

Allowing people to do this trick to blank multiple potions from one
potion of water seems like it's not an abuse, given that it can be
done in a more tedious way with water walking or the like and it
costs resources, but it's definitely abusive to make it possible
entirely for free.
2018-01-06 00:38:37 +00:00
Alex Smith
2b7b2af9eb Give feedback when oilskin sacks get wet
We can identify them by elimination in this case (they're the only
bag-like container that doesn't produce a message, the others all
do), so it's probably best to be more explicit as to what's going
on (for user interfaces and TDTTOE purposes).
2018-01-06 00:38:05 +00:00
PatR
0c51555849 fix #H6713 - unpaid_cost: object not on any bill
Stealing a shop object from outside the shop with a grappling hook
would result in that item being left marked 'unpaid' after the shop's
bill was treated as being bought and not yet paid for.  This led to
"unpaid_cost: object wasn't on any bill" every time inventory was
examined.  The problem was caused by handling the shop robbery after
removing the object from the floor but before adding it to inventory,
so it couldn't be found to have its unpaid bit cleared.

When investigating this I came across a more severe bug:  if the hero
had never entered the shop, the shopkeeper's bill wasn't initialized
properly and add_one_tobill() could crash while attempting to execute
    bp->bo_id = obj->o_id;
because 'bp' was Null.
2018-01-05 01:23:56 -08:00
PatR
66242a0691 fix #H6707 - double "gush of water hits" messages
When polymorphed into an iron golem (or gremlin with 2/3 chance),
triggering a rust trap would give "a gush of water hits <you or some
body part>" and then give a second "a gush of water hits you" when
dealing with golem or gremlin effects.  That made it seem as if the
trap was hitting twice.  This removes the redundant messages.  (Rust
trap against monster iron golem or gremlin didn't have them.)
2018-01-01 17:14:37 -08:00
PatR
bb9738ff0e special level mimics
The special level loader would allow the level description to specify
an alternate monster appearance for any type of monster, and if one
was specified for a mimic then that mimic would be polymorphed into
the appearance instead of masquerading as it.  This changes it to
only use an appearance for mimics, the Wizard, vampires, and general
shapeshifters (chameleons, doppelgangers, sandestins).  The mimic
case doesn't work as expected:  map display shows the symbol for the
specified shape but farlook describes it as a mimic.  The Wizard case
hasn't been tested.  The chameleon and vampshifter cases seem to work.

It also allowed shapechangers (including vampires) to be given an
object or furniture appearance.  I didn't try things out to find out
what what their behavior would be if/when that happened.

I'm not sure whether the farlook issue for mimics-as-monsters is with
the pager code or the monster name formatting code.  (Possibly the
mimic just needs to be flagged has 'hidden' as well has having an
alternate appearance.)  I'm not going to worry about it since none of
our special levels attempt to give mimics a monster shape.  Mimicking
a monster is a feature for clones of the Wizard, not for mimics,
although it might be nice if the latter worked correctly someday.
2017-12-31 17:19:38 -08:00
PatR
46da4b5e90 fix #H6704 - appearance of mimic's replacement
If mimics were genocided before loading a special level which
contained mimics with specific appearances, whatever random monsters
took their place also end up having their intended appearance.
monst->cham uses NON_PM rather than 0 to mean "not a shapechanger".
2017-12-31 03:38:29 -08:00
PatR
9f12aeb8ab uncursing prayer vs helm of opposite alignment
Implement the suggestion that hero's current god not uncurse a worn helm
of opposite alignment when prayer result is fix-worst-cursed-item or
uncurse-all-cursed-items since doing so makes it easy for hero to switch
to another god.  The second boon will still uncurse non-worn helms of
opposite alignment since that has no effect on how easy or hard it is
for the hero to change alignments.  (The first boon only applies to worn
items plus luckstones and loadstones; non-worn helms aren't applicable.)
2017-12-29 16:20:05 -08:00
PatR
860cdf6625 playing music while impaired
Newsgroup discussion mentioned that it was possible to open the castle
drawbridge with musical notes even while confused.  There was already
some handling for confusion:  improvisation treats magical instruments
as their mundane equivalents.  This takes if farther:  when stunned
or confused or hallucinating you'll always improvise instead of being
given a chance to choose notes.  Being stunned now behaves the same
as being confused in regards to magical instruments (possibly/probably
it should prevent playing music altogether).  Hallucination gives
different feedback at start but still allows magical playing.
2017-12-28 15:40:11 -08:00
PatR
6857372f45 fix #H6624 - missile miss message redundancy
Excess verbosity for multi-shot throwing/shooting by monsters.
 The Green-elf shoots 2 elven arrows.
 You are almost hit by the 1st elven arrow.  The 1st elven arrow misses.
 You are almost hit by the 2nd elven arrow.  The 2nd elven arrow misses.
Just give one or the other of the miss messages.  If it reaches the
hero's location, give the first.  If it lands somewhere else, give the
second.  (It might be possible to get both if hero is displaced and
the monster thinks he/she is behind his/her actual location.  I'm not
sure.)

Also, only say "you are almost hit" if it is true:  the dieroll nearly
got past your armor.  Otherwise, say "The Nth arrow misses you."
2017-12-24 14:00:49 -08:00
PatR
062748c695 fix #H6648 - can't wear via 'W' but can via 'P'
More fallout from allowing W/T on accessories and P/R on armor without
combining them outright.  If poly'd into verysmall or nohands critter,
'W' yields "don't even bother" before even prompting what to wear, but
'P' would prompt for an accessory and then wear armor if that was what
got picked.  Now 'P' will still prompt, in case it's for an accessory,
but picking a piece of armor no longer wears that armor.

'W' still doesn't even prompt, so won't allow accessories as well as
no armor.  I'm not sure whether that should be changed.
2017-12-23 15:42:20 -08:00
PatR
93f61975f5 flags.sortloot
This should maximize save file compatibility between 3.6.1 and 3.6.0,
at the risk of breaking save files for folks using post-3.6.0 git
sources.  (It's unlikely that many in that situation are using a
configuration which will be affected, so probably nobody will notice.)
2017-12-23 15:19:27 -08:00
PatR
f296c6605d fix #H6628 - secret doors display as wrong wall
A relatively recent change to make secret doors within horizontal walls
become horizontal doors after discovery was making some secret doors
that should have remained vertical become horizontal too.  While still
hidden, they got displayed as horizontal wall segments in the midst
of vertical walls.  Example was the "Catacombs" (minend-3) variant of
mines' end.  The hidden door on the east wall of the entry room was
shown as horizontal, while another one on the west wall of that same
room was correctly vertical.  This fix uses different criteria to
decide horizontal vs vertical, partly because I couldn't understand
how the previous code was supposed to work.

Hidden doors now seem to display as correctly oriented walls and once
discovered seem to become correctly oriented doors.  I tested by
checking quite a few special levels (and some regular ones)--but not
all--with '#terrain d'.  Plus some searching to unhide secret doors
while using a custom symbol set that displayed closed horizontal doors
(S_hcdoor) as '=' and vertical ones (S_vcdoor) as '"'.
2017-12-21 10:04:18 -08:00
PatR
876d509921 sanity check bit - current_wand
'current_wand' should always be Null at the time the sanity checking
routine is called, so check for that.  Also a couple of formatting bits.
2017-12-14 16:46:16 -08:00
PatR
c2fb384a5d rehumanizing while Unchanging
When hero poly'd into paper golem "burns completely" he is rehumanized
even if he has the Unchanging attribute.  A comment states that that is
intentional, but there was no explanation given to the player.  Report
that "your amulet of unchanging failed" when rehumanization despite
Unchanging happens.  (Don't ask me how or why it fails; I don't know.)
2017-12-14 16:39:21 -08:00
PatR
892f210c1e fix #H6610 - completely burnt paper golem
When a monster killed a paper golem with a fire attack, the player was
told that the golem "burns completely" yet it might still leave some
blank scrolls as 'corpse'.  The fix for that was one-line, but several
other death-by-fire situations which didn't report "burns completely"
were also leaving scrolls:  fireball spell or scroll of fire or other
fire explosions (if any), also wand of fire.  Fire trap and poly'd
hero with fire attack were already suppressing 'corpse'.
2017-12-14 16:22:36 -08:00