Changes to be committed:
modified: include/botl.h
modified: include/extern.h
modified: include/wintty.h
modified: src/botl.c
modified: src/options.c
modified: src/windows.c
modified: win/tty/wintty.c
get the tty versions started
Changes to be committed:
modified: include/extern.h
modified: src/botl.c
modified: src/options.c
modified: src/windows.c
defer notification of the window port until after
proper initialization. Options are processed very
early in 3.6.0
Changes to be committed:
modified: include/botl.h
modified: src/botl.c
modified: src/windows.c
modified: win/tty/wintty.c
Move the windowport stuff out of botl.c and into windows.c
where it belongs.
Make Orcrist glow light blue when orcs are present, just like Sting.
(Sting supposedly glowed because it was made by the elves of Gondolin
rather than any particular attribute built into it, and Orcrist was
made there too. I think it also glowed in the Hobbit; that was how
Bilbo recognized what the situation was when he first saw Sting glow.
Maybe it was the other sword rather than Orcrist, but they were treated
as being functionally equivalent.)
Also make Grimtooth glow red when elves are present. That's from thin
air, to give it some novelty. Unlike Sting, whose double-damage bonus
is restricted to orc targets, Grimtooth's weak 1d6 bonus still applies
to all targets.
Implement Boudewijn's suggestion that #name be extended to allow naming
something of the floor. I'm sure he wants this so that he can avoid
picking up gray stones, but it's something I started to implement years
ago (probably at an earlier suggestion from him...) and then forgot all
about.
This changes the #name menu to be
m - a monster
i - a particular object in inventory
o - the type of an object in inventory
f - the type of an object upon the floor
d - the type of an object on discoveries list
a - record an annotation for the current level
What do you want to name?
with the i and o choices omitted when inventory is empty. If the
'lootabc' option is set it will use a through f instead, but then the
last three entries change letters when inventory is empty. 'y' and 'n'
are still accelerators (effectively hidden choices) for the i and o
entries, corresponding to the answers for the 3.4.3 and earlier "name
an individual object?" prompt.
The floor choice asks you to pick a location. If you pick yourself,
then the top object of the pile underneath you is targetted. Otherwise,
the target must be an object glyph, and the object must have its dknown
bit set, so have previously been seen up close or revealed via blessed
potion of object detection. To make it be more useful, targetting an
object on an adjacent square will set the dknown bit. (Just the top
object if there is a pile there.) There's no cockatrice corpse touch
check since you aren't actually touching anything, just looking.
The setting of dknown bit for an adjacent object has been extended to
the '/' and ';' commands for examining things on the screen as well.
It's only done for adjacent spots you actively select, not all 8 spots
around you.
MSGTYPE allows the user to define how messages in the message
area behave. For example:
MSGTYPE=stop "You swap places with "
would always make that message prompt for -more-. Allowed types
are "show" (normal message), "hide" (do not show), "stop" (wait
for user), and "norep" (do not repeat message).
Adding this, because it's relatively simple, proven to work, and
it seemed to be the major thing betatesters felt was lacking when
compared to NAO.
The option defaults to on, which is the old-style behaviour.
Turning the option off will never omit the "uncursed" -status
from inventory lines. This is pretty much required if users
want to use menucolors based on the BUC state.
Replace static in_line[] and out_line[] with local variables that are
released when the quest pager code returns to caller. QTEXT_IN_SIZ
was already removed from makedefs; now QTEXT_OUTSIZ is removed from
nethack. Use regular BUFSZ for them instead of trying to maintain a
separate size for quest text.
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 post-3.4.3 '#terrain' command be more versatile by allowing the
player to choose between floor-only, floor+traps, and floor+traps+objects
so that it is possible to view known traps covered by objects or monsters
and remembered objects covered by monsters. The extra explore mode and
wizard mode choices aren't affected.
Move the message given when a monster digs through a closed door
or a secret corridor into a separate routine. In theory, nethack
should determine whether there is a path between the new opening
and the hero's location in order to decide whether a draft can
be felt. (I don't think anyone is likely to implement that--I'm
certainly not. Checking whether the hero is in a room with no
breaches in its walls could at least catch being inside a vault.)
While at it, add some USA-centric puns about feeling the prospect
of imminent military conscription instead of air current if it
happens while hallucinating.
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 started out just to replace the weird partial expression in the
maybe_display_usteed macro but ended up cleaning up some other stuff
such as line wrapping.
There are still tabs present.
* derek-elbereth:
ensure that the 'safe' objects remain safe
finish up the changes to trigger erosion on use
initial pass for toning down Elbereth
Conflicts:
dat/castle.des
dat/sokoban.des
include/extern.h
src/engrave.c
src/mklev.c
src/monmove.c
src/zap.c
Suppress close to 400 warnings generated by gcc on the win/X11/*.c code,
most due to -Wwrite-strings which makes string literals implicitly have
the 'const' attribute. (Since modifying a string literal results in
undefined behavior, that is an appropriate check to have enabled, but
it can be troublesome since string literals have type 'char *' and code
that uses them that way is correct provided it avoids modifying them.)
113 warning: initialization discards qualifiers from pointer target type
127 warning: assignment discards qualifiers from pointer target type
29 warning: passing argument discards qualifiers from pointer target type
109 warning: unused parameter
12 warning: comparison between signed and unsigned
The nhStr() hack casts to 'char *', explicitly removing 'const', for
situations where it isn't feasible to make code directly honor const.
The vast marjority of uses are for the second parameter to XtSetArg(),
which is a macro that actually performs an assignment with the second
argument rather than passing it in a function. It takes values like
'XtNtop', which doesn't need to be altered (although in many places I
changed that to nhStr(XtNtop) for uniformity with the surrounding code,
and 'XtNbottom', which does need to have the extra const stripping to
avoid a warning. Go figure.
The nhUse() hack actually uses its argument in a meaningless way if the
code is compiled with FORCE_ARG_USAGE defined. When GCC_WARN is defined,
FORCE_ARG_USAGE will be enabled if it hasn't been already. Example:
/*ARGUSED*/
int foo(arg)
int arg; /* not used */
{
+ nhUse(arg);
return 0;
}
The extra line will expand to ';' when FORCE_ARG_USAGE is not defined
or too
nhUse_dummy += (unsigned)arg;
when it is. I figured direct assignment might lead to a different
warning by some compilers in a situation like
nhUse(arg);
nhUse(otherarg);
where the first assignment would be clobbered by the second, and using
bitwise operations or safer '+= (arg != 0)' would most likely generate
more non-useful code. Some tweaking might turn out to be necessary.
modified files: include/hack.h, src/decl.c, sys/unix/Makefile.src
Groundwork for cleaning up the X11 sources, where gcc with the option
settings specified in the OSX hints file currently generates close to
400 warnings for win/X11/*.c.
lint.h is included by hack.h, and I've moved the debugpline stuff from
the latter to the former to hide it better. (By rights it belongs in
debug.h or something of the sort, but I didn't want to go that far.)
Makefile and project dependencies need to catch up.
nhStr() hides a cast to char *, and is intended to by used on string
literals where it isn't feasible to maintain the 'const' attribute.
(A pernicious problem with X11 code, where the include situation can
become very convoluted, and many, MANY string literals are hidden
behind macros to look like keyword-type tokens.)
nhUse() can be used to force a fake usage on something which triggers
an unused parameter warning. There are a 6 or 8 or 10 places in the
core code where that applies, but so far I have't touched any of them.
There's a tradeoff since it will result in some worthless code being
generated and executed, but is much simpler than tacking on compiler-
specific workarounds like '#pragma unused' or gcc's __attribute__ hack.