summaryrefslogtreecommitdiffstats
path: root/larn
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2008-02-03 19:20:40 +0000
committerdholland <dholland@NetBSD.org>2008-02-03 19:20:40 +0000
commitbf91baeffb42cde8688e3e5735369c864ed29d91 (patch)
treec431f9c498c73de5ed5021009b69cecd9de27c02 /larn
parentf1ec001029402476abce34e4130373b3c34a16c7 (diff)
downloadbsdgames-darwin-bf91baeffb42cde8688e3e5735369c864ed29d91.tar.gz
bsdgames-darwin-bf91baeffb42cde8688e3e5735369c864ed29d91.tar.zst
bsdgames-darwin-bf91baeffb42cde8688e3e5735369c864ed29d91.zip
Make a bunch of functions static. Merged from larn 12.2.
Diffstat (limited to 'larn')
-rw-r--r--larn/create.c36
-rw-r--r--larn/diag.c22
-rw-r--r--larn/display.c25
-rw-r--r--larn/extern.h24
-rw-r--r--larn/help.c11
-rw-r--r--larn/io.c8
-rw-r--r--larn/main.c8
-rw-r--r--larn/monster.c14
8 files changed, 80 insertions, 68 deletions
diff --git a/larn/create.c b/larn/create.c
index 36bea724..128f564d 100644
--- a/larn/create.c
+++ b/larn/create.c
@@ -1,16 +1,26 @@
-/* $NetBSD: create.c,v 1.9 2008/01/28 05:38:53 dholland Exp $ */
+/* $NetBSD: create.c,v 1.10 2008/02/03 19:20:40 dholland Exp $ */
/* create.c Larn is copyrighted 1986 by Noah Morgan. */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: create.c,v 1.9 2008/01/28 05:38:53 dholland Exp $");
+__RCSID("$NetBSD: create.c,v 1.10 2008/02/03 19:20:40 dholland Exp $");
#endif /* not lint */
#include "header.h"
#include "extern.h"
#include <unistd.h>
+
+static void makemaze(int);
+static int cannedlevel(int);
+static void treasureroom(int);
+static void troom(int, int, int, int, int, int);
+static void makeobject(int);
+static void fillmroom(int, int, int);
+static void froom(int, int, int);
static void fillroom(int, int);
+static void sethp(int);
+static void checkgen(void);
/*
makeplayer()
@@ -103,7 +113,8 @@ chgn: checkgen(); /* wipe out any genocided monsters */
subroutine to make the caverns for a given level. only walls are made.
*/
static int mx, mxl, mxh, my, myl, myh, tmp2;
-void
+
+static void
makemaze(k)
int k;
{
@@ -228,7 +239,7 @@ eat(xx, yy)
* ~ eye of larn ! cure dianthroritis
* - random object
*/
-int
+static int
cannedlevel(k)
int k;
{
@@ -305,7 +316,7 @@ cannedlevel(k)
level 10's treasure room has the eye in it and demon lords
level V3 has potion of cure dianthroritis and demon prince
*/
-void
+static void
treasureroom(lv)
int lv;
{
@@ -328,7 +339,7 @@ treasureroom(lv)
* room is filled with objects and monsters
* the coordinate given is that of the upper left corner of the room
*/
-void
+static void
troom(lv, xsize, ysize, tx, ty, glyph)
int lv, xsize, ysize, tx, ty, glyph;
{
@@ -386,7 +397,7 @@ troom(lv, xsize, ysize, tx, ty, glyph)
***********
subroutine to create the objects in the maze for the given level
*/
-void
+static void
makeobject(j)
int j;
{
@@ -480,7 +491,7 @@ makeobject(j)
subroutine to fill in a number of objects of the same kind
*/
-void
+static void
fillmroom(n, what, arg)
int n, arg;
char what;
@@ -489,7 +500,8 @@ fillmroom(n, what, arg)
for (i = 0; i < n; i++)
fillroom(what, arg);
}
-void
+
+static void
froom(int n, int theitem, int arg)
{
if (rnd(151) < n)
@@ -561,7 +573,7 @@ fillmonst(what)
must be done when entering a new level
if sethp(1) then wipe out old monsters else leave them there
*/
-void
+static void
sethp(flg)
int flg;
{
@@ -587,8 +599,8 @@ sethp(flg)
/*
* Function to destroy all genocided monsters on the present level
*/
-void
-checkgen()
+static void
+checkgen(void)
{
int x, y;
for (y = 0; y < MAXY; y++)
diff --git a/larn/diag.c b/larn/diag.c
index 4f8ea899..43f1ff64 100644
--- a/larn/diag.c
+++ b/larn/diag.c
@@ -1,9 +1,9 @@
-/* $NetBSD: diag.c,v 1.11 2008/01/28 05:38:53 dholland Exp $ */
+/* $NetBSD: diag.c,v 1.12 2008/02/03 19:20:41 dholland Exp $ */
/* diag.c Larn is copyrighted 1986 by Noah Morgan. */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: diag.c,v 1.11 2008/01/28 05:38:53 dholland Exp $");
+__RCSID("$NetBSD: diag.c,v 1.12 2008/02/03 19:20:41 dholland Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -14,7 +14,13 @@ __RCSID("$NetBSD: diag.c,v 1.11 2008/01/28 05:38:53 dholland Exp $");
#include <unistd.h>
#include "header.h"
#include "extern.h"
+
+static void greedy(void);
+static void fsorry(void);
+static void fcheat(void);
+
static struct tms cputime;
+
/*
***************************
DIAG -- dungeon diagnostics
@@ -353,8 +359,8 @@ restoregame(fname)
/*
subroutine to not allow greedy cheaters
*/
-void
-greedy()
+static void
+greedy(void)
{
#if WIZID
if (wizard)
@@ -375,8 +381,8 @@ greedy()
subroutine to not allow altered save files and terminate the attempted
restart
*/
-void
-fsorry()
+static void
+fsorry(void)
{
lprcat("\nSorry, but your savefile has been altered.\n");
lprcat("However, seeing as I am a good sport, I will let you play.\n");
@@ -388,8 +394,8 @@ fsorry()
/*
subroutine to not allow game if save file can't be deleted
*/
-void
-fcheat()
+static void
+fcheat(void)
{
#if WIZID
if (wizard)
diff --git a/larn/display.c b/larn/display.c
index cb7ef552..05744824 100644
--- a/larn/display.c
+++ b/larn/display.c
@@ -1,16 +1,21 @@
-/* $NetBSD: display.c,v 1.7 2008/01/28 05:38:53 dholland Exp $ */
+/* $NetBSD: display.c,v 1.8 2008/02/03 19:20:41 dholland Exp $ */
/* display.c Larn is copyrighted 1986 by Noah Morgan. */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: display.c,v 1.7 2008/01/28 05:38:53 dholland Exp $");
+__RCSID("$NetBSD: display.c,v 1.8 2008/02/03 19:20:41 dholland Exp $");
#endif /* not lint */
#include "header.h"
#include "extern.h"
+
#define makecode(_a,_b,_c) (((_a)<<16) + ((_b)<<8) + (_c))
+static void bot_hpx(void);
+static void bot_spellx(void);
+static void botside(void);
static void botsub(int, const char *);
+static void seepage(void);
static int minx, maxx, miny, maxy, k, m;
static char bot1f = 0, bot2f = 0, bot3f = 0;
@@ -147,8 +152,8 @@ bottomgold()
special routine to update hp and level fields on bottom lines
called in monster.c hitplayer() and spattack()
*/
-void
-bot_hpx()
+static void
+bot_hpx(void)
{
if (c[EXPERIENCE] != cbak[EXPERIENCE]) {
recalc();
@@ -160,8 +165,8 @@ bot_hpx()
/*
special routine to update number of spells called from regen()
*/
-void
-bot_spellx()
+static void
+bot_spellx(void)
{
botsub(makecode(SPELLS, 9, 18), "%2ld");
}
@@ -194,8 +199,8 @@ static struct bot_side_def {
{ WTW, "Wall-Walk" }
};
-void
-botside()
+static void
+botside(void)
{
int i, idx;
for (i = 0; i < 17; i++) {
@@ -612,8 +617,8 @@ seemagic(arg)
/*
* subroutine to paginate the seemagic function
*/
-void
-seepage()
+static void
+seepage(void)
{
if (++count == 3) {
lincount++;
diff --git a/larn/extern.h b/larn/extern.h
index ea767e6a..71cad280 100644
--- a/larn/extern.h
+++ b/larn/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.7 2008/01/28 05:38:53 dholland Exp $ */
+/* $NetBSD: extern.h,v 1.8 2008/02/03 19:20:41 dholland Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
@@ -37,17 +37,8 @@ void mailbill(void);
/* create.c */
void makeplayer(void);
void newcavelevel(int);
-void makemaze(int);
void eat(int, int);
-int cannedlevel(int);
-void treasureroom(int);
-void troom(int, int, int, int, int, int);
-void makeobject(int);
-void fillmroom(int, int, int);
-void froom(int, int, int);
int fillmonst(int);
-void sethp(int);
-void checkgen(void);
/* data.c */
@@ -57,9 +48,6 @@ int dcount(int);
void diagdrawscreen(void);
int savegame(char *);
void restoregame(char *);
-void greedy(void);
-void fsorry(void);
-void fcheat(void);
/* display.c */
void bottomline(void);
@@ -68,9 +56,6 @@ void bottomspell(void);
void bottomdo(void);
void bot_linex(void);
void bottomgold(void);
-void bot_hpx(void);
-void bot_spellx(void);
-void botside(void);
void draws(int, int, int, int);
void drawscreen(void);
void showcell(int, int);
@@ -78,7 +63,6 @@ void show1cell(int, int);
void showplayer(void);
int moveplayer(int);
void seemagic(int);
-void seepage(void);
/* fortune.c */
const char *fortune(void);
@@ -122,7 +106,6 @@ int rund(int);
void help(void);
void welcome(void);
void retcont(void);
-int openhelp(void);
/* io.c */
void setupvt100(void);
@@ -155,7 +138,6 @@ void standout(const char *);
void set_score_output(void);
void lflush(void);
int xputchar(int);
-void flush_buf(void);
char *tmcapcnv(char *, char *);
void beep(void);
@@ -184,13 +166,11 @@ void dropobj(void);
void readscr(void);
void eatcookie(void);
void quaff(void);
-int whatitem(const char *);
unsigned long readnum(long);
void szero(char *);
/* monster.c */
void createmonster(int);
-int cgood(int, int, int, int);
void createitem(int, int);
void cast(void);
void speldamage(int);
@@ -208,11 +188,9 @@ void dirpoly(int);
void hitmonster(int, int);
int hitm(int, int, int);
void hitplayer(int, int);
-void dropsomething(int);
void dropgold(int);
void something(int);
int newobject(int, int *);
-int spattack(int, int, int);
void checkloss(int);
int annihilate(void);
int newsphere(int, int, int, int);
diff --git a/larn/help.c b/larn/help.c
index 42c87e6d..47350d10 100644
--- a/larn/help.c
+++ b/larn/help.c
@@ -1,15 +1,18 @@
-/* $NetBSD: help.c,v 1.5 2001/02/05 00:57:33 christos Exp $ */
+/* $NetBSD: help.c,v 1.6 2008/02/03 19:20:41 dholland Exp $ */
/* help.c Larn is copyrighted 1986 by Noah Morgan. */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: help.c,v 1.5 2001/02/05 00:57:33 christos Exp $");
+__RCSID("$NetBSD: help.c,v 1.6 2008/02/03 19:20:41 dholland Exp $");
#endif /* not lint */
#include <unistd.h>
#include "header.h"
#include "extern.h"
+
+static int openhelp(void);
+
/*
* help function to display the help info
*
@@ -109,8 +112,8 @@ retcont()
/*
* routine to open the help file and return the first character - '0'
*/
-int
-openhelp()
+static int
+openhelp(void)
{
if (lopen(helpfile) < 0) {
lprintf("Can't open help file \"%s\" ", helpfile);
diff --git a/larn/io.c b/larn/io.c
index ac3fadab..c6f41522 100644
--- a/larn/io.c
+++ b/larn/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.20 2008/01/28 05:48:57 dholland Exp $ */
+/* $NetBSD: io.c,v 1.21 2008/02/03 19:20:41 dholland Exp $ */
/*
* io.c Larn is copyrighted 1986 by Noah Morgan.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: io.c,v 1.20 2008/01/28 05:48:57 dholland Exp $");
+__RCSID("$NetBSD: io.c,v 1.21 2008/02/03 19:20:41 dholland Exp $");
#endif /* not lint */
#include "header.h"
@@ -126,6 +126,8 @@ typedef char *va_list;
#define va_arg(plist,mode) ((mode *)(plist += sizeof(mode)))[-1]
#endif /* NOVARARGS */
+static void flush_buf(void);
+
#define LINBUFSIZE 128 /* size of the lgetw() and lgetl() buffer */
int io_outfd; /* output file numbers */
int io_infd; /* input file numbers */
@@ -966,7 +968,7 @@ xputchar(int ch)
/*
* flush_buf() Flush buffer with decoded output.
*/
-void
+static void
flush_buf()
{
if (vindex)
diff --git a/larn/main.c b/larn/main.c
index 288a8f8b..14f1caef 100644
--- a/larn/main.c
+++ b/larn/main.c
@@ -1,9 +1,9 @@
-/* $NetBSD: main.c,v 1.21 2008/02/03 03:45:55 dholland Exp $ */
+/* $NetBSD: main.c,v 1.22 2008/02/03 19:20:42 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.22 2008/02/03 19:20:42 dholland Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -15,6 +15,8 @@ __RCSID("$NetBSD: main.c,v 1.21 2008/02/03 03:45:55 dholland Exp $");
#include "header.h"
#include "extern.h"
+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 */
@@ -1267,7 +1269,7 @@ quaff()
/*
function to ask what player wants to do
*/
-int
+static int
whatitem(const char *str)
{
int i;
diff --git a/larn/monster.c b/larn/monster.c
index fd5c942d..2b691569 100644
--- a/larn/monster.c
+++ b/larn/monster.c
@@ -1,4 +1,4 @@
-/* $NetBSD: monster.c,v 1.13 2008/01/28 05:38:54 dholland Exp $ */
+/* $NetBSD: monster.c,v 1.14 2008/02/03 19:20:42 dholland Exp $ */
/*
* monster.c Larn is copyrighted 1986 by Noah Morgan.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: monster.c,v 1.13 2008/01/28 05:38:54 dholland Exp $");
+__RCSID("$NetBSD: monster.c,v 1.14 2008/02/03 19:20:42 dholland Exp $");
#endif /* not lint */
#include <string.h>
@@ -114,7 +114,11 @@ struct isave { /* used for altar reality */
short arg; /* the type of item or hitpoints of monster */
};
+static int cgood(int, int, int, int);
static int dirsub(int *, int *);
+static void dropsomething(int);
+static int spattack(int, int, int);
+
/*
* createmonster(monstno) Function to create a monster next to the player
* int monstno;
@@ -168,7 +172,7 @@ createmonster(mon)
* if monst==TRUE check for no monster at this location
* This routine will return FALSE if at a wall or the dungeon exit on level 1
*/
-int
+static int
cgood(int x, int y, int theitem, int monst)
{
#define itm __lose
@@ -1283,7 +1287,7 @@ hitplayer(x, y)
* Enter with the monster number
* Returns nothing of value.
*/
-void
+static void
dropsomething(monst)
int monst;
{
@@ -1499,7 +1503,7 @@ static char rustarm[ARMORTYPES][2] = {
{ OPLATEARMOR, -9}
};
static char spsel[] = {1, 2, 3, 5, 6, 8, 9, 11, 13, 14};
-int
+static int
spattack(x, xx, yy)
int x, xx, yy;
{