]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/events.c
include sys/cdefs.h so that __attribute__ can be fixed later
[bsdgames-darwin.git] / trek / events.c
index c150e10eebb74724dfc60d4bd03d6463cec9b09f..512a93d24289267caea8a2aff5f2bb613d3f7d1e 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.7 2003/08/07 09:37:51 agc Exp $   */
 
 /*
  * Copyright (c) 1980, 1993
  * 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.
  *
  * 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.7 2003/08/07 09:37:51 agc 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 +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)