* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)warp.c 5.1 (Berkeley) %G%";
** This is both the "move" and the "ram" commands, differing
** only in the flag 'fl'. It is also used for automatic
** emergency override mode, when 'fl' is < 0 and 'c' and 'd'
** are the course and distance to be moved. If 'fl' >= 0,
** the course and distance are asked of the captain.
** The guts of this routine are in the routine move(), which
** is shared with impulse(). Also, the working part of this
** routine is very small; the rest is to handle the slight chance
** that you may be moving at some riduculous speed. In that
** case, there is code to handle time warps, etc.
return (printf("%s is docked\n", Ship
.shipname
));
if (getcodi(&course
, &dist
))
/* 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;
printf("Scotty: That would consume %d%% of our remaining energy.\n",
if (!getynpar("Are you sure that is wise"))
/* compute the speed we will move at, and the time it will take */
speed
= Ship
.warp2
/ Param
.warptime
;
/* check to see that that value is not ridiculous */
percent
= 100 * time
/ Now
.time
+ 0.5;
printf("Spock: That would take %d%% of our remaining time.\n",
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))
damage(WARP
, (frac
+ 1.0) * Ship
.warp
* (franf() + 0.25) * 0.20);
Move
.time
= move(fl
, course
, time
, speed
);
/* see how far we actually went, and decrement energy appropriately */
dist
= Move
.time
* speed
;
Ship
.energy
-= dist
* Ship
.warp3
* (Ship
.shldup
+ 1);
/* test for bizarre events */
printf("\n\n ___ Speed exceeding warp nine ___\n\n");
printf("Ship's safety systems malfunction\n");
printf("Crew experiencing extreme sensory distortion\n");
if (ranf(100) >= 100 * dist
)
return (printf("Equilibrium restored -- all systems normal\n"));
/* select a bizzare thing to happen to us */
if (percent
< 35 || !Game
.snap
)
time
= (Ship
.warp
- 8.0) * dist
* (franf() + 1.0);
printf("Positive time portal entered -- it is now Stardate %.2f\n",
for (i
= 0; i
< MAXEVENTS
; i
++)
percent
= Event
[i
].evcode
;
if (percent
== E_FIXDV
|| percent
== E_LRTB
)
/* s/he got lucky: a negative time portal */
bmove(i
, Quad
, sizeof Quad
);
bmove(i
+= sizeof Quad
, Event
, sizeof Event
);
bmove(i
+= sizeof Event
, &Now
, sizeof Now
);
printf("Negative time portal entered -- it is now Stardate %.2f\n",
for (i
= 0; i
< MAXEVENTS
; i
++)
if (Event
[i
].evcode
== E_FIXDV
)
reschedule(&Event
[i
], Event
[i
].date
- time
);
/* test for just a lot of damage */
printf("Equilibrium restored -- extreme damage occured to ship systems\n");
for (i
= 0; i
< NDEV
; i
++)
damage(i
, (3.0 * (franf() + franf()) + 1.0) * Param
.damfac
[i
]);