Newer compiler found new things to complain about.
NHinternal/shared/sys/share/flexhack.h has been updated.
Generated sys/share/ sources have to be committed separately so
they happen after this update fills in new banner comment for
their source.
Increase the lex paramaters in lev_comp.l and replace use of snprintf
with sprintf in lev_comp.y and lev_main.c.
Also some reformatting for lev_comp.y, but I gave up pretty quickly:
some early tab replacement and adjusting of the spacing for casts.
Make genl_status_update behave approximately the same as basic bot2
when processing the second status line. Preferred order:
Dlvl Gold Hp(HpMax) Pw(PwMax) AC Xp Time Conditions
Alternate orders if above exceeds COLNO (note several extra spaces
get sequeezed out). First one is used if everything except time fits,
second one is used if everything except experience (which can be wide
if 'showexp' option is on) and time fits, third is last resort:
Dlvl Gold Hp(HpMax) Pw(PwMax) AC Xp Conditions Time
Dlvl Gold Hp(HpMax) Pw(PwMax) AC Conditions Xp Time
Hp(HpMax) Pw(PwMax) AC Conditions Dlvl Gold Xp Time
Basic bot2 currently has Conditions as
Stone Slime Strngl FoodPois TermIll <hunger> <encumbrance> Blind Deaf
Stun Conf Hallu Lev Fly Ride
genl_status_update has
<hunger> <encumbrance> Stone Slime Strngl FoodPois TermIll Blind Deaf
Stun Conf Hallu Lev Fly Ride
which is as close as it can get with the current field organization.
Tested by temporarily changing tty_procs.status_init and .status_update
to use genl_* instead of tty_*.
Several people have asked if 3.6.0 supports playing with tiles on
a public server. Because there's no way for the user's end to know
what that white @ is, this adds special console escape codes for
tile hinting.
The idea was originally a patch called TelnetTiles by Justin Hiltscher,
but this expanded version comes via NAO, where it's been in use for years.
This is basically an interim hack, which should go away when/if
we support actual client-server model.
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.
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.
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.
Tell git to ignore the presence of the heaputil program in util/.
(It lives in NHinternal/devteam/util/heaputil.c but working with it
from there is inconvenient.)
If makedefs.c is compiled with MONITOR_HEAP defined, attempted calls to
free() resulted in link failure. Since makedefs doesn't use alloc(),
call free() directly instead of redirecting to nhfree().
Also some assorted reformatting....
Bustling Town can be generated with inaccessible areas outside the
top edge of the fixed town map. If you end up in one of those area
without any way to dig or teleport, you're stuck.
This adds a new level flag "inaccessibles" to force checking for
such inaccessible areas, and add secret doors, holes/trapdoors,
or some random escape item into the areas.
Changes to be committed:
modified: src/version.c
modified: sys/share/cppregex.cpp
modified: sys/share/pmatchregex.c
modified: sys/share/posixregex.c
modified: util/makedefs.c
Some options in 3.6.0 are determined by what you link with.
The choice of regex support is one.
Let #version show that linked option along with the compile-time options.
makedefs.c: In function 'fgetline':
makedefs.c:2630: warning: comparison between signed and unsigned
makedefs.c: At top level:
makedefs.c:2638: warning: ISO C does not allow extra ';' outside of a function
fgetline() makes my recent check for quest line truncation become
redundant, so strip that out. I haven't taken the corresponding
macro out of qtext.h though.
[I didn't see any patch introducing 'fgetline'. Was it hidden as
part of some big merge?]
I did my best to exempt some of the bigger aligned blocks from the reformatting
using the /* clang-format off */ and /* clang-format on */ tags. Probably some
that shouldn't have been formatted were anyway; if you encounter them, please
fix.
The clang-format tags were left in on the basis that it's much easier to prune
those out later than to put them back in, and it means that, modulo my custom
version of clang-format, I should be able to run clang-format on the source tree
again without changing anything, now that Pat has fixed the VA_DECL issues.
Make the input buffer for quest messages bigger so that the expanded
header line from nhsub won't be too long. Also, makedefs will notice
and report too long lines ('makedefs -q' only) and sanely proceed with
the rest of the file instead of treating the excess part of a long
line as a separate line.
Make the variadic functions look more like ordinary code rather than
have the function opening brace be hidden inside the VA_DECL() macro.
That brace is still there, but VA_DECL() now needs to be followed by
a visible brace (which introduces a nested block rather than the
start of the funciton). VA_END() now provides a hidden closing brace
to end the nested block, and the existing closing brace still matches
the one in VA_DECL().
Sample usage:
void foo VA_DECL(int, arg) --macro expansion has a hidden opening brace
{ --new, explicit opening brace (actually introduces a nested block)
VA_START(bar);
...code for foo...
VA_END(); --expansion now provides a closing brace for the nested block
} --existing closing brace, still pairs with the hidden one in VA_DECL()
This should help if/when another round of reformatting ever takes place,
and also with editors or other tools that do brace/bracket/parenthesis
matching.
I had forgotten that there were variadic functions in sys/* and ended
up modifying a lot more files than intended. The majority of changes
to those just inserted a new '{' line so that revised VA_END()'s '}'
won't introduce a syntax error. A couple of them needed VA_END() moved
so that local variables wouldn't go out of scope too soon. Only the
Unix ones have been tested.
I'll push a formatting guide at some point. There may still be
outstanding changes, but please feel free to resolve those as you arrive
a them.
To the best of my knowledge, there is no changes to the actual code
content, but the formatter does have the occasional bug. If you run into
an issue, please fix it!
* Add missing entry for include/tile.h to (top)/Files; also
add new entry for generated file util/tiletxt.c (Unix only);
* Add several missing entries for tile utility programs that
can be built by sys/unix/Makefile.utl to util/.gitignore;
* Update sys/unix/Makefile.utl to build 'tilemap' differently so
that it won't leave behind an unwanted subdirectory tree under OSX:
util/tilemap.dSYM/
util/tilemap.dSYM/Contents/
util/tilemap.dSYM/Contents/Info.plist
util/tilemap.dSYM/Contents/Resources/
util/tilemap.dSYM/Contents/Resources/DWARF/
util/tilemap.dSYM/Contents/Resources/DWARF/tilemap
It now generates util/tiletxt.c on the fly, to be compiled into
tiletxt.o, so that tilemap.c can be compiled in the ordinary
manner and tilemap.o can be kept around for dependency checking.
(Creating real source file win/share/tiletxt.c would be a little
bit cleaner, but it's effectively two lines long so seems silly
to be in the source distribution.) I looked to see whether I
could find a linker or compiler option to suppress that stuff but
failed. I'm sure something of the sort must exist but didn't
pursue it. Someday I might actually learn about how OSX works....
Changes to be committed:
modified: include/config.h
modified: include/extern.h
modified: include/flag.h
modified: include/global.h
modified: include/ntconf.h
modified: include/wintty.h
modified: src/cmd.c
modified: src/files.c
modified: src/options.c
modified: sys/share/pcmain.c
modified: sys/share/pcsys.c
modified: sys/share/pcunix.c
modified: sys/winnt/Makefile.gcc
modified: sys/winnt/Makefile.msc
modified: sys/winnt/nttty.c
new file: sys/winnt/stubs.c
modified: sys/winnt/winnt.c
modified: util/makedefs.c
modified: win/tty/wintty.c
Adjust the code and the command line Makefile so that
you no longer have to choose whether to build the tty
version NetHack.exe, or the gui version NetHackW.exe.
Both will now be built in a single 'nmake install' pass.
The previous USE_OLDARGS worked with gcc on Intel, but was inherently
unsafe. This method is completely safe, just obnoxiously intrusive.
It you disliked debugpline*(), you're bound to hate this....
It should now be randomly disabled for a 3rd of Gehennom, to make things
a tad more interesting there. It's also disabled in Baalzebub's lair,
to make things a little more interesting.
Still don't know why the beetle is disappearing.
Remove the requirement for <stdarg.h> that was introduced to lev_comp.
USE_STDARG still works. USE_OLDARGS required hackery but has been
tested and actually works, although I wouldn't trust it on platforms
where 'long' and 'char *' aren't the same size. USE_VARARGS didn't
require any hackery--aside from the conversion to core's pline code--
but has not been tested: <varargs.h> supplied with OSX won't compile,
with an #error directive that basically says "switch to <stdarg.h>".
I changed several printf formats of %i and %li to %d and %ld because
I'm not sure how widespread the 'i' variant was back in days of yore.
[TODO: avoid use of snprintf since pre-ANSI systems won't have it.]