Commit Graph

178 Commits

Author SHA1 Message Date
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
PatR
9e0e1ac5d1 remove accidentally added util/lev_main.i 2015-05-15 23:08:15 -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
Sean Hunt
97d6fade74 Reformat all C files.
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!
2015-05-09 13:43:16 -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
8ebf5b1759 Merge branch 'master' into win32-x64-working 2015-05-03 09:01:46 -04:00
PatR
23a671147f tiles-related build stuff
* 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....
2015-05-03 00:47:10 -07:00
nhmall
77dd76ed17 Merge branch 'master' into win32-x64-working
Resolved Conflicts:
	src/cmd.c
	src/mkobj.c

 All conflicts fixed but you are still merging.

 Changes to be committed:
	modified:   dat/Priest.des
	modified:   dat/Rogue.des
	modified:   dat/Valkyrie.des
	modified:   dat/Wizard.des
	modified:   dat/gehennom.des
	modified:   src/cmd.c
	modified:   src/mkobj.c
	modified:   src/steal.c
	modified:   sys/share/lev_yacc.c
	modified:   util/lev_comp.y
2015-05-02 13:53:08 -04:00
Pasi Kallinen
b234c7032f Make the Valley have slight variations 2015-05-02 18:29:35 +03:00
nhmall
aaca36a6d5 build both tty NetHack.exe and gui NetHackW.exe
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.
2015-04-22 00:07:46 -04:00
nhmall
3d3ee78a0b Merge branch 'master' into win32-x64-working
Conflicts:
	src/files.c
	src/potion.c
	sys/winnt/Makefile.msc

 Changes to be committed:
	modified:   .gitignore
	modified:   DEVEL/hooksdir/nhsub
	modified:   dat/.gitignore
	modified:   dat/opthelp
	modified:   doc/Guidebook.mn
	modified:   doc/Guidebook.tex
	modified:   doc/fixes35.0
	modified:   include/context.h
	modified:   include/decl.h
	modified:   include/extern.h
	modified:   include/flag.h
	modified:   include/hack.h
	modified:   include/patchlevel.h
	modified:   src/apply.c
	modified:   src/attrib.c
	modified:   src/decl.c
	modified:   src/do.c
	modified:   src/do_name.c
	modified:   src/dothrow.c
	modified:   src/eat.c
	modified:   src/files.c
	modified:   src/hack.c
	modified:   src/invent.c
	modified:   src/lock.c
	modified:   src/mklev.c
	modified:   src/mondata.c
	modified:   src/monmove.c
	modified:   src/music.c
	modified:   src/options.c
	modified:   src/potion.c
	modified:   src/pray.c
	modified:   src/sit.c
	modified:   src/sp_lev.c
	modified:   src/uhitm.c
	modified:   sys/share/posixregex.c
	modified:   sys/winnt/Makefile.msc
	modified:   util/.gitignore
	modified:   win/win32/vs2010/NetHackW.vcxproj
2015-04-14 18:23:48 -04:00
Pasi Kallinen
ee5002210f Fix gitignored 2015-04-13 08:30:47 +03:00
nhmall
2cfa05cde1 Merge branch 'master' into win32-x64-working
Conflicts:
	include/config.h
	include/extern.h
	src/do.c
	src/files.c
	src/hack.c
	src/mkobj.c
	src/mon.c
	src/objnam.c
	src/vision.c
	sys/share/pcmain.c
	win/share/other.txt
	win/share/renumtiles.pl
2015-04-12 00:15:40 -04:00
Pasi Kallinen
c266d05680 Minor special level and compiler tweakage
Fix allowed map characters.
Make some predefined MAPs blend in better with randomly
generated parts.
2015-04-10 16:47:32 +03: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
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
Derek S. Ray
b4142b5894 Merge branch 'master' into win32-x64-working
* master: (354 commits)
  Add missing protos
  a warning bout lc_error
  Add S_poisoncloud to Guidebooks
  ...

