X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/462fca95471224f85b85be911e72faee16cd1597..b83825244af1cd795330975ed4ccdb6cdd0e5432:/trek/warp.c diff --git a/trek/warp.c b/trek/warp.c index 0b78b5e2..d221d965 100644 --- a/trek/warp.c +++ b/trek/warp.c @@ -1,6 +1,8 @@ +/* $NetBSD: warp.c,v 1.6 1998/09/11 14:28:28 hubertf Exp $ */ + /* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. + * 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 @@ -31,12 +33,21 @@ * SUCH DAMAGE. */ +#include #ifndef lint -/*static char sccsid[] = "from: @(#)warp.c 5.4 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$Id: warp.c,v 1.2 1993/08/01 18:49:52 mycroft Exp $"; +#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 $"); +#endif #endif /* not lint */ -# include "trek.h" +#include +#include +#include +#include +#include "trek.h" +#include "getpar.h" /* ** MOVE UNDER WARP POWER @@ -54,34 +65,45 @@ static char rcsid[] = "$Id: warp.c,v 1.2 1993/08/01 18:49:52 mycroft Exp $"; ** case, there is code to handle time warps, etc. */ +void +dowarp(fl) + int 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(); - - if (Ship.cond == DOCKED) - return (printf("%s is docked\n", Ship.shipname)); - if (damaged(WARP)) - { - return (out(WARP)); + char *p; + int course; + double power; + double dist; + double time; + double speed; + double frac; + int percent; + int i; + + if (Ship.cond == DOCKED) { + printf("%s is docked\n", Ship.shipname); + return; } - if (fl < 0) + if (damaged(WARP)) { - course = c; - dist = d; + out(WARP); + return; } - 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; @@ -135,7 +157,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 */ @@ -161,10 +184,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++)