copy in from cvs; cvs2svn fucked up big time

git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@9775 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
2003-12-19 19:12:08 +00:00
parent 351c8ca204
commit 51eabc017b
310 changed files with 7852 additions and 5005 deletions

View File

@@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.5 1997/10/13 19:44:38 christos Exp $ */
/* $NetBSD: misc.c,v 1.12 2001/02/05 01:10:10 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,23 +38,26 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: misc.c,v 1.5 1997/10/13 19:44:38 christos Exp $");
__RCSID("$NetBSD: misc.c,v 1.12 2001/02/05 01:10:10 christos Exp $");
#endif
#endif /* not lint */
#include <fcntl.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <sys/file.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "extern.h"
#include "pathnames.h"
#define distance(x,y) (abs(x) >= abs(y) ? abs(x) + abs(y)/2 : abs(y) + abs(x)/2)
static int angle(int, int);
/* XXX */
int
range(from, to)
struct ship *from, *to;
range(struct ship *from, struct ship *to)
{
int bow1r, bow1c, bow2r, bow2c;
int stern1r, stern1c, stern2c, stern2r;
@@ -81,9 +84,7 @@ struct ship *from, *to;
}
struct ship *
closestenemy(from, side, anyship)
struct ship *from;
char side, anyship;
closestenemy(struct ship *from, int side, int anyship)
{
struct ship *sp;
char a;
@@ -109,9 +110,8 @@ char side, anyship;
return closest;
}
int
angle(dr, dc)
int dr, dc;
static int
angle(int dr, int dc)
{
int i;
@@ -137,9 +137,9 @@ int dr, dc;
return i % 8 + 1;
}
/* checks for target bow or stern */
int
gunsbear(from, to) /* checks for target bow or stern */
struct ship *from, *to;
gunsbear(struct ship *from, struct ship *to)
{
int Dr, Dc, i;
int ang;
@@ -159,11 +159,10 @@ struct ship *from, *to;
return 0;
}
/* returns true if fromship is shooting at onship's starboard side */
int
portside(from, on, quick)
struct ship *from, *on;
int quick; /* returns true if fromship is */
{ /* shooting at onship's starboard side */
portside(struct ship *from, struct ship *on, int quick)
{
int ang;
int Dr, Dc;
@@ -181,8 +180,7 @@ int quick; /* returns true if fromship is */
}
int
colours(sp)
struct ship *sp;
colours(struct ship *sp)
{
char flag = '\0';
@@ -199,8 +197,7 @@ struct ship *sp;
}
void
logger(s)
struct ship *s;
logger(struct ship *s)
{
FILE *fp;
int persons;
@@ -227,27 +224,24 @@ struct ship *s;
= lp->l_gamenum = lp->l_netpoints = 0;
rewind(fp);
if (persons < 0)
(void) putw(1, fp);
putw(1, fp);
else
(void) putw(persons + 1, fp);
putw(persons + 1, fp);
for (lp = log; lp < &log[NLOG]; lp++)
if (net > (float)lp->l_netpoints
/ scene[lp->l_gamenum].ship[lp->l_shipnum].specs->pts) {
(void) fwrite((char *)log,
sizeof (struct logs), lp - log, fp);
(void) strcpy(log[NLOG-1].l_name, s->file->captain);
fwrite((char *)log, sizeof (struct logs), lp - log, fp);
strcpy(log[NLOG-1].l_name, s->file->captain);
log[NLOG-1].l_uid = getuid();
log[NLOG-1].l_shipnum = s->file->index;
log[NLOG-1].l_gamenum = game;
log[NLOG-1].l_netpoints = s->file->points;
(void) fwrite((char *)&log[NLOG-1],
sizeof (struct logs), 1, fp);
(void) fwrite((char *)lp,
sizeof (struct logs), &log[NLOG-1] - lp, fp);
fwrite((char *)&log[NLOG-1], sizeof (struct logs), 1, fp);
fwrite((char *)lp, sizeof (struct logs), &log[NLOG-1] - lp, fp);
break;
}
#ifdef LOCK_EX
(void) flock(fileno(fp), LOCK_UN);
flock(fileno(fp), LOCK_UN);
#endif
(void) fclose(fp);
fclose(fp);
}