Commit Graph

6176 Commits

Author SHA1 Message Date
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
Derek S. Ray
5ccae41702 add glob merging for obvious cases
flooreffects() covers most dropped/thrown/etc. cases, and the hooks in
invent and mon handle "deathdrops" along with picking up items.
still need to check putting into/removing from containers
2015-03-23 23:13:53 -04:00
Sean Hunt
e41b3f7143 Fix use-after-frees on dipped objects. 2015-03-23 11:42:36 -04:00
nhmall
b93cf718b6 ensure tribute handles conduct correctly 2015-03-22 22:39:45 -04:00
nhmall
3fa52686d8 A couple of Makefile updates
Include the tribute file.

Windows Makefile
Unix Makefile.top
2015-03-22 22:06:13 -04:00
PatR
97ffd73add {DEC,IBM,MAC}graphics (2 of 2: unixmain)
Unix command line processing required that the initial 'd' of
"-DECgraphics" be lowercase so that it wouldn't conflict with -D for
wizard mode.  This retains -D for wizard mode and now also recognizes
"-debug" (case insensitive, but full 5 letters necessary) for the same
thing, and allows "-DECgraphics" to be capitalized as it is throughout
the rest of the program (actual matching is case-insensitive, so "-dec"
and "-decgraphics" still work.  It now requires that anything  after
"DEC" match the rest of that string instead of accepting "-DECanthing"
as a synonym for "-DECgraphics".  Likewise for "-IBMgraphics":  when
more than 3 letters are supplied, the extra ones must be an initial
substring of "graphics" rather than arbitrary characters.

The raw_printf() warnings don't actually work as intended, but that
isn't a change from the old behavior so I've left them in for now.
2015-03-22 18:29:37 -07:00
PatR
7b571b72f2 {DEC,IBM,MAC}graphics (1 of 2: core)
DECgraphics, IBMgraphics, and MACgraphics used to be recognized when
at least 3 letters were supplied back when they were true boolean
options.  When they got demoted to shortcuts for the symset option,
they started needing 10 (DEC and IBM) or all 11 (MAC), otherwise
triggering "bad syntax in NETHACKOPTIONS" (or config file).  Revert
to having the first three letters be sufficient.
2015-03-22 18:22:36 -07:00
nhmall
a948e6aafb remove stale feature alert
This old feature alert from 3.3.0 is pretty stale, so remove
if from the code because everybody has probably suppressed
it by now.

	/* Because 'Q' used to be quit... */
	if (flags.suppress_alert < FEATURE_NOTICE_VER(3,3,0))
		pline("Note: Please use #quit if you wish to exit the game.");
2015-03-22 18:11:49 -04:00
nhmall
0e6355e017 Add note about feature alert mechanism 2015-03-22 18:04:18 -04:00
nhmall
d792f7625d Merge branch 'master' into nhmall-booktribute
Conflicts:
	sys/winnt/Makefile.msc
2015-03-22 15:22:17 -04:00
nhmall
3b064145a3 File for explaining code quirks/features/caveats
- added NOCWD_ASSUMPTIONS and PREFIXES_IN_USE section.
2015-03-22 15:05:18 -04:00
nhmall
74c5f489ae adjust PREFIXES_IN_USE for SYSCF 2015-03-22 11:11:41 -04:00
nhmall
c3c968f87c options and config file handling
With SYSCF, the SYSCF_FILE name was overwriting the
default config file name making it unavailable for
subsequent user config file options handling.

- Keep the name of the last config file successfully opened.
- Do it without orphaning the default config file name needed
  for the next pass.
2015-03-22 10:44:36 -04:00
PatR
86959fe242 fix "mysterious force" probabilities in do.c comment
Reported by Alex, the probabilites shown in the comment about the effect
of the mysterious force have been wrong ever since they were added 20 or
so years ago.  Lawfuls and neutrals are much more likely to go down just
one level rather than 2 or 3.
2015-03-21 19:24:08 -07:00
PatR
91b13d939a wishing fix for "eyes"
No, not a blindness cure. :-}  Post-3.4.3 revisions to makesingular()
inadvertently made it impossible to successfully wish for "the Eyes
of the Overworld" because the string got changed into "the Eye of the
Overworld" which doesn't match anything.  So don't singularize "eyes".

