Commit Graph

1023 Commits

Author SHA1 Message Date
Pasi Kallinen
fd1932075e Fix dark room glyphs on level re-entry 2015-05-25 10:02:09 +03:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09:00
Sean Hunt
8b57d96fd2 Reformat .h files.
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.
2015-05-25 09:21:15 +09:00
Sean Hunt
26ee7dc370 Convert the vibrating square to a trap
Patch due to ais523 in NetHack 4.

This is not ready to be merged yet; the vibrating square needs a tile
image for tiles builds.
2015-05-25 09:19:20 +09:00
Sean Hunt
b6f32e7eff Warning cleanup. 2015-05-24 11:12:58 -04:00
nhmall
194fd2f78c merge two sets of patches to makedefs.c,qtext.h
Changes to be committed:
	modified:   include/qtext.h
	modified:   util/makedefs.c
2015-05-24 10:27:03 -04:00
Sean Hunt
84d63e169b Use the common regex engine in more places.
In particular, in autopickup_exceptions and user sounds.
2015-05-24 10:17:58 -04:00
Sean Hunt
49b9f6c926 Modify makedefs to use dynamic buffers for reading.
This will prevent crashing due to excessively long lines.
2015-05-24 10:17:28 -04:00
nhmall
f477645774 prep for sean's emailed patch 2015-05-24 10:16:38 -04:00
nhmall
57e404250a prep for sean's emailed patch 2015-05-24 10:09:44 -04:00
PatR
5f0a55f2cd makedefs -q fix
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.
2015-05-23 23:11:41 -07:00
nhmall
56266a0800 Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource 2015-05-21 20:46:58 -04:00
nhmall
43006357bd comment out experimentals 2015-05-21 20:44:32 -04:00
PatR
168572fd0d #terrain update
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.
2015-05-21 16:53:46 -07:00
PatR
f0370f5f86 you feel {a,an unexpected} draft
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.
2015-05-18 18:25:44 -07:00
PatR
fabf9cd901 VA_DECL/VA_END usage
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.
2015-05-15 17:45:21 -07:00
PatR
2dc2091626 display.h cleanup
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.
2015-05-09 16:54:05 -07:00
Sean Hunt
167800afdf Fix type compatibility warning. 2015-05-09 13:07:49 -04:00
Derek S. Ray
d0fb68795d Merge branch 'derek-elbereth'
* 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
2015-05-09 11:58:36 -04:00
nhmall
5011459c7e Merge branch 'master' into win32-x64-working 2015-05-07 05:00:36 -04:00
nhmall
b901acc7d6 make internal numbering match updated headers 2015-05-07 04:58:59 -04:00
nhmall
20069798d4 Merge branch 'master' into win32-x64-working 2015-05-07 04:52:30 -04:00
karnov
2a907f894e Version number increment 2015-05-06 22:04:27 -04:00
nhmall
8a3a92d2e2 put back Derek's _MSC_VER changes into the lint.h version 2015-05-06 19:58:31 -04:00
nhmall
1ef94c890f Merge branch 'master' into win32-x64-working
Conflicts:
	include/hack.h
	win/X11/winmenu.c
	win/X11/winstat.c
2015-05-06 19:53:26 -04:00
PatR
9de8b03c03 X11 lint suppression
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.
2015-05-06 00:59:15 -07:00
PatR
e72246f1d1 new file: include/lint.h
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.
2015-05-06 00:38:16 -07:00
nhmall
f692db8581 Merge branch 'master' into win32-x64-working 2015-05-04 17:56:35 -04:00
karnov
490092d3ef Made sysconf define contiditional to ensure no double inclusion. 2015-05-03 22:03:09 -04:00
nhmall
088e0471f1 Merge branch 'master' into win32-x64-working 2015-05-01 18:36:39 -04:00
nhmall
573c9dc98f Merge branch 'AlexK-misc' 2015-05-01 18:24:59 -04:00
Pasi Kallinen
8f639796d5 Handle boulder-option in config file
Setting boulder in config file did not work correctly in post-3.4.3
code, due to the symset changes.
2015-05-01 22:03:13 +03:00
nhmall
353417c642 Merge branch 'master' into win32-x64-working
Conflicts:
	src/mon.c
	src/options.c
	src/pickup.c
	src/zap.c

 Changes to be committed:
	modified:   doc/Guidebook.mn
	modified:   doc/Guidebook.tex
	modified:   doc/fixes35.0
	modified:   include/color.h
	modified:   include/extern.h
	modified:   include/mondata.h
	modified:   src/ball.c
	modified:   src/dbridge.c
	modified:   src/dig.c
	modified:   src/display.c
	modified:   src/dokick.c
	modified:   src/dungeon.c
	modified:   src/fountain.c
	modified:   src/invent.c
	modified:   src/mkmaze.c
	modified:   src/mkobj.c
	modified:   src/mon.c
	modified:   src/monmove.c
	modified:   src/mthrowu.c
	modified:   src/options.c
	modified:   src/pickup.c
	modified:   src/sit.c
2015-04-30 06:39:44 -04:00
Derek S. Ray
fb8a071a39 finish up the changes to trigger erosion on use
Elbereth is a magical power, and like everything else, magic eventually
gets used up... even for burned engravings.
2015-04-27 18:18:16 -04:00
Pasi Kallinen
86dc5cf588 Unify getting terrain under drawbridge 2015-04-27 22:15:23 +03:00
Pasi Kallinen
0903df974f Unify guards yelling 2015-04-27 21:31:25 +03:00
Pasi Kallinen
f0699b76d9 Add is_watch define for watchmen 2015-04-27 21:09:26 +03:00
Pasi Kallinen
eecd19caa9 Allow changing menucolors in-game via Options 2015-04-27 17:45:48 +03:00
nhmall
ea21088d2a Merge branch 'AlexK-misc' into win32-x64-working 2015-04-26 18:08:50 -04:00
Alex Kompel
664b4eb643 bubble structure contains pointer into static array. Bubble objects
are being flat-dumped into save file and this causes segfault in restore()
whenever data segment layout changes (e.g. global variables added/removed).
bmask should either be stored with the objects.
2015-04-26 14:47:38 -07:00
nhmall
fa238fad65 Merge branch 'master' into win32-x64-working 2015-04-26 08:39:18 -04:00
Pasi Kallinen
4e067f5f2b Show level annotation on level entry
Idea by Chris Smith, via Unnethack
2015-04-26 10:46:42 +03:00
nhmall
ed2e70b506 Merge branch 'master' into win32-x64-working 2015-04-24 11:50:34 -04:00
Derek S. Ray
22ffe3b84e initial pass for toning down Elbereth 2015-04-23 23:04:35 -04:00
Pasi Kallinen
aea472c0c0 Give honorifics to vampires and elves 2015-04-23 21:46:10 +03:00
nhmall
5a87938c7d Merge branch 'master' into win32-x64-working
Conflicts:
	src/restore.c
	src/save.c
2015-04-23 07:03:45 -04:00
PatR
ae6eeec22a statue glyph save/restore
Remove the code that converted statues shown as monsters into stautes
shown as big rocks when saving and then reversed the effect when
restoring.  It was done to preserve save file compatability with 3.4.3
where statue-as-monster glyphs didn't exist, so is no longer useful.
2015-04-22 19:47:55 -07:00
nhmall
67e7565ee2 Merge branch 'master' into win32-x64-working
Conflicts:
	src/sp_lev.c
2015-04-22 22:33:22 -04:00
PatR
16d8074352 lint 2015-04-22 19:17:49 -07:00
nhmall
68a68e167a merge fallout from previous night 2015-04-22 20:05:27 -04:00