]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/hack.bones.c
1 /* $NetBSD: hack.bones.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */
4 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
9 __RCSID("$NetBSD: hack.bones.c,v 1.5 2001/03/25 20:43:59 jsm Exp $");
17 char bones
[] = "bones_xx";
19 /* save bones and possessions of a deceased adventurer */
28 if (dlevel
<= 0 || dlevel
> MAXLEVEL
)
30 if (!rn2(1 + dlevel
/ 2))
31 return; /* not so many ghosts on low levels */
32 bones
[6] = '0' + (dlevel
/ 10);
33 bones
[7] = '0' + (dlevel
% 10);
34 if ((fd
= open(bones
, O_RDONLY
)) >= 0) {
38 /* drop everything; the corpse's possessions are usually cursed */
43 otmp
->age
= 0; /* very long ago */
50 invent
= 0; /* superfluous */
55 if (!(mtmp
= makemon(PM_GHOST
, u
.ux
, u
.uy
)))
60 (void) strcpy((char *) mtmp
->mextra
, plname
);
61 mkgold(somegold() + d(dlevel
, 30), u
.ux
, u
.uy
);
62 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
72 for (ttmp
= ftrap
; ttmp
; ttmp
= ttmp
->ntrap
)
74 for (otmp
= fobj
; otmp
; otmp
= otmp
->nobj
) {
76 /* otmp->o_cnt_id = 0; - superfluous */
80 if (otmp
->olet
== AMULET_SYM
&& !otmp
->spe
) {
81 otmp
->spe
= -1; /* no longer the actual amulet */
82 otmp
->cursed
= 1; /* flag as gotten from a
86 if ((fd
= creat(bones
, FMASK
)) < 0)
98 return (0); /* only once in three times do we find bones */
99 bones
[6] = '0' + dlevel
/ 10;
100 bones
[7] = '0' + dlevel
% 10;
101 if ((fd
= open(bones
, O_RDONLY
)) < 0)
103 if ((ok
= uptodate(fd
)) != 0) {
104 getlev(fd
, 0, dlevel
);
105 for (x
= 0; x
< COLNO
; x
++)
106 for (y
= 0; y
< ROWNO
; y
++)
107 levl
[x
][y
].seen
= levl
[x
][y
].new = 0;
111 if (!wizard
) /* duvel!frans: don't remove bones while
114 if (unlink(bones
) < 0) {
115 pline("Cannot unlink %s .", bones
);