-/* $NetBSD: scores.c,v 1.19 2010/04/02 21:40:00 christos Exp $ */
+/* $NetBSD: scores.c,v 1.21 2012/06/19 05:30:44 dholland Exp $ */
/*
* scores.c Larn is copyrighted 1986 by Noah Morgan.
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: scores.c,v 1.19 2010/04/02 21:40:00 christos Exp $");
+__RCSID("$NetBSD: scores.c,v 1.21 2012/06/19 05:30:44 dholland Exp $");
#endif /* not lint */
#include <sys/types.h>
#include <sys/times.h>
#include "header.h"
#include "extern.h"
+#include <time.h>
+
struct scofmt { /* This is the structure for the scoreboard */
long score; /* the score of the player */
long suid; /* the user id number of the player */
struct log_fmt { /* 102 bytes struct for the log file */
long score; /* the players score */
- time_t diedtime; /* time when game was over */
+ int32_t diedtime; /* time when game was over */
short cavelev;/* level in caves */
short diff; /* difficulty player played at */
#ifdef EXTRA
* returns -1 if unable to read in the scoreboard, returns 0 if all is OK
*/
static int
-readboard()
+readboard(void)
{
int i;
* returns -1 if unable to write the scoreboard, returns 0 if all is OK
*/
static int
-writeboard()
+writeboard(void)
{
int i;
* returns -1 if unable to write the scoreboard, returns 0 if all is OK
*/
int
-makeboard()
+makeboard(void)
{
int i;
set_score_output();
* the winners scoreboard.
*/
int
-hashewon()
+hashewon(void)
{
int i;
c[HARDGAME] = 0;
* Returns amount actually paid.
*/
long
-paytaxes(x)
- long x;
+paytaxes(long x)
{
int i;
long amt;
* Returns the number of players on scoreboard that were shown
*/
static int
-winshou()
+winshou(void)
{
struct wscofmt *p;
int i, j, count;
* Returns the number of players on scoreboard that were shown
*/
static int
-shou(x)
- int x;
+shou(int x)
{
int i, j, n, k;
int count;
*/
static char esb[] = "The scoreboard is empty.\n";
void
-showscores()
+showscores(void)
{
int i, j;
lflush();
* Returns nothing of value
*/
void
-showallscores()
+showallscores(void)
{
int i, j;
lflush();
* Returns 0 if no sorting done, else returns 1
*/
static int
-sortboard()
+sortboard(void)
{
int i, j = 0, pos;
long jdat;
* ex. newscore(1000, "player 1", 32, 0);
*/
static void
-newscore(score, whoo, whyded, winner)
- long score;
- int winner, whyded;
- char *whoo;
+newscore(long score, char *whoo, int whyded, int winner)
{
int i;
long taxes;
* Returns nothing of value
*/
static void
-new1sub(score, i, whoo, taxes)
- long score, taxes;
- int i;
- char *whoo;
+new1sub(long score, int i, char *whoo, long taxes)
{
struct wscofmt *p;
p = &winr[i];
* Returns nothing of value
*/
static void
-new2sub(score, i, whoo, whyded)
- long score;
- int i, whyded;
- char *whoo;
+new2sub(long score, int i, char *whoo, int whyded)
{
int j;
struct scofmt *p;
static int scorerror;
void
-died(x)
- int x;
+died(int x)
{
int f, win;
char ch;
* diedlog() Subroutine to read a log file and print it out in ascii format
*/
void
-diedlog()
+diedlog(void)
{
int n;
char *p;
static char q[] = "?";
struct stat stbuf;
+ time_t t;
+
lcreat((char *) 0);
if (lopen(logfile) < 0) {
lprintf("Can't locate log file <%s>\n", logfile);
}
for (n = stbuf.st_size / sizeof(struct log_fmt); n > 0; --n) {
lrfill((char *) &logg, sizeof(struct log_fmt));
- if ((p = ctime(&logg.diedtime)) == NULL)
+ t = logg.diedtime;
+ if ((p = ctime(&t)) == NULL)
p = q;
else {
p[16] = '\n';