build system.
Anyone who wants to do a build from sys/unix and doesn't want to figure this
out just needs to do:
sh setup.sh hints/unix
instead of:
sh setup.sh
and then continue on as usual.
New files:
sys/unix/NewInstall.unx - the new directions
sys/unix/hints/* - the hints files. There will be more later.
sys/unix/mkmkfile.sh - helper for setup.sh
Summary of changes:
see NewInstall.unx for info on the new build system
introduction of various preprocessor symbols to turn options off that
are defaulted on historically
comment out nethackrc (and similar) entries that still use the old symbol
syntax.
commenting out of Makefile.* lines that now come from hints/unix
GAMEDIR is replaced with HACKDIR so the Makefiles and the C source agree.
Note that I have NOT changed the docs and/or Makefiles for be, msdos, os2,
vms, or winnt. If port maintainers don't then I will, but I can't test
those ports.
nethack.sh now handles the font path automatically
Some post-3.4.3 code in done() cleans up thrownobj and kickobj to
plug a potential memory leak (unnoticeable one since the game is over),
but they have to be free objects rather than on any list. toss_up() was
leaving thrownobj defined after putting the thrown object on the floor,
leading to "obj not free" panic from dealloc_obj() if threw you an object
upward and it dealt fatal damage when it fell back down. (For non-fatal
damage, toss_up()'s caller cleaned things up later.)
Get rid of most of the vestiges of the old warning code that was
replaced over 7 years ago. I left the list of colors which were used for
warning flashes.
In the newsgroup about three weeks ago someone described trying to
use the Bell of Opening to find the magic portal on the Plane of Water
and not succeeding. It's supposed to work like a wand of secret door
detection to mark nearby traps as known. And does, but it turns out
that the wand wasn't working as expected there either. They both require
line of sight, and since the water outside of the bubbles blocks that
they only found the portal if it was within the same bubble as the hero.
(Clouds on the Plane of Air posed a similar problem, although monster
activity usually reveals the portal on that level so this wasn't much of
an issue there.) Since the detection magic doesn't require the hero to
see the traps--wand and Bell both work while blind--this patch overrides
the line of sight requirement on the Planes of Water and Air. As long as
hero is within the detection magic's range, the portals on those levels
will get marked as having been seen and when the hero gets into the right
bubble or out of the clouds the portal traps will be shown on the map.
The line-of-sight override code is simple-minded and lets players
find traps through boulders when/if those are present (but the found
traps won't be seen yet since vision still controls the map display).
Also, it assumes that only water/air/cloud terrain is present so could
potentially yield strange results if any other terrain gets introduced on
either of those two levels.
From the newsgroup: hangup save while picking up gold from the
floor in a shop would duplicate that gold in the save file. First the
gold amount was being added to hero's gold, then two messages were given
[pline() or prinv() about pickup followed by one from costly_gold() about
shop credit], and lastly the floor gold would be removed. The second
message could trigger --More-- and provide a controllable interruption
point between giving the gold to the hero and removing it from the floor.
Change this to do the removal step before feedback.
From a bug report, attempting to open or close
a door while blind didn't always update the map display after telling the
player that a remembered-closed door was already open or a remembered-open
door was already closed. And in the cases where it did update the map to
reflect a change in door state, it didn't use up a turn. Now always update
the display and use up a turn when 'o' or 'c' reveals any new information.
From a bug report, wizard mode's sanity_check
option has a check for container contents but wasn't using it recursively
for nested containers, so the contents of the latter weren't checked.
This fixes that, and also adds a check for objects carried by migrating
monsters. And it now formats objects and monsters fully even if the hero
happens to be blind or hallucinating at the time.
Tested by using a debugger to poke in various bits of invalid data.
Newsgroup discussion about the devnull tournament which started
today has pointed out that ``d4294967296$'' would cause getobj() to create
a gold piece object with quantity 0 which then got dropped to the floor.
(It's specific to gold; other types of objects don't behave that way.)
Also, wrapping which went past negative and zero all the way to positive
again (like 429496729*10+7, yielding 1) wasn't detected.
Newsgroup discussion points out that a chameleon which starts out
in nymph form also starts out with nymph's inventory (50% chance each for
mirror and potion of object detection). That's not right; shapechanging
shouldn't manufacture items. Also, the post-3.4.3 code to initialize
vampires was overly complicated in order to preserve chameleon behavior,
but the old chameleon initialization which used rndmonst() instead of
selecting a preferred shape was just that way by accident (says the
person who implemented preferred shapes however long ago and completely
overlooked that at the time...).
This is tricky to test; ^G these days forces a created shapechanger
to start out in its natural form. That's a bit odd to begin with (a side-
effect of transforming requests for uniques and other special monsters
into doggelgangers), but downright strange when monpolycontrol is enabled;
a prompt to pick monster shape is issued, then the player's choice gets
overridden. I'm not sure which aspect, if any, of all this should be
changed to fix a wizard mode quirk.
The fix for #H1409 a couple of days ago included updates for
sys/vms/Makefile.* but not vmsbuild.com. I thought the latter didn't
need any, but was mistaken; vmsfiles.c needs to be compiled early in
order for vmsfiles.obj to be present in the object library when makedefs
gets linked.
Fix the problem From a bug report. His system has a logical name "DATA" pointing at some disk, and
when the dlb utility tried to open "data" for inclusion in the library
being built at install time, it attempted to access the wrong thing and
failed. He then attempted to fix it in a manner which let dlb finish, by
modifying dlb_main.c to append "." to file names that lack a dot, but
then nethack couldn't access "dungeon" in the library because string
comparison didn't match the altered dlb directory entry of "dungeon.".
NetHack was working around this unintended interaction with the
environment issue in fopen_datafile(), and dlb was doing so for fopen()
but not open(). This moves nethack's fixup out of src/files.c and into
sys/vms/vmsfiles.c, adds another routine there so that both open() and
fopen() are covered, and updates the vms Makefiles so that the various
utility programs all link with vmsfiles. (The build script vmsbuild.com
puts object files into a library and gets that last bit for free.)
"You can see invisible" is misleading when you can't see anything,
so use alternate phrasing for See_invisible when blind. Also, add extra
wizard mode feedback when blindness is overridden by the monk's Eyes
artifact, when invisibility is blocked by worn mummy wrapping, and when
clairvoyance is blocked by worn cornuthaum. And fix end-of-game disclosure
for blindness; it was only being shown if/when caused by worn blindfold.
Reported a month ago by <email deleted>, putting on
a cloak of invisibility while blind and then using ';' or '/' to examine
yourself revealed that you had become invisible. This fix just changes
the lookat() output when you can't see that you can't see yourself. :-)
Probing and stethoscope still reveal invisibility, as will any message
which uses x_monnam() to identify the hero. (First part is intentional;
last part seems not worth bothering about--I'm not even sure that the
player can arrange to trigger it.)
shknam.c had the same comment typo as the one just fixed in do_name.c.
In the process of fixing it, I noticed that the prefix usage for Janet's
name didn't match that comment. And in the process of fixing _that_, I
promoted several names from being port-specific to general and added a few
missing ones. There was no attempt to be comprehensive; I'm sure that lots
of port team members' names are still missing.
Prevent monsters who kill other monsters to obtain the Amulet from
targetting a priest inside his temple. Blocks players from just staying
on the Sanctum stairs while a teleporting arch-lich or Asmodeus fetchs the
Amulet from Moloch's high priest for them. A previous post-3.4.3 change
prevented monsters from targetting the Wizard; this extends that (and
assumes that we can ignore the possibility of other temple priests ever
handling the Amulet). The earlier patch went into the branch code, but
inhistemple() isn't available there so this one is trunk only.
From a bug report, if you're swallowed
while in a vault and the guard arrives, he'll ask your name even though
you're hidden within the engulfer. This makes him give a message and
then leave, as is already done if you're mimicking an object or unable to
speak.
This also suppresses his repeated "Move along!" message if you're
swallowed or held since it's silly to keep telling you to move when you
obviously can't.
water_damage() gave "A potion explodes!" when destroying potions of
acid even when it was a stack of multiple potions exploding. The vague
fixes entry "grammar, spelling and other typos" covers this one....
Full moon and Friday the 13th affect Luck's equilibrium point, but
not its range (which is always -10 to +10 for natural luck, -13 to +13
when extended by luck-conferring objects). The water_damage() comment
implying that max Luck could be 14 during a full moon was incorrect.
From a bug report, unseen pet sensed by
telepathy was referred to as "it" in the message given when it ate food.
This code is subtly convoluted and has now been changed at least four or
five times over the years. This patch changes the terse comment to try to
spell out the intent. Whether or not the new code actually matches that
intent remains to be seen....
From a bug report, a monster which
died by moving into a trap which was next to the hero standing on Elbereth
resulted in "The <mon> is killed! The <mon> turns to flee!". An earlier
change made monflee() return if it's given a dead monster, so the fleeing
message is no longer given. This fixes the place where monflee() was
inappropriately being called for a dead monster in the reported situation.
From the newsgroup:
The tin opens like magic!
<some interruption occurs>
You stop opening the tin.
Either it opens immediately or it doesn't, so the "opens like magic"
message is inaccurate. Rather than simply changing the phrasing, this
gives blessed tins a 50% chance to really open immediately so that their
contents are available for eating on the same turn, and 50% to behave as
before but with a message which is suitable for the single turn delay.
Hero poly'd into a metalivore always gets the same-turn case when eating
any tin. Use of a tin opener has a chance to do so (always when blessed,
50/50 for same-turn vs 1 turn delay when uncursed, 33/33/33 same-turn or
1 or 2 turn delay when cursed).
Overall, blessed tins are better than they used to be, since half
of the time you'll save a turn, but they're still not reliable to eat in
the midst of combat since sometimes you'll need another turn and will be
likely to get interrupted in that situation. Uncursed tin openers still
give the same behavior as opening blessed tins, so are also better than
they used to be. Blessed tin openers are now superior, and cursed ones
are slightly inferior in addition to being welded to hero's weapon hand.
From a bug report, when ice on the Valkyrie
quest home level was melted and a boulder filled the resulting pool, that
pool was described as a moat. This was actually a terrain issue rather
than a formatting glitch, so instead of tweaking waterbody_name() with an
extra special case, extend the level compiler to allow specifying ice as
frozen pool instead of always being frozen moat. There's no provision
for having both types of ice on the same level, just a level-wide flag to
control which of the two applies for ice on that level.
This change has a side-effect for the V quest levels: once ice has
been melted, a second blast of fire will now boil away the pool and leave
a pit. The unfrozen water locations on the home level already behaved
that way (ie, they are pools rather than moats) so this should be ok. I
also added <Someone>'s suggestion to make one of the two drawbridges
on the goal level start in random state instead of always being open.
Michael pointed out what needed to be fixed in order to change gold
on rogue level from regular "$" back to intended "*". This was post-3.4.3
code so no fixes entry needed.
Fix the crash From a bug report, where
having the hit that cuts a long worm into two also take the original down
to 1 HP would result in clone_mon() returning null and nethack crashing due
to a segmentation fault or access violation. The same thing could happen
if there's been enough long worms created to get them flagged as extinct.
This bug was only present in 3.4.3. Prior to that, cut_worm() did
its own monster creation inline instead of calling clone_mon(), ignoring
extinction and too-low hit points.
Using F prefix when trying to move into a wall or closed door yielded
"you attack thin air". Like the recently fixed F-vs-boulder case, give
more appropriate feedback. Also like F-vs-boulder, initiate digging if
wielding a pick-axe. (Also handles axes versus trees and closed doors).
One thing which isn't handled but possibly should be: F vs closed
door when not wielding a pick or other axe might attempt to force the door.
(Right now it gives "you harmlessly attack the door".)
From the newsgroup: objects created when killing a monster over
water weren't being affected by falling into the water. The objects were
being created directly on the floor instead of being dropped as if they'd
been in the monster's inventory. This fixes the random "treasure drop"
item, but special items--like dragon scales and the miscellaneous golem
remains--produced by make_corpse() are still put directly onto the floor.
The check to prevent small monsters from dropping big objects was
overly complex, possibly due to the 3.1.x weight threshold bug which was
just recently fixed. Food rations and leashes pass the weight test so
don't need to be special cased; spears, polearms, and morning stars fail
the weight test. (Javelins are an exception; they pass the weight test
so are allowed to be dropped by small monsters now since spears aren't
special cased any more.)
Followup to yesterday's "you attack thin air" fix for when there's a
boulder at the target location: if wielding a pick-axe or mattock and you
use F to explicitly try to attack a boulder, dig the boulder to break it.
Also, treat statues like boulders: F at them gets "you harmlessly attack
a statue" for non-pick weapon, or digs/breaks statue when wielding a pick.
Classified as a new feature in the fixes file.
ansimpleoname() and siblings always reported statue and figurine
type to be "of a giant ant" because the corpsenm field was left as 0.
Explicitly set it to -1 in the minimal object and teach xname() to leave
off the monster type in that situation, yielding just "a statue" or "a
figurine". [It's tempting to classify this as an xname() bug since other
object types which use corpsenm do so in doname().] No fixes entry; this
is post-3.4.3 code.
This is another item from "#Q397: List of Bugs from #nethack" sent
in Janurary by <email deleted> and containing a list
of things collected from the IRC channel associated with nethack.alt.org's
public server. Using F prefix and moving toward a boulder would give
"You attack thin air." Now that'll be "You harmlessly attack a boulder."
This is one of the items from "#Q397: List of Bugs from #nethack" sent
in Janurary by <email deleted> and containing a list
of things collected from the IRC channel associated with nethack.alt.org's
public server. Moving diagonally between segments of a worm tail is
conceptually passing right through the worm's body. This patch prevents
moving in such a fashion for both the hero and monsters (it's still
possible to fight in that position though). It only applies when the two
tail segments are consecutive.
|...... In the diagram here, where tail segments are represented by
|.w1?.. digits indicating relative sequence number, the @ can still
|..@2.. move between segments 2 and 5 to reach !, but can no longer
|.65!3. move between 1 and 2 to reach ?. [However, if there is a
|...4.. monster at the ? spot, it can still hit @ and vice versa.]
Missiles and wand zaps still pass through such diagonals without
noticing or affecting the worm. I'm not sure whether this ought to be
extended to change that--it might get pretty messy since it would need
to be considered during monsters' targetting as well as during the path
traversal itself.
From the newsgroup: you could get "suddenly you cannot see the <mon>"
even though it remained visible. Cited case was for an orc who drank a
potion of invisibility while being observed by a hero wielding Sting, which
causes orcs to be displayed even when they're invisible. But it could also
happen when non-blind telepathy or extended monster detection is in effect.
From a bug report, reading a scroll
of mail violates illiterate conduct and he requests that it not do so.
I didn't go that far, since unlike needing to read the Book of the Dead
to be able to finish the game, reading scrolls of mail is completely
voluntary and someone attempting voluntary challanges can choose not to
do it. Instead, this issues a prompt to require confirmation if reading
such a scroll will be the first violation of that conduct. Ordinary
players can answer no and then use '!' to read mail from a shell. I'm not
sure what'll happen to players on public servers who aren't given access
to a shell. Usually they wouldn't be able to get mail either, so more
elaborate servers like the one at nethack.alt.org which allow players to
use mail to communicate with each other will have to come up with their
own solution (perhaps by providing a mail-reader-only shell).
From a bug report, you could swap places with a pet grid bug when
you're making a diagonal move. Now you can't. [Completely ignored: it
is possible to swap places with pets which are incapable of movement....]
This imposes the same restriction on the astral Riders when they're
exchanging places with monsters in their way.
More tuning to throttle pudding farming (plus endgame Rider farming).
Earlier changes made cloned black puddings less likely to leave corpses,
to cut down on sacrifice fodder a bit, and cloned anything less likely to
drop random items when killed; this one makes killing cloned or revived
monsters be worth less experience as the number killed goes up, to cut
down on final score inflation. [With several boulders and magic missile
or a polearm, it's possible to kill any of the Riders repeatedly with
virtually no risk of even getting hit, much less of getting killed. Now
if you kill Pestilence 240 times it will be worth 62720 points instead of
297840 (not including doubling bonus for ascension), with an additional
19 points per kill instead of 1241 after that, requiring a couple orders
more magnitude of abuse--excuse me, superhuman "patience"--to get the
score to reach the overflow threshold.]
While testing this, I got "The Famine's corpse glows iridescently."
This fixes that too. Also, previously unused kill count for experience()
had an off by one error; was including ``+ 1'' even though mvitals[].died
has already been incremented by the time that that code uses it.
It's possible for the player to put escape sequences into strings via
dogname/catname/fruit options (or probably interactively by using "\233"
instead of "\033["--the two character 7-bit version wouldn't work because
its leading ESC gets treated as player's request to abort current input,
but the 8-bit version probably works, I just can't test it because I don't
know how to type such things with this terminal emulator). Such sequences
can do funny things like clear the screen and say "game over" (or worse
with creative abuse of some terminals' "answer back" capability--when
reproducing the reported situation, I kept things simple and had my dog's
name underlined and fruit name blinking; they displayed correctly but
nethack was confused about how long they were since it doesn't expect to
be given characters which don't advance the cursor). This fix still lets
users experiment with such stuff during their own games, but it replaces
suspect characters while loading bones data, so if one player creates a
bones file with suspect strings in it, another can--I hope--be able to
use that file safely.
Monster and object names, engravings, and named fruits are handled.
For the last, if uncensored string matches one already present then it
leaves that alone, so bones data created with same OPTIONS=fruit:whatever
as being used in the current game will continue to keep the same value.
New hero would remember part of old one's terrain discoveries (such
as presence of fountains) for bones levels. Also, some topology changes
(such as fountain destruction) can be detected by touch while blinded but
dungeon overview continued to remember the old feature. Post-3.4.3 code.
Another entry in $cvsroot/shared/bugs/buglist, this one reported by
<email deleted>: if the Wizard had the Amulet and used
his "double trouble" spell, his clone would attack him in order to try to
get the Amulet. This prevents any monster who's after the Amulet from
attacking the Wizard to get it.
From an entry in $cvsroot/shared/bugs/buglist From a bug report:
when item weights were all scaled up by a factor of 10 for 3.1.0, the
code controlling random item drops by monsters still limited small ones
to dropping things of 3 weight units of less. Scale that up to 30.
Someone in the newsgroup accidentally dipped the wrong item into a
fountain and wants the second prompt to be "Dip <obj> into the fountain?"
instead of just "Dip _it_ into the fountain?", hoping that he would have
noticed that he had selected the wrong object. I think he's fooling
himself there, but this gives a brief object name for fountain, pool, and
potion prompts.
From the newsgroup: drowning on the Plane of Water gave cause of
death as "drowned in a moat". There was already some post-3.4.3 code to
handle naming of moat on Juiblex level as "swamp", but it wasn't used for
drowning's cause of death and we were still getting "drowned in a moat"
there too. Now the Plane of Water yields "drowned in deep water" and
Juiblex's level yields "drowned in a swamp".