-/* $NetBSD: main.c,v 1.21 2008/02/03 03:45:55 dholland Exp $ */
+/* $NetBSD: main.c,v 1.25 2012/06/19 05:30:43 dholland Exp $ */
/* main.c */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: main.c,v 1.21 2008/02/03 03:45:55 dholland Exp $");
+__RCSID("$NetBSD: main.c,v 1.25 2012/06/19 05:30:43 dholland Exp $");
#endif /* not lint */
#include <sys/types.h>
#include "header.h"
#include "extern.h"
+static void showstr(void);
+static void t_setup(int);
+static void t_endup(int);
+static void showwear(void);
+static void showwield(void);
+static void showread(void);
+static void showeat(void);
+static void showquaff(void);
+static void show1(int, const char *[]);
+static void randmonst(void);
+static void parse(void);
+static void run(int);
+static void wield(void);
+static void ydhi(int);
+static void ycwi(int);
+static void wear(void);
+static void dropobj(void);
+static void readscr(void);
+static void eatcookie(void);
+static void quaff(void);
+static int whatitem(const char *);
+
static char copyright[] = "\nLarn is copyrighted 1986 by Noah Morgan.\n";
int srcount = 0; /* line counter for showstr() */
int dropflag = 0; /* if 1 then don't lookforobject() next round */
************
*/
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
int i;
int hard;
show character's inventory
*/
-void
-showstr()
+static void
+showstr(void)
{
int i, number;
for (number = 3, i = 0; i < 26; i++)
}
void
-qshowstr()
+qshowstr(void)
{
int i, j, k, sigsav;
srcount = 0;
/*
* subroutine to clear screen depending on # lines to display
*/
-void
-t_setup(count)
- int count;
+static void
+t_setup(int count)
{
if (count < 20) { /* how do we clear the screen? */
cl_up(79, count);
/*
* subroutine to restore normal display screen depending on t_setup()
*/
-void
-t_endup(count)
- int count;
+static void
+t_endup(int count)
{
if (count < 18) /* how did we clear the screen? */
draws(0, MAXX, 0, (count > MAXY) ? MAXY : count);
/*
function to show the things player is wearing only
*/
-void
-showwear()
+static void
+showwear(void)
{
int i, j, sigsav, count;
sigsav = nosignal;
/*
function to show the things player can wield only
*/
-void
-showwield()
+static void
+showwield(void)
{
int i, j, sigsav, count;
sigsav = nosignal;
/*
* function to show the things player can read only
*/
-void
-showread()
+static void
+showread(void)
{
int i, j, sigsav, count;
sigsav = nosignal;
/*
* function to show the things player can eat only
*/
-void
-showeat()
+static void
+showeat(void)
{
int i, j, sigsav, count;
sigsav = nosignal;
/*
function to show the things player can quaff only
*/
-void
-showquaff()
+static void
+showquaff(void)
{
int i, j, sigsav, count;
sigsav = nosignal;
t_endup(count);
}
-void
-show1(idx, str2)
- int idx;
- const char *str2[];
+static void
+show1(int idx, const char *str2[])
{
lprintf("\n%c) %s", idx + 'a', objectname[iven[idx]]);
if (str2 != 0 && str2[ivenarg[idx]][0] != 0)
/*
subroutine to randomly create monsters if needed
*/
-void
-randmonst()
+static void
+randmonst(void)
{
if (c[TIMESTOP])
return; /* don't make monsters if time is stopped */
get and execute a command
*/
-void
-parse()
+static void
+parse(void)
{
int i, j, k, flag;
while (1) {
}
void
-parse2()
+parse2(void)
{
if (c[HASTEMONST])
movemonst();
regen();
}
-void
-run(dir)
- int dir;
+static void
+run(int dir)
{
int i;
i = 1;
/*
function to wield a weapon
*/
-void
-wield()
+static void
+wield(void)
{
int i;
while (1) {
/*
common routine to say you don't have an item
*/
-void
-ydhi(x)
- int x;
+static void
+ydhi(int x)
{
cursors();
lprintf("\nYou don't have item %c!", x);
}
-void
-ycwi(x)
- int x;
+static void
+ycwi(int x)
{
cursors();
lprintf("\nYou can't wield item %c!", x);
/*
function to wear armor
*/
-void
-wear()
+static void
+wear(void)
{
int i;
while (1) {
/*
function to drop an object
*/
-void
-dropobj()
+static void
+dropobj(void)
{
int i;
unsigned char *p;
/*
* readscr() Subroutine to read a scroll one is carrying
*/
-void
-readscr()
+static void
+readscr(void)
{
int i;
while (1) {
/*
* subroutine to eat a cookie one is carrying
*/
-void
+static void
eatcookie(void)
{
const char *p;
/*
* subroutine to quaff a potion one is carrying
*/
-void
-quaff()
+static void
+quaff(void)
{
int i;
while (1) {
/*
function to ask what player wants to do
*/
-int
+static int
whatitem(const char *str)
{
int i;
lprintf("\nWhat do you want to %s [* for all] ? ", str);
i = 0;
while (i > 'z' || (i < 'a' && i != '*' && i != '\33' && i != '.'))
- i = lgetchar();
+ i = ttgetch();
if (i == '\33')
lprcat(" aborted");
return (i);
and allow * to mean return amt, else return the number entered
*/
unsigned long
-readnum(mx)
- long mx;
+readnum(long mx)
{
int i;
unsigned long amt = 0;
sncbr();
- if ((i = lgetchar()) == '*')
+ if ((i = ttgetch()) == '*')
amt = mx; /* allow him to say * for all gold */
else
while (i != '\n') {
}
if ((i <= '9') && (i >= '0') && (amt < 99999999))
amt = amt * 10 + i - '0';
- i = lgetchar();
+ i = ttgetch();
}
scbr();
return (amt);