]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/events.c
Add ${MACROS} to ${ROFF} usage to make output readable
[bsdgames-darwin.git] / trek / events.c
index c150e10eebb74724dfc60d4bd03d6463cec9b09f..a49472779419f6a89ee130b8fa6107813385391f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: events.c,v 1.3 1995/04/22 10:58:50 cgd Exp $   */
+/*     $NetBSD: events.c,v 1.6 2001/06/12 15:17:12 wiz Exp $   */
 
 /*
  * Copyright (c) 1980, 1993
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
 #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.6 2001/06/12 15:17:12 wiz Exp $");
 #endif
 #endif /* not lint */
 
-# include      "trek.h"
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "getpar.h"
+#include "trek.h"
 
 /*
 **  CAUSE TIME TO ELAPSE
@@ -52,19 +57,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 +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;
@@ -228,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++;
@@ -389,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;
 
@@ -447,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)