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 */
23 while (pcel
< pecel
) {
24 pcel
->mitem
= *pmitem
++;
25 pcel
->hitp
= *phitp
++;
26 pcel
->item
= *pitem
++;
27 pcel
->know
= *pknow
++;
28 pcel
++->iarg
= *piarg
++;
33 * routine to restore a level from storage
39 char *pitem
, *pknow
, *pmitem
;
42 pcel
= &cell
[level
* MAXX
* MAXY
]; /* pointer to this level's cells */
43 pecel
= pcel
+ MAXX
* MAXY
; /* pointer to past end of this level's cells */
49 while (pcel
< pecel
) {
50 *pmitem
++ = pcel
->mitem
;
51 *phitp
++ = pcel
->hitp
;
52 *pitem
++ = pcel
->item
;
53 *pknow
++ = pcel
->know
;
54 *piarg
++ = pcel
++->iarg
;