+/* $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
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#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 <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "getpar.h"
+#include "trek.h"
/*
** CAUSE TIME TO ELAPSE
*/
+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;
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;
/* 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++;
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;
}
/* unschedule an attack during a rest period */
- if (e = Now.eventptr[E_ATTACK])
+ if ((e = Now.eventptr[E_ATTACK]) != NULL)
unschedule(e);
if (!warp)