-/* $NetBSD: score.c,v 1.12 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: score.c,v 1.16 2011/08/26 06:18:17 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: score.c,v 1.12 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: score.c,v 1.16 2011/08/26 06:18:17 dholland Exp $");
#endif
#endif /* not lint */
#include "rogue.h"
#include "pathnames.h"
+static void center(short, const char *);
+static int get_value(const object *);
+static void id_all(void);
+static void sell_pack(void);
+static void sf_error(void) __dead;
+
void
-killed_by(monster, other)
- const object *monster;
- short other;
+killed_by(const object *monster, short other)
{
const char *mechanism = "killed by something unknown (?)";
char mechanism_buf[128];
}
void
-win()
+win(void)
{
unwield(rogue.weapon); /* disarm and relax */
unwear(rogue.armor);
messagef(0, "%s", ""); /* gcc objects to just "" */
id_all();
sell_pack();
- put_scores((object *) 0, WIN);
+ put_scores(NULL, WIN);
}
void
-quit(from_intrpt)
- boolean from_intrpt;
+quit(boolean from_intrpt)
{
char buf[DCOLS];
short i, orow, ocol;
clean_up(byebye_string);
}
check_message();
- killed_by((object *) 0, QUIT);
+ killed_by(NULL, QUIT);
}
/*
#define NUM_SCORE_ENTRIES 10
-static void pad_spaces __P((char *, size_t));
-static void unpad_spaces(char *);
-static int read_score_entry __P((struct score_entry *, FILE *));
-static void write_score_entry __P((const struct score_entry *, int, FILE *));
-static void make_score __P((struct score_entry *, const object *, int));
-
+static void make_score(struct score_entry *, const object *, int);
static
void
-pad_spaces(str, len)
- char *str;
- size_t len;
+pad_spaces(char *str, size_t len)
{
size_t x;
for (x=strlen(str); x<len-1; x++) {
static
void
-unpad_spaces(str)
- char *str;
+unpad_spaces(char *str)
{
size_t x;
for (x=strlen(str); x>0 && str[x-1]==' '; x--);
static
int
-read_score_entry(se, fp)
- struct score_entry *se;
- FILE *fp;
+read_score_entry(struct score_entry *se, FILE *fp)
{
char score_block[80];
char nickname_block[30];
static
void
-write_score_entry(se, rank, fp)
- const struct score_entry *se;
- int rank;
- FILE *fp;
+write_score_entry(const struct score_entry *se, int rank, FILE *fp)
{
char score_block[80];
char nickname_block[30];
}
void
-put_scores(monster, other)
- const object *monster;
- short other;
+put_scores(const object *monster, short other)
{
short i, rank=-1, found_player = -1, numscores = 0;
struct score_entry scores[NUM_SCORE_ENTRIES];
}
setegid(gid);
rewind(fp);
- (void) xxx(1);
+ (void)xxx(1);
for (numscores = 0; numscores < NUM_SCORE_ENTRIES; numscores++) {
if (read_score_entry(&scores[numscores], fp) == 0) {
md_ignore_signals();
rewind(fp);
- (void) xxx(1);
+ (void)xxx(1);
for (i = 0; i < numscores; i++) {
write_score_entry(&scores[i], i, fp);
static
void
-make_score(se, monster, other)
- struct score_entry *se;
- const object *monster;
- int other;
+make_score(struct score_entry *se, const object *monster, int other)
{
const char *death = "bolts from the blue (?)";
const char *hasamulet;
} else {
article = "a";
}
-
+
snprintf(deathbuf, sizeof(deathbuf),
"killed by %s %s", article, mn);
death = deathbuf;
}
boolean
-is_vowel(ch)
- short ch;
+is_vowel(short ch)
{
return( (ch == 'a') ||
(ch == 'e') ||
(ch == 'u') );
}
-void
-sell_pack()
+static void
+sell_pack(void)
{
object *obj;
short row = 2, val;
messagef(0, "%s", ""); /* gcc objects to just "" */
}
-int
-get_value(obj)
- const object *obj;
+static int
+get_value(const object *obj)
{
short wc;
int val;
return(val);
}
-void
-id_all()
+static void
+id_all(void)
{
short i;
}
void
-xxxx(buf, n)
- char *buf;
- short n;
+xxxx(char *buf, short n)
{
short i;
unsigned char c;
for (i = 0; i < n; i++) {
/* It does not matter if accuracy is lost during this assignment */
- c = (unsigned char) xxx(0);
+ c = (unsigned char)xxx(0);
buf[i] ^= c;
}
}
long
-xxx(st)
- boolean st;
+xxx(boolean st)
{
static long f, s;
long r;
return(r);
}
-void
-center(row, buf)
- short row;
- const char *buf;
+static void
+center(short row, const char *buf)
{
short margin;
mvaddstr(row, margin, buf);
}
-void
-sf_error()
+static void
+sf_error(void)
{
md_lock(0);
messagef(1, "%s", ""); /* gcc objects to just "" */