summaryrefslogtreecommitdiffstats
path: root/trek/events.c
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-05-24 22:55:03 +0000
committerdholland <dholland@NetBSD.org>2009-05-24 22:55:03 +0000
commit04b8b3500b4c9df35ceefed6fdc1f8dfa9560447 (patch)
tree2191a382af7496c4fec957e0b28c002becc177aa /trek/events.c
parent9abf00d9b32a3a985614d8f734b52090bed2e3b7 (diff)
downloadbsdgames-darwin-04b8b3500b4c9df35ceefed6fdc1f8dfa9560447.tar.gz
bsdgames-darwin-04b8b3500b4c9df35ceefed6fdc1f8dfa9560447.tar.zst
bsdgames-darwin-04b8b3500b4c9df35ceefed6fdc1f8dfa9560447.zip
Split up lines > 80 chars. Object files unchanged.
Diffstat (limited to 'trek/events.c')
-rw-r--r--trek/events.c95
1 files changed, 64 insertions, 31 deletions
diff --git a/trek/events.c b/trek/events.c
index e15ad251..62f23bcf 100644
--- a/trek/events.c
+++ b/trek/events.c
@@ -1,4 +1,4 @@
-/* $NetBSD: events.c,v 1.10 2009/05/24 21:44:56 dholland Exp $ */
+/* $NetBSD: events.c,v 1.11 2009/05/24 22:55:03 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)events.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: events.c,v 1.10 2009/05/24 21:44:56 dholland Exp $");
+__RCSID("$NetBSD: events.c,v 1.11 2009/05/24 22:55:03 dholland Exp $");
#endif
#endif /* not lint */
@@ -152,7 +152,8 @@ events(int timewarp)
for (iy = 0; iy < NQUADS; iy++) {
q = &Quad[ix][iy];
if (q->stars >= 0)
- if ((i -= q->klings) <= 0)
+ if ((i -= q->klings)
+ <= 0)
break;
}
if (i <= 0)
@@ -166,8 +167,11 @@ events(int timewarp)
/* nope, dump him in the new quadrant */
Ship.quadx = ix;
Ship.quady = iy;
- printf("\n%s caught in long range tractor beam\n", Ship.shipname);
- printf("*** Pulled to quadrant %d,%d\n", Ship.quadx, Ship.quady);
+ printf("\n%s caught in long range tractor "
+ "beam\n",
+ Ship.shipname);
+ printf("*** Pulled to quadrant %d,%d\n",
+ Ship.quadx, Ship.quady);
Ship.sectx = ranf(NSECTS);
Ship.secty = ranf(NSECTS);
initquad(0);
@@ -208,23 +212,33 @@ events(int timewarp)
}
e = ev;
if (i >= Now.bases) {
- /* not now; wait a while and see if some Klingons move in */
+ /*
+ * not now; wait a while and see if
+ * some Klingons move in
+ */
reschedule(e, 0.5 + 3.0 * franf());
break;
}
- /* schedule a new attack, and a destruction of the base */
+ /*
+ * schedule a new attack, and a destruction of
+ * the base
+ */
xresched(e, E_KATSB, 1);
e = xsched(E_KDESB, 1, ix, iy, 0);
/* report it if we can */
if (!damaged(SSRADIO)) {
- printf("\nUhura: Captain, we have received a distress signal\n");
- printf(" from the starbase in quadrant %d,%d.\n",
+ printf("\nUhura: Captain, we have received a "
+ "distress signal\n");
+ printf(" from the starbase in quadrant "
+ "%d,%d.\n",
ix, iy);
restcancel++;
} else {
- /* SSRADIO out, make it so we can't see the distress call */
- /* but it's still there!!! */
+ /*
+ * SSRADIO out, make it so we can't see the
+ * distress call but it's still there!!!
+ */
e->evcode |= E_HIDDEN;
}
break;
@@ -232,8 +246,10 @@ events(int timewarp)
case E_KDESB: /* Klingon destroys starbase */
unschedule(e);
q = &Quad[e->x][e->y];
- /* if the base has mysteriously gone away, or if the Klingon
- got tired and went home, ignore this event */
+ /*
+ * if the base has mysteriously gone away, or if the
+ * Klingon got tired and went home, ignore this event
+ */
if (q->bases <=0 || q->klings <= 0)
break;
/* are we in the same quadrant? */
@@ -252,18 +268,23 @@ events(int timewarp)
/* if we already have too many, throw this one away */
if (Ship.distressed >= MAXDISTR)
break;
- /* try a whole bunch of times to find something suitable */
+ /* try a bunch of times to find something suitable */
for (i = 0; i < 100; i++) {
ix = ranf(NQUADS);
iy = ranf(NQUADS);
q = &Quad[ix][iy];
- /* need a quadrant which is not the current one,
- which has some stars which are inhabited and
- not already under attack, which is not
- supernova'ed, and which has some Klingons in it */
- if (!((ix == Ship.quadx && iy == Ship.quady) || q->stars < 0 ||
- (q->qsystemname & Q_DISTRESSED) ||
- (q->qsystemname & Q_SYSTEM) == 0 || q->klings <= 0))
+ /*
+ * need a quadrant which is not the current
+ * one, which has some inhabited stars which
+ * are not already under attack, which is not
+ * supernova'ed, and which has some Klingons
+ * in it
+ */
+ if (!((ix == Ship.quadx && iy == Ship.quady) ||
+ q->stars < 0 ||
+ (q->qsystemname & Q_DISTRESSED) ||
+ (q->qsystemname & Q_SYSTEM) == 0 ||
+ q->klings <= 0))
break;
}
if (i >= 100)
@@ -277,7 +298,8 @@ events(int timewarp)
/* tell the captain about it if we can */
if (!damaged(SSRADIO)) {
- printf("\nUhura: Captain, starsystem %s in quadrant %d,%d is under attack\n",
+ printf("\nUhura: Captain, starsystem %s in "
+ "quadrant %d,%d is under attack\n",
Systemname[e->systemname], ix, iy);
restcancel++;
} else {
@@ -298,11 +320,13 @@ events(int timewarp)
}
/* play stork and schedule the first baby */
- e = schedule(E_REPRO, Param.eventdly[E_REPRO] * franf(), e->x, e->y, e->systemname);
+ e = schedule(E_REPRO, Param.eventdly[E_REPRO] * franf(),
+ e->x, e->y, e->systemname);
/* report the disaster if we can */
if (!damaged(SSRADIO)) {
- printf("\nUhura: We've lost contact with starsystem %s\n",
+ printf("\nUhura: We've lost contact with "
+ "starsystem %s\n",
Systemname[e->systemname]);
printf(" in quadrant %d,%d.\n",
e->x, e->y);
@@ -335,8 +359,12 @@ events(int timewarp)
if (j < 0 || j >= NQUADS)
continue;
q = &Quad[i][j];
- /* check for this quad ok (not full & no snova) */
- if (q->klings >= MAXKLQUAD || q->stars < 0)
+ /*
+ * check for this quad ok (not
+ * full & no snova)
+ */
+ if (q->klings >= MAXKLQUAD ||
+ q->stars < 0)
continue;
break;
}
@@ -361,7 +389,8 @@ events(int timewarp)
k->y = iy;
k->power = Param.klingpwr;
k->srndreq = 0;
- compkldist(Etc.klingon[0].dist == Etc.klingon[0].avgdist ? 0 : 1);
+ compkldist(Etc.klingon[0].dist ==
+ Etc.klingon[0].avgdist ? 0 : 1);
}
/* recompute time left */
@@ -406,9 +435,12 @@ events(int timewarp)
case SINS:
if (Ship.cond == DOCKED)
break;
- printf("Spock has tried to recalibrate your Space Internal Navigation System,\n");
- printf(" but he has no standard base to calibrate to. Suggest you get\n");
- printf(" to a starbase immediately so that you can properly recalibrate.\n");
+ printf("Spock has tried to recalibrate your "
+ "Space Internal Navigation System,\n");
+ printf(" but he has no standard base to "
+ "calibrate to. Suggest you get\n");
+ printf(" to a starbase immediately so that "
+ "you can properly recalibrate.\n");
Ship.sinsbad = 1;
break;
@@ -422,7 +454,8 @@ events(int timewarp)
break;
}
- if (restcancel && Move.resting && getynpar("Spock: Shall we cancel our rest period"))
+ if (restcancel && Move.resting &&
+ getynpar("Spock: Shall we cancel our rest period"))
Move.time = xdate - idate;
}