Warnsify and remove local implementations of libc functions.
This commit is contained in:
parent
ce8b7a418a
commit
ef383c95e2
@ -1,7 +1,6 @@
|
||||
# $NetBSD: Makefile,v 1.9 1997/10/12 14:21:51 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.10 1997/10/12 21:24:24 christos Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
WARNS=0
|
||||
PROG= trek
|
||||
SRCS= abandon.c attack.c autover.c capture.c check_out.c checkcond.c \
|
||||
compkl.c computer.c damage.c damaged.c dcrept.c destruct.c \
|
||||
@ -9,7 +8,7 @@ SRCS= abandon.c attack.c autover.c capture.c check_out.c checkcond.c \
|
||||
getcodi.c getpar.c help.c impulse.c initquad.c kill.c klmove.c \
|
||||
lose.c lrscan.c main.c move.c nova.c out.c phaser.c play.c ram.c \
|
||||
ranf.c rest.c schedule.c score.c setup.c setwarp.c \
|
||||
shield.c snova.c srscan.c systemname.c torped.c utility.c \
|
||||
shield.c snova.c srscan.c systemname.c torped.c \
|
||||
visual.c warp.c win.c cgetc.c
|
||||
MAN= trek.6
|
||||
DPADD= ${LIBM}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: abandon.c,v 1.3 1995/04/22 10:58:24 cgd Exp $ */
|
||||
/* $NetBSD: abandon.c,v 1.4 1997/10/12 21:24:25 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)abandon.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: abandon.c,v 1.3 1995/04/22 10:58:24 cgd Exp $";
|
||||
__RCSID("$NetBSD: abandon.c,v 1.4 1997/10/12 21:24:25 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Abandon Ship
|
||||
@ -68,19 +70,26 @@ static char rcsid[] = "$NetBSD: abandon.c,v 1.3 1995/04/22 10:58:24 cgd Exp $";
|
||||
** Uses trace flag 40
|
||||
*/
|
||||
|
||||
abandon()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
abandon(v)
|
||||
int v;
|
||||
{
|
||||
register struct quad *q;
|
||||
register int i;
|
||||
int j;
|
||||
register struct event *e;
|
||||
struct quad *q;
|
||||
int i;
|
||||
int j;
|
||||
struct event *e;
|
||||
|
||||
if (Ship.ship == QUEENE)
|
||||
return (printf("You may not abandon ye Faire Queene\n"));
|
||||
if (Ship.ship == QUEENE) {
|
||||
printf("You may not abandon ye Faire Queene\n");
|
||||
return;
|
||||
}
|
||||
if (Ship.cond != DOCKED)
|
||||
{
|
||||
if (damaged(SHUTTLE))
|
||||
return (out(SHUTTLE));
|
||||
if (damaged(SHUTTLE)) {
|
||||
out(SHUTTLE);
|
||||
return;
|
||||
}
|
||||
printf("Officers escape in shuttlecraft\n");
|
||||
/* decide on fate of crew */
|
||||
q = &Quad[Ship.quadx][Ship.quady];
|
||||
@ -154,7 +163,7 @@ abandon()
|
||||
if (Sect[Ship.sectx][Ship.secty] == EMPTY)
|
||||
{
|
||||
Sect[Ship.sectx][Ship.secty] = QUEENE;
|
||||
dock();
|
||||
dock(0);
|
||||
compkldist(0);
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: attack.c,v 1.3 1995/04/22 10:58:26 cgd Exp $ */
|
||||
/* $NetBSD: attack.c,v 1.4 1997/10/12 21:24:26 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)attack.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: attack.c,v 1.3 1995/04/22 10:58:26 cgd Exp $";
|
||||
__RCSID("$NetBSD: attack.c,v 1.4 1997/10/12 21:24:26 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Klingon Attack Routine
|
||||
@ -73,15 +76,16 @@ static char rcsid[] = "$NetBSD: attack.c,v 1.3 1995/04/22 10:58:26 cgd Exp $";
|
||||
** Casualties can also occur.
|
||||
*/
|
||||
|
||||
void
|
||||
attack(resting)
|
||||
int resting; /* set if attack while resting */
|
||||
{
|
||||
register int hit, i, l;
|
||||
int maxhit, tothit, shldabsb;
|
||||
double chgfac, propor, extradm;
|
||||
double dustfac, tothe;
|
||||
int cas;
|
||||
int hitflag;
|
||||
int hit, i, l;
|
||||
int maxhit, tothit, shldabsb;
|
||||
double chgfac, propor, extradm;
|
||||
double dustfac, tothe;
|
||||
int cas;
|
||||
int hitflag;
|
||||
|
||||
if (Move.free)
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autover.c,v 1.3 1995/04/22 10:58:28 cgd Exp $ */
|
||||
/* $NetBSD: autover.c,v 1.4 1997/10/12 21:24:27 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)autover.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: autover.c,v 1.3 1995/04/22 10:58:28 cgd Exp $";
|
||||
__RCSID("$NetBSD: autover.c,v 1.4 1997/10/12 21:24:27 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Automatic Override
|
||||
@ -61,10 +63,11 @@ static char rcsid[] = "$NetBSD: autover.c,v 1.3 1995/04/22 10:58:28 cgd Exp $";
|
||||
** quadrants, since that is all that is needed.
|
||||
*/
|
||||
|
||||
void
|
||||
autover()
|
||||
{
|
||||
double dist;
|
||||
register int course;
|
||||
int course;
|
||||
|
||||
printf("\07RED ALERT: The %s is in a supernova quadrant\n", Ship.shipname);
|
||||
printf("*** Emergency override attempts to hurl %s to safety\n", Ship.shipname);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: capture.c,v 1.3 1995/04/22 10:58:32 cgd Exp $ */
|
||||
/* $NetBSD: capture.c,v 1.4 1997/10/12 21:24:29 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)capture.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: capture.c,v 1.3 1995/04/22 10:58:32 cgd Exp $";
|
||||
__RCSID("$NetBSD: capture.c,v 1.4 1997/10/12 21:24:29 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Ask a Klingon To Surrender
|
||||
@ -57,12 +59,14 @@ static char rcsid[] = "$NetBSD: capture.c,v 1.3 1995/04/22 10:58:32 cgd Exp $";
|
||||
** etc.
|
||||
*/
|
||||
|
||||
capture()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
capture(v)
|
||||
int v;
|
||||
{
|
||||
register int i;
|
||||
register struct kling *k;
|
||||
int i;
|
||||
struct kling *k;
|
||||
double x;
|
||||
extern struct kling *selectklingon();
|
||||
|
||||
/* check for not cloaked */
|
||||
if (Ship.cloaked)
|
||||
@ -70,8 +74,10 @@ capture()
|
||||
printf("Ship-ship communications out when cloaked\n");
|
||||
return;
|
||||
}
|
||||
if (damaged(SSRADIO))
|
||||
return (out(SSRADIO));
|
||||
if (damaged(SSRADIO)) {
|
||||
out(SSRADIO);
|
||||
return;
|
||||
}
|
||||
/* find out if there are any at all */
|
||||
if (Etc.nkling <= 0)
|
||||
{
|
||||
@ -124,7 +130,7 @@ capture()
|
||||
|
||||
struct kling *selectklingon()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (Etc.nkling < 2)
|
||||
i = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cgetc.c,v 1.3 1995/04/22 10:58:34 cgd Exp $ */
|
||||
/* $NetBSD: cgetc.c,v 1.4 1997/10/12 21:24:30 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cgetc.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: cgetc.c,v 1.3 1995/04/22 10:58:34 cgd Exp $";
|
||||
__RCSID("$NetBSD: cgetc.c,v 1.4 1997/10/12 21:24:30 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include <stdio.h>
|
||||
# include "trek.h"
|
||||
|
||||
char cgetc(i)
|
||||
int i;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: check_out.c,v 1.3 1995/04/22 10:58:35 cgd Exp $ */
|
||||
/* $NetBSD: check_out.c,v 1.4 1997/10/12 21:24:31 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)check_out.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: check_out.c,v 1.3 1995/04/22 10:58:35 cgd Exp $";
|
||||
__RCSID("$NetBSD: check_out.c,v 1.4 1997/10/12 21:24:31 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** CHECK IF A DEVICE IS OUT
|
||||
@ -54,10 +56,11 @@ static char rcsid[] = "$NetBSD: check_out.c,v 1.3 1995/04/22 10:58:35 cgd Exp $"
|
||||
** It prints appropriate messages too.
|
||||
*/
|
||||
|
||||
int
|
||||
check_out(device)
|
||||
int device;
|
||||
{
|
||||
register int dev;
|
||||
int dev;
|
||||
|
||||
dev = device;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: checkcond.c,v 1.3 1995/04/22 10:58:37 cgd Exp $ */
|
||||
/* $NetBSD: checkcond.c,v 1.4 1997/10/12 21:24:32 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,16 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)checkcond.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: checkcond.c,v 1.3 1995/04/22 10:58:37 cgd Exp $";
|
||||
__RCSID("$NetBSD: checkcond.c,v 1.4 1997/10/12 21:24:32 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Check for Condition After a Move
|
||||
@ -68,10 +69,9 @@ static char rcsid[] = "$NetBSD: checkcond.c,v 1.3 1995/04/22 10:58:37 cgd Exp $"
|
||||
** and battle conditions.
|
||||
*/
|
||||
|
||||
void
|
||||
checkcond()
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
/* see if we are still alive and well */
|
||||
if (Ship.reserves < 0.0)
|
||||
lose(L_NOLIFE);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compkl.c,v 1.3 1995/04/22 10:58:38 cgd Exp $ */
|
||||
/* $NetBSD: compkl.c,v 1.4 1997/10/12 21:24:33 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)compkl.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: compkl.c,v 1.3 1995/04/22 10:58:38 cgd Exp $";
|
||||
__RCSID("$NetBSD: compkl.c,v 1.4 1997/10/12 21:24:33 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <math.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** compute klingon distances
|
||||
@ -54,12 +56,15 @@ static char rcsid[] = "$NetBSD: compkl.c,v 1.3 1995/04/22 10:58:38 cgd Exp $";
|
||||
** move.
|
||||
*/
|
||||
|
||||
static void sortkl __P((void));
|
||||
|
||||
void
|
||||
compkldist(f)
|
||||
int f; /* set if new quadrant */
|
||||
{
|
||||
register int i, dx, dy;
|
||||
double d;
|
||||
double temp;
|
||||
int i, dx, dy;
|
||||
double d;
|
||||
double temp;
|
||||
|
||||
if (Etc.nkling == 0)
|
||||
return;
|
||||
@ -96,10 +101,11 @@ int f; /* set if new quadrant */
|
||||
** bubble sort on ascending distance
|
||||
*/
|
||||
|
||||
static void
|
||||
sortkl()
|
||||
{
|
||||
struct kling t;
|
||||
register int f, i, m;
|
||||
int f, i, m;
|
||||
|
||||
m = Etc.nkling - 1;
|
||||
f = 1;
|
||||
@ -109,9 +115,9 @@ sortkl()
|
||||
for (i = 0; i < m; i++)
|
||||
if (Etc.klingon[i].dist > Etc.klingon[i+1].dist)
|
||||
{
|
||||
bmove(&Etc.klingon[i], &t, sizeof t);
|
||||
bmove(&Etc.klingon[i+1], &Etc.klingon[i], sizeof t);
|
||||
bmove(&t, &Etc.klingon[i+1], sizeof t);
|
||||
t = Etc.klingon[i];
|
||||
Etc.klingon[i] = Etc.klingon[i+1];
|
||||
Etc.klingon[i+1] = t;
|
||||
f = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: computer.c,v 1.4 1995/04/24 12:25:51 cgd Exp $ */
|
||||
/* $NetBSD: computer.c,v 1.5 1997/10/12 21:24:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,17 +33,20 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: computer.c,v 1.4 1995/04/24 12:25:51 cgd Exp $";
|
||||
__RCSID("$NetBSD: computer.c,v 1.5 1997/10/12 21:24:34 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
# include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** On-Board Computer
|
||||
**
|
||||
@ -92,31 +95,36 @@ static char rcsid[] = "$NetBSD: computer.c,v 1.4 1995/04/24 12:25:51 cgd Exp $";
|
||||
|
||||
struct cvntab Cputab[] =
|
||||
{
|
||||
"ch", "art", (int (*)())1, 0,
|
||||
"t", "rajectory", (int (*)())2, 0,
|
||||
"c", "ourse", (int (*)())3, 0,
|
||||
"m", "ove", (int (*)())3, 1,
|
||||
"s", "core", (int (*)())4, 0,
|
||||
"p", "heff", (int (*)())5, 0,
|
||||
"w", "arpcost", (int (*)())6, 0,
|
||||
"i", "mpcost", (int (*)())7, 0,
|
||||
"d", "istresslist", (int (*)())8, 0,
|
||||
0
|
||||
{ "ch", "art", (cmdfun)1, 0 },
|
||||
{ "t", "rajectory", (cmdfun)2, 0 },
|
||||
{ "c", "ourse", (cmdfun)3, 0 },
|
||||
{ "m", "ove", (cmdfun)3, 1 },
|
||||
{ "s", "core", (cmdfun)4, 0 },
|
||||
{ "p", "heff", (cmdfun)5, 0 },
|
||||
{ "w", "arpcost", (cmdfun)6, 0 },
|
||||
{ "i", "mpcost", (cmdfun)7, 0 },
|
||||
{ "d", "istresslist", (cmdfun)8, 0 },
|
||||
{ NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
computer()
|
||||
static int kalc __P((int, int, int, int, double *));
|
||||
static void prkalc __P((int, double));
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
computer(v)
|
||||
int v;
|
||||
{
|
||||
int ix, iy;
|
||||
register int i, j;
|
||||
int numout;
|
||||
int tqx, tqy;
|
||||
struct cvntab *r;
|
||||
int cost;
|
||||
int course;
|
||||
double dist, time;
|
||||
double warpfact;
|
||||
struct quad *q;
|
||||
register struct event *e;
|
||||
int ix, iy;
|
||||
int i, j;
|
||||
int tqx, tqy;
|
||||
struct cvntab *r;
|
||||
int cost;
|
||||
int course;
|
||||
double dist, time;
|
||||
double warpfact;
|
||||
struct quad *q;
|
||||
struct event *e;
|
||||
|
||||
if (check_out(COMPUTER))
|
||||
return;
|
||||
@ -311,6 +319,7 @@ computer()
|
||||
** sqx,sqy/ssx,ssy to tqx,tqy/tsx,tsy.
|
||||
*/
|
||||
|
||||
static int
|
||||
kalc(tqx, tqy, tsx, tsy, dist)
|
||||
int tqx;
|
||||
int tqy;
|
||||
@ -321,7 +330,7 @@ double *dist;
|
||||
double dx, dy;
|
||||
double quadsize;
|
||||
double angle;
|
||||
register int course;
|
||||
int course;
|
||||
|
||||
/* normalize to quadrant distances */
|
||||
quadsize = NSECTS;
|
||||
@ -340,7 +349,7 @@ double *dist;
|
||||
return (course);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
prkalc(course, dist)
|
||||
int course;
|
||||
double dist;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: damage.c,v 1.3 1995/04/22 10:58:40 cgd Exp $ */
|
||||
/* $NetBSD: damage.c,v 1.4 1997/10/12 21:24:36 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)damage.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: damage.c,v 1.3 1995/04/22 10:58:40 cgd Exp $";
|
||||
__RCSID("$NetBSD: damage.c,v 1.4 1997/10/12 21:24:36 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Schedule Ship.damages to a Device
|
||||
@ -55,14 +58,15 @@ static char rcsid[] = "$NetBSD: damage.c,v 1.3 1995/04/22 10:58:40 cgd Exp $";
|
||||
** that the dock() and undock() have to reschedule the event.
|
||||
*/
|
||||
|
||||
void
|
||||
damage(dev1, dam)
|
||||
int dev1; /* device index */
|
||||
double dam; /* time to repair */
|
||||
{
|
||||
register int i;
|
||||
register struct event *e;
|
||||
int f;
|
||||
register int dev;
|
||||
int i;
|
||||
struct event *e;
|
||||
int f;
|
||||
int dev;
|
||||
|
||||
/* ignore zero damages */
|
||||
if (dam <= 0.0)
|
||||
@ -93,5 +97,5 @@ double dam; /* time to repair */
|
||||
reschedule(e, e->date - Now.date + dam);
|
||||
return;
|
||||
}
|
||||
syserr("Cannot find old damages %d\n", dev);
|
||||
errx(1, "Cannot find old damages %d\n", dev);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: damaged.c,v 1.3 1995/04/22 10:58:41 cgd Exp $ */
|
||||
/* $NetBSD: damaged.c,v 1.4 1997/10/12 21:24:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)damaged.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: damaged.c,v 1.3 1995/04/22 10:58:41 cgd Exp $";
|
||||
__RCSID("$NetBSD: damaged.c,v 1.4 1997/10/12 21:24:37 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -50,12 +51,13 @@ static char rcsid[] = "$NetBSD: damaged.c,v 1.3 1995/04/22 10:58:41 cgd Exp $";
|
||||
** event list for a "device fix" action on that device.
|
||||
*/
|
||||
|
||||
int
|
||||
damaged(dev)
|
||||
int dev;
|
||||
{
|
||||
register int d;
|
||||
register struct event *e;
|
||||
register int i;
|
||||
int d;
|
||||
struct event *e;
|
||||
int i;
|
||||
|
||||
d = dev;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dcrept.c,v 1.3 1995/04/22 10:58:43 cgd Exp $ */
|
||||
/* $NetBSD: dcrept.c,v 1.4 1997/10/12 21:24:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dcrept.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: dcrept.c,v 1.3 1995/04/22 10:58:43 cgd Exp $";
|
||||
__RCSID("$NetBSD: dcrept.c,v 1.4 1997/10/12 21:24:38 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** damage control report
|
||||
@ -55,12 +57,15 @@ static char rcsid[] = "$NetBSD: dcrept.c,v 1.3 1995/04/22 10:58:43 cgd Exp $";
|
||||
** fix things if you are docked.
|
||||
*/
|
||||
|
||||
dcrept()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dcrept(v)
|
||||
int v;
|
||||
{
|
||||
register int i, f;
|
||||
double x;
|
||||
double m1, m2;
|
||||
register struct event *e;
|
||||
int i, f;
|
||||
double x;
|
||||
double m1, m2;
|
||||
struct event *e;
|
||||
|
||||
/* set up the magic factors to output the time till fixed */
|
||||
if (Ship.cond == DOCKED)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: destruct.c,v 1.3 1995/04/22 10:58:44 cgd Exp $ */
|
||||
/* $NetBSD: destruct.c,v 1.4 1997/10/12 21:24:40 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)destruct.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: destruct.c,v 1.3 1995/04/22 10:58:44 cgd Exp $";
|
||||
__RCSID("$NetBSD: destruct.c,v 1.4 1997/10/12 21:24:40 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** Self Destruct Sequence
|
||||
@ -63,14 +67,19 @@ static char rcsid[] = "$NetBSD: destruct.c,v 1.3 1995/04/22 10:58:44 cgd Exp $";
|
||||
** Uses trace flag 41
|
||||
*/
|
||||
|
||||
destruct()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
destruct(v)
|
||||
int v;
|
||||
{
|
||||
char checkpass[15];
|
||||
register int i, j;
|
||||
int i, j;
|
||||
double zap;
|
||||
|
||||
if (damaged(COMPUTER))
|
||||
return (out(COMPUTER));
|
||||
if (damaged(COMPUTER)) {
|
||||
out(COMPUTER);
|
||||
return;
|
||||
}
|
||||
printf("\n\07 --- WORKING ---\07\n");
|
||||
sleep(3);
|
||||
/* output the count 10 9 8 7 6 */
|
||||
@ -85,8 +94,10 @@ destruct()
|
||||
skiptonl(0);
|
||||
getstrpar("Enter password verification", checkpass, 14, 0);
|
||||
sleep(2);
|
||||
if (!sequal(checkpass, Game.passwd))
|
||||
return (printf("Self destruct sequence aborted\n"));
|
||||
if (strcmp(checkpass, Game.passwd) != 0) {
|
||||
printf("Self destruct sequence aborted\n");
|
||||
return;
|
||||
}
|
||||
printf("Password verified; self destruct sequence continues:\n");
|
||||
sleep(2);
|
||||
/* output count 5 4 3 2 1 0 */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dock.c,v 1.3 1995/04/22 10:58:45 cgd Exp $ */
|
||||
/* $NetBSD: dock.c,v 1.4 1997/10/12 21:24:41 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dock.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: dock.c,v 1.3 1995/04/22 10:58:45 cgd Exp $";
|
||||
__RCSID("$NetBSD: dock.c,v 1.4 1997/10/12 21:24:41 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** DOCK TO STARBASE
|
||||
@ -58,14 +60,19 @@ static char rcsid[] = "$NetBSD: dock.c,v 1.3 1995/04/22 10:58:45 cgd Exp $";
|
||||
** are docked.
|
||||
*/
|
||||
|
||||
dock()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dock(v)
|
||||
int v;
|
||||
{
|
||||
register int i, j;
|
||||
int ok;
|
||||
register struct event *e;
|
||||
int i, j;
|
||||
int ok;
|
||||
struct event *e;
|
||||
|
||||
if (Ship.cond == DOCKED)
|
||||
return (printf("Chekov: But captain, we are already docked\n"));
|
||||
if (Ship.cond == DOCKED) {
|
||||
printf("Chekov: But captain, we are already docked\n");
|
||||
return;
|
||||
}
|
||||
/* check for ok to dock, i.e., adjacent to a starbase */
|
||||
ok = 0;
|
||||
for (i = Ship.sectx - 1; i <= Ship.sectx + 1 && !ok; i++)
|
||||
@ -83,8 +90,10 @@ dock()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ok)
|
||||
return (printf("Chekov: But captain, we are not adjacent to a starbase.\n"));
|
||||
if (!ok) {
|
||||
printf("Chekov: But captain, we are not adjacent to a starbase.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* restore resources */
|
||||
Ship.energy = Param.energy;
|
||||
@ -125,10 +134,13 @@ dock()
|
||||
** is to reschedule any damages so that they will take longer.
|
||||
*/
|
||||
|
||||
undock()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
undock(v)
|
||||
int v;
|
||||
{
|
||||
register struct event *e;
|
||||
register int i;
|
||||
struct event *e;
|
||||
int i;
|
||||
|
||||
if (Ship.cond != DOCKED)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dumpgame.c,v 1.4 1995/04/24 12:25:54 cgd Exp $ */
|
||||
/* $NetBSD: dumpgame.c,v 1.5 1997/10/12 21:24:42 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,20 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dumpgame.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: dumpgame.c,v 1.4 1995/04/24 12:25:54 cgd Exp $";
|
||||
__RCSID("$NetBSD: dumpgame.c,v 1.5 1997/10/12 21:24:42 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*** THIS CONSTANT MUST CHANGE AS THE DATA SPACES CHANGE ***/
|
||||
# define VERSION 2
|
||||
@ -52,19 +57,21 @@ struct dump
|
||||
int count;
|
||||
};
|
||||
|
||||
static int readdump __P((int));
|
||||
|
||||
|
||||
struct dump Dump_template[] =
|
||||
{
|
||||
(char *)&Ship, sizeof (Ship),
|
||||
(char *)&Now, sizeof (Now),
|
||||
(char *)&Param, sizeof (Param),
|
||||
(char *)&Etc, sizeof (Etc),
|
||||
(char *)&Game, sizeof (Game),
|
||||
(char *)Sect, sizeof (Sect),
|
||||
(char *)Quad, sizeof (Quad),
|
||||
(char *)&Move, sizeof (Move),
|
||||
(char *)Event, sizeof (Event),
|
||||
0
|
||||
{ (char *)&Ship, sizeof (Ship) },
|
||||
{ (char *)&Now, sizeof (Now) },
|
||||
{ (char *)&Param, sizeof (Param) },
|
||||
{ (char *)&Etc, sizeof (Etc) },
|
||||
{ (char *)&Game, sizeof (Game) },
|
||||
{ (char *)Sect, sizeof (Sect) },
|
||||
{ (char *)Quad, sizeof (Quad) },
|
||||
{ (char *)&Move, sizeof (Move) },
|
||||
{ (char *)Event, sizeof (Event) },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
@ -77,15 +84,20 @@ struct dump Dump_template[] =
|
||||
** output change.
|
||||
*/
|
||||
|
||||
dumpgame()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dumpgame(v)
|
||||
int v;
|
||||
{
|
||||
int version;
|
||||
register int fd;
|
||||
register struct dump *d;
|
||||
register int i;
|
||||
int version;
|
||||
int fd;
|
||||
struct dump *d;
|
||||
int i;
|
||||
|
||||
if ((fd = creat("trek.dump", 0644)) < 0)
|
||||
return (printf("cannot dump\n"));
|
||||
if ((fd = creat("trek.dump", 0644)) < 0) {
|
||||
warn("cannot open `trek.dump'");
|
||||
return;
|
||||
}
|
||||
version = VERSION;
|
||||
write(fd, &version, sizeof version);
|
||||
|
||||
@ -112,9 +124,10 @@ dumpgame()
|
||||
** Return value is zero for success, one for failure.
|
||||
*/
|
||||
|
||||
int
|
||||
restartgame()
|
||||
{
|
||||
register int fd;
|
||||
int fd;
|
||||
int version;
|
||||
|
||||
if ((fd = open("trek.dump", 0)) < 0 ||
|
||||
@ -141,12 +154,13 @@ restartgame()
|
||||
** Returns zero for success, one for failure.
|
||||
*/
|
||||
|
||||
static int
|
||||
readdump(fd1)
|
||||
int fd1;
|
||||
{
|
||||
register int fd;
|
||||
register struct dump *d;
|
||||
register int i;
|
||||
int fd;
|
||||
struct dump *d;
|
||||
int i;
|
||||
long junk;
|
||||
|
||||
fd = fd1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dumpme.c,v 1.3 1995/04/22 10:58:48 cgd Exp $ */
|
||||
/* $NetBSD: dumpme.c,v 1.4 1997/10/12 21:24:43 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dumpme.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: dumpme.c,v 1.3 1995/04/22 10:58:48 cgd Exp $";
|
||||
__RCSID("$NetBSD: dumpme.c,v 1.4 1997/10/12 21:24:43 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Dump the starship somewhere in the galaxy
|
||||
@ -55,20 +57,21 @@ static char rcsid[] = "$NetBSD: dumpme.c,v 1.3 1995/04/22 10:58:48 cgd Exp $";
|
||||
** Repair of devices must be deferred.
|
||||
*/
|
||||
|
||||
void
|
||||
dumpme(flag)
|
||||
int flag;
|
||||
{
|
||||
register int f;
|
||||
double x;
|
||||
register struct event *e;
|
||||
register int i;
|
||||
int f;
|
||||
double x;
|
||||
struct event *e;
|
||||
int i;
|
||||
|
||||
f = flag;
|
||||
Ship.quadx = ranf(NQUADS);
|
||||
Ship.quady = ranf(NQUADS);
|
||||
Ship.sectx = ranf(NSECTS);
|
||||
Ship.secty = ranf(NSECTS);
|
||||
x += 1.5 * franf();
|
||||
x = 1.5 * franf();
|
||||
Move.time += x;
|
||||
if (f)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dumpssradio.c,v 1.3 1995/04/22 10:58:49 cgd Exp $ */
|
||||
/* $NetBSD: dumpssradio.c,v 1.4 1997/10/12 21:24:45 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,25 +33,28 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dumpssradio.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: dumpssradio.c,v 1.3 1995/04/22 10:58:49 cgd Exp $";
|
||||
__RCSID("$NetBSD: dumpssradio.c,v 1.4 1997/10/12 21:24:45 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/**
|
||||
** output hidden distress calls
|
||||
**/
|
||||
|
||||
int
|
||||
dumpssradio()
|
||||
{
|
||||
register struct event *e;
|
||||
register int j;
|
||||
register int chkrest;
|
||||
struct event *e;
|
||||
int j;
|
||||
int chkrest;
|
||||
|
||||
chkrest = 0;
|
||||
for (j = 0; j < MAXEVENTS; j++)
|
||||
@ -64,7 +67,7 @@ dumpssradio()
|
||||
{
|
||||
unschedule(e);
|
||||
printf("Starsystem %s in quadrant %d,%d is no longer distressed\n",
|
||||
systemname(e), e->x, e->y);
|
||||
systemname(&Quad[e->x][e->y]), e->x, e->y);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -80,7 +83,7 @@ dumpssradio()
|
||||
case E_ENSLV:
|
||||
case E_REPRO:
|
||||
printf("Starsystem %s in quadrant %d,%d is distressed\n",
|
||||
systemname(e), e->x, e->y);
|
||||
systemname(&Quad[e->x][e->y]), e->x, e->y);
|
||||
chkrest++;
|
||||
break;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: events.c,v 1.3 1995/04/22 10:58:50 cgd Exp $ */
|
||||
/* $NetBSD: events.c,v 1.4 1997/10/12 21:24:46 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)events.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: events.c,v 1.3 1995/04/22 10:58:50 cgd Exp $";
|
||||
__RCSID("$NetBSD: events.c,v 1.4 1997/10/12 21:24:46 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "getpar.h"
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** CAUSE TIME TO ELAPSE
|
||||
@ -52,19 +56,21 @@ static char rcsid[] = "$NetBSD: events.c,v 1.3 1995/04/22 10:58:50 cgd Exp $";
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
events(warp)
|
||||
int warp; /* set if called in a time warp */
|
||||
{
|
||||
register int i;
|
||||
int j;
|
||||
int i;
|
||||
char *p;
|
||||
int j = 0;
|
||||
struct kling *k;
|
||||
double rtime;
|
||||
double xdate;
|
||||
double idate;
|
||||
struct event *ev, *xsched(), *schedule();
|
||||
struct event *ev = NULL;
|
||||
int ix, iy;
|
||||
register struct quad *q;
|
||||
register struct event *e;
|
||||
struct quad *q;
|
||||
struct event *e;
|
||||
int evnum;
|
||||
int restcancel;
|
||||
|
||||
@ -138,7 +144,7 @@ int warp; /* set if called in a time warp */
|
||||
|
||||
case E_SNOVA: /* supernova */
|
||||
/* cause the supernova to happen */
|
||||
snova(-1);
|
||||
snova(-1, 0);
|
||||
/* and schedule the next one */
|
||||
xresched(e, E_SNOVA, 1);
|
||||
break;
|
||||
@ -389,10 +395,12 @@ int warp; /* set if called in a time warp */
|
||||
|
||||
case E_SNAP: /* take a snapshot of the galaxy */
|
||||
xresched(e, E_SNAP, 1);
|
||||
i = (int) Etc.snapshot;
|
||||
i = bmove(Quad, i, sizeof (Quad));
|
||||
i = bmove(Event, i, sizeof (Event));
|
||||
i = bmove(&Now, i, sizeof (Now));
|
||||
p = (char *) Etc.snapshot;
|
||||
memcpy(p, Quad, sizeof (Quad));
|
||||
p += sizeof(Quad);
|
||||
memcpy(p, Event, sizeof (Event));
|
||||
p += sizeof(Event);
|
||||
memcpy(p, &Now, sizeof (Now));
|
||||
Game.snap = 1;
|
||||
break;
|
||||
|
||||
@ -447,7 +455,7 @@ int warp; /* set if called in a time warp */
|
||||
}
|
||||
|
||||
/* unschedule an attack during a rest period */
|
||||
if (e = Now.eventptr[E_ATTACK])
|
||||
if ((e = Now.eventptr[E_ATTACK]) != NULL)
|
||||
unschedule(e);
|
||||
|
||||
if (!warp)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: externs.c,v 1.3 1995/04/22 10:58:53 cgd Exp $ */
|
||||
/* $NetBSD: externs.c,v 1.4 1997/10/12 21:24:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)externs.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: externs.c,v 1.3 1995/04/22 10:58:53 cgd Exp $";
|
||||
__RCSID("$NetBSD: externs.c,v 1.4 1997/10/12 21:24:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -49,22 +50,22 @@ static char rcsid[] = "$NetBSD: externs.c,v 1.3 1995/04/22 10:58:53 cgd Exp $";
|
||||
|
||||
struct device Device[NDEV] =
|
||||
{
|
||||
"warp drive", "Scotty",
|
||||
"S.R. scanners", "Scotty",
|
||||
"L.R. scanners", "Scotty",
|
||||
"phasers", "Sulu",
|
||||
"photon tubes", "Sulu",
|
||||
"impulse engines", "Scotty",
|
||||
"shield control", "Sulu",
|
||||
"computer", "Spock",
|
||||
"subspace radio", "Uhura",
|
||||
"life support", "Scotty",
|
||||
"navigation system", "Chekov",
|
||||
"cloaking device", "Scotty",
|
||||
"transporter", "Scotty",
|
||||
"shuttlecraft", "Scotty",
|
||||
"*ERR 14*", "Nobody",
|
||||
"*ERR 15*", "Nobody"
|
||||
{ "warp drive", "Scotty" },
|
||||
{ "S.R. scanners", "Scotty" },
|
||||
{ "L.R. scanners", "Scotty" },
|
||||
{ "phasers", "Sulu" },
|
||||
{ "photon tubes", "Sulu" },
|
||||
{ "impulse engines", "Scotty" },
|
||||
{ "shield control", "Sulu" },
|
||||
{ "computer", "Spock" },
|
||||
{ "subspace radio", "Uhura" },
|
||||
{ "life support", "Scotty" },
|
||||
{ "navigation system", "Chekov" },
|
||||
{ "cloaking device", "Scotty" },
|
||||
{ "transporter", "Scotty" },
|
||||
{ "shuttlecraft", "Scotty" },
|
||||
{ "*ERR 14*", "Nobody" },
|
||||
{ "*ERR 15*", "Nobody" }
|
||||
};
|
||||
|
||||
char *Systemname[NINHAB] =
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getcodi.c,v 1.3 1995/04/22 10:58:55 cgd Exp $ */
|
||||
/* $NetBSD: getcodi.c,v 1.4 1997/10/12 21:24:49 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)getcodi.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: getcodi.c,v 1.3 1995/04/22 10:58:55 cgd Exp $";
|
||||
__RCSID("$NetBSD: getcodi.c,v 1.4 1997/10/12 21:24:49 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "getpar.h"
|
||||
#include "getpar.h"
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** get course and distance
|
||||
@ -53,6 +55,7 @@ static char rcsid[] = "$NetBSD: getcodi.c,v 1.3 1995/04/22 10:58:55 cgd Exp $";
|
||||
** (meaning to drop the request).
|
||||
*/
|
||||
|
||||
int
|
||||
getcodi(co, di)
|
||||
int *co;
|
||||
double *di;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getpar.c,v 1.4 1995/04/24 12:25:57 cgd Exp $ */
|
||||
/* $NetBSD: getpar.c,v 1.5 1997/10/12 21:24:50 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,25 +33,31 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)getpar.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: getpar.c,v 1.4 1995/04/24 12:25:57 cgd Exp $";
|
||||
__RCSID("$NetBSD: getpar.c,v 1.5 1997/10/12 21:24:50 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include <stdio.h>
|
||||
# include "getpar.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "getpar.h"
|
||||
#include "trek.h"
|
||||
|
||||
static int testterm __P((void));
|
||||
|
||||
/**
|
||||
** get integer parameter
|
||||
**/
|
||||
|
||||
int
|
||||
getintpar(s)
|
||||
char *s;
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
int n;
|
||||
|
||||
while (1)
|
||||
@ -75,7 +81,7 @@ char *s;
|
||||
double getfltpar(s)
|
||||
char *s;
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
double d;
|
||||
|
||||
while (1)
|
||||
@ -98,18 +104,19 @@ char *s;
|
||||
|
||||
struct cvntab Yntab[] =
|
||||
{
|
||||
"y", "es", (int (*)())1, 0,
|
||||
"n", "o", (int (*)())0, 0,
|
||||
0
|
||||
{ "y", "es", (cmdfun)1, 0 },
|
||||
{ "n", "o", (cmdfun)0, 0 },
|
||||
{ NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
int
|
||||
getynpar(s)
|
||||
char *s;
|
||||
{
|
||||
struct cvntab *r;
|
||||
|
||||
r = getcodpar(s, Yntab);
|
||||
return ((long) r->value);
|
||||
return (int) r->value;
|
||||
}
|
||||
|
||||
|
||||
@ -122,9 +129,9 @@ char *s;
|
||||
struct cvntab tab[];
|
||||
{
|
||||
char input[100];
|
||||
register struct cvntab *r;
|
||||
struct cvntab *r;
|
||||
int flag;
|
||||
register char *p, *q;
|
||||
char *p, *q;
|
||||
int c;
|
||||
int f;
|
||||
|
||||
@ -149,7 +156,8 @@ struct cvntab tab[];
|
||||
c = 4;
|
||||
for (r = tab; r->abrev; r++)
|
||||
{
|
||||
concat(r->abrev, r->full, input);
|
||||
strcpy(input, r->abrev);
|
||||
strcat(input, r->full);
|
||||
printf("%14.14s", input);
|
||||
if (--c > 0)
|
||||
continue;
|
||||
@ -194,15 +202,16 @@ struct cvntab tab[];
|
||||
** get string parameter
|
||||
**/
|
||||
|
||||
void
|
||||
getstrpar(s, r, l, t)
|
||||
char *s;
|
||||
char *r;
|
||||
int l;
|
||||
char *t;
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
char format[20];
|
||||
register int f;
|
||||
int f;
|
||||
|
||||
if (t == 0)
|
||||
t = " \t\n;";
|
||||
@ -227,9 +236,10 @@ char *t;
|
||||
** test if newline is next valid character
|
||||
**/
|
||||
|
||||
int
|
||||
testnl()
|
||||
{
|
||||
register char c;
|
||||
char c;
|
||||
|
||||
while ((c = cgetc(0)) != '\n')
|
||||
if ((c >= '0' && c <= '9') || c == '.' || c == '!' ||
|
||||
@ -248,8 +258,9 @@ testnl()
|
||||
** scan for newline
|
||||
**/
|
||||
|
||||
void
|
||||
skiptonl(c)
|
||||
char c;
|
||||
int c;
|
||||
{
|
||||
while (c != '\n')
|
||||
if (!(c = cgetc(0)))
|
||||
@ -263,9 +274,10 @@ char c;
|
||||
** test for valid terminator
|
||||
**/
|
||||
|
||||
static int
|
||||
testterm()
|
||||
{
|
||||
register char c;
|
||||
char c;
|
||||
|
||||
if (!(c = cgetc(0)))
|
||||
return (1);
|
||||
@ -285,12 +297,13 @@ testterm()
|
||||
** zero is returned.
|
||||
*/
|
||||
|
||||
int
|
||||
readdelim(d)
|
||||
char d;
|
||||
{
|
||||
register char c;
|
||||
char c;
|
||||
|
||||
while (c = cgetc(0))
|
||||
while ((c = cgetc(0)) != '\0')
|
||||
{
|
||||
if (c == d)
|
||||
return (1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getpar.h,v 1.3 1995/04/22 10:58:59 cgd Exp $ */
|
||||
/* $NetBSD: getpar.h,v 1.4 1997/10/12 21:24:51 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -35,13 +35,20 @@
|
||||
* @(#)getpar.h 8.1 (Berkeley) 5/31/93
|
||||
*/
|
||||
|
||||
typedef void (*cmdfun) __P((int));
|
||||
struct cvntab /* used for getcodpar() paramater list */
|
||||
{
|
||||
char *abrev;
|
||||
char *full;
|
||||
int (*value)();
|
||||
cmdfun value;
|
||||
int value2;
|
||||
};
|
||||
|
||||
extern double getfltpar();
|
||||
extern struct cvntab *getcodpar();
|
||||
int getintpar __P((char *));
|
||||
double getfltpar __P((char *));
|
||||
int getynpar __P((char *));
|
||||
struct cvntab *getcodpar __P((char *, struct cvntab[]));
|
||||
void getstrpar __P((char *, char *, int, char *));
|
||||
int testnl __P((void));
|
||||
void skiptonl __P((int));
|
||||
int readdelim __P((int));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: help.c,v 1.3 1995/04/22 10:59:01 cgd Exp $ */
|
||||
/* $NetBSD: help.c,v 1.4 1997/10/12 21:24:53 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)help.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: help.c,v 1.3 1995/04/22 10:59:01 cgd Exp $";
|
||||
__RCSID("$NetBSD: help.c,v 1.4 1997/10/12 21:24:53 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** call starbase for help
|
||||
@ -66,22 +70,31 @@ static char rcsid[] = "$NetBSD: help.c,v 1.3 1995/04/22 10:59:01 cgd Exp $";
|
||||
char *Cntvect[3] =
|
||||
{"first", "second", "third"};
|
||||
|
||||
help()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
help(v)
|
||||
int v;
|
||||
{
|
||||
register int i;
|
||||
double dist, x;
|
||||
register int dx, dy;
|
||||
int j, l;
|
||||
int i;
|
||||
double dist, x;
|
||||
int dx = 0, dy = 0;
|
||||
int j, l = 0;
|
||||
|
||||
/* check to see if calling for help is reasonable ... */
|
||||
if (Ship.cond == DOCKED)
|
||||
return (printf("Uhura: But Captain, we're already docked\n"));
|
||||
if (Ship.cond == DOCKED) {
|
||||
printf("Uhura: But Captain, we're already docked\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* or possible */
|
||||
if (damaged(SSRADIO))
|
||||
return (out(SSRADIO));
|
||||
if (Now.bases <= 0)
|
||||
return (printf("Uhura: I'm not getting any response from starbase\n"));
|
||||
if (damaged(SSRADIO)) {
|
||||
out(SSRADIO);
|
||||
return;
|
||||
}
|
||||
if (Now.bases <= 0) {
|
||||
printf("Uhura: I'm not getting any response from starbase\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* tut tut, there goes the score */
|
||||
Game.helps += 1;
|
||||
@ -149,7 +162,7 @@ help()
|
||||
Ship.sectx = dx;
|
||||
Ship.secty = dy;
|
||||
Sect[dx][dy] = Ship.ship;
|
||||
dock();
|
||||
dock(0);
|
||||
compkldist(0);
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: impulse.c,v 1.3 1995/04/22 10:59:03 cgd Exp $ */
|
||||
/* $NetBSD: impulse.c,v 1.4 1997/10/12 21:24:54 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,32 +33,41 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)impulse.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: impulse.c,v 1.3 1995/04/22 10:59:03 cgd Exp $";
|
||||
__RCSID("$NetBSD: impulse.c,v 1.4 1997/10/12 21:24:54 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/**
|
||||
** move under impulse power
|
||||
**/
|
||||
|
||||
impulse()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
impulse(v)
|
||||
int v;
|
||||
{
|
||||
int course;
|
||||
register int power;
|
||||
double dist, time;
|
||||
register int percent;
|
||||
extern double move();
|
||||
int course;
|
||||
int power;
|
||||
double dist, time;
|
||||
int percent;
|
||||
|
||||
if (Ship.cond == DOCKED)
|
||||
return (printf("Scotty: Sorry captain, but we are still docked.\n"));
|
||||
if (damaged(IMPULSE))
|
||||
return (out(IMPULSE));
|
||||
if (Ship.cond == DOCKED) {
|
||||
printf("Scotty: Sorry captain, but we are still docked.\n");
|
||||
return;
|
||||
}
|
||||
if (damaged(IMPULSE)) {
|
||||
out(IMPULSE);
|
||||
return;
|
||||
}
|
||||
if (getcodi(&course, &dist))
|
||||
return;
|
||||
power = 20 + 100 * dist;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: initquad.c,v 1.3 1995/04/22 10:59:04 cgd Exp $ */
|
||||
/* $NetBSD: initquad.c,v 1.4 1997/10/12 21:24:55 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)initquad.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: initquad.c,v 1.3 1995/04/22 10:59:04 cgd Exp $";
|
||||
__RCSID("$NetBSD: initquad.c,v 1.4 1997/10/12 21:24:55 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Paramize Quadrant Upon Entering
|
||||
@ -60,14 +62,15 @@ static char rcsid[] = "$NetBSD: initquad.c,v 1.3 1995/04/22 10:59:04 cgd Exp $";
|
||||
** to be docked, i.e., abandon() and help().
|
||||
*/
|
||||
|
||||
void
|
||||
initquad(f)
|
||||
int f;
|
||||
{
|
||||
register int i, j;
|
||||
int rx, ry;
|
||||
int nbases, nstars;
|
||||
register struct quad *q;
|
||||
int nholes;
|
||||
int i, j;
|
||||
int rx, ry;
|
||||
int nbases, nstars;
|
||||
struct quad *q;
|
||||
int nholes;
|
||||
|
||||
q = &Quad[Ship.quadx][Ship.quady];
|
||||
|
||||
@ -142,10 +145,11 @@ int f;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sector(x, y)
|
||||
int *x, *y;
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kill.c,v 1.3 1995/04/22 10:59:06 cgd Exp $ */
|
||||
/* $NetBSD: kill.c,v 1.4 1997/10/12 21:24:56 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)kill.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: kill.c,v 1.3 1995/04/22 10:59:06 cgd Exp $";
|
||||
__RCSID("$NetBSD: kill.c,v 1.4 1997/10/12 21:24:56 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** KILL KILL KILL !!!
|
||||
@ -59,10 +61,11 @@ static char rcsid[] = "$NetBSD: kill.c,v 1.3 1995/04/22 10:59:06 cgd Exp $";
|
||||
** and the game is won if that was the last klingon.
|
||||
*/
|
||||
|
||||
void
|
||||
killk(ix, iy)
|
||||
int ix, iy;
|
||||
{
|
||||
register int i, j;
|
||||
int i;
|
||||
|
||||
printf(" *** Klingon at %d,%d destroyed ***\n", ix, iy);
|
||||
|
||||
@ -81,7 +84,7 @@ int ix, iy;
|
||||
/* purge him from the list */
|
||||
Etc.nkling -= 1;
|
||||
for (; i < Etc.nkling; i++)
|
||||
bmove(&Etc.klingon[i+1], &Etc.klingon[i], sizeof Etc.klingon[i]);
|
||||
Etc.klingon[i] = Etc.klingon[i+1];
|
||||
break;
|
||||
}
|
||||
|
||||
@ -99,11 +102,12 @@ int ix, iy;
|
||||
** handle a starbase's death
|
||||
*/
|
||||
|
||||
void
|
||||
killb(qx, qy)
|
||||
int qx, qy;
|
||||
{
|
||||
register struct quad *q;
|
||||
register struct xy *b;
|
||||
struct quad *q;
|
||||
struct xy *b;
|
||||
|
||||
q = &Quad[qx][qy];
|
||||
|
||||
@ -121,12 +125,12 @@ int qx, qy;
|
||||
for (b = Now.base; ; b++)
|
||||
if (qx == b->x && qy == b->y)
|
||||
break;
|
||||
bmove(&Now.base[Now.bases], b, sizeof *b);
|
||||
*b = Now.base[Now.bases];
|
||||
if (qx == Ship.quadx && qy == Ship.quady)
|
||||
{
|
||||
Sect[Etc.starbase.x][Etc.starbase.y] = EMPTY;
|
||||
if (Ship.cond == DOCKED)
|
||||
undock();
|
||||
undock(0);
|
||||
printf("Starbase at %d,%d destroyed\n", Etc.starbase.x, Etc.starbase.y);
|
||||
}
|
||||
else
|
||||
@ -146,14 +150,14 @@ int qx, qy;
|
||||
** kill an inhabited starsystem
|
||||
**/
|
||||
|
||||
void
|
||||
kills(x, y, f)
|
||||
int x, y; /* quad coords if f == 0, else sector coords */
|
||||
int f; /* f != 0 -- this quad; f < 0 -- Enterprise's fault */
|
||||
{
|
||||
register struct quad *q;
|
||||
register struct event *e;
|
||||
register char *name;
|
||||
char *systemname();
|
||||
struct quad *q;
|
||||
struct event *e;
|
||||
char *name;
|
||||
|
||||
if (f)
|
||||
{
|
||||
@ -190,13 +194,14 @@ int f; /* f != 0 -- this quad; f < 0 -- Enterprise's fault */
|
||||
** "kill" a distress call
|
||||
**/
|
||||
|
||||
void
|
||||
killd(x, y, f)
|
||||
int x, y; /* quadrant coordinates */
|
||||
int f; /* set if user is to be informed */
|
||||
{
|
||||
register struct event *e;
|
||||
register int i;
|
||||
register struct quad *q;
|
||||
struct event *e;
|
||||
int i;
|
||||
struct quad *q;
|
||||
|
||||
q = &Quad[x][y];
|
||||
for (i = 0; i < MAXEVENTS; i++)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: klmove.c,v 1.3 1995/04/22 10:59:07 cgd Exp $ */
|
||||
/* $NetBSD: klmove.c,v 1.4 1997/10/12 21:24:57 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)klmove.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: klmove.c,v 1.3 1995/04/22 10:59:07 cgd Exp $";
|
||||
__RCSID("$NetBSD: klmove.c,v 1.4 1997/10/12 21:24:57 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Move Klingons Around
|
||||
@ -66,14 +68,15 @@ static char rcsid[] = "$NetBSD: klmove.c,v 1.3 1995/04/22 10:59:07 cgd Exp $";
|
||||
** course around stars.
|
||||
*/
|
||||
|
||||
void
|
||||
klmove(fl)
|
||||
int fl;
|
||||
{
|
||||
int n;
|
||||
register struct kling *k;
|
||||
struct kling *k;
|
||||
double dx, dy;
|
||||
int nextx, nexty;
|
||||
register int lookx, looky;
|
||||
int lookx, looky;
|
||||
int motion;
|
||||
int fudgex, fudgey;
|
||||
int qx, qy;
|
||||
@ -84,7 +87,7 @@ int fl;
|
||||
if (Trace)
|
||||
printf("klmove: fl = %d, Etc.nkling = %d\n", fl, Etc.nkling);
|
||||
# endif
|
||||
for (n = 0; n < Etc.nkling; k && n++)
|
||||
for (n = 0; n < Etc.nkling; n++)
|
||||
{
|
||||
k = &Etc.klingon[n];
|
||||
i = 100;
|
||||
@ -151,7 +154,7 @@ int fl;
|
||||
Sect[k->x][k->y] = EMPTY;
|
||||
Quad[qx][qy].klings += 1;
|
||||
Etc.nkling -= 1;
|
||||
bmove(&Etc.klingon[Etc.nkling], k, sizeof *k);
|
||||
*k = Etc.klingon[Etc.nkling];
|
||||
Quad[Ship.quadx][Ship.quady].klings -= 1;
|
||||
k = 0;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lose.c,v 1.3 1995/04/22 10:59:08 cgd Exp $ */
|
||||
/* $NetBSD: lose.c,v 1.4 1997/10/12 21:24:58 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,20 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lose.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: lose.c,v 1.3 1995/04/22 10:59:08 cgd Exp $";
|
||||
__RCSID("$NetBSD: lose.c,v 1.4 1997/10/12 21:24:58 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <unistd.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** PRINT OUT LOSER MESSAGES
|
||||
@ -69,6 +73,7 @@ char *Losemsg[] =
|
||||
"Your last crew member died",
|
||||
};
|
||||
|
||||
void
|
||||
lose(why)
|
||||
int why;
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lrscan.c,v 1.3 1995/04/22 10:59:09 cgd Exp $ */
|
||||
/* $NetBSD: lrscan.c,v 1.4 1997/10/12 21:24:59 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lrscan.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: lrscan.c,v 1.3 1995/04/22 10:59:09 cgd Exp $";
|
||||
__RCSID("$NetBSD: lrscan.c,v 1.4 1997/10/12 21:24:59 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** LONG RANGE OF SCANNERS
|
||||
@ -55,10 +57,13 @@ static char rcsid[] = "$NetBSD: lrscan.c,v 1.3 1995/04/22 10:59:09 cgd Exp $";
|
||||
** for future use by the "chart" option of the computer.
|
||||
*/
|
||||
|
||||
lrscan()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
lrscan(v)
|
||||
int v;
|
||||
{
|
||||
register int i, j;
|
||||
register struct quad *q;
|
||||
int i, j;
|
||||
struct quad *q;
|
||||
|
||||
if (check_out(LRSCAN))
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.4 1995/04/22 10:59:10 cgd Exp $ */
|
||||
/* $NetBSD: main.c,v 1.5 1997/10/12 21:25:01 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,24 +33,28 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1980, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.4 1995/04/22 10:59:10 cgd Exp $";
|
||||
__RCSID("$NetBSD: main.c,v 1.5 1997/10/12 21:25:01 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include <stdio.h>
|
||||
# include <setjmp.h>
|
||||
# include <termios.h>
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <termios.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
# define PRIO 00 /* default priority */
|
||||
|
||||
@ -155,16 +159,18 @@ int Mother = 51 + (51 << 8);
|
||||
|
||||
jmp_buf env;
|
||||
|
||||
int main __P((int, char **));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
long vect;
|
||||
/* extern FILE *f_log; */
|
||||
register char opencode;
|
||||
char opencode;
|
||||
int prio;
|
||||
register int ac;
|
||||
register char **av;
|
||||
int ac;
|
||||
char **av;
|
||||
struct termios argp;
|
||||
|
||||
av = argv;
|
||||
@ -220,7 +226,7 @@ char **argv;
|
||||
av++;
|
||||
}
|
||||
if (ac > 2)
|
||||
syserr(0, "arg count");
|
||||
errx(1, "arg count");
|
||||
/*
|
||||
if (ac > 1)
|
||||
f_log = fopen(av[0], opencode);
|
||||
@ -240,4 +246,5 @@ char **argv;
|
||||
} while (getynpar("Another game"));
|
||||
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: move.c,v 1.3 1995/04/22 10:59:12 cgd Exp $ */
|
||||
/* $NetBSD: move.c,v 1.4 1997/10/12 21:25:02 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: move.c,v 1.3 1995/04/22 10:59:12 cgd Exp $";
|
||||
__RCSID("$NetBSD: move.c,v 1.4 1997/10/12 21:25:02 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Move Under Warp or Impulse Power
|
||||
@ -86,10 +89,10 @@ double speed;
|
||||
{
|
||||
double angle;
|
||||
double x, y, dx, dy;
|
||||
register int ix, iy;
|
||||
int ix = 0, iy = 0;
|
||||
double bigger;
|
||||
int n;
|
||||
register int i;
|
||||
int i;
|
||||
double dist;
|
||||
double sectsize;
|
||||
double xn;
|
||||
@ -122,7 +125,7 @@ double speed;
|
||||
evtime = Now.eventptr[E_LRTB]->date - Now.date;
|
||||
# ifdef xTRACE
|
||||
if (Trace)
|
||||
printf("E.ep = %u, ->evcode = %d, ->date = %.2f, evtime = %.2f\n",
|
||||
printf("E.ep = %p, ->evcode = %d, ->date = %.2f, evtime = %.2f\n",
|
||||
Now.eventptr[E_LRTB], Now.eventptr[E_LRTB]->evcode,
|
||||
Now.eventptr[E_LRTB]->date, evtime);
|
||||
# endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nova.c,v 1.3 1995/04/22 10:59:14 cgd Exp $ */
|
||||
/* $NetBSD: nova.c,v 1.4 1997/10/12 21:25:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)nova.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: nova.c,v 1.3 1995/04/22 10:59:14 cgd Exp $";
|
||||
__RCSID("$NetBSD: nova.c,v 1.4 1997/10/12 21:25:03 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** CAUSE A NOVA TO OCCUR
|
||||
@ -57,11 +59,12 @@ static char rcsid[] = "$NetBSD: nova.c,v 1.3 1995/04/22 10:59:14 cgd Exp $";
|
||||
** If the zap is too much, it gets destroyed.
|
||||
*/
|
||||
|
||||
void
|
||||
nova(x, y)
|
||||
int x, y;
|
||||
{
|
||||
register int i, j;
|
||||
register int se;
|
||||
int i, j;
|
||||
int se;
|
||||
|
||||
if (Sect[x][y] != STAR || Quad[Ship.quadx][Ship.quady].stars < 0)
|
||||
return;
|
||||
@ -70,8 +73,10 @@ int x, y;
|
||||
printf("Spock: Star at %d,%d failed to nova.\n", x, y);
|
||||
return;
|
||||
}
|
||||
if (ranf(100) < 5)
|
||||
return (snova(x, y));
|
||||
if (ranf(100) < 5) {
|
||||
snova(x, y);
|
||||
return;
|
||||
}
|
||||
printf("Spock: Star at %d,%d gone nova\n", x, y);
|
||||
|
||||
if (ranf(4) != 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: out.c,v 1.3 1995/04/22 10:59:16 cgd Exp $ */
|
||||
/* $NetBSD: out.c,v 1.4 1997/10/12 21:25:04 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,28 +33,31 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)out.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: out.c,v 1.3 1995/04/22 10:59:16 cgd Exp $";
|
||||
__RCSID("$NetBSD: out.c,v 1.4 1997/10/12 21:25:04 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** Announce Device Out
|
||||
*/
|
||||
|
||||
void
|
||||
out(dev)
|
||||
int dev;
|
||||
{
|
||||
register struct device *d;
|
||||
struct device *d;
|
||||
|
||||
d = &Device[dev];
|
||||
printf("%s reports %s ", d->person, d->name);
|
||||
if (d->name[length(d->name) - 1] == 's')
|
||||
if (d->name[strlen(d->name) - 1] == 's')
|
||||
printf("are");
|
||||
else
|
||||
printf("is");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: phaser.c,v 1.4 1995/04/24 12:26:02 cgd Exp $ */
|
||||
/* $NetBSD: phaser.c,v 1.5 1997/10/12 21:25:06 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)phaser.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: phaser.c,v 1.4 1995/04/24 12:26:02 cgd Exp $";
|
||||
__RCSID("$NetBSD: phaser.c,v 1.5 1997/10/12 21:25:06 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/* factors for phaser hits; see description below */
|
||||
|
||||
@ -79,9 +82,9 @@ static char rcsid[] = "$NetBSD: phaser.c,v 1.4 1995/04/24 12:26:02 cgd Exp $";
|
||||
|
||||
struct cvntab Matab[] =
|
||||
{
|
||||
"m", "anual", (int (*)())1, 0,
|
||||
"a", "utomatic", 0, 0,
|
||||
0
|
||||
{ "m", "anual", (cmdfun) 1, 0 },
|
||||
{ "a", "utomatic", (cmdfun) 0, 0 },
|
||||
{ NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
struct banks
|
||||
@ -93,28 +96,37 @@ struct banks
|
||||
|
||||
|
||||
|
||||
phaser()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
phaser(v)
|
||||
int v;
|
||||
{
|
||||
register int i;
|
||||
int j;
|
||||
register struct kling *k;
|
||||
double dx, dy;
|
||||
double anglefactor, distfactor;
|
||||
register struct banks *b;
|
||||
int manual, flag, extra;
|
||||
int hit;
|
||||
double tot;
|
||||
int n;
|
||||
int hitreqd[NBANKS];
|
||||
struct banks bank[NBANKS];
|
||||
struct cvntab *ptr;
|
||||
int i;
|
||||
int j;
|
||||
struct kling *k;
|
||||
double dx, dy;
|
||||
double anglefactor, distfactor;
|
||||
struct banks *b;
|
||||
int manual, flag, extra = 0;
|
||||
int hit;
|
||||
double tot;
|
||||
int n;
|
||||
int hitreqd[NBANKS];
|
||||
struct banks bank[NBANKS];
|
||||
struct cvntab *ptr;
|
||||
|
||||
if (Ship.cond == DOCKED)
|
||||
return(printf("Phasers cannot fire through starbase shields\n"));
|
||||
if (damaged(PHASER))
|
||||
return (out(PHASER));
|
||||
if (Ship.shldup)
|
||||
return (printf("Sulu: Captain, we cannot fire through shields.\n"));
|
||||
if (Ship.cond == DOCKED) {
|
||||
printf("Phasers cannot fire through starbase shields\n");
|
||||
return;
|
||||
}
|
||||
if (damaged(PHASER)) {
|
||||
out(PHASER);
|
||||
return;
|
||||
}
|
||||
if (Ship.shldup) {
|
||||
printf("Sulu: Captain, we cannot fire through shields.\n");
|
||||
return;
|
||||
}
|
||||
if (Ship.cloaked)
|
||||
{
|
||||
printf("Sulu: Captain, surely you must realize that we cannot fire\n");
|
||||
@ -198,8 +210,10 @@ phaser()
|
||||
else
|
||||
{
|
||||
/* automatic distribution of power */
|
||||
if (Etc.nkling <= 0)
|
||||
return (printf("Sulu: But there are no Klingons in this quadrant\n"));
|
||||
if (Etc.nkling <= 0) {
|
||||
printf("Sulu: But there are no Klingons in this quadrant\n");
|
||||
return;
|
||||
}
|
||||
printf("Phasers locked on target. ");
|
||||
while (flag)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: play.c,v 1.3 1995/04/22 10:59:18 cgd Exp $ */
|
||||
/* $NetBSD: play.c,v 1.4 1997/10/12 21:25:07 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,17 +33,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: play.c,v 1.3 1995/04/22 10:59:18 cgd Exp $";
|
||||
__RCSID("$NetBSD: play.c,v 1.4 1997/10/12 21:25:07 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
# include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** INSTRUCTION READ AND MAIN PLAY LOOP
|
||||
@ -55,46 +57,46 @@ static char rcsid[] = "$NetBSD: play.c,v 1.3 1995/04/22 10:59:18 cgd Exp $";
|
||||
** attack if the move was not free, and checkcond() to check up
|
||||
** on how we are doing after the move.
|
||||
*/
|
||||
extern int abandon(), capture(), shield(), computer(), dcrept(),
|
||||
destruct(), dock(), help(), impulse(), lrscan(),
|
||||
warp(), dumpgame(), rest(), srscan(),
|
||||
myreset(), torped(), visual(), setwarp(), undock(), phaser();
|
||||
|
||||
struct cvntab Comtab[] =
|
||||
{
|
||||
"abandon", "", abandon, 0,
|
||||
"ca", "pture", capture, 0,
|
||||
"cl", "oak", shield, -1,
|
||||
"c", "omputer", computer, 0,
|
||||
"da", "mages", dcrept, 0,
|
||||
"destruct", "", destruct, 0,
|
||||
"do", "ck", dock, 0,
|
||||
"help", "", help, 0,
|
||||
"i", "mpulse", impulse, 0,
|
||||
"l", "rscan", lrscan, 0,
|
||||
"m", "ove", warp, 0,
|
||||
"p", "hasers", phaser, 0,
|
||||
"ram", "", warp, 1,
|
||||
"dump", "", dumpgame, 0,
|
||||
"r", "est", rest, 0,
|
||||
"sh", "ield", shield, 0,
|
||||
"s", "rscan", srscan, 0,
|
||||
"st", "atus", srscan, -1,
|
||||
"terminate", "", myreset, 0,
|
||||
"t", "orpedo", torped, 0,
|
||||
"u", "ndock", undock, 0,
|
||||
"v", "isual", visual, 0,
|
||||
"w", "arp", setwarp, 0,
|
||||
0
|
||||
{ "abandon", "", abandon, 0 },
|
||||
{ "ca", "pture", capture, 0 },
|
||||
{ "cl", "oak", shield, -1 },
|
||||
{ "c", "omputer", computer, 0 },
|
||||
{ "da", "mages", dcrept, 0 },
|
||||
{ "destruct", "", destruct, 0 },
|
||||
{ "do", "ck", dock, 0 },
|
||||
{ "help", "", help, 0 },
|
||||
{ "i", "mpulse", impulse, 0 },
|
||||
{ "l", "rscan", lrscan, 0 },
|
||||
{ "m", "ove", dowarp, 0 },
|
||||
{ "p", "hasers", phaser, 0 },
|
||||
{ "ram", "", dowarp, 1 },
|
||||
{ "dump", "", dumpgame, 0 },
|
||||
{ "r", "est", rest, 0 },
|
||||
{ "sh", "ield", shield, 0 },
|
||||
{ "s", "rscan", srscan, 0 },
|
||||
{ "st", "atus", srscan, -1 },
|
||||
{ "terminate", "", myreset, 0 },
|
||||
{ "t", "orpedo", torped, 0 },
|
||||
{ "u", "ndock", undock, 0 },
|
||||
{ "v", "isual", visual, 0 },
|
||||
{ "w", "arp", setwarp, 0 },
|
||||
{ NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
myreset()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
myreset(v)
|
||||
int v;
|
||||
{
|
||||
extern jmp_buf env;
|
||||
|
||||
longjmp(env, 1);
|
||||
}
|
||||
|
||||
void
|
||||
play()
|
||||
{
|
||||
struct cvntab *r;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ram.c,v 1.3 1995/04/22 10:59:19 cgd Exp $ */
|
||||
/* $NetBSD: ram.c,v 1.4 1997/10/12 21:25:08 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ram.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: ram.c,v 1.3 1995/04/22 10:59:19 cgd Exp $";
|
||||
__RCSID("$NetBSD: ram.c,v 1.4 1997/10/12 21:25:08 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** RAM SOME OBJECT
|
||||
@ -54,11 +57,12 @@ static char rcsid[] = "$NetBSD: ram.c,v 1.3 1995/04/22 10:59:19 cgd Exp $";
|
||||
** also rack up incredible damages.
|
||||
*/
|
||||
|
||||
void
|
||||
ram(ix, iy)
|
||||
int ix, iy;
|
||||
{
|
||||
register int i;
|
||||
register char c;
|
||||
int i;
|
||||
char c;
|
||||
|
||||
printf("\07RED ALERT\07: collision imminent\n");
|
||||
c = Sect[ix][iy];
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ranf.c,v 1.3 1995/04/22 10:59:21 cgd Exp $ */
|
||||
/* $NetBSD: ranf.c,v 1.4 1997/10/12 21:25:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,20 +33,24 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ranf.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: ranf.c,v 1.3 1995/04/22 10:59:21 cgd Exp $";
|
||||
__RCSID("$NetBSD: ranf.c,v 1.4 1997/10/12 21:25:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "trek.h"
|
||||
|
||||
int
|
||||
ranf(max)
|
||||
int max;
|
||||
{
|
||||
register int t;
|
||||
int t;
|
||||
|
||||
if (max <= 0)
|
||||
return (0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rest.c,v 1.3 1995/04/22 10:59:22 cgd Exp $ */
|
||||
/* $NetBSD: rest.c,v 1.4 1997/10/12 21:25:10 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)rest.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: rest.c,v 1.3 1995/04/22 10:59:22 cgd Exp $";
|
||||
__RCSID("$NetBSD: rest.c,v 1.4 1997/10/12 21:25:10 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** REST FOR REPAIRS
|
||||
@ -58,10 +60,13 @@ static char rcsid[] = "$NetBSD: rest.c,v 1.3 1995/04/22 10:59:22 cgd Exp $";
|
||||
** rest period if anything momentous happens.
|
||||
*/
|
||||
|
||||
rest()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
rest(v)
|
||||
int v;
|
||||
{
|
||||
double t;
|
||||
register int percent;
|
||||
double t;
|
||||
int percent;
|
||||
|
||||
/* get the time to rest */
|
||||
t = getfltpar("How long");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: schedule.c,v 1.3 1995/04/22 10:59:23 cgd Exp $ */
|
||||
/* $NetBSD: schedule.c,v 1.4 1997/10/12 21:25:11 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)schedule.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: schedule.c,v 1.3 1995/04/22 10:59:23 cgd Exp $";
|
||||
__RCSID("$NetBSD: schedule.c,v 1.4 1997/10/12 21:25:11 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <err.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** SCHEDULE AN EVENT
|
||||
@ -59,8 +63,8 @@ double offset;
|
||||
char x, y;
|
||||
char z;
|
||||
{
|
||||
register struct event *e;
|
||||
register int i;
|
||||
struct event *e;
|
||||
int i;
|
||||
double date;
|
||||
|
||||
date = Now.date + offset;
|
||||
@ -83,7 +87,7 @@ char z;
|
||||
Now.eventptr[type] = e;
|
||||
return (e);
|
||||
}
|
||||
syserr("Cannot schedule event %d parm %d %d %d", type, x, y, z);
|
||||
errx(1, "Cannot schedule event %d parm %d %d %d", type, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@ -94,12 +98,13 @@ char z;
|
||||
** time plus 'offset'.
|
||||
*/
|
||||
|
||||
void
|
||||
reschedule(e1, offset)
|
||||
struct event *e1;
|
||||
double offset;
|
||||
{
|
||||
double date;
|
||||
register struct event *e;
|
||||
struct event *e;
|
||||
|
||||
e = e1;
|
||||
|
||||
@ -120,10 +125,11 @@ double offset;
|
||||
** The event at slot 'e' is deleted.
|
||||
*/
|
||||
|
||||
void
|
||||
unschedule(e1)
|
||||
struct event *e1;
|
||||
{
|
||||
register struct event *e;
|
||||
struct event *e;
|
||||
|
||||
e = e1;
|
||||
|
||||
@ -151,7 +157,7 @@ int ev1;
|
||||
int factor;
|
||||
int x, y, z;
|
||||
{
|
||||
register int ev;
|
||||
int ev;
|
||||
|
||||
ev = ev1;
|
||||
return (schedule(ev, -Param.eventdly[ev] * Param.time * log(franf()) / factor, x, y, z));
|
||||
@ -165,13 +171,14 @@ int x, y, z;
|
||||
** division factor. Look at the code to see what really happens.
|
||||
*/
|
||||
|
||||
void
|
||||
xresched(e1, ev1, factor)
|
||||
struct event *e1;
|
||||
int ev1;
|
||||
int factor;
|
||||
{
|
||||
register int ev;
|
||||
register struct event *e;
|
||||
int ev;
|
||||
struct event *e;
|
||||
|
||||
ev = ev1;
|
||||
e = e1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: score.c,v 1.3 1995/04/22 10:59:24 cgd Exp $ */
|
||||
/* $NetBSD: score.c,v 1.4 1997/10/12 21:25:13 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: score.c,v 1.3 1995/04/22 10:59:24 cgd Exp $";
|
||||
__RCSID("$NetBSD: score.c,v 1.4 1997/10/12 21:25:13 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** PRINT OUT THE CURRENT SCORE
|
||||
@ -50,11 +52,10 @@ static char rcsid[] = "$NetBSD: score.c,v 1.3 1995/04/22 10:59:24 cgd Exp $";
|
||||
|
||||
long score()
|
||||
{
|
||||
register int u;
|
||||
register int t;
|
||||
long s;
|
||||
double r;
|
||||
extern struct cvntab Skitab[];
|
||||
int u;
|
||||
int t;
|
||||
long s;
|
||||
double r;
|
||||
|
||||
printf("\n*** Your score:\n");
|
||||
s = t = Param.klingpwr / 4 * (u = Game.killk);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setup.c,v 1.4 1995/04/24 12:26:06 cgd Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.5 1997/10/12 21:25:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,22 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: setup.c,v 1.4 1995/04/24 12:26:06 cgd Exp $";
|
||||
__RCSID("$NetBSD: setup.c,v 1.5 1997/10/12 21:25:15 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <err.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** INITIALIZE THE GAME
|
||||
@ -57,34 +63,34 @@ static char rcsid[] = "$NetBSD: setup.c,v 1.4 1995/04/24 12:26:06 cgd Exp $";
|
||||
|
||||
struct cvntab Lentab[] =
|
||||
{
|
||||
"s", "hort", (int (*)())1, 0,
|
||||
"m", "edium", (int (*)())2, 0,
|
||||
"l", "ong", (int (*)())4, 0,
|
||||
"restart", "", 0, 0,
|
||||
0
|
||||
{ "s", "hort", (cmdfun)1, 0 },
|
||||
{ "m", "edium", (cmdfun)2, 0 },
|
||||
{ "l", "ong", (cmdfun)4, 0 },
|
||||
{ "restart", "", (cmdfun)0, 0 },
|
||||
{ NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
struct cvntab Skitab[] =
|
||||
{
|
||||
"n", "ovice", (int (*)())1, 0,
|
||||
"f", "air", (int (*)())2, 0,
|
||||
"g", "ood", (int (*)())3, 0,
|
||||
"e", "xpert", (int (*)())4, 0,
|
||||
"c", "ommodore", (int (*)())5, 0,
|
||||
"i", "mpossible", (int (*)())6, 0,
|
||||
0
|
||||
{ "n", "ovice", (cmdfun)1, 0 },
|
||||
{ "f", "air", (cmdfun)2, 0 },
|
||||
{ "g", "ood", (cmdfun)3, 0 },
|
||||
{ "e", "xpert", (cmdfun)4, 0 },
|
||||
{ "c", "ommodore", (cmdfun)5, 0 },
|
||||
{ "i", "mpossible", (cmdfun)6, 0 },
|
||||
{ NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
void
|
||||
setup()
|
||||
{
|
||||
struct cvntab *r;
|
||||
register int i, j;
|
||||
int i, j;
|
||||
double f;
|
||||
int d;
|
||||
int fd;
|
||||
int klump;
|
||||
int ix, iy;
|
||||
register struct quad *q;
|
||||
struct quad *q;
|
||||
struct event *e;
|
||||
|
||||
while (1)
|
||||
@ -103,7 +109,7 @@ setup()
|
||||
Game.skill = (long) r->value;
|
||||
Game.tourn = 0;
|
||||
getstrpar("Enter a password", Game.passwd, 14, 0);
|
||||
if (sequal(Game.passwd, "tournament"))
|
||||
if (strcmp(Game.passwd, "tournament") == 0)
|
||||
{
|
||||
getstrpar("Enter tournament code", Game.passwd, 14, 0);
|
||||
Game.tourn = 1;
|
||||
@ -165,7 +171,7 @@ setup()
|
||||
for (i = j = 0; i < NDEV; i++)
|
||||
j += Param.damprob[i];
|
||||
if (j != 1000)
|
||||
syserr("Device probabilities sum to %d", j);
|
||||
errx(1, "Device probabilities sum to %d", j);
|
||||
Param.dockfac = 0.5;
|
||||
Param.regenfac = (5 - Game.skill) * 0.05;
|
||||
if (Param.regenfac < 0.0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setwarp.c,v 1.3 1995/04/22 10:59:27 cgd Exp $ */
|
||||
/* $NetBSD: setwarp.c,v 1.4 1997/10/12 21:25:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setwarp.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: setwarp.c,v 1.3 1995/04/22 10:59:27 cgd Exp $";
|
||||
__RCSID("$NetBSD: setwarp.c,v 1.4 1997/10/12 21:25:16 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** SET WARP FACTOR
|
||||
@ -51,17 +53,24 @@ static char rcsid[] = "$NetBSD: setwarp.c,v 1.3 1995/04/22 10:59:27 cgd Exp $";
|
||||
** checked for consistancy.
|
||||
*/
|
||||
|
||||
setwarp()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
setwarp(v)
|
||||
int v;
|
||||
{
|
||||
double warpfac;
|
||||
|
||||
warpfac = getfltpar("Warp factor");
|
||||
if (warpfac < 0.0)
|
||||
return;
|
||||
if (warpfac < 1.0)
|
||||
return (printf("Minimum warp speed is 1.0\n"));
|
||||
if (warpfac > 10.0)
|
||||
return (printf("Maximum speed is warp 10.0\n"));
|
||||
if (warpfac < 1.0) {
|
||||
printf("Minimum warp speed is 1.0\n");
|
||||
return;
|
||||
}
|
||||
if (warpfac > 10.0) {
|
||||
printf("Maximum speed is warp 10.0\n");
|
||||
return;
|
||||
}
|
||||
if (warpfac > 6.0)
|
||||
printf("Damage to warp engines may occur above warp 6.0\n");
|
||||
Ship.warp = warpfac;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: shield.c,v 1.4 1995/04/24 12:26:09 cgd Exp $ */
|
||||
/* $NetBSD: shield.c,v 1.5 1997/10/12 21:25:17 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)shield.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: shield.c,v 1.4 1995/04/24 12:26:09 cgd Exp $";
|
||||
__RCSID("$NetBSD: shield.c,v 1.5 1997/10/12 21:25:17 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** SHIELD AND CLOAKING DEVICE CONTROL
|
||||
@ -63,29 +65,31 @@ static char rcsid[] = "$NetBSD: shield.c,v 1.4 1995/04/24 12:26:09 cgd Exp $";
|
||||
|
||||
struct cvntab Udtab[] =
|
||||
{
|
||||
"u", "p", (int (*)())1, 0,
|
||||
"d", "own", 0, 0,
|
||||
0
|
||||
{ "u", "p", (cmdfun)1, 0 },
|
||||
{ "d", "own", (cmdfun)0, 0 },
|
||||
{ NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
void
|
||||
shield(f)
|
||||
int f;
|
||||
{
|
||||
register int i;
|
||||
char c;
|
||||
struct cvntab *r;
|
||||
char s[100];
|
||||
char *device, *dev2, *dev3;
|
||||
int ind;
|
||||
char *stat;
|
||||
int i;
|
||||
struct cvntab *r;
|
||||
char s[100];
|
||||
char *device, *dev2, *dev3;
|
||||
int ind;
|
||||
char *stat;
|
||||
|
||||
if (f > 0 && (Ship.shldup || damaged(SRSCAN)))
|
||||
return;
|
||||
if (f < 0)
|
||||
{
|
||||
/* cloaking device */
|
||||
if (Ship.ship == QUEENE)
|
||||
return (printf("Ye Faire Queene does not have the cloaking device.\n"));
|
||||
if (Ship.ship == QUEENE) {
|
||||
printf("Ye Faire Queene does not have the cloaking device.\n");
|
||||
return;
|
||||
}
|
||||
device = "Cloaking device";
|
||||
dev2 = "is";
|
||||
ind = CLOAK;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: snova.c,v 1.3 1995/04/22 10:59:29 cgd Exp $ */
|
||||
/* $NetBSD: snova.c,v 1.4 1997/10/12 21:25:18 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)snova.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: snova.c,v 1.3 1995/04/22 10:59:29 cgd Exp $";
|
||||
__RCSID("$NetBSD: snova.c,v 1.4 1997/10/12 21:25:18 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "trek.h"
|
||||
|
||||
/*
|
||||
** CAUSE SUPERNOVA TO OCCUR
|
||||
@ -64,15 +67,16 @@ static char rcsid[] = "$NetBSD: snova.c,v 1.3 1995/04/22 10:59:29 cgd Exp $";
|
||||
** override mode.
|
||||
*/
|
||||
|
||||
void
|
||||
snova(x, y)
|
||||
int x, y;
|
||||
{
|
||||
int qx, qy;
|
||||
register int ix, iy;
|
||||
int f;
|
||||
int dx, dy;
|
||||
int n;
|
||||
register struct quad *q;
|
||||
int qx, qy;
|
||||
int ix, iy = 0;
|
||||
int f;
|
||||
int dx, dy;
|
||||
int n;
|
||||
struct quad *q;
|
||||
|
||||
f = 0;
|
||||
ix = x;
|
||||
@ -146,12 +150,12 @@ int x, y;
|
||||
/* Enterprise caused supernova */
|
||||
Game.kills += dy;
|
||||
if (q->bases)
|
||||
killb(qx, qy, -1);
|
||||
killb(qx, qy);
|
||||
Game.killk += dx;
|
||||
}
|
||||
else
|
||||
if (q->bases)
|
||||
killb(qx, qy, 0);
|
||||
killb(qx, qy);
|
||||
killd(qx, qy, (x >= 0));
|
||||
q->stars = -1;
|
||||
q->klings = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: srscan.c,v 1.3 1995/04/22 10:59:31 cgd Exp $ */
|
||||
/* $NetBSD: srscan.c,v 1.4 1997/10/12 21:25:19 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)srscan.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: srscan.c,v 1.3 1995/04/22 10:59:31 cgd Exp $";
|
||||
__RCSID("$NetBSD: srscan.c,v 1.4 1997/10/12 21:25:19 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** SHORT RANGE SENSOR SCAN
|
||||
@ -67,16 +69,15 @@ char *Color[4] =
|
||||
"RED"
|
||||
};
|
||||
|
||||
void
|
||||
srscan(f)
|
||||
int f;
|
||||
{
|
||||
register int i, j;
|
||||
register int statinfo;
|
||||
char *s;
|
||||
int percent;
|
||||
struct quad *q;
|
||||
extern struct cvntab Skitab[];
|
||||
extern struct cvntab Lentab[];
|
||||
int i, j;
|
||||
int statinfo;
|
||||
char *s;
|
||||
int percent;
|
||||
struct quad *q = NULL;
|
||||
struct cvntab *p;
|
||||
|
||||
if (f >= 0 && check_out(SRSCAN))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: systemname.c,v 1.3 1995/04/22 10:59:32 cgd Exp $ */
|
||||
/* $NetBSD: systemname.c,v 1.4 1997/10/12 21:25:21 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)systemname.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: systemname.c,v 1.3 1995/04/22 10:59:32 cgd Exp $";
|
||||
__RCSID("$NetBSD: systemname.c,v 1.4 1997/10/12 21:25:21 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -57,8 +58,8 @@ static char rcsid[] = "$NetBSD: systemname.c,v 1.3 1995/04/22 10:59:32 cgd Exp $
|
||||
char *systemname(q1)
|
||||
struct quad *q1;
|
||||
{
|
||||
register struct quad *q;
|
||||
register int i;
|
||||
struct quad *q;
|
||||
int i;
|
||||
|
||||
q = q1;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: torped.c,v 1.3 1995/04/22 10:59:34 cgd Exp $ */
|
||||
/* $NetBSD: torped.c,v 1.4 1997/10/12 21:25:22 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,16 +33,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)torped.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: torped.c,v 1.3 1995/04/22 10:59:34 cgd Exp $";
|
||||
__RCSID("$NetBSD: torped.c,v 1.4 1997/10/12 21:25:22 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include <stdio.h>
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** PHOTON TORPEDO CONTROL
|
||||
@ -63,28 +66,34 @@ static char rcsid[] = "$NetBSD: torped.c,v 1.3 1995/04/22 10:59:34 cgd Exp $";
|
||||
** the misfire damages your torpedo tubes.
|
||||
*/
|
||||
|
||||
static int randcourse __P((int));
|
||||
|
||||
torped()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
torped(v)
|
||||
int v;
|
||||
{
|
||||
register int ix, iy;
|
||||
double x, y, dx, dy;
|
||||
double angle;
|
||||
int course, course2;
|
||||
register int k;
|
||||
double bigger;
|
||||
double sectsize;
|
||||
int burst;
|
||||
int n;
|
||||
int ix, iy;
|
||||
double x, y, dx, dy;
|
||||
double angle;
|
||||
int course, course2;
|
||||
int k;
|
||||
double bigger;
|
||||
double sectsize;
|
||||
int burst;
|
||||
int n;
|
||||
|
||||
if (Ship.cloaked)
|
||||
{
|
||||
return (printf("Federation regulations do not permit attack while cloaked.\n"));
|
||||
printf("Federation regulations do not permit attack while cloaked.\n");
|
||||
return;
|
||||
}
|
||||
if (check_out(TORPED))
|
||||
return;
|
||||
if (Ship.torped <= 0)
|
||||
{
|
||||
return (printf("All photon torpedos expended\n"));
|
||||
printf("All photon torpedos expended\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* get the course */
|
||||
@ -118,8 +127,10 @@ torped()
|
||||
burst = getintpar("burst angle");
|
||||
if (burst <= 0)
|
||||
return;
|
||||
if (burst > 15)
|
||||
return (printf("Maximum burst angle is 15 degrees\n"));
|
||||
if (burst > 15) {
|
||||
printf("Maximum burst angle is 15 degrees\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
sectsize = NSECTS;
|
||||
n = -1;
|
||||
@ -221,11 +232,12 @@ torped()
|
||||
** to the tubes, etc.
|
||||
*/
|
||||
|
||||
static int
|
||||
randcourse(n)
|
||||
int n;
|
||||
{
|
||||
double r;
|
||||
register int d;
|
||||
int d;
|
||||
|
||||
d = ((franf() + franf()) - 1.0) * 20;
|
||||
if (abs(d) > 12)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trek.h,v 1.4 1997/03/29 20:42:26 thorpej Exp $ */
|
||||
/* $NetBSD: trek.h,v 1.5 1997/10/12 21:25:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -54,14 +54,6 @@
|
||||
*/
|
||||
|
||||
/* external function definitions */
|
||||
extern double franf(); /* floating random number function */
|
||||
extern double sqrt(); /* square root */
|
||||
extern double sin(), cos(); /* trig functions */
|
||||
extern double atan2(); /* fancy arc tangent function */
|
||||
extern double log(); /* log base e */
|
||||
extern double pow(); /* power function */
|
||||
extern double fabs(); /* absolute value function */
|
||||
extern double exp(); /* exponential function */
|
||||
|
||||
/********************* GALAXY **************************/
|
||||
|
||||
@ -72,7 +64,7 @@ extern double exp(); /* exponential function */
|
||||
|
||||
struct quad /* definition for each quadrant */
|
||||
{
|
||||
char bases; /* number of bases in this quadrant */
|
||||
unsigned char bases; /* number of bases in this quadrant */
|
||||
char klings; /* number of Klingons in this quadrant */
|
||||
char holes; /* number of black holes in this quadrant */
|
||||
int scanned; /* star chart entry (see below) */
|
||||
@ -117,6 +109,7 @@ struct quad Quad[NQUADS][NQUADS];
|
||||
char Sect[NSECTS][NSECTS];
|
||||
|
||||
|
||||
|
||||
/************************ DEVICES ******************************/
|
||||
|
||||
# define NDEV 16 /* max number of devices */
|
||||
@ -167,10 +160,10 @@ struct device Device[NDEV];
|
||||
|
||||
struct event
|
||||
{
|
||||
char x, y; /* coordinates */
|
||||
double date; /* trap stardate */
|
||||
char evcode; /* event type */
|
||||
char systemname; /* starsystem name */
|
||||
unsigned char x, y; /* coordinates */
|
||||
double date; /* trap stardate */
|
||||
char evcode; /* event type */
|
||||
unsigned char systemname; /* starsystem name */
|
||||
};
|
||||
/* systemname conventions:
|
||||
* 1 -> NINHAB index into Systemname table for reported distress calls
|
||||
@ -190,7 +183,7 @@ struct event Event[MAXEVENTS]; /* dynamic event list; one entry per pending even
|
||||
|
||||
struct kling
|
||||
{
|
||||
char x, y; /* coordinates */
|
||||
unsigned char x, y; /* coordinates */
|
||||
int power; /* power left */
|
||||
double dist; /* distance to Enterprise */
|
||||
double avgdist; /* average over this move */
|
||||
@ -218,10 +211,13 @@ struct kling
|
||||
|
||||
struct xy
|
||||
{
|
||||
char x, y; /* coordinates */
|
||||
unsigned char x, y; /* coordinates */
|
||||
};
|
||||
|
||||
|
||||
extern struct cvntab Skitab[];
|
||||
extern struct cvntab Lentab[];
|
||||
|
||||
/*
|
||||
* note that much of the stuff in the following structs CAN NOT
|
||||
* be moved around!!!!
|
||||
@ -247,7 +243,7 @@ struct
|
||||
int quady; /* quadrant y coord */
|
||||
int sectx; /* sector x coord */
|
||||
int secty; /* sector y coord */
|
||||
char cond; /* condition code */
|
||||
unsigned char cond; /* condition code */
|
||||
char sinsbad; /* Space Inertial Navigation System condition */
|
||||
char *shipname; /* name of current starship */
|
||||
char ship; /* current starship */
|
||||
@ -289,7 +285,7 @@ struct
|
||||
/* parametric information */
|
||||
struct
|
||||
{
|
||||
char bases; /* number of starbases */
|
||||
unsigned char bases; /* number of starbases */
|
||||
char klings; /* number of klingons */
|
||||
double date; /* stardate */
|
||||
double time; /* time left */
|
||||
@ -325,7 +321,7 @@ struct
|
||||
/* other information kept in a snapshot */
|
||||
struct
|
||||
{
|
||||
char bases; /* number of starbases */
|
||||
unsigned char bases; /* number of starbases */
|
||||
char klings; /* number of klingons */
|
||||
double date; /* stardate */
|
||||
double time; /* time left */
|
||||
@ -380,3 +376,157 @@ struct
|
||||
/* Trace info */
|
||||
# define xTRACE 1
|
||||
int Trace;
|
||||
|
||||
/* abandon.c */
|
||||
void abandon __P((int));
|
||||
|
||||
/* attack.c */
|
||||
void attack __P((int));
|
||||
|
||||
/* autover.c */
|
||||
void autover __P((void));
|
||||
|
||||
/* capture.c */
|
||||
void capture __P((int));
|
||||
struct kling *selectklingon __P((void));
|
||||
|
||||
/* cgetc.c */
|
||||
char cgetc __P((int));
|
||||
|
||||
/* check_out.c */
|
||||
int check_out __P((int));
|
||||
|
||||
/* checkcond.c */
|
||||
void checkcond __P((void));
|
||||
|
||||
/* compkl.c */
|
||||
void compkldist __P((int));
|
||||
|
||||
/* computer.c */
|
||||
void computer __P((int));
|
||||
|
||||
/* damage.c */
|
||||
void damage __P((int, double));
|
||||
|
||||
/* damaged.c */
|
||||
int damaged __P((int));
|
||||
|
||||
/* dcrept.c */
|
||||
void dcrept __P((int));
|
||||
|
||||
/* destruct.c */
|
||||
void destruct __P((int));
|
||||
|
||||
/* dock.c */
|
||||
void dock __P((int));
|
||||
void undock __P((int));
|
||||
|
||||
/* dumpgame.c */
|
||||
void dumpgame __P((int));
|
||||
int restartgame __P((void));
|
||||
|
||||
/* dumpme.c */
|
||||
void dumpme __P((int));
|
||||
|
||||
/* dumpssradio.c */
|
||||
int dumpssradio __P((void));
|
||||
|
||||
/* events.c */
|
||||
int events __P((int));
|
||||
|
||||
/* externs.c */
|
||||
|
||||
/* getcodi.c */
|
||||
int getcodi __P((int *, double *));
|
||||
|
||||
/* help.c */
|
||||
void help __P((int));
|
||||
|
||||
/* impulse.c */
|
||||
void impulse __P((int));
|
||||
|
||||
/* initquad.c */
|
||||
void initquad __P((int));
|
||||
void sector __P((int *, int *));
|
||||
|
||||
/* kill.c */
|
||||
void killk __P((int, int ));
|
||||
void killb __P((int, int ));
|
||||
void kills __P((int, int , int));
|
||||
void killd __P((int, int , int));
|
||||
|
||||
/* klmove.c */
|
||||
void klmove __P((int));
|
||||
|
||||
/* lose.c */
|
||||
void lose __P((int));
|
||||
|
||||
/* lrscan.c */
|
||||
void lrscan __P((int));
|
||||
|
||||
/* move.c */
|
||||
double move __P((int, int, double, double));
|
||||
|
||||
/* nova.c */
|
||||
void nova __P((int, int ));
|
||||
|
||||
/* out.c */
|
||||
void out __P((int));
|
||||
|
||||
/* phaser.c */
|
||||
void phaser __P((int));
|
||||
|
||||
/* play.c */
|
||||
void myreset __P((int));
|
||||
void play __P((void));
|
||||
|
||||
/* ram.c */
|
||||
void ram __P((int, int ));
|
||||
|
||||
/* ranf.c */
|
||||
int ranf __P((int));
|
||||
double franf __P((void));
|
||||
|
||||
/* rest.c */
|
||||
void rest __P((int));
|
||||
|
||||
/* schedule.c */
|
||||
struct event *schedule __P((int, double, int, int , int));
|
||||
void reschedule __P((struct event *, double));
|
||||
void unschedule __P((struct event *));
|
||||
struct event *xsched __P((int, int, int, int , int ));
|
||||
void xresched __P((struct event *, int, int));
|
||||
|
||||
/* score.c */
|
||||
long score __P((void));
|
||||
|
||||
/* setup.c */
|
||||
void setup __P((void));
|
||||
|
||||
/* setwarp.c */
|
||||
void setwarp __P((int));
|
||||
|
||||
/* shield.c */
|
||||
void shield __P((int));
|
||||
|
||||
/* snova.c */
|
||||
void snova __P((int, int ));
|
||||
|
||||
/* srscan.c */
|
||||
void srscan __P((int));
|
||||
|
||||
/* systemname.c */
|
||||
char *systemname __P((struct quad *));
|
||||
|
||||
/* torped.c */
|
||||
void torped __P((int));
|
||||
|
||||
/* visual.c */
|
||||
void visual __P((int));
|
||||
|
||||
/* warp.c */
|
||||
void dowarp __P((int));
|
||||
void warp __P((int, int, double));
|
||||
|
||||
/* win.c */
|
||||
void win __P((void));
|
||||
|
@ -1,156 +0,0 @@
|
||||
/* $NetBSD: utility.c,v 1.3 1995/04/22 10:59:37 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)utility.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: utility.c,v 1.3 1995/04/22 10:59:37 cgd Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
** ASSORTED UTILITY ROUTINES
|
||||
*/
|
||||
|
||||
/*
|
||||
** BLOCK MOVE
|
||||
**
|
||||
** Moves a block of storage of length `l' bytes from the data
|
||||
** area pointed to by `a' to the area pointed to by `b'.
|
||||
** Returns the address of the byte following the `b' field.
|
||||
** Overflow of `b' is not tested.
|
||||
*/
|
||||
|
||||
char *bmove(a, b, l)
|
||||
char *a, *b;
|
||||
int l;
|
||||
{
|
||||
register int n;
|
||||
register char *p, *q;
|
||||
|
||||
p = a;
|
||||
q = b;
|
||||
n = l;
|
||||
while (n--)
|
||||
*q++ = *p++;
|
||||
return (q);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** STRING EQUALITY TEST
|
||||
** null-terminated strings `a' and `b' are tested for
|
||||
** absolute equality.
|
||||
** returns one if equal, zero otherwise.
|
||||
*/
|
||||
|
||||
sequal(a, b)
|
||||
char *a, *b;
|
||||
{
|
||||
register char *p, *q;
|
||||
|
||||
p = a;
|
||||
q = b;
|
||||
while (*p || *q)
|
||||
if (*p++ != *q++)
|
||||
return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** STRING CONCATENATE
|
||||
**
|
||||
** The strings `s1' and `s2' are concatenated and stored into
|
||||
** `s3'. It is ok for `s1' to equal `s3', but terrible things
|
||||
** will happen if `s2' equals `s3'. The return value is is a
|
||||
** pointer to the end of `s3' field.
|
||||
*/
|
||||
|
||||
char *concat(s1, s2, s3)
|
||||
char *s1, *s2, *s3;
|
||||
{
|
||||
register char *p;
|
||||
register char *q;
|
||||
|
||||
p = s3;
|
||||
q = s1;
|
||||
while (*q)
|
||||
*p++ = *q++;
|
||||
q = s2;
|
||||
while (*q)
|
||||
*p++ = *q++;
|
||||
*p = 0;
|
||||
return (p);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** FIND STRING LENGTH
|
||||
**
|
||||
** The length of string `s' (excluding the null byte which
|
||||
** terminates the string) is returned.
|
||||
*/
|
||||
|
||||
length(s)
|
||||
char *s;
|
||||
{
|
||||
register int l;
|
||||
register char *p;
|
||||
|
||||
l = 0;
|
||||
p = s;
|
||||
while (*p++)
|
||||
l++;
|
||||
return(l);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** SYSTEM ERROR
|
||||
*/
|
||||
|
||||
syserr(p0, p1, p2, p3, p4, p5)
|
||||
{
|
||||
extern int errno;
|
||||
|
||||
printf("\n\07TREK SYSERR: ");
|
||||
printf(p0, p1, p2, p3, p4, p5);
|
||||
printf("\n");
|
||||
if (errno)
|
||||
printf("\tsystem error %d\n", errno);
|
||||
exit(-1);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: visual.c,v 1.3 1995/04/22 10:59:39 cgd Exp $ */
|
||||
/* $NetBSD: visual.c,v 1.4 1997/10/12 21:25:26 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)visual.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: visual.c,v 1.3 1995/04/22 10:59:39 cgd Exp $";
|
||||
__RCSID("$NetBSD: visual.c,v 1.4 1997/10/12 21:25:26 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** VISUAL SCAN
|
||||
@ -55,24 +58,27 @@ static char rcsid[] = "$NetBSD: visual.c,v 1.3 1995/04/22 10:59:39 cgd Exp $";
|
||||
/* This struct[] has the delta x, delta y for particular directions */
|
||||
struct xy Visdelta[11] =
|
||||
{
|
||||
-1, -1,
|
||||
-1, 0,
|
||||
-1, 1,
|
||||
0, 1,
|
||||
1, 1,
|
||||
1, 0,
|
||||
1, -1,
|
||||
0, -1,
|
||||
-1, -1,
|
||||
-1, 0,
|
||||
-1, 1
|
||||
{ -1, -1 },
|
||||
{ -1, 0 },
|
||||
{ -1, 1 },
|
||||
{ 0, 1 },
|
||||
{ 1, 1 },
|
||||
{ 1, 0 },
|
||||
{ 1, -1 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, 0 },
|
||||
{ -1, 1 }
|
||||
};
|
||||
|
||||
visual()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
visual(z)
|
||||
int z;
|
||||
{
|
||||
register int ix, iy;
|
||||
int co;
|
||||
register struct xy *v;
|
||||
int ix, iy;
|
||||
int co;
|
||||
struct xy *v;
|
||||
|
||||
co = getintpar("direction");
|
||||
if (co < 0 || co > 360)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: warp.c,v 1.3 1995/04/22 10:59:40 cgd Exp $ */
|
||||
/* $NetBSD: warp.c,v 1.4 1997/10/12 21:25:27 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,15 +33,20 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)warp.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: warp.c,v 1.3 1995/04/22 10:59:40 cgd Exp $";
|
||||
__RCSID("$NetBSD: warp.c,v 1.4 1997/10/12 21:25:27 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** MOVE UNDER WARP POWER
|
||||
@ -59,34 +64,44 @@ static char rcsid[] = "$NetBSD: warp.c,v 1.3 1995/04/22 10:59:40 cgd Exp $";
|
||||
** case, there is code to handle time warps, etc.
|
||||
*/
|
||||
|
||||
void
|
||||
dowarp(fl)
|
||||
{
|
||||
int c;
|
||||
double d;
|
||||
|
||||
if (getcodi(&c, &d))
|
||||
return;
|
||||
warp(fl, c, d);
|
||||
}
|
||||
|
||||
void
|
||||
warp(fl, c, d)
|
||||
int fl, c;
|
||||
double d;
|
||||
{
|
||||
int course;
|
||||
double power;
|
||||
double dist;
|
||||
double time;
|
||||
double speed;
|
||||
double frac;
|
||||
register int percent;
|
||||
register int i;
|
||||
extern double move();
|
||||
char *p;
|
||||
int course;
|
||||
double power;
|
||||
double dist;
|
||||
double time;
|
||||
double speed;
|
||||
double frac;
|
||||
int percent;
|
||||
int i;
|
||||
|
||||
if (Ship.cond == DOCKED)
|
||||
return (printf("%s is docked\n", Ship.shipname));
|
||||
if (Ship.cond == DOCKED) {
|
||||
printf("%s is docked\n", Ship.shipname);
|
||||
return;
|
||||
}
|
||||
if (damaged(WARP))
|
||||
{
|
||||
return (out(WARP));
|
||||
out(WARP);
|
||||
return;
|
||||
}
|
||||
if (fl < 0)
|
||||
{
|
||||
course = c;
|
||||
dist = d;
|
||||
}
|
||||
else
|
||||
if (getcodi(&course, &dist))
|
||||
return;
|
||||
|
||||
course = c;
|
||||
dist = d;
|
||||
|
||||
/* check to see that we are not using an absurd amount of power */
|
||||
power = (dist + 0.05) * Ship.warp3;
|
||||
@ -140,7 +155,8 @@ double d;
|
||||
sleep(4);
|
||||
if (ranf(100) >= 100 * dist)
|
||||
{
|
||||
return (printf("Equilibrium restored -- all systems normal\n"));
|
||||
printf("Equilibrium restored -- all systems normal\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* select a bizzare thing to happen to us */
|
||||
@ -166,10 +182,12 @@ double d;
|
||||
|
||||
/* s/he got lucky: a negative time portal */
|
||||
time = Now.date;
|
||||
i = (int) Etc.snapshot;
|
||||
bmove(i, Quad, sizeof Quad);
|
||||
bmove(i += sizeof Quad, Event, sizeof Event);
|
||||
bmove(i += sizeof Event, &Now, sizeof Now);
|
||||
p = (char *) Etc.snapshot;
|
||||
memcpy(p, Quad, sizeof Quad);
|
||||
p += sizeof Quad;
|
||||
memcpy(p, Event, sizeof Event);
|
||||
p += sizeof Event;
|
||||
memcpy(p, &Now, sizeof Now);
|
||||
printf("Negative time portal entered -- it is now Stardate %.2f\n",
|
||||
Now.date);
|
||||
for (i = 0; i < MAXEVENTS; i++)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: win.c,v 1.3 1995/04/22 10:59:41 cgd Exp $ */
|
||||
/* $NetBSD: win.c,v 1.4 1997/10/12 21:25:28 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -33,17 +33,20 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)win.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: win.c,v 1.3 1995/04/22 10:59:41 cgd Exp $";
|
||||
__RCSID("$NetBSD: win.c,v 1.4 1997/10/12 21:25:28 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
# include "trek.h"
|
||||
# include "getpar.h"
|
||||
# include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
#include "trek.h"
|
||||
#include "getpar.h"
|
||||
|
||||
/*
|
||||
** Signal game won
|
||||
@ -58,13 +61,12 @@ static char rcsid[] = "$NetBSD: win.c,v 1.3 1995/04/22 10:59:41 cgd Exp $";
|
||||
** pretty off the wall.
|
||||
*/
|
||||
|
||||
void
|
||||
win()
|
||||
{
|
||||
long s;
|
||||
extern jmp_buf env;
|
||||
extern long score();
|
||||
extern struct cvntab Skitab[];
|
||||
register struct cvntab *p;
|
||||
long s;
|
||||
struct cvntab *p = NULL;
|
||||
extern jmp_buf env;
|
||||
|
||||
sleep(1);
|
||||
printf("\nCongratulations, you have saved the Federation\n");
|
||||
|
Loading…
Reference in New Issue
Block a user