-/* $NetBSD: store.c,v 1.12 2008/01/28 05:38:54 dholland Exp $ */
+/* $NetBSD: store.c,v 1.17 2021/05/02 12:50:45 rillig Exp $ */
/*-
* Copyright (c) 1988 The Regents of the University of California.
#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.17 2021/05/02 12:50:45 rillig Exp $");
#endif
#endif /* not lint */
static void nogold(void);
static void dnditem(int);
static void banktitle(const char *);
+static void obanksub(void);
static void otradhead(void);
+static void cnsitm(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
/*
function for the dnd store
*/
-void
-dnd_2hed()
+static void
+dnd_2hed(void)
{
lprcat("Welcome to the Larn Thrift Shoppe. We stock many items explorers find useful\n");
lprcat(" in their adventures. Feel free to browse to your hearts content.\n");
lprcat("Also be advised, if you break 'em, you pay for 'em.");
}
-void
-dnd_hed()
+static void
+dnd_hed(void)
{
int i;
for (i = dnditm; i < 26 + dnditm; i++)
}
static void
-handsfull()
+handsfull(void)
{
lprcat("\nYou can't carry anything more!");
lflush();
}
static void
-outofstock()
+outofstock(void)
{
lprcat("\nSorry, but we are out of that item.");
lflush();
nap(2200);
}
-static void
-nogold()
+static void
+nogold(void)
{
lprcat("\nYou don't have enough gold to pay for that!");
lflush();
}
void
-dndstore()
+dndstore(void)
{
int i;
dnditm = 0;
lflush();
i = 0;
while (i != '\33')
- i = lgetchar();
+ i = ttgetch();
drawscreen();
nosignal = 0; /* enable signals */
return;
lprcat(" to leave]? ");
i = 0;
while ((i < 'a' || i > 'z') && (i != ' ') && (i != '\33') && (i != 12))
- i = lgetchar();
+ i = ttgetch();
if (i == 12) {
clear();
dnd_2hed();
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();
to print the item list; used in dndstore() enter with the index into itm
*/
static void
-dnditem(i)
- int i;
+dnditem(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) {
for the college of larn
*/
u_char course[26] = {0}; /* the list of courses taken */
-char coursetime[] = {10, 15, 10, 20, 10, 10, 10, 5};
+static char coursetime[] = {10, 15, 10, 20, 10, 10, 10, 5};
/*
function to display the header info for the school
*/
-void
-sch_hed()
+static void
+sch_hed(void)
{
clear();
lprcat("The College of Larn offers the exciting opportunity of higher education to\n");
}
void
-oschool()
+oschool(void)
{
int i;
long time_used;
yrepcount = 0;
i = 0;
while ((i < 'a' || i > 'h') && (i != '\33') && (i != 12))
- i = lgetchar();
+ i = ttgetch();
if (i == 12) {
sch_hed();
continue;
int lasttime = 0; /* last time he was in bank */
void
-obank()
+obank(void)
{
banktitle(" Welcome to the First National Bank of Larn.");
}
void
-obank2()
+obank2(void)
{
banktitle("Welcome to the 5th level branch office of the First National Bank of Larn.");
}
lflush();
i = 0;
while (i != '\33')
- i = lgetchar();
+ i = ttgetch();
drawscreen();
nosignal = 0; /* enable signals */
return;
* function to put interest on your bank account
*/
void
-ointerest()
+ointerest(void)
{
int i;
if (c[BANKACCOUNT] < 0)
* for each */
static long gemvalue[26] = {0}; /* the appraisal of the gems */
void
-obanksub()
+obanksub(void)
{
long amt;
int i, k;
yrepcount = 0;
i = 0;
while (i != 'd' && i != 'w' && i != 's' && i != '\33')
- i = lgetchar();
+ i = ttgetch();
switch (i) {
case 'd':
lprcat("deposit\nHow much? ");
lprcat("\nWhich stone would you like to sell? ");
i = 0;
while ((i < 'a' || i > 'z') && i != '*')
- i = lgetchar();
+ i = ttgetch();
if (i == '*')
for (i = 0; i < 26; i++) {
if (gemvalue[i]) {
}
}
+#if 0 /* XXX: apparently unused */
/*
subroutine to appraise any stone for the bank
*/
-void
-appraise(gemstone)
- int gemstone;
+static void
+appraise(int gemstone)
{
int j, amt;
for (j = 0; j < 26; j++)
lprcat("no\nO. K.\n");
}
}
+#endif /* 0 - unused */
+
/*
function for the trading post
*/
static void
-otradhead()
+otradhead(void)
{
clear();
lprcat("Welcome to the Larn Trading Post. We buy items that explorers no longer find\n");
}
void
-otradepost()
+otradepost(void)
{
int i, j, value, isub, izarg;
dnditm = dndcount = 0;
lprcat("] ? ");
i = 0;
while (i > 'z' || (i < 'a' && i != '*' && i != '\33' && i != '.'))
- i = lgetchar();
+ i = ttgetch();
if (i == '\33') {
setscroll();
recalc();
} 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
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.");
}
}
}
}
-void
-cnsitm()
+static void
+cnsitm(void)
{
lprcat("\nSorry, we can't accept unidentified objects.");
}
* for the Larn Revenue Service
*/
void
-olrs()
+olrs(void)
{
int i, first;
long amt;
yrepcount = 0;
i = 0;
while (i != 'p' && i != '\33')
- i = lgetchar();
+ i = ttgetch();
switch (i) {
case 'p':
lprcat("pay taxes\nHow much? ");