Commit Graph

971 Commits

Author SHA1 Message Date
nhmall
b901acc7d6 make internal numbering match updated headers 2015-05-07 04:58:59 -04:00
karnov
2a907f894e Version number increment 2015-05-06 22:04:27 -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
karnov
490092d3ef Made sysconf define contiditional to ensure no double inclusion. 2015-05-03 22:03:09 -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
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
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
Pasi Kallinen
4e067f5f2b Show level annotation on level entry
Idea by Chris Smith, via Unnethack
2015-04-26 10:46:42 +03:00
Pasi Kallinen
aea472c0c0 Give honorifics to vampires and elves 2015-04-23 21:46:10 +03: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
PatR
16d8074352 lint 2015-04-22 19:17:49 -07:00
Pasi Kallinen
5a42ce4040 Unify boulder dropping on player
... and if you're swallowed, make the dropped boulder hit the monster.
(Changes from UnNetHack)
2015-04-22 20:22:55 +03:00
Pasi Kallinen
ed164ad324 Fix typo in func decl 2015-04-22 13:24:51 +03:00
Pasi Kallinen
bd69677933 Unify stumbling on door mimic 2015-04-22 09:23:54 +03:00
Pasi Kallinen
75e7d837e6 Unify food-related conducts when eating a monster 2015-04-22 09:16:49 +03:00
Pasi Kallinen
6d4aa312e6 Unify hero free hand check and msg 2015-04-22 09:02:38 +03:00
Pasi Kallinen
171e8284cd Unify monster gender setting 2015-04-22 08:58:04 +03:00
Pasi Kallinen
3bf2d17e2c Unify iron ball unwielding 2015-04-22 08:53:13 +03:00
Pasi Kallinen
34d5a4c1f9 Unify file removed -trickery 2015-04-22 08:45:03 +03:00
Pasi Kallinen
2783157f95 Unify "You are rooted" message 2015-04-22 08:35:14 +03:00
Derek S. Ray
0bef94cfde Make coalescence message be smart about status
- honor blindness and hallucination
- honor ability to see one of the mergees
- provide audible feedback if appropriate
- merging inside pack gets special-cased so player knows something
  different/unusual is happening
2015-04-21 21:47:33 -04:00
Pasi Kallinen
c9bb75eaf3 Unify dropping boulder on monster 2015-04-21 22:40:27 +03:00
PatR
6cad21e4e8 tribute in-game bonus
Give 20 experience points the first time the hero reads a passage
from a tribute novel.  It's enough to go from level 1 to 2 or from
2 to 3.  By the time a book store is found, that's too trivial for
most to care about, but it's potentially useful to a pacifist.
2015-04-20 00:05:00 -07:00
nhmall
0fdcea70c6 suggested booktribute mods
Changes to be committed:
	modified:   include/extern.h
	modified:   src/files.c
	modified:   src/objects.c
	modified:   src/spell.c

- charge a little more.
- no free read in the bookstore.
2015-04-18 17:45:27 -04:00
Pasi Kallinen
8c41a962a7 Fix saving xlogfile realtime 2015-04-17 10:35:05 +03:00
Pasi Kallinen
647a072b62 Move triplicate defines into single place 2015-04-14 20:33:30 +03:00
Pasi Kallinen
cd3b0efe5d Unify description of hero's visage into single function 2015-04-14 19:41:44 +03:00
Pasi Kallinen
879f6d55c2 Add Auto open doors -patch 2015-04-13 21:11:44 +03:00
Pasi Kallinen
1c970b171e Some monsters can eat through iron bars
Any monster with rusting or corrosion attack can eat through
the bars. This includes rust monsters, grey oozes, and black puddings.

Original patch by Malcolm Ryan
2015-04-13 19:41:51 +03:00
Pasi Kallinen
6209d458f9 A camera may contain a picture-painting demon
Original patch by Leon Arnott
2015-04-13 18:54:24 +03:00
Pasi Kallinen
eba5bf7d5e Add litmus test
Original patch by Dylan O'Donnell
2015-04-13 18:30:53 +03:00
Sean Hunt
80aa109855 Use extern.h for regexes.
I was planning to do this anyway, but it created an include loop that
was breaking it on Windows.
2015-04-12 11:46:54 -04:00
Sean Hunt
b86ad06d6b Implement a new system-based matching harness.
The intent is to look for platform-specific facilities for regex
matching, to provide portable MENUCOLORS configuration files.

This is a prototype implementation being committed to see if Windows can
use the POSIX regex implementation provided with the C++11 standard
library. If this works, I will write a harness for POSIX regexes and for
pmatch(), and those can be linked in by platforms as appropriate.

pmatch() should be used only as a very last resort, because it breaks
compatibility between platforms.
2015-04-12 11:46:26 -04:00
nhmall
11560933cc Merge branch 'master' into nhmall-booktribute
Conflicts:
	doc/fixes35.0
	include/extern.h
	src/mkobj.c
	src/mon.c
	src/objnam.c
	win/share/objects.txt
2015-04-12 10:02:17 -04:00
PatR
5974ae5700 new pmatch variations
Add pmatchi() to perform case-insensitive wildcard matching, and
pmatchz() which is also case-insensitive and ignores spaces, dashes,
and underscores like the type of matching done during wish parsing.
At the moment, neither is being used, although DEBUGFILES handling
uses pmatch and needs to be taught to distinguish between case-
sensitive and case-insensitive filenames so will eventually use
pmatchi when appropriate.
2015-04-11 19:39:59 -07:00
Pasi Kallinen
eb77c57a6c Allow disabling savefile UID checking in sysconf 2015-04-11 21:07:57 +03:00
PatR
91fc8dc69c obj_nexto_xy lint 2015-04-10 18:31:11 -07:00
Derek S. Ray
9fc9a86d34 lock MENU_COLOR_REGEX away since it isn't Win32 yet 2015-04-10 17:08:31 -04:00
Derek S. Ray
32619fa8cc Merge branch 'master' into derek-farming
Reverse merge before final reintegration.

* master: (40 commits)
  Fix magic mapped dark room symbols
  Disclose extinct species alongside genocided ones
  ...

Conflicts:
	doc/fixes35.0
	src/do.c
	src/files.c
	src/invent.c
	src/objnam.c
	sys/share/pcmain.c
2015-04-10 16:56:30 -04:00
nhmall
7e098c0c4e Merge branch 'master' into nhmall-booktribute 2015-04-10 12:15:14 -04:00
PatR
71d7eff0a7 revisit variable arguments in new lev_comp
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....
2015-04-10 01:39:55 -07:00
Sean Hunt
f523055746 Make WALLIFIED_MAZE into a level flag.
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.
2015-04-09 13:27:44 -04:00
Pasi Kallinen
92a7962399 Add sortloot -patch
Adds the "sortloot" compound option, with possible values
of "none", "loot", or "full".  It controls the sorting of
item pickup lists for inventory and looting.
2015-04-09 18:23:54 +03:00
PatR
9072e80085 support pre-ansi varargs in new lev_comp
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.]
2015-04-09 03:09:00 -07:00
Pasi Kallinen
c967dabc0b Clive Crous' Dark Room patch
This patch adds a new glyph that represents dark parts of room,
splitting the dual functionality of the "unexplored/dark area" glyph.
2015-04-07 21:01:21 +03:00