Conflicts:
	.gitattributes
	dat/.gitattributes
	doc/.gitattributes
	doc/Guidebook.mn
	include/config.h
	include/decl.h
	include/extern.h
	include/flag.h
	include/hack.h
	include/ntconf.h
	include/sys.h
	include/wceconf.h
	src/apply.c
	src/attrib.c
	src/bones.c
	src/botl.c
	src/dbridge.c
	src/dig.c
	src/do.c
	src/do_name.c
	src/dog.c
	src/dungeon.c
	src/eat.c
	src/end.c
	src/files.c
	src/fountain.c
	src/hack.c
	src/invent.c
	src/light.c
	src/makemon.c
	src/mhitu.c
	src/mklev.c
	src/mkmaze.c
	src/mkobj.c
	src/mkroom.c
	src/mon.c
	src/objnam.c
	src/options.c
	src/pager.c
	src/pickup.c
	src/potion.c
	src/pray.c
	src/questpgr.c
	src/read.c
	src/restore.c
	src/rnd.c
	src/role.c
	src/rumors.c
	src/save.c
	src/shk.c
	src/sit.c
	src/sp_lev.c
	src/sys.c
	src/teleport.c
	src/trap.c
	src/u_init.c
	src/uhitm.c
	src/wield.c
	src/worn.c
	src/zap.c
	sys/amiga/.gitattributes
	sys/mac/.gitattributes
	sys/msdos/.gitattributes
	sys/msdos/pctiles.c
	sys/msdos/vidvga.c
	sys/os2/.gitattributes
	sys/share/.gitattributes
	sys/share/pcmain.c
	sys/unix/.gitattributes
	sys/unix/hints/.gitattributes
	sys/unix/sysconf
	sys/unix/unixmain.c
	sys/vms/.gitattributes
	sys/wince/.gitattributes
	sys/wince/mhstatus.c
	sys/winnt/.gitattributes
	sys/winnt/Makefile.msc
	sys/winnt/nhsetup.bat
	util/lev_comp.l
	util/makedefs.c
	win/X11/winmenu.c
	win/X11/winstat.c
	win/gnome/gnstatus.c
	win/share/tilemap.c
	win/tty/termcap.c
	win/tty/topl.c
	win/tty/wintty.c
2015-04-05 23:42:15 -04:00
nhmall
660534389e a warning bout lc_error
lev_comp.l(310) : warning C4013: 'lc_error' undefined; assuming extern returning int
2015-04-05 09:26:01 -04:00
Pasi Kallinen
68a39aeab4 Fix GCC warnings caused by new lev_comp 2015-04-03 17:40:54 +03:00
Pasi Kallinen
c8e781c418 Add menucolors
-Add a boolean option menucolors to toggle menu color
-Add MENUCOLOR -config file option

TODO:
-Better support for win32
-Support more windowports
-Update Guidebook
-Allow changing menucolor lines in-game
2015-04-02 20:16:25 +03:00
Pasi Kallinen
323b8b4038 Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource into paxed-new_lev_comp
Conflicts:
	src/trap.c
	sys/winnt/Makefile.msc
2015-04-01 16:09:53 +03:00
keni
8ee2d5976e NHDT substitution version 2.
Re-run nhgitset.pl to install.
"perldoc DEVEL/hooksdir/nhsub" for details.  General docs still to come.
Quick notes:
- "git nhsub" lets you apply substitutions to a file without involving any
  version control.
- When doing nhadd/nhcommit, the working directory WILL reflect the results
  of the substitutions.
Let's see what this breaks.
2015-03-31 09:50:02 -04:00
Pasi Kallinen
0a9248c7f1 Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource into paxed-new_lev_comp
Conflicts:
	doc/fixes35.0
	include/extern.h
	include/ntconf.h
	include/obj.h
	include/patchlevel.h
	src/dig.c
	src/do.c
	src/files.c
	src/fountain.c
	src/mklev.c
	src/objnam.c
	src/options.c
	src/potion.c
	src/rumors.c
	src/save.c
	src/topten.c
	src/trap.c
	src/wield.c
	sys/share/pcmain.c
	sys/unix/unixmain.c
	sys/winnt/Makefile.msc
	util/lev_main.c
	util/makedefs.c
2015-03-24 19:46:38 +02:00
Pasi Kallinen
8785f73b7f Use the correct declaration macro 2015-03-24 19:28:27 +02:00
nhmall
b1547c4770 include header file <ctype.h> in lev_main.c
options.c depends on ctype.h  and uses tolower()
so no sense getting into a discussion about
use of _that_
2015-03-24 19:26:01 +02:00
nhmall
c4009b781c Actually use the new routines in lev_main 2015-03-24 19:25:54 +02:00
nhmall
f9d22e02cd lev_main's own internal case-insensitive compare
TEST SUITE

int case_insensitive_comp(const char *, const char *);

