1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.bones.c - version 1.0.3 */
3 /* $FreeBSD: src/games/hack/hack.bones.c,v 1.4 1999/11/16 10:26:35 marcel Exp $ */
4 /* $DragonFly: src/games/hack/hack.bones.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */
8 char bones
[] = "bones_xx";
10 /* save bones and possessions of a deceased adventurer */
18 if(dlevel
<= 0 || dlevel
> MAXLEVEL
) return;
19 if(!rn2(1 + dlevel
/2)) return; /* not so many ghosts on low levels */
20 bones
[6] = '0' + (dlevel
/10);
21 bones
[7] = '0' + (dlevel
%10);
22 if((fd
= open(bones
,0)) >= 0){
26 /* drop everything; the corpse's possessions are usually cursed */
31 otmp
->age
= 0; /* very long ago */
33 if(rn2(5)) otmp
->cursed
= 1;
37 invent
= 0; /* superfluous */
42 if(!(mtmp
= makemon(PM_GHOST
, u
.ux
, u
.uy
))) return;
46 strcpy((char *) mtmp
->mextra
, plname
);
47 mkgold(somegold() + d(dlevel
,30), u
.ux
, u
.uy
);
48 for(mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
){
55 if(mtmp
->mdispl
) unpmon(mtmp
);
57 for(ttmp
= ftrap
; ttmp
; ttmp
= ttmp
->ntrap
)
59 for(otmp
= fobj
; otmp
; otmp
= otmp
->nobj
) {
61 /* otmp->o_cnt_id = 0; - superfluous */
65 if(otmp
->olet
== AMULET_SYM
&& !otmp
->spe
) {
66 otmp
->spe
= -1; /* no longer the actual amulet */
67 otmp
->cursed
= 1; /* flag as gotten from a ghost */
70 if((fd
= creat(bones
, FMASK
)) < 0) return;
79 if(rn2(3)) return(0); /* only once in three times do we find bones */
80 bones
[6] = '0' + dlevel
/10;
81 bones
[7] = '0' + dlevel
%10;
82 if((fd
= open(bones
, 0)) < 0) return(0);
83 if((ok
= uptodate(fd
)) != 0){
84 getlev(fd
, 0, dlevel
);
85 for(x
= 0; x
< COLNO
; x
++) for(y
= 0; y
< ROWNO
; y
++)
86 levl
[x
][y
].seen
= levl
[x
][y
].new = 0;
90 if(!wizard
) /* duvel!frans: don't remove bones while debugging */
92 if(unlink(bones
) < 0){
93 pline("Cannot unlink %s .", bones
);