Commit Graph

49 Commits

Author SHA1 Message Date
Pasi Kallinen
6ec55a3624 Rework stairs structure
Use a linked list to store stair and ladder information, instead
of having fixed up/down stairs/ladders and a single "special" (branch)
stair.

Breaks saves and bones.

Adds information to migrating objects and monsters for the dungeon
and level where they are migrating from.
2020-11-13 20:27:17 +02:00
nhmall
ac9ba38449 file header bump from "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:07:36 -04:00
nhmall
75d22a2dbf separate MAIL functionality from MAIL-related structure inclusion
With 3.7+ aspirations of improving savefile interoperability between 32-bit
and 64-bit builds, as well as between platforms, it is better to not have
the underlying struct/array content be conditional.

This splits off some of the MAIL code into MAIL_STRUCTURES code. In theory,
since MAIL_STRUCTURES is unconditionally included, the macro could
just go away and leave that code unconditional, but this commit doesn't
go that far.
2019-11-09 16:19:05 -05:00
nhmall
e5fc5efd21 Merge branch 'NetHack-3.6' 2019-09-17 08:25:45 -04:00
PatR
7c2b7d4417 github pull request - fake mail
Fixes #216

A github pull request changed one of the fake mail messages so that
our web site's URL is added at compile time instead of being hard-
coded.  However, it wouldn't compile with a pre-ANSI compiler since
it relied on concatenating adjacent string literals.  This is more
complex but achieves the same result, and also makes the existing
run-time subsitution be a bit clearer.

Testing was a hassle but eventually successful.
2019-09-14 17:52:02 -07:00
nhmall
0d34f43830 remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR from core 2019-07-14 17:24:58 -04:00
Bart House
90547edb83 moves, monstermoves, wailmsg, migrating_objs and billobjs moved to g. 2018-12-24 20:22:33 -08:00
Bart House
572ee347b9 Another round of instance globals changes. 2018-12-24 16:43:50 -08:00
Bart House
e5e906dc3b Changes needed in various ports due to globals changes. 2018-12-24 14:47:51 -08:00
Bart House
62e1a45b60 Merge branch 'win-wip3.7' into win-wip3.7-bart
Conflicts:
	src/end.c
2018-12-24 12:09:42 -08:00
PatR
7bc36ddef4 fix #H6942 - dropx vs hold_another_object
Dropping an existing fragile item while levitating will usually
break it.  Getting a new wished-for fragile item and dropping it
because of fumbling or overfull inventory never would.

Some callers of hold_another_object() held on to its return value,
others discarded that.  That return value was unsafe if the item
was dropped and fell down a hole (or broke [after this change]).
Return Null if we can't be sure of the value, and make sure all
callers are prepared to deal with Null.
2018-12-23 12:37:26 -08:00
Bart House
74edf42f1c Moved decl.c globals into instance globals. 2018-12-22 18:44:22 -08:00
Pasi Kallinen
030efe84fa Map column 0 is not a valid location 2018-11-21 19:17:08 +02:00
PatR
50cb52ab31 sentence spacing
Use two spaces between sentences.  This only fixes the instances of
one-space that were fairly easy to find.
2018-11-20 17:56:16 -08:00
Pasi Kallinen
b54dda5624 More monster location sanity checks
Placing a monster over already existing one will now complain.
Define EXTRA_SANITY_CHECKS to check monster removal too.
2018-11-19 22:38:16 +02:00
Pasi Kallinen
878ac24037 Fix freeing monsters not on map
Sometimes we free the monster data, but the monster is not on the
map - usually this happens if the map is full of monsters and a new one
is migrated on the level.

