]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - larn/savelev.c
cgram: fix assertion when substituting at the end of the longest line
[bsdgames-darwin.git] / larn / savelev.c
index 4419acb95092ffdf4c1e7ecf405b6488389279c8..9954ff08b264a3a158ad8d34d0934edf95d4eaa5 100644 (file)
@@ -1,47 +1,67 @@
+/*     $NetBSD: savelev.c,v 1.7 2012/06/19 05:30:44 dholland Exp $     */
+
 /* savelev.c            Larn is copyrighted 1986 by Noah Morgan. */
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: savelev.c,v 1.7 2012/06/19 05:30:44 dholland Exp $");
+#endif                         /* not lint */
 #include "header.h"
-extern struct cel *cell;
+#include "extern.h"
 
 /*
  *     routine to save the present level into storage
  */
-savelevel()
-       {
-       register struct cel *pcel;
-       register char *pitem,*pknow,*pmitem;
-       register short *phitp,*piarg;
-       register struct cel *pecel;
-       pcel = &cell[level*MAXX*MAXY];  /* pointer to this level's cells */
-       pecel = pcel + MAXX*MAXY;       /* pointer to past end of this level's cells */
-       pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
-       while (pcel < pecel)
-               {
-               pcel->mitem  = *pmitem++;
-               pcel->hitp   = *phitp++;
-               pcel->item   = *pitem++;
-               pcel->know   = *pknow++;
-               pcel++->iarg = *piarg++;
-               }
+void
+savelevel(void)
+{
+       struct cel *pcel;
+       u_char  *pitem, *pknow, *pmitem;
+       short *phitp, *piarg;
+       struct cel *pecel;
+       pcel = &cell[level * MAXX * MAXY];      /* pointer to this level's
+                                                * cells */
+       pecel = pcel + MAXX * MAXY;     /* pointer to past end of this
+                                        * level's cells */
+       pitem = item[0];
+       piarg = iarg[0];
+       pknow = know[0];
+       pmitem = mitem[0];
+       phitp = hitp[0];
+       while (pcel < pecel) {
+               pcel->mitem = *pmitem++;
+               pcel->hitp = *phitp++;
+               pcel->item = *pitem++;
+               pcel->know = *pknow++;
+               pcel->iarg = *piarg++;
+               pcel++;
        }
+}
 
 /*
  *     routine to restore a level from storage
  */
-getlevel()
-       {
-       register struct cel *pcel;
-       register char *pitem,*pknow,*pmitem;
-       register short *phitp,*piarg;
-       register struct cel *pecel;
-       pcel = &cell[level*MAXX*MAXY];  /* pointer to this level's cells */
-       pecel = pcel + MAXX*MAXY;       /* pointer to past end of this level's cells */
-       pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
-       while (pcel < pecel)
-               {
+void
+getlevel(void)
+{
+       struct cel *pcel;
+       u_char  *pitem, *pknow, *pmitem;
+       short *phitp, *piarg;
+       struct cel *pecel;
+       pcel = &cell[level * MAXX * MAXY];      /* pointer to this level's
+                                                * cells */
+       pecel = pcel + MAXX * MAXY;     /* pointer to past end of this
+                                        * level's cells */
+       pitem = item[0];
+       piarg = iarg[0];
+       pknow = know[0];
+       pmitem = mitem[0];
+       phitp = hitp[0];
+       while (pcel < pecel) {
                *pmitem++ = pcel->mitem;
                *phitp++ = pcel->hitp;
                *pitem++ = pcel->item;
                *pknow++ = pcel->know;
-               *piarg++ = pcel++->iarg;
-               }
+               *piarg++ = pcel->iarg;
+               pcel++;
        }
+}