]> 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 88c4849f2dca93ccb234c6bb9eef7416132028ab..9954ff08b264a3a158ad8d34d0934edf95d4eaa5 100644 (file)
@@ -1,9 +1,9 @@
-/*     $NetBSD: savelev.c,v 1.4 1997/10/18 20:03:45 christos Exp $     */
+/*     $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.4 1997/10/18 20:03:45 christos Exp $");
+__RCSID("$NetBSD: savelev.c,v 1.7 2012/06/19 05:30:44 dholland Exp $");
 #endif                         /* not lint */
 #include "header.h"
 #include "extern.h"
@@ -12,10 +12,10 @@ __RCSID("$NetBSD: savelev.c,v 1.4 1997/10/18 20:03:45 christos Exp $");
  *     routine to save the present level into storage
  */
 void
-savelevel()
+savelevel(void)
 {
        struct cel *pcel;
-       char  *pitem, *pknow, *pmitem;
+       u_char  *pitem, *pknow, *pmitem;
        short *phitp, *piarg;
        struct cel *pecel;
        pcel = &cell[level * MAXX * MAXY];      /* pointer to this level's
@@ -32,7 +32,8 @@ savelevel()
                pcel->hitp = *phitp++;
                pcel->item = *pitem++;
                pcel->know = *pknow++;
-               pcel++->iarg = *piarg++;
+               pcel->iarg = *piarg++;
+               pcel++;
        }
 }
 
@@ -40,10 +41,10 @@ savelevel()
  *     routine to restore a level from storage
  */
 void
-getlevel()
+getlevel(void)
 {
        struct cel *pcel;
-       char  *pitem, *pknow, *pmitem;
+       u_char  *pitem, *pknow, *pmitem;
        short *phitp, *piarg;
        struct cel *pecel;
        pcel = &cell[level * MAXX * MAXY];      /* pointer to this level's
@@ -60,6 +61,7 @@ getlevel()
                *phitp++ = pcel->hitp;
                *pitem++ = pcel->item;
                *pknow++ = pcel->know;
-               *piarg++ = pcel++->iarg;
+               *piarg++ = pcel->iarg;
+               pcel++;
        }
 }