Make m_detach check the monster x coordinate, so it knows not to touch the map
if the monster isn't on it.
2018-11-19 21:16:46 +02:00
Pasi Kallinen
0bb6754998 Fuzz testing debug tool
Add code to run a fuzz tester, simulating (more-or-less) random
keyboard mashing. There's no option to turn it on, you need to
set iflags.debug_fuzzer on via a debugger or something along
those lines.
2018-11-08 15:55:49 +02:00
keni
d8c49ec9d1 Add updated copyright lines, part 1. 2018-04-25 15:00:13 -04:00
Pasi Kallinen
94ad7512a6 Compile-time option to allow some prompts remember the input
Define EDIT_GETLIN to make the tty, X11, and Qt4 windowports to
remember the input strings for wishing and annotation.
2018-03-26 23:04:53 +03:00
PatR
859ef823d6 fix #H6867 - mail buffer overrun
Web contact report of a github pull request.  A previous fix from
same user dealt with potential crash caused by freeing mailbox data
when the mailbox came from getenv("MAIL").  getenv() doesn't return
a value obtained by malloc so freeing it was bad.  The fix was to
allocate memory to hold a copy of getenv("MAIL") so that free() was
valid.  Unfortunately it didn't allocate enough space to hold the
terminating '\0' so potentially corrupted malloc/free bookkeeping
data.  And the alloc+copy was being performed every time the mailbox
was checked, resulting in leaked memory from the previous check (if
MAIL came from player's environment).  Fortunately the recheck only
takes place after new mail is actually detected and reported to the
player so the leak was probably small for most folks.

This compiles for the set of conditionals that apply to me (after
taking out -DNOMAIL that the hints put in my Makefile) but I can't
test that it actually works since mail is never delivered to this
machine.
2018-02-19 11:59:14 -08:00
Pasi Kallinen
189809a55c Rename terminate to nh_terminate so VS2015 can compile 2017-08-19 14:10:29 +03:00
Pasi Kallinen
d91d445fc6 Fix compiler warning 2016-06-20 13:21:22 +03:00
Bobby Durrett
1c8f312fb6 Fix crash with MAIL env variable 2016-06-05 21:10:26 -07:00
PatR
b8d1f44272 unix mail cleanup bulletproofing
If the recently added release routine ever gets called twice for
some reason, don't free already freed memory, or worse, was freed
here and then allocated for something else which is still in use.
2016-05-25 17:25:47 -07:00
Pasi Kallinen
3b38c75517 Free mailbox at exit 2016-05-23 17:18:24 +03:00
PatR
e8e1673df7 build fix for ck_server_admin_msg()
ck_server_admin_msg() is only available for '#if (UNIX && MAIL)' but
moveloop() tried to call it unconditionally.  Call if from the UNIX
edition of ckmailstatus() instead.
2016-01-04 16:51:24 -08:00
Pasi Kallinen
e9b0fa23d2 Add server admin messaging functionality
It's occasionally important for public servers to notify
all the players. Sending a mail is not reliable, as not everyone
wants to break conduct, or have mail on.

This adds a compile-time defined filename, which NetHack
will monitor. The contents of the file are in the same
format as SIMPLE_MAIL: "sender:message" on one line.
2016-01-04 23:04:59 +02:00
Pasi Kallinen
89e4d5e9fa Add SIMPLE_MAIL compile-time option for public servers 2016-01-04 19:54:36 +02:00
PatR
af6887796f scrolls written while blind; scrolls of mail
Make a fix suggested during beta testing:  you can read scrolls while
blind if you know the label, and you can write a scroll with a magic
marker while blind, but the result was flagged as description unknown
so you couldn't read the newly written scroll until regaining sight
or obtaining object identification.  So change writing a previously
discovered scroll while blind to set dknown since a successful write
always yields the type of scroll requested.  Getting lucky while
attempting to write an undiscovered scroll--which has to be done by
scroll's type name (for instance "food detection") rather than by its
label ("YUM YUM")--still leaves the description flagged as unknown
since hero hasn't seen the what sort of label the new scroll has.

Along the way I got side-tracked by the possibilty of writing a scroll
of mail.  It's allowed and yielded the same result as finding such a
scroll in bones, or wishing for one:  when read, it was junk mail from
Larn.  Make one written via marker give different feedback since it
comes from creation of a stamped scroll without any stamps available.

Also, suppress an "argument not used" warning for readmail().
2015-12-16 02:23:32 -08:00
Pasi Kallinen
af1c77808b Comment typofixes, pt 4 2015-10-17 18:47:31 +03:00
PatR
2b2ee0fbab formatting fixup (1 of 2)
Replace instances of strings split across lines which rely on C89/C90
implicit concatenation of string literals to splice them together
with single strings that are outdented relative to the code that uses
them.  It's uglier but it won't break compile for pre-ANSI compilers.

This covers many files in src/ that only have one or two such split
strings.  There are several more files which have three or more.  Those
will eventually be '(2 of 2)'.

Noticed along the way:  the fake mail message/subject
  Report bugs to devteam@nethack.org.
wasn't using its format string of "Report bugs to %s.", so would have
just shown our email address.  Doesn't anybody enable fake mail anymore?

I modified that format to enclose the address within angle brackets and
made a similar change for the 'contact' choice of the '?' command.
2015-07-12 19:35:06 -07:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09: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
karnov
2a907f894e Version number increment 2015-05-06 22:04:27 -04:00
Pasi Kallinen
322d004e12 Some spam for mail daemon to deliver 2015-03-31 18:32:23 +03:00
keni
03140969ee Bulk recovery of file CVS headers and addition of NHDT- headers. 2015-02-26 09:19:03 -05:00
Sean Hunt
ca6bbf8bc3 Fix warning with verbalize1 2015-02-18 21:48:34 -05:00
keni
4eabcee787 Add RCS version lines 2009-05-06 10:50:32 +00:00
nethack.allison
76350a5348 Fix a few build issues seen by various compilers
that I have on my system but haven't used for a while
(a couple of warnings and a couple of errors)
2008-12-30 22:02:31 +00:00
keni
6f0e178368 more SYSCF and related bits - cleanup and features
infrastructure for "system options" - things currently specified at build
 time that should be changeable at install time or run time but not really
 under user control
generalize contact info so it can be localized and it doesn't have to be
 an email address
move recently introduced WIZARDS into sysopt
drop bogus OPTIONS=wizards possibility
new function build_english_list() to comma-ize and add 'or' from a whitespace separated list: A.  A or B.  A, B, or C.
syscf file now handles: WIZARDS SUPPORT RECOVER
 SUPPORT specifies local support information
 RECOVER will eventually supply port-specific and/or localized info on how
  to run recover (or get it run for you).
Note: in sys/msdos I changed sys.o (generated from pcsys.c) to pcsys.o
Note: sys/msdos/Makefile.GCC has 2 rules for sys.o (now pcsys.o)
2008-01-31 00:56:59 +00:00
nethack.rankin
175e5b67f5 accessible()
There's some discussion in the newsgroup about an engraving bug, and
while verifying that it's reproducible I've come across an unintentional
change between the current code and 3.4.3.  A recent change made engraving
use accessible(), and that routine wasn't yielding an appropriate value
when applied to a raised drawbridge if the terrain in front of it was ice
or floor (ie, moat or lava had been filled in).  Several places which used
the ACCESSIBLE() macro instead of the function suffer from same problem.

     This doesn't attempt to address the newsgroup bug (which is that an
engraving written on a lowered bridge transfers to the underlying terrain
if the bridge is raised, even when that terrain is water or lava; the
converse case applies too, an engraving on the ground gets transfered to
the bridge when it lowers).
2006-12-15 02:36:58 +00:00
nethack.allison
4169a3a308 Remove win32 mapi mail from distribution (trunk only) 2006-10-19 13:26:54 +00:00
nethack.rankin
5501922aa8 omailcmd (trunk only)
The revised newmail() wouldn't compile (Strncpy doesn't exist, `buf'
was an array of pointers rather than of char).  Simplify it substantially,
and adjust the one caller (vms) that relied on the old convoluted bit.
2006-04-15 02:14:36 +00:00
nethack.allison
f55210be79 code change - oextra
move oattached and oname and other things that vary
the size of the obj structure into a separate
non-adjacent oextra structure, similar to what has
already been done for mextra. The obj structure
itself becomes a fixed size.

New macros:

#define ONAME(o)	((o)->oextra->oname)
#define OMID(o)		((o)->oextra->omid)
#define OMONST(o)	((o)->oextra->omonst)
#define OLONG(o)	((o)->oextra->olong)
#define OMAILCMD(o)	((o)->oextra->omailcmd)

#define has_oname(o)	((o)->oextra && ONAME(o))
#define has_omid(o)	((o)->oextra && OMID(o))
#define has_omonst(o)	((o)->oextra && OMONST(o))
#define has_olong(o)	((o)->oextra && OLONG(o))
#define has_omailcmd(o)	((o)->oextra && OMAILCMD(o))

changed macros:
has_name(mon) becomes has_mname(mon)  to correspond.

The CVS repository was tagged with
	NETHACK_PRE_OEXTRA
before commiting these, and
tagged with
	NETHACK_POST_OEXTRA
immediately after. The diff
between those two tags is this oextra patch.

The associated mail daemon changes to use an oextra
structure instead of a hidden command located in the
name after the terminating NUL, have not been tried
or tested.
2006-04-14 16:23:56 +00:00
nethack.allison
5fa8f73af8 housekeeping: mark trunk sources 3.5 (src) 2005-01-02 16:44:46 +00:00
nethack.allison
416412f92b Remove vestiges of old overlay source split
[trunk only]
2003-09-05 02:45:18 +00:00
nethack.allison
06528d1002 3.3.2 to 3.4.0 2002-02-04 16:06:00 +00:00
nethack.allison
89c576a941 more Guidebook credit updates - Amiga team, devteam, web site. 2002-01-14 02:28:52 +00:00
jwalz
e7f30eef99 *** empty log message *** 2002-01-05 21:05:49 +00:00