PatR [Sun, 13 Dec 2015 02:08:11 +0000 (18:08 -0800)]
fix #H4061 - uncursed scroll of enchant armor
In 3.4.3, reading an uncursed scroll of enchant armor while wearing
a piece of cursed armor performed an uncurse as well as raising
enchantment. A fairly big patch to redo how pending shop bills were
affected by altering the items on the bill accidentally took away
the uncurse part when modifying the scroll code to use the bless()/
uncurse()/curse() functions instead of manipulating the armor's
blessed and cursed flags directly.
PatR [Sat, 12 Dec 2015 09:55:44 +0000 (01:55 -0800)]
naming artifacts vs illiteracy
Requested by a beta tester back in June: naming Sting or Orcrist
violates illiterate conduct. I left it at that; any object naming
could be construed as being literate, but I don't think breaking
conduct for doing such would be a good idea.
PatR [Sat, 12 Dec 2015 08:34:16 +0000 (00:34 -0800)]
vampire genocide could produce unkillable critter
Vampires who were currently shape-shifted into a fog cloud, bat, or wolf
became an unkillable fog could, bat, or wolf if the player genocided
vampires. When such a creature was killed, the attempt to transform it
back into a vampire failed, but the monster continued to be resurrected
anyway.
nhmall [Sat, 12 Dec 2015 04:08:01 +0000 (23:08 -0500)]
fix windows bugs H4030 and H4045 (123 and 138)
Changes to be committed:
modified: sys/share/pcmain.c
modified: sys/winnt/nttty.c
modified: sys/winnt/stubs.c
Bug 123 Report 4030:
Minor thing I've noticed - if I quit the game, at the "Hit <Enter> to end."
prompt, if I close the window rather than pressing Enter, I get the following:
Bug 138 - #H4045:
"nethack -s" leads to "-s is not supported for the Graphical Interface".
That's wrong.
(The Graphical Interface comes with "nethackw".)
PatR [Fri, 11 Dec 2015 10:36:56 +0000 (02:36 -0800)]
fix #H4039 - symset:default
Options parsing didn't support "default" (shown by the 'O' command)
or "Default symbols" (menu entry for choosing a symbol set via the
'O' command. Symbol handling is somewhat confusing, but this seems to
do the trick. They can't be truncated, but they're case-insensitive,
and "Default" and "symbols" can be separated by dash or underscore as
well as space, or run-together with no separator.
PatR [Fri, 11 Dec 2015 02:42:27 +0000 (18:42 -0800)]
sys/vms/*.c - mostly reformatting
I'm not sure whether basic formatting cleanup belongs in 3.6.1, but
there are also a couple of strings that got split and require the
implicit concatenation of adjacent string literals introduced with
C89/C90. The code itself compiles with pre-ANSI compilers, or at
least used to--most of it was developed with one....
Much of it is tabs in comments. But there was one substantive item:
an obsolete reference to "use 'Q' to Quit" after however many years....
PatR [Fri, 11 Dec 2015 02:11:12 +0000 (18:11 -0800)]
fix #H4035 - msg when wand zapped by mon explodes
Message given when you see a cursed wand explode while being zapped
by a monster got suppressed if hero was deaf, even though there's no
reference to sound in that message. Change it to ignore deafness;
also, change the alternate message when not visible (which uses
You_hear so already gets suppressed when deaf without caller worrying
about it) use "nearby" or "in the distance" with same criteria as
hearing a wand being zapped, instead of always "in the distance".
I also changed the near/far criteria: threshold to be considered
"far" shrinks from 9 steps to 5 when there's no direct line of sight.
PatR [Thu, 10 Dec 2015 09:34:09 +0000 (01:34 -0800)]
fix #H4038 - distant name vs Eyes of the Overworld
distant_name() temporarily blinded the hero before calling xname() or
doname() in order to prevent the object being formatted from having
its dknown flag set. The Eyes of the Overworld override blindness, so
that bit got set for heros wearing them regardless of intention. This
switches to a file-scope global instead of blindness as the way that
distant_name() tells xname() not to set dknown.
This bug has been present ever since the Eyes were added (3.3.0?).
PatR [Thu, 10 Dec 2015 08:36:01 +0000 (00:36 -0800)]
fruit enlightenment
Move the 'if (wizard) { /* give feedback for named fruit */ }' code
in ^X/enlightenment into an #if DEBUG block, and expand the if (wizard)
predicate with '&& explicitdebug("fruit")' to require that 'fruit' be in
DEBUGFILES. So, build with DEBUG enabled and run via
|% DEBUGFILES='fruit' nethack
to get it back....
This isn't actually a bug fix and it isn't necessary for 3.6.1, but I
got tired of seeing ^X and end-of-game disclosure of attributes end with
three lines about fruit when I'm not doing anything with named fruit.
Pasi Kallinen [Wed, 9 Dec 2015 20:27:22 +0000 (22:27 +0200)]
Allow unlimited number of players
This is important for public servers. Setting the MAXPLAYERS
sysconf value to 0 (or commenting it out) constructs the lock
files with the player UID and player name, so each player may
have one game at a time.
PatR [Wed, 9 Dec 2015 13:56:40 +0000 (05:56 -0800)]
fix #H4026 - silly plural bug
When a stack of corpses gets zapped by undead turning, the message was
"The <foo> corpses glows iridescently." Change it to "One of the <foo>
corpses glows iridescently." since only one of the stack gets revived.
PatR [Wed, 9 Dec 2015 07:12:28 +0000 (23:12 -0800)]
fix #H3994 - cursed genocide is inconsistent
After reading a cursed scroll of genocide, explicitly choosing "none"
when asked to pick what type of monster to wipe out, you get "sent in
some <rndmonst>". But picking nothing (or something invalid) 5 times
gave "that's enough tries" without sending in random monsters. Make
the time-to-give-up behavior be the same as the don't-want-to behavior.
Also, treat picking ESC the same as "none", like blessed genocide does.
PatR [Wed, 9 Dec 2015 00:39:39 +0000 (16:39 -0800)]
fix #H4011 - sys/unix/Makefile.top
Some commented make variables for X11 misspelled 'pilemark.xbm' with
bad '.xbm' suffix.
'symbols' was handled strangely, but it still should have been working
during playground installation. This removes the strangeness but I have
no idea whether it solves #H4015 ('unable to access "symbols" file' for
the Mac OSX binary).
PatR [Tue, 8 Dec 2015 23:15:00 +0000 (15:15 -0800)]
man page updates
Update the man pages and generated text copies for nethack and recover.
I haven't looked at the other four (dlb, makedefs, dgn_comp, lev_comp).
recover's page referred to INSURANCE as being conditional, which is no
longer the case. nethack's page was missing a bunch of files to be
found in the playground and also a couple of environment variables.
I haven't read through the text of the page to try to see whether other
updates are warranted.
The generated text is wider than the previous copy (one or two space
right margin instead of 5 or so). I just used 'make nethack.txt' and
'make recover.txt' so don't know why that changed. (The older, wider
margin looks better, so if anyone knows how to fix this, please do.
And there's got to be a better way to force a blank line inside a
table than my <space><tab> hack.)
PatR [Tue, 8 Dec 2015 22:52:01 +0000 (14:52 -0800)]
update sys/share/{dgn,lev}_lex.c
The HP C compiler for VMS issued a pair of diagnostics for both *_lex.c
files, about an expression of the form (unsigned_var <= 0) maybe not
being what was really intended, and it was right. Changing that to
'< 1' would have suppressed the diagnostic but left the bug, which was
in code that performed a subtraction and then checked for a negative
result. It worked in older flex versions when the variables were
signed, but got broken when they were changed to unsigned (no doubt in
respose to gcc complaining about comparing signed and unsigned in some
other spot where one of them was used).
The bug is in flex's original skeleton, so was inherited by our new
custom skeleton. I've fixed it in the custom skeleton, which means
that sys/share/*_lex.c became out of date even though util/*_comp.l
remain unchanged.
PatR [Tue, 8 Dec 2015 15:21:48 +0000 (07:21 -0800)]
doclassdisco() - missing start_menu() call
Apparently tty doesn't mind if you use add_menu() without preceding
it with start_menu(), because doclassdisco() (the new with 3.6.0 '`'
command) works for me with all four settings of menustyle.
PatR [Mon, 7 Dec 2015 00:47:20 +0000 (16:47 -0800)]
add missing sys/vms/sysconf
SYSCF is enabled by default, but nethack won't run without the required
sysconf file. sys/vms/install.com expects to find a template one in
sys/vms/sysconf so create that.
Since the tarball will need repackaging, fix a comment typo (dyslexic
spelling of "nymph") in sys/unix/sysconf. Also, move DEBUGFILES to the
bottom so that more useful entries move up. And expand the comment for
the PANICTRACE options.
PatR [Sun, 6 Dec 2015 07:02:35 +0000 (23:02 -0800)]
sys/share/???_lex.c
Generated with flex 2.6.0 and a new custom skeleton for that version
(which almost certainly won't work with any older or newer version of
flex, but that limitation has no effect on the usefulness of the
generated scanner code).
Function definitions are oldstyle:
int foo(bar)
char *bar;
{...}
rather than ANSI, like nethack's core code. Advance declarations use
FDECL for prototypes, so should also fit nethack, although the usage
'FDECL(, (arglist))' makes me feel a bit uneasy. gcc doesn't mind the
omitted first argument but other compilers might not like it.
The system headers (stdlib.h and a few others) that flex has been
insisting on including are gone (with this skeleton). It starts out
including "config.h" and that header has the responsibility for any
definitions and declarations necessary. That shouldn't be a big deal
since config.h -> XXXconf.h -> system.h is what we're already relying
on for everything else, but it does need testing for any configuration
that uses sys/share/{dgn,lev}_{lex,yacc}.c.
I'll be checking the skeleton into the NHinternals repository after
adding some documentation, but I'm wondering whether it should really
become part of the source distribution.
PatR [Sat, 5 Dec 2015 06:18:17 +0000 (22:18 -0800)]
PANICTRACE option parsing
Fix the situation where disabling PANICTRACE, which happened implicitly
when BETA got disabled, caused SYSCF option processing to complain and
quit if the 'sysconf' file contained any PANICTRACE settings.
Now accept all the PANICTRACE options (assuming SYSCF is defined) even
if PANICTRACE is not defined. Their values are recorded in the 'sysopt'
struct, but only validated when the appropriate macros (PANICTRACE,
PANICTRACE_LIB) are defined.
PatR [Fri, 4 Dec 2015 22:58:49 +0000 (14:58 -0800)]
!DEBUG warnings
With DEBUG suppressed, I started getting
16 warning: empty body in an if-statement
and 2 warning: empty body in an else-statement
from gcc.
Using braces for an empty block instead of just ';' avoids the warning:
if (foo)
debugpline("foo");
is bad,
if (bar) {
debugpline("bar");
}
is good. ;-)
nhmall [Thu, 3 Dec 2015 04:19:04 +0000 (23:19 -0500)]
windows build without DEBUG defined in global.h
Changes to be committed:
modified: include/global.h
modified: sys/share/pcmain.c
modified: win/win32/mswproc.c
PatR [Wed, 2 Dec 2015 10:18:24 +0000 (02:18 -0800)]
sp_lev.c update
Shorten a function name in sp_lev.c that exceeded 31 characters.
That's a limit imposed by the VMS linker and the compiler complains
that it will be truncated.
Make all sp_lev.c functions which aren't listed in extern.h be static
and give all of them a declaration at the top of the file. I reordered
the ones already declared there in the same order as they occur in the
source, so the diff is quite a bit bigger than the actual changes.
(Once the one with the long name became static, the length of its name
no longer mattered, but I've shortened it anyway.)
Indent a couple of #pragma directives. Some pre-ANSI compiler didn't
like '#' in column 1 followed by something it didn't understand, even
when that occurred in a conditional block which was in the midst of
being excluded. (util/*_comp.y recently reminded me of that. files.c
should get a fix like this too.)
PatR [Tue, 1 Dec 2015 09:49:36 +0000 (01:49 -0800)]
From KevinS: sys/vms/Install.vms
This could use a bit of reformatting. I stripped off trailing spaces
from a handful of lines but otherwise have kept it as is since the
formatting issue is minor.
PatR [Mon, 30 Nov 2015 21:49:43 +0000 (13:49 -0800)]
Guidebook: #annotate, #overview
Another issue from old beta-tester mail: #annotate and #overview were
missing from the list of extended commands. M-A and M-O were listed
but marked "(if supported)" even though they've become unconditional.
Same for M-R, although in its case #ride wasn't missing.
PatR [Mon, 30 Nov 2015 20:59:17 +0000 (12:59 -0800)]
Guidebook: implicit_uncursed
Some old beta-tester mail suggested mentioning the implicit_uncursed
option in the "Curses and Blessings" section; this patch does that.
It also mentions that option in the "Configuring Menu Colors" section
since anyone trying to specify a color for " uncursed " will want
objects to be explicitly described as "uncursed".
The changes to the LaTeX version haven't been tested. The generated
plain text version has a lot of spurious changes due to the padding
method it uses to right-justify short lines.
PatR [Mon, 30 Nov 2015 05:46:24 +0000 (21:46 -0800)]
dungeon overview bug fixes
Reported by a beta tester months ago: it was possible to recognize
your god's temple on the Astral Plane by stepping into its doorway,
since #overview would show "temple of <your god>" (only if just one
temple had been entered and the altar in it was the only one you'd
seen and it was for your own god; #overview doesn't show "temple of
<other god>", just "a temple"). After this fix it will just show
"a temple" even when you can see the temple's altar, so #overview
can't be used as a shortcut to finding the right temple.
While testing the fix I discovered that amnesia wasn't handled when
forgetting the current level's map, only when other levels got
flagged as forgotten. The number of altars, fountains, and so on
are recalculated when #overview is executed, so current-level amnesia
worked for those. But data about known rooms is not recalculated,
so the number of temples and shops you'd visited on the level stayed
instead of being forgotten. The fix is a bit iffy for the case where
you only forget random spots scattered across the level's map rather
than the whole thing; this just wipes #overview memory of every room
even if parts of rooms are still remembered.
PatR [Sat, 28 Nov 2015 11:46:33 +0000 (03:46 -0800)]
lexing updates (sys/unix/Makefile.utl)
Change the 'make' rules for *_lex.c, *_yacc.c, and *_comp.h to put
the end files names into whatever #line directives that refer to
the generated names (lex.yy.c, y.tab.c, y.tab.h). This should not
produce any change in behavior during compilation except to provide
more accurate specifications of where any warnings or errors occur.
Add a 'make dist' target that copies generated scanner and parser
files to sys/share. (As mentioned in the previous patch, I haven't
committed any of those since I have different versions of flex and
also of bison.)
PatR [Sat, 28 Nov 2015 11:38:03 +0000 (03:38 -0800)]
lexer updates
Bump the number of nodes (%e) specified in lev_comp.l so that the lex
on Solaris doesn't choke. flex doesn't use those paramters (%e, %p,
and a few others), so this change gets accepted but hasn't been
adequately tested to verify that it solves the problem.
Reformat some of the C code at the end of dgn_comp.l and lev_comp.l;
going through the whole thing isn't worth the effort, particularly
since flex generates such a mess in the rest of the code it produces.
I haven't updated sys/share/*_lex.c and they definitely need it now.
I've got an older version of flex than the one that was used on the
code that's there now, and the most recent version. Both of those
produce different code--the stuff that's there now has been through
more testing so whatever version was used for it ought to be used for
new editions.
PatR [Thu, 26 Nov 2015 12:30:55 +0000 (04:30 -0800)]
quest message summary debugging code
How that there's nothing left to trigger it, put in some extra quest
messge debugging code. Could be useful if new roles are added or if
any deliver-by-pline messages get changed to be deliver-by-window.
PatR [Thu, 26 Nov 2015 08:11:43 +0000 (00:11 -0800)]
quest message summaries: Rog, Sam, Tou
The samurai ones leave something to be desired since they make no
attempt to include Japanese terminology or to make sure the tone stays
appropriate to a samurai's honor.
PatR [Thu, 26 Nov 2015 00:09:33 +0000 (16:09 -0800)]
dog/cat/rat/ape body parts
Another bit prompted by vibrating square testing:
|You see a strange vibration beneath the little dog's rear claws.
Fix up some body parts: dog, cat, and yeti-class (includes sasquatch,
monkey and ape, owlbear) already have "paws" instead of "fore claws".
Take away all 'Y' except owlbear from that list and add rodents to it.
Give them "rear paws" instead of "rear claws" for their feet; for legs,
use "foreleg" instead of "forelimb" and "read leg" instead of "rear limb".
For yeti/sasquatch/monkey/ape/carnivorous-ape, switch from paws to hands
since they have opposable thumbs, and switch to arm, leg, foot instead
of forelimb, rear limb, and rear claw. I've left "fore claw" for finger.
PatR [Wed, 25 Nov 2015 22:56:58 +0000 (14:56 -0800)]
trap creation sanity check
Noticed while testing the look-at vs vibrating square patch: I was
able to cover stairs with a trap via wizard mode wish. That wish can
achieve a lot of irregular things, but prevent this particular one.
PatR [Wed, 25 Nov 2015 20:16:00 +0000 (12:16 -0800)]
look_at tweak
When examining a trap with '/' or ';', show
|a trap (arrow trap)
instead of
|a trap or a vibrating square (arrow trap)
outside of Gehennom (unless the trap actually is a vibrating square,
which could happen via wizard mode wish). The extra verbosity is
distracting, and limiting mention of the vibrating square to the region
where it's relevant may give a hint to players getting that far for the
first time.
PatR [Mon, 23 Nov 2015 01:23:11 +0000 (17:23 -0800)]
SYSCF WIZARDS
Preformat SYSCF entry 'WIZARDS' so that it can be displayed during panic
feedback without allocating memory for the formatted list at that time.
It also gets displayed for help's "support information" ('?k').
For panic(), push "it may be possible to rebuild" to a second line since
the formatted usernames might make the line long.
PatR [Sun, 22 Nov 2015 16:33:42 +0000 (08:33 -0800)]
flag panic() and terminate() as "no return"
Mark panic() as never returning so that code analysis might be able
to do a smarter job. It required splitting done() into two routines
since the first part really can return (but not if PANICKED was the
reason it got called). done() is now much shorter and ends with a
call to new really_done(), and panic() skips done()'s might-return
part by calling really_done() directly.
Noticed in passing: the "report error to <list of SYSCF WIZARDS>"
code calls a routine which uses alloc(), which won't work very well
if the reason for panic was because malloc() ran out of memory.
PatR [Sun, 22 Nov 2015 16:26:12 +0000 (08:26 -0800)]
avoid panic save panic if external compress fails
On OSX 10.5, save file compression and uncompression fail when I run
under debugger control (for gdb, at least; I don't know why). I used
'#panic' to try something out. panic() calls exit_nhwindows(), then
after some messages calls dosave0(). Saving calls docompress_file()
and when that fails on tty it tries to call clear_nhwindow(WIN_MESSAGE)
but WIN_MESSAGE has been torn down already, leading to a nested panic().
Avoid the call to clear_nhwindow() if windows aren't up.
PatR [Sun, 22 Nov 2015 07:01:43 +0000 (23:01 -0800)]
valgrind vs genl_putmixed
In the midst of composing a commit message about how I reorganized some
of genl_putmixed()'s code without finding any problem, I realized that
there was a problem. The character immediately after \G12345678 would
be copied directly to the output buffer without examination. If that
was the leading backslash for a second encoded sequence, the G and the
hex digits would follow their backslash as just ordinary chars, which
is not what's intended. Or if instead of a backslash the next character
was the input's terminating '\0', the latter would be copied into the
output and the pointer to the input string would be incremented, then
the next loop iteraction would examined whatever followed. If valgrind
is smart enough--and it seems to be--it would complain about accessing
a character that putmixed()'s caller hadn't initialized.
The only use of putmixed() I'm sure about is the what-is code showing
a screen symbol with its explanation, which doesn't exercise either
\G12345678\G12345678 or \G12345678\0. I didn't go hunting to see if
there was someplace that might have an encoded symbol at the end of the
string. what-is still works after this patch....
The only substantive change is adding ``continue'' but I haven't gone
back and undone the reorg that preceded it.
PatR [Sat, 21 Nov 2015 08:25:50 +0000 (00:25 -0800)]
fix more clang complaints
Fix some more of the complaints from clang's static analyzer. The one
in options.c (manipulating warnings symbols) appears to be an actual bug.
All the rest are either because the analysis isn't quite sophicated
enough or outright bogus.
Two of them appear to be because a static routine is attempting to guard
against callers in the same file failing to pass in required output
pointers. Stripping away the check for missing pointer should convince
the analyzer that those output parameters always receive a value. We'll
see once the analysis is eventually re-run....
PatR [Sat, 21 Nov 2015 02:58:48 +0000 (18:58 -0800)]
lev_main cleanup
Use an alternate fix for the complaint from clang's static analyzer
(about potentially derefencing a null pointer, which can't happen
here because alloc() panics and quits rather than return Null), plus
some reformatting and removal of a chunk of unused code (strncmpi).
Also a formatting bit for lev_comp.y, making sys/share/lev_yacc.c
be out of date. However, the generated code will be the same--except
for line numbers--so this shouldn't inhibit anybody's planned testing
waiting for the generated copy to be updated.
PatR [Sat, 21 Nov 2015 02:31:17 +0000 (18:31 -0800)]
valgrind trap complaint
I think this should fix one of the valgrind complaints. Traps which
didn't use the trap->vl union field never initialized it, leaving a
bit of random garbage in the malloc'd trap structure. (And traps
which overwrote existing ones that did use it didn't reinitialize it
so kept stale data around.) Since those fields weren't in use by
the traps that don't care about them, this didn't provoke any actual
trouble.
nhmall [Fri, 20 Nov 2015 03:35:49 +0000 (22:35 -0500)]
nmake output status messages
Changes to be committed:
modified: sys/winnt/Makefile.msc
I've noticed odd output from some of the echo statements
used in the Microsoft nmake Makefile before, but never
bothered to investigate why.
Pat observed that it was due to conversion of \t
in the path that resulted from expansion of the target
macro $@
This change uses the macro character substitution
feature to convert the back slashes to forward slashes
in the message, making the quirky conversion go away.
PatR [Fri, 20 Nov 2015 02:49:50 +0000 (18:49 -0800)]
warning suppression
Fix a couple of the clang static analyzer's warnings.
muse.c has some reformatting. zap.c wasn't triggering any warning about
possible null pointer, but using MON_AT() to maybe avoid m_at() is not
a useful optimization since m_at() is a macro which starts out by using
MON_AT() itself.