(After this fix, wishing for "the Eyes of the Aethiopica" no longer
yields the Eye of same, but I think that's the correct behavior.)
2015-03-21 15:36:47 -07:00
nhmall
af9af8b701 put mystery line back but !WIN32
Since that line of code is used by a lot of different ports, I decided to
recant its removal and just add #ifdef to ensure it isn't compiled on WIN32.

I think other ports might encounter the same issue where the first pass with
filename set to 'sysconf', is then going to overwrite the hard-coded user
config file name, but I can't fix or test those so for those ports, it
will be now be back the way it was.
2015-03-21 16:17:17 -04:00
nhmall
349e264ac3 remove a troublesome line of code
Whenever SYSCF was enabled on Windows, the option
processing would go bonkers with illegal options
at startup. I noticed it months ago, and Derek
had it happen the other evening.

It turns out, the hard-coded 'defaults.nh' setting
was being overwritten with the name sysconf on
the first SET_IN_SYS pass, so all subsequent passes
were re-opening the SYSC_FILE instead of the
user config file.

I opted to take it out as I couldn't ascertain
why it was there in the first place.
2015-03-21 16:01:03 -04:00
nhmall
b8515fb5fd throw in a windows sysconf skeleton 2015-03-21 15:54:30 -04:00
nhmall
734d118d39 a sys/winnt/Makefile.msc update 2015-03-21 15:50:03 -04:00
nhmall
41ac4aef92 fix SYSCF so that things build when first defined
Things won't build for ports that first
define SYSCF.

This moves assure_syscf_file() from unixmain.c
to files.c and adjusts extern.h to get it
out from under #ifdef UNIX.

The call to assure_syscf_file() in options.c was
only #ifdef SYSCF, SYSCF_FILE and not UNIX,
so new ports #defining SYSCF would get an erro.

assure_syscf_file() will be utilized by mswin
when SYSCF is defined.
2015-03-21 15:38:31 -04:00
Pasi Kallinen
e554cba0ac Update precompiled lex/yacc files 2015-03-21 20:37:44 +02:00
Pasi Kallinen
b3ca446426 Change strcmpi to strcasecmp 2015-03-21 20:22:34 +02:00
Pasi Kallinen
2649cb385c Merge branch 'master' into paxed-new_lev_comp
Conflicts:
	.gitignore
	doc/fixes35.0
	include/obj.h
	include/patchlevel.h
	src/dig.c
	src/mklev.c
	src/rumors.c
	src/save.c
	src/topten.c
	src/trap.c
	sys/winnt/Makefile.msc
	util/makedefs.c
	win/win32/levstuff.mak
2015-03-21 19:39:48 +02:00
nhmall
f2a132adca more book tribute - store index right in obj 2015-03-21 11:02:52 -04:00
nhmall
a0d3224834 Merge branch 'master' into nhmall-booktribute
Conflicts:
	sys/winnt/Makefile.msc
2015-03-21 10:59:49 -04:00
nhmall
297e7c6d5f Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource 2015-03-21 10:53:42 -04:00
Pasi Kallinen
c9df82fb42 Update hacklib func comment doc 2015-03-21 16:49:31 +02:00
nhmall
e3eb74166f obj change to support some upcoming work
This is an enabling patch for upcoming work. It breaks
save/bones so editlevel is incremented.

I'd like to a second overloadable int field in struct obj,
instead of just the one that is typically overloaded - corpsenm.

The second one can be used for things that are being tallied
up as opposed to a static one time assignment for reference/linkage
purposes.

The differentiation will allow both uses to co-exist for the
same object.
2015-03-21 10:46:11 -04:00
nhmall
d7ff451301 More book tribute integration 2015-03-21 10:33:59 -04:00
Pasi Kallinen
6fcc030f37 Make HoOA alignment change depend on object ID
The same Helm of opposite alignment will always make
the same alignment change for neutrals.
2015-03-21 13:40:19 +02:00
Pasi Kallinen
3434a157f8 More C343-108: Handle "rub on the stone" 2015-03-21 11:03:54 +02:00
nhmall
66d642fad9 more mswin cmdline Makefile tweaks 2015-03-20 22:06:28 -04:00
Pasi Kallinen
2ec4ff0b8c Fix C343-108 (e- leaves prompt on screen)
You'll get "You mime eating something."
2015-03-20 19:25:24 +02:00
Derek S. Ray
daf3343dae pull the globs outside the Meaty Sequence
update tiles textfile, too
2015-03-20 11:37:50 -04:00
Derek S. Ray
7f03ee4216 Changes for Win32; update precompiled files
Also fix Orctown probabilities; fixed support for snprintf;
update Win32 makefile to allow level compiler use

Conflicts:
	win/win32/levstuff.mak
2015-03-20 15:14:31 +02:00
Derek S. Ray
b1835cc65d Swap out Frontier Town with Orctown 2015-03-20 15:09:51 +02:00
nhmall
b342beea2b skeleton tribute text file 2015-03-20 01:07:59 -04:00
nhmall
0a8d24d87d more updates to the bookstore tribute 2015-03-20 00:58:29 -04:00
nhmall
c72c531c2c change printed novel to paperback novel 2015-03-19 19:47:52 -04:00
PatR
f2dc48086f acid explosion messages from water_damage()
Restore the variant phrasing used when more than one stack of potions of
acid explode while being inflicted with water damage.  First message:
"a potion explodes" or "some potions explode"; second and subsequent
messages: "another potion explodes" or "more potions explode".  This
trivial feature stopped working when erosion handling was overhauled and
old water_damage was split into current water_damage_chain+water_damage.

Augment the message so that vague "potion" is only used when the object's
dknown flag isn't set (ie, object hasn't been seen yet).  Use "<color>
potion" or "potion of acid" otherwise, depending upon whether such potions
have been fully discovered.
2015-03-19 15:54:17 -07:00
Pasi Kallinen
384f519cc8 Add lots of new random epitaphs 2015-03-19 22:01:16 +02:00
Pasi Kallinen
1fd371600d Add some new random engravings 2015-03-19 21:13:24 +02:00
Pasi Kallinen
f5ea4e0d1f Add lots of new hallu monsters 2015-03-19 18:43:35 +02:00
Pasi Kallinen
3cc3709d95 Save xlogfile time_t fields correctly 2015-03-19 17:41:14 +02:00
nhmall
02cdaf5a09 Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource 2015-03-18 23:01:34 -04:00