o Update dd(1) to accept capital letters (B, K, M, G) as size modifiers.
[dragonfly.git] / games / larn / savelev.c
blobb7809fb70ce1959172cd21e0dd22594d879d28a5
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]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
19 while (pcel < pecel)
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
32 void
33 getlevel(void)
35 struct cel *pcel;
36 char *pitem,*pknow,*pmitem;
37 short *phitp,*piarg;
38 struct cel *pecel;
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];
42 while (pcel < pecel)
44 *pmitem++ = pcel->mitem;
45 *phitp++ = pcel->hitp;
46 *pitem++ = pcel->item;
47 *pknow++ = pcel->know;
48 *piarg++ = pcel++->iarg;