kernel: Fix a -Wundef warning.
[dragonfly.git] / games / larn / savelev.c
blobf736e888e339f573e11518d7279f04b4b4a1728b
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 $ */
4 #include "header.h"
6 /*
7 * routine to save the present level into storage
8 */
9 void
10 savelevel(void)
12 struct cel *pcel;
13 char *pitem, *pknow, *pmitem;
14 short *phitp, *piarg;
15 struct cel *pecel;
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];
19 piarg = iarg[0];
20 pknow = know[0];
21 pmitem = mitem[0];
22 phitp = hitp[0];
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
35 void
36 getlevel(void)
38 struct cel *pcel;
39 char *pitem, *pknow, *pmitem;
40 short *phitp, *piarg;
41 struct cel *pecel;
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 */
44 pitem = item[0];
45 piarg = iarg[0];
46 pknow = know[0];
47 pmitem = mitem[0];
48 phitp = hitp[0];
49 while (pcel < pecel) {
50 *pmitem++ = pcel->mitem;
51 *phitp++ = pcel->hitp;
52 *pitem++ = pcel->item;
53 *pknow++ = pcel->know;
54 *piarg++ = pcel++->iarg;