]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/savelev.c
Correct capital of the Philippines, allow usual spelling of Jakarta
[bsdgames-darwin.git] / larn / savelev.c
1 /* $NetBSD: savelev.c,v 1.4 1997/10/18 20:03:45 christos Exp $ */
2
3 /* savelev.c Larn is copyrighted 1986 by Noah Morgan. */
4 #include <sys/cdefs.h>
5 #ifndef lint
6 __RCSID("$NetBSD: savelev.c,v 1.4 1997/10/18 20:03:45 christos Exp $");
7 #endif /* not lint */
8 #include "header.h"
9 #include "extern.h"
10
11 /*
12 * routine to save the present level into storage
13 */
14 void
15 savelevel()
16 {
17 struct cel *pcel;
18 char *pitem, *pknow, *pmitem;
19 short *phitp, *piarg;
20 struct cel *pecel;
21 pcel = &cell[level * MAXX * MAXY]; /* pointer to this level's
22 * cells */
23 pecel = pcel + MAXX * MAXY; /* pointer to past end of this
24 * level's cells */
25 pitem = item[0];
26 piarg = iarg[0];
27 pknow = know[0];
28 pmitem = mitem[0];
29 phitp = hitp[0];
30 while (pcel < pecel) {
31 pcel->mitem = *pmitem++;
32 pcel->hitp = *phitp++;
33 pcel->item = *pitem++;
34 pcel->know = *pknow++;
35 pcel++->iarg = *piarg++;
36 }
37 }
38
39 /*
40 * routine to restore a level from storage
41 */
42 void
43 getlevel()
44 {
45 struct cel *pcel;
46 char *pitem, *pknow, *pmitem;
47 short *phitp, *piarg;
48 struct cel *pecel;
49 pcel = &cell[level * MAXX * MAXY]; /* pointer to this level's
50 * cells */
51 pecel = pcel + MAXX * MAXY; /* pointer to past end of this
52 * level's cells */
53 pitem = item[0];
54 piarg = iarg[0];
55 pknow = know[0];
56 pmitem = mitem[0];
57 phitp = hitp[0];
58 while (pcel < pecel) {
59 *pmitem++ = pcel->mitem;
60 *phitp++ = pcel->hitp;
61 *pitem++ = pcel->item;
62 *pknow++ = pcel->know;
63 *piarg++ = pcel++->iarg;
64 }
65 }