X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/b2ca333c4ad541145141d538923e93ec3464e29d..1241b50c5ecd257030f9ddd40c9009a0a4c55ee8:/trek/events.c diff --git a/trek/events.c b/trek/events.c index c150e10e..512a93d2 100644 --- a/trek/events.c +++ b/trek/events.c @@ -1,4 +1,4 @@ -/* $NetBSD: events.c,v 1.3 1995/04/22 10:58:50 cgd Exp $ */ +/* $NetBSD: events.c,v 1.7 2003/08/07 09:37:51 agc Exp $ */ /* * Copyright (c) 1980, 1993 @@ -12,11 +12,7 @@ * 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. * @@ -33,15 +29,20 @@ * SUCH DAMAGE. */ +#include #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.7 2003/08/07 09:37:51 agc Exp $"); #endif #endif /* not lint */ -# include "trek.h" +#include +#include +#include +#include "getpar.h" +#include "trek.h" /* ** CAUSE TIME TO ELAPSE @@ -52,19 +53,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 +141,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; @@ -228,7 +231,7 @@ int warp; /* set if called in a time warp */ /* report it if we can */ if (!damaged(SSRADIO)) { - printf("\nUhura: Captain, we have recieved a distress signal\n"); + printf("\nUhura: Captain, we have received a distress signal\n"); printf(" from the starbase in quadrant %d,%d.\n", ix, iy); restcancel++; @@ -389,10 +392,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 +452,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)