Make this compile with gcc40: rename variables so that they don't collide
[dragonfly.git] / games / larn / savelev.c
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.2 2003/06/17 04:25:24 dillon Exp $ */
4 #include "header.h"
5 extern struct cel *cell;
6
7 /*
8  *      routine to save the present level into storage
9  */
10 savelevel()
11         {
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)
20                 {
21                 pcel->mitem  = *pmitem++;
22                 pcel->hitp   = *phitp++;
23                 pcel->item   = *pitem++;
24                 pcel->know   = *pknow++;
25                 pcel++->iarg = *piarg++;
26                 }
27         }
28
29 /*
30  *      routine to restore a level from storage
31  */
32 getlevel()
33         {
34         struct cel *pcel;
35         char *pitem,*pknow,*pmitem;
36         short *phitp,*piarg;
37         struct cel *pecel;
38         pcel = &cell[level*MAXX*MAXY];  /* pointer to this level's cells */
39         pecel = pcel + MAXX*MAXY;       /* pointer to past end of this level's cells */
40         pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
41         while (pcel < pecel)
42                 {
43                 *pmitem++ = pcel->mitem;
44                 *phitp++ = pcel->hitp;
45                 *pitem++ = pcel->item;
46                 *pknow++ = pcel->know;
47                 *piarg++ = pcel++->iarg;
48                 }
49         }