-/* $NetBSD: warp.c,v 1.6 1998/09/11 14:28:28 hubertf Exp $ */
+/* $NetBSD: warp.c,v 1.11 2009/05/24 22:55:03 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
* 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
+ * 3. 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.
*
#if 0
static char sccsid[] = "@(#)warp.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: warp.c,v 1.6 1998/09/11 14:28:28 hubertf Exp $");
+__RCSID("$NetBSD: warp.c,v 1.11 2009/05/24 22:55:03 dholland Exp $");
#endif
#endif /* not lint */
*/
void
-dowarp(fl)
- int fl;
+dowarp(int fl)
{
int c;
double d;
}
void
-warp(fl, c, d)
-int fl, c;
-double d;
+warp(int fl, int c, double d)
{
char *p;
int course;
double frac;
int percent;
int i;
+ double repairs;
if (Ship.cond == DOCKED) {
printf("%s is docked\n", Ship.shipname);
return;
}
- if (damaged(WARP))
- {
+ if (damaged(WARP)) {
out(WARP);
return;
}
/* check to see that we are not using an absurd amount of power */
power = (dist + 0.05) * Ship.warp3;
percent = 100 * power / Ship.energy + 0.5;
- if (percent >= 85)
- {
- printf("Scotty: That would consume %d%% of our remaining energy.\n",
+ if (percent >= 85) {
+ printf("Scotty: That would consume %d%% of our remaining "
+ "energy.\n",
percent);
if (!getynpar("Are you sure that is wise"))
return;
/* check to see that that value is not ridiculous */
percent = 100 * time / Now.time + 0.5;
- if (percent >= 85)
- {
+ if (percent >= 85) {
printf("Spock: That would take %d%% of our remaining time.\n",
percent);
if (!getynpar("Are you sure that is wise"))
}
/* compute how far we will go if we get damages */
- if (Ship.warp > 6.0 && ranf(100) < 20 + 15 * (Ship.warp - 6.0))
- {
+ if (Ship.warp > 6.0 && ranf(100) < 20 + 15 * (Ship.warp - 6.0)) {
frac = franf();
dist *= frac;
time *= frac;
- damage(WARP, (frac + 1.0) * Ship.warp * (franf() + 0.25) * 0.20);
+ repairs = (frac + 1.0) * Ship.warp * (franf() + 0.25) * 0.20;
+ damage(WARP, repairs);
}
/* do the move */
sleep(2);
printf("Crew experiencing extreme sensory distortion\n");
sleep(4);
- if (ranf(100) >= 100 * dist)
- {
+ if (ranf(100) >= 100 * dist) {
printf("Equilibrium restored -- all systems normal\n");
return;
}
/* select a bizzare thing to happen to us */
percent = ranf(100);
- if (percent < 70)
- {
+ if (percent < 70) {
/* time warp */
- if (percent < 35 || !Game.snap)
- {
+ if (percent < 35 || !Game.snap) {
/* positive time warp */
time = (Ship.warp - 8.0) * dist * (franf() + 1.0);
Now.date += time;
- printf("Positive time portal entered -- it is now Stardate %.2f\n",
+ printf("Positive time portal entered -- "
+ "it is now Stardate %.2f\n",
Now.date);
- for (i = 0; i < MAXEVENTS; i++)
- {
+ for (i = 0; i < MAXEVENTS; i++) {
percent = Event[i].evcode;
if (percent == E_FIXDV || percent == E_LRTB)
Event[i].date += time;
memcpy(p, Event, sizeof Event);
p += sizeof Event;
memcpy(p, &Now, sizeof Now);
- printf("Negative time portal entered -- it is now Stardate %.2f\n",
+ printf("Negative time portal entered -- "
+ "it is now Stardate %.2f\n",
Now.date);
for (i = 0; i < MAXEVENTS; i++)
if (Event[i].evcode == E_FIXDV)
/* test for just a lot of damage */
if (percent < 80)
lose(L_TOOFAST);
- printf("Equilibrium restored -- extreme damage occured to ship systems\n");
+ printf("Equilibrium restored -- "
+ "extreme damage occurred to ship systems\n");
for (i = 0; i < NDEV; i++)
damage(i, (3.0 * (franf() + franf()) + 1.0) * Param.damfac[i]);
Ship.shldup = 0;