/* define your built-in compiler library variation here */

/* #define BUILTIN(a,b) strcasecmp(a,b) */
/* #define BUILTIN(a,b) stricmp(a,b) */

int main(int argc, char *argv[])
{
	const char *t1 = "NetHack";
	const char *t2 = "nethack";
	const char *t3 = "Fred";
	const char *t4 = "Barney lived next door";

	/* try the results with built-in strcmpi first */

	printf("builtin:\tcompare <%s> to <%s>, result %d.\n",
		t1, t2, BUILTIN(t1,t2));
	printf("builtin:\tcompare <%s> to <%s>, result %d.\n",
		t3, t4, BUILTIN(t3,t4));

	/* try the results with case_insensitive_comp 2nd */

	printf("ours:\tcompare <%s> to <%s>, result %d.\n",
		t1, t2, case_insensitive_comp(t1,t2));
	printf("ours:\tcompare <%s> to <%s>, result %d.\n",
		t3, t4, case_insensitive_comp(t3,t4));

}

int
case_insensitive_comp(s1, s2)
const char *s1;
const char *s2;
{
    unsigned char u1, u2;

    for ( ; ; s1++, s2++) {
	u1 = tolower((unsigned char) *s1);
	u2 = tolower((unsigned char) *s2);
	if ((u1 == '\0') || (u1 != u2)) {
	    break;
	}
    }
    return u1-u2;
}

======================== END TEST SUITE ===========================
2015-03-24 19:25:45 +02:00
nhmall
c49dbcc5b3 include this also 2015-03-24 19:16:29 +02:00
nhmall
4c2df285b4 an easy fix for strcmpi and we move on
Here in branch paxed-new_lev_comp-B (branched
from paxed-new_lev_comp) is a simple fix
for the strcmpi issue.

The bottom section of lev_main.c has a bunch
of forced linkages to names from NetHack etc.
	#ifdef STRICT_REF_DEF
	bunch of stuff
	#endif

This change to lev_main should make everything
work for those that don't supply a compiler
library version of strcmpi()

With this patch, those people can just
add a -DSTRICT_REF_DEF to their compile line
for lev_main.c.

This would close the issue in a simple way,
and doesn't require linking in anything new to
the level compiler, or modifying any port's Makefiles etc.
2015-03-24 19:06:01 +02:00
Pasi Kallinen
debdf7ca48 Move some hard-coded string arrays into data files.
Random epitaphs, engravings and hallucinatory monsters now
live in text data files.
2015-03-18 22:05:10 +02:00
Pasi Kallinen
56699486a0 Catch up with post-343 lev_comp changes
- Iced pools vs. iced moats
- allow making map outer edges nonpasswall & nondiggable,
  so eg. xorns cannot be teleported there
2015-03-17 18:57:39 +02:00
Pasi Kallinen
c9d5bb9d68 Fix some level flags, sokoban premapping 2015-03-17 18:52:53 +02:00
Pasi Kallinen
47bb9abace New level compiler: code changes 2015-03-17 18:52:42 +02:00
keni
c5bc6a5268 Manually fix botched NHDT-Branch expansions. 2015-03-17 18:46:55 +02:00
Pasi Kallinen
d67ffd179a Remove useless dungeon.def mangling 2015-03-17 18:46:54 +02:00
Pasi Kallinen
56279a9950 Add new parameters to makedefs: --debug and --make
"makedefs --debug --make q" is equivalent to "makedefs -q" with
DEBUG defined.
2015-03-17 18:46:52 +02:00
Sean Hunt
07da4a740e Fix some warnings on the unconditionals branch. 2015-03-17 18:46:48 +02:00
Sean Hunt
fb46fed99d Make EXP_ON_BOTL unconditional. 2015-03-17 18:46:44 +02:00
Sean Hunt
f27d319e68 Make REDO unconditional. 2015-03-17 18:46:41 +02:00
Sean Hunt
3481ec6589 Make AUTOPICKUP_EXCEPTIONS unconditional. 2015-03-17 18:46:37 +02:00
Sean Hunt
8798197d85 Make BARGETHROUGH unconditional. 2015-03-17 18:46:35 +02:00
Sean Hunt
dcc2f8ba93 Make SEDUCE unconditional. 2015-03-17 18:46:32 +02:00
Sean Hunt
05f7a63728 Make GOLDOBJ unconditional. 2015-03-17 18:46:23 +02:00