DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T b

⟦aece7075c⟧ TextFile

    Length: 1439 (0x59f)
    Types: TextFile
    Names: »bpv.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Trek73/src/bpv.c« 

TextFile

#ident "@(#) TREK73 $Header: bpv.c,v 1.2 87/10/09 15:48:35 okamoto Exp $"
/*
 * $Source: /ccc/okamoto/src/trek/src/RCS/bpv.c,v $
 *
 * $Header: bpv.c,v 1.2 87/10/09 15:48:35 okamoto Exp $
 *
 * $Log:	bpv.c,v $
 * Revision 1.2  87/10/09  15:48:35  15:48:35  okamoto (Jeff Okamoto)
 * Added declaration of round as a function returning a double.
 * 
 * Revision 1.1  87/10/09  11:00:29  11:00:29  okamoto (Jeff Okamoto)
 * Initial revision
 * 
 */
/*
 * TREK73: bpv.c
 *
 * Calculate the Basic Point Value of a ships
 *
 */

void
calculate(regen, pods, p_div, t_div, weapons, crew, bpv, eff, turn, max)
double regen;	/* Regeneration */
float pods;	/* Number of antimatter pods */
float p_div;	/* Shield divisor for phasers */
float t_div;	/* Shield divisor for torps */
int weapons;	/* Number of weapons */
int crew;	/* Number of crew */
double *bpv;	/* Return for BPV */
double *eff;	/* Return for efficiency */
int *turn;	/* Turn per segment */
int *max;	/* Maximum speed */
{
	double floor(), round();

	*bpv = 0.;
	*bpv += regen * 12;
	*bpv += pods / 2;
	*bpv += p_div * 30;
	*bpv += t_div * 40;
	*bpv += weapons * 10;
	*bpv += crew / 15;

	*eff = round(4 * (0.0034 * *bpv - 0.78)) / 4.0;
	if (*eff< 0.25)
		*eff= 0.25;
	*turn = (int) (10 - floor(*bpv / 100.0));
	if (*turn < 1)
		*turn = 1;
	*max= (int) round(-0.004 * *bpv + 11.0);
	if (*max < 1)
		*max = 1;
}

double
round(x)
double x;
{
	double floor();

	return(floor(x + 0.5));
}