1 /* savelev.c Larn is copyrighted 1986 by Noah Morgan. */
2 /* $FreeBSD: src/games/larn/savelev.c,v 1.3 1999/11/16 02:57:24 billf Exp $ */
3 /* $DragonFly: src/games/larn/savelev.c,v 1.3 2006/08/26 17:05:05 pavalos Exp $ */
7 * routine to save the present level into storage
13 char *pitem
,*pknow
,*pmitem
;
16 pcel
= &cell
[level
*MAXX
*MAXY
]; /* pointer to this level's cells */
17 pecel
= pcel
+ MAXX
*MAXY
; /* pointer to past end of this level's cells */
18 pitem
=item
[0]; piarg
=iarg
[0]; pknow
=know
[0]; pmitem
=mitem
[0]; phitp
=hitp
[0];
21 pcel
->mitem
= *pmitem
++;
22 pcel
->hitp
= *phitp
++;
23 pcel
->item
= *pitem
++;
24 pcel
->know
= *pknow
++;
25 pcel
++->iarg
= *piarg
++;
30 * routine to restore a level from storage
36 char *pitem
,*pknow
,*pmitem
;
39 pcel
= &cell
[level
*MAXX
*MAXY
]; /* pointer to this level's cells */
40 pecel
= pcel
+ MAXX
*MAXY
; /* pointer to past end of this level's cells */
41 pitem
=item
[0]; piarg
=iarg
[0]; pknow
=know
[0]; pmitem
=mitem
[0]; phitp
=hitp
[0];
44 *pmitem
++ = pcel
->mitem
;
45 *phitp
++ = pcel
->hitp
;
46 *pitem
++ = pcel
->item
;
47 *pknow
++ = pcel
->know
;
48 *piarg
++ = pcel
++->iarg
;