Some assorted minor cleanups, from larn 12.2.
This commit is contained in:
parent
d7ba3de791
commit
ef066a156b
@ -1,10 +1,10 @@
|
||||
/* $NetBSD: create.c,v 1.10 2008/02/03 19:20:40 dholland Exp $ */
|
||||
/* $NetBSD: create.c,v 1.11 2008/02/03 19:29:50 dholland Exp $ */
|
||||
|
||||
/* create.c Larn is copyrighted 1986 by Noah Morgan. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: create.c,v 1.10 2008/02/03 19:20:40 dholland Exp $");
|
||||
__RCSID("$NetBSD: create.c,v 1.11 2008/02/03 19:29:50 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "header.h"
|
||||
@ -80,30 +80,31 @@ newcavelevel(x)
|
||||
savelevel(); /* put the level back into storage */
|
||||
level = x; /* get the new level and put in working
|
||||
* storage */
|
||||
if (beenhere[x] == 0)
|
||||
for (i = 0; i < MAXY; i++)
|
||||
for (j = 0; j < MAXX; j++)
|
||||
know[j][i] = mitem[j][i] = 0;
|
||||
else {
|
||||
if (beenhere[x]) {
|
||||
getlevel();
|
||||
sethp(0);
|
||||
goto chgn;
|
||||
checkgen();
|
||||
return;
|
||||
}
|
||||
|
||||
/* fill in new level */
|
||||
for (i = 0; i < MAXY; i++)
|
||||
for (j = 0; j < MAXX; j++)
|
||||
know[j][i] = mitem[j][i] = 0;
|
||||
makemaze(x);
|
||||
makeobject(x);
|
||||
beenhere[x] = 1;
|
||||
sethp(1);
|
||||
checkgen(); /* wipe out any genocided monsters */
|
||||
|
||||
#if WIZID
|
||||
if (wizard || x == 0)
|
||||
#else
|
||||
if (x == 0)
|
||||
#endif
|
||||
|
||||
for (j = 0; j < MAXY; j++)
|
||||
for (i = 0; i < MAXX; i++)
|
||||
know[i][j] = 1;
|
||||
chgn: checkgen(); /* wipe out any genocided monsters */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: header.h,v 1.18 2008/02/03 03:45:55 dholland Exp $ */
|
||||
/* $NetBSD: header.h,v 1.19 2008/02/03 19:29:50 dholland Exp $ */
|
||||
|
||||
/* header.h Larn is copyrighted 1986 by Noah Morgan. */
|
||||
|
||||
@ -331,7 +331,7 @@ struct sphere {
|
||||
|
||||
#ifndef NODEFS
|
||||
extern char VERSION, SUBVERSION;
|
||||
extern u_char alpha[], beenhere[], boldon, cheat, ckpflag;
|
||||
extern u_char beenhere[], boldon, cheat, ckpflag;
|
||||
extern const char *class[];
|
||||
extern u_char course[];
|
||||
extern char diagfile[], helpfile[], ckpfile[], larnlevels[],
|
||||
@ -371,7 +371,7 @@ extern struct cel *cell;
|
||||
extern struct monst monster[];
|
||||
extern struct sphere *spheres;
|
||||
extern struct _itm itm[];
|
||||
extern int rmst, maxitm, lasttime;
|
||||
extern int rmst, lasttime;
|
||||
|
||||
/* macro to create scroll #'s with probability of occurrence */
|
||||
#define newscroll() (scprob[rund(81)])
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* $NetBSD: savelev.c,v 1.5 2008/01/28 05:38:54 dholland Exp $ */
|
||||
/* $NetBSD: savelev.c,v 1.6 2008/02/03 19:29:50 dholland Exp $ */
|
||||
|
||||
/* savelev.c Larn is copyrighted 1986 by Noah Morgan. */
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: savelev.c,v 1.5 2008/01/28 05:38:54 dholland Exp $");
|
||||
__RCSID("$NetBSD: savelev.c,v 1.6 2008/02/03 19:29:50 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
#include "header.h"
|
||||
#include "extern.h"
|
||||
@ -32,7 +32,8 @@ savelevel()
|
||||
pcel->hitp = *phitp++;
|
||||
pcel->item = *pitem++;
|
||||
pcel->know = *pknow++;
|
||||
pcel++->iarg = *piarg++;
|
||||
pcel->iarg = *piarg++;
|
||||
pcel++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,6 +61,7 @@ getlevel()
|
||||
*phitp++ = pcel->hitp;
|
||||
*pitem++ = pcel->item;
|
||||
*pknow++ = pcel->know;
|
||||
*piarg++ = pcel++->iarg;
|
||||
*piarg++ = pcel->iarg;
|
||||
pcel++;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: store.c,v 1.12 2008/01/28 05:38:54 dholland Exp $ */
|
||||
/* $NetBSD: store.c,v 1.13 2008/02/03 19:29:50 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)store.c 5.4 (Berkeley) 5/13/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: store.c,v 1.12 2008/01/28 05:38:54 dholland Exp $");
|
||||
__RCSID("$NetBSD: store.c,v 1.13 2008/02/03 19:29:50 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -51,8 +51,10 @@ static void otradhead(void);
|
||||
|
||||
static int dndcount = 0, dnditm = 0;
|
||||
|
||||
/* number of items in the dnd inventory table */
|
||||
#define MAXITM 83
|
||||
|
||||
/* this is the data for the stuff in the dnd store */
|
||||
int maxitm = 83; /* number of items in the dnd inventory table */
|
||||
struct _itm itm[90] = {
|
||||
/*
|
||||
* cost iven name iven arg how gp
|
||||
@ -278,13 +280,13 @@ dndstore()
|
||||
return;
|
||||
} else if (i == ' ') {
|
||||
cl_dn(1, 4);
|
||||
if ((dnditm += 26) >= maxitm)
|
||||
if ((dnditm += 26) >= MAXITM)
|
||||
dnditm = 0;
|
||||
dnd_hed();
|
||||
} else { /* buy something */
|
||||
lprc(i);/* echo the byte */
|
||||
i += dnditm - 'a';
|
||||
if (i >= maxitm)
|
||||
if (i >= MAXITM)
|
||||
outofstock();
|
||||
else if (itm[i].qty <= 0)
|
||||
outofstock();
|
||||
@ -320,7 +322,7 @@ dnditem(i)
|
||||
int i;
|
||||
{
|
||||
int j, k;
|
||||
if (i >= maxitm)
|
||||
if (i >= MAXITM)
|
||||
return;
|
||||
cursor((j = (i & 1) * 40 + 1), (k = ((i % 26) >> 1) + 5));
|
||||
if (itm[i].qty == 0) {
|
||||
@ -794,7 +796,7 @@ otradepost()
|
||||
} else if (iven[isub] == 0)
|
||||
lprintf("\nYou don't have item %c!", isub + 'a');
|
||||
else {
|
||||
for (j = 0; j < maxitm; j++)
|
||||
for (j = 0; j < MAXITM; j++)
|
||||
if ((itm[j].obj == iven[isub]) || (iven[isub] == ODIAMOND) || (iven[isub] == ORUBY) || (iven[isub] == OEMERALD) || (iven[isub] == OSAPPHIRE)) {
|
||||
srcount = 0;
|
||||
show3(isub); /* show what the item
|
||||
@ -827,10 +829,10 @@ otradepost()
|
||||
iven[isub] = 0;
|
||||
} else
|
||||
lprcat("no thanks.\n");
|
||||
j = maxitm + 100; /* get out of the inner
|
||||
j = MAXITM + 100; /* get out of the inner
|
||||
* loop */
|
||||
}
|
||||
if (j <= maxitm + 2)
|
||||
if (j <= MAXITM + 2)
|
||||
lprcat("\nSo sorry, but we are not authorized to accept that item.");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user