$NetBSD: patch-aw,v 1.3 2004/04/15 21:17:08 ben Exp $ --- savelev.c.orig 1992-06-19 13:55:34.000000000 -0700 +++ savelev.c @@ -1,4 +1,7 @@ /* savelev.c */ +#include +#include +#include #include "header.h" #include "sphere.h" #include "player.h" @@ -6,12 +9,7 @@ #include "monst.h" #include "extern.h" -extern char *sys_errlist[]; -extern int errno; - -typedef char Char_Ary[MAXX][MAXY]; -typedef short Short_Ary[MAXX][MAXY]; -typedef long Long_Ary[MAXX][MAXY]; +typedef int Int_Ary[MAXX][MAXY]; typedef struct_mitem Mitem_Ary[MAXX][MAXY]; static int w = 0; @@ -19,11 +17,11 @@ static int r = 0; /* this is the structure that holds the entire dungeon specifications */ typedef struct save_lev_str { - Short_Ary hitp; + Int_Ary hitp; Mitem_Ary mitem; - Char_Ary item; - Short_Ary iarg; /* must be long for goldpiles */ - Char_Ary know; + Int_Ary item; + Int_Ary iarg; + Int_Ary know; } Saved_Level; static Saved_Level *saved_levels[NLEVELS]; @@ -33,15 +31,15 @@ static unsigned int FileSum; /* * routine to save the present level into storage */ -savelevel() +void savelevel(void) { Saved_Level *storage = saved_levels[level]; - memcpy((char *)storage->hitp, (char *)hitp, sizeof(Short_Ary)); + memcpy((char *)storage->hitp, (char *)hitp, sizeof(Int_Ary)); memcpy((char *)storage->mitem, (char *)mitem, sizeof(Mitem_Ary)); - memcpy((char *)storage->item, (char *)item, sizeof(Char_Ary)); - memcpy((char *)storage->iarg, (char *)iarg, sizeof(Short_Ary)); - memcpy((char *)storage->know, (char *)know, sizeof(Char_Ary)); + memcpy((char *)storage->item, (char *)item, sizeof(Int_Ary)); + memcpy((char *)storage->iarg, (char *)iarg, sizeof(Int_Ary)); + memcpy((char *)storage->know, (char *)know, sizeof(Int_Ary)); level_sums[level] = sum((unsigned char *)storage, sizeof(Saved_Level)); } @@ -49,17 +47,17 @@ savelevel() /* * routine to restore a level from storage */ -getlevel() +void getlevel(void) { unsigned int i; Saved_Level *storage = saved_levels[level]; - memcpy((char *)hitp, (char *)storage->hitp, sizeof(Short_Ary)); + memcpy((char *)hitp, (char *)storage->hitp, sizeof(Int_Ary)); memcpy((char *)mitem, (char *)storage->mitem, sizeof(Mitem_Ary)); - memcpy((char *)item, (char *)storage->item, sizeof(Char_Ary)); - memcpy((char *)iarg, (char *)storage->iarg, sizeof(Short_Ary)); - memcpy((char *)know, (char *)storage->know, sizeof(Char_Ary)); + memcpy((char *)item, (char *)storage->item, sizeof(Int_Ary)); + memcpy((char *)iarg, (char *)storage->iarg, sizeof(Int_Ary)); + memcpy((char *)know, (char *)storage->know, sizeof(Int_Ary)); if (level_sums[level] > 0) { if ((i = sum((unsigned char *)storage,sizeof(Saved_Level))) @@ -82,7 +80,7 @@ getlevel() /* * to save the game in a file */ -savegame(fname) +int savegame(fname) char *fname; { int i; @@ -145,10 +143,10 @@ char *fname; bwrite(fd,(char * )char_class, 20 * sizeof(char)); for (i=0; i