X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/77e3814f0c0e3dea4d0032e25666f77e6f83bfff..d53a08d3fa6a2db3b438535bd41ebe4cdb2b149a:/trek/events.c?ds=inline diff --git a/trek/events.c b/trek/events.c index 4ed6d982..a4947277 100644 --- a/trek/events.c +++ b/trek/events.c @@ -1,6 +1,8 @@ +/* $NetBSD: events.c,v 1.6 2001/06/12 15:17:12 wiz 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,11 +33,20 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char sccsid[] = "@(#)events.c 5.4 (Berkeley) 6/1/90"; +#if 0 +static char sccsid[] = "@(#)events.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: events.c,v 1.6 2001/06/12 15:17:12 wiz Exp $"); +#endif #endif /* not lint */ -# include "trek.h" +#include +#include +#include +#include "getpar.h" +#include "trek.h" /* ** CAUSE TIME TO ELAPSE @@ -46,19 +57,21 @@ static char sccsid[] = "@(#)events.c 5.4 (Berkeley) 6/1/90"; */ +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; @@ -132,7 +145,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; @@ -222,7 +235,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++; @@ -383,10 +396,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; @@ -441,7 +456,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)