From 04b8b3500b4c9df35ceefed6fdc1f8dfa9560447 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 24 May 2009 22:55:03 +0000 Subject: Split up lines > 80 chars. Object files unchanged. --- trek/attack.c | 22 ++++++++----- trek/autover.c | 10 +++--- trek/capture.c | 7 ++-- trek/computer.c | 38 ++++++++++++++-------- trek/dcrept.c | 7 ++-- trek/dock.c | 7 ++-- trek/dumpme.c | 10 +++--- trek/dumpssradio.c | 10 +++--- trek/events.c | 95 ++++++++++++++++++++++++++++++++++++------------------ trek/help.c | 7 ++-- trek/impulse.c | 7 ++-- trek/kill.c | 19 +++++++---- trek/klmove.c | 25 ++++++++------ trek/lrscan.c | 7 ++-- trek/main.c | 7 ++-- trek/move.c | 16 +++++---- trek/phaser.c | 13 +++++--- trek/ram.c | 7 ++-- trek/schedule.c | 15 ++++++--- trek/score.c | 10 +++--- trek/shield.c | 13 +++++--- trek/snova.c | 16 +++++---- trek/srscan.c | 10 +++--- trek/torped.c | 20 ++++++++---- trek/trek.h | 19 +++++------ trek/warp.c | 20 ++++++++---- trek/win.c | 9 +++--- 27 files changed, 280 insertions(+), 166 deletions(-) (limited to 'trek') diff --git a/trek/attack.c b/trek/attack.c index 6dbfc872..a9bc4e20 100644 --- a/trek/attack.c +++ b/trek/attack.c @@ -1,4 +1,4 @@ -/* $NetBSD: attack.c,v 1.8 2009/05/24 21:55:24 dholland Exp $ */ +/* $NetBSD: attack.c,v 1.9 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)attack.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: attack.c,v 1.8 2009/05/24 21:55:24 dholland Exp $"); +__RCSID("$NetBSD: attack.c,v 1.9 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -94,7 +94,8 @@ attack(int resting) klmove(0); if (Ship.cond == DOCKED) { if (!resting) - printf("Starbase shields protect the %s\n", Ship.shipname); + printf("Starbase shields protect the %s\n", + Ship.shipname); return; } /* setup shield effectiveness */ @@ -120,7 +121,8 @@ attack(int resting) hit = Etc.klingon[i].power * pow(dustfac, tothe) * Param.hitfac; /* deplete his energy */ dustfac = Etc.klingon[i].power; - Etc.klingon[i].power = dustfac * Param.phasfac * (1.0 + (franf() - 0.5) * 0.2); + Etc.klingon[i].power = dustfac * Param.phasfac * + (1.0 + (franf() - 0.5) * 0.2); /* see how much of hit shields will absorb */ shldabsb = 0; if (Ship.shldup || Move.shldchg) { @@ -134,7 +136,8 @@ attack(int resting) /* actually do the hit */ printf("\aHIT: %d units", hit); if (!damaged(SRSCAN)) - printf(" from %d,%d", Etc.klingon[i].x, Etc.klingon[i].y); + printf(" from %d,%d", + Etc.klingon[i].x, Etc.klingon[i].y); cas = (shldabsb * 100) / hit; hit -= shldabsb; if (shldabsb > 0) @@ -155,12 +158,14 @@ attack(int resting) cas -= Param.damprob[l]; l -= 1; /* compute amount of damage */ - extradm = (hit * Param.damfac[l]) / (75 + ranf(25)) + 0.5; + extradm = (hit * Param.damfac[l]) / + (75 + ranf(25)) + 0.5; /* damage the device */ damage(l, extradm); if (damaged(SHIELD)) { if (Ship.shldup) - printf("Sulu: Shields knocked down, captain.\n"); + printf("Sulu: Shields knocked down, " + "captain.\n"); Ship.shldup = 0; Move.shldchg = 0; } @@ -173,7 +178,8 @@ attack(int resting) if (maxhit >= 200 || tothit >= 500) { cas = tothit * 0.015 * franf(); if (cas >= 2) { - printf("McCoy: we suffered %d casualties in that attack.\n", + printf("McCoy: we suffered %d casualties in that " + "attack.\n", cas); Game.deaths += cas; Ship.crew -= cas; diff --git a/trek/autover.c b/trek/autover.c index 5bdc8d7e..af2fe0cd 100644 --- a/trek/autover.c +++ b/trek/autover.c @@ -1,4 +1,4 @@ -/* $NetBSD: autover.c,v 1.6 2009/05/24 19:18:44 dholland Exp $ */ +/* $NetBSD: autover.c,v 1.7 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)autover.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: autover.c,v 1.6 2009/05/24 19:18:44 dholland Exp $"); +__RCSID("$NetBSD: autover.c,v 1.7 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -65,8 +65,10 @@ autover(void) double dist; int course; - printf("\07RED ALERT: The %s is in a supernova quadrant\n", Ship.shipname); - printf("*** Emergency override attempts to hurl %s to safety\n", Ship.shipname); + printf("\07RED ALERT: The %s is in a supernova quadrant\n", + Ship.shipname); + printf("*** Emergency override attempts to hurl %s to safety\n", + Ship.shipname); /* let's get our ass out of here */ Ship.warp = 6.0 + 2.0 * franf(); Ship.warp2 = Ship.warp * Ship.warp; diff --git a/trek/capture.c b/trek/capture.c index 510e4346..bc3d0932 100644 --- a/trek/capture.c +++ b/trek/capture.c @@ -1,4 +1,4 @@ -/* $NetBSD: capture.c,v 1.10 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: capture.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[] = "@(#)capture.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: capture.c,v 1.10 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: capture.c,v 1.11 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -99,7 +99,8 @@ capture(int v __unused) printf("Klingon at %d,%d surrenders\n", k->x, k->y); i = ranf(Param.klingcrew); if ( i > 0 ) - printf("%d klingons commit suicide rather than be taken captive\n", Param.klingcrew - i); + printf("%d klingons commit suicide rather than be " + "taken captive\n", Param.klingcrew - i); if (i > Ship.brigfree) i = Ship.brigfree; Ship.brigfree -= i; diff --git a/trek/computer.c b/trek/computer.c index f1f944be..04c62f53 100644 --- a/trek/computer.c +++ b/trek/computer.c @@ -1,4 +1,4 @@ -/* $NetBSD: computer.c,v 1.13 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: computer.c,v 1.14 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: computer.c,v 1.13 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: computer.c,v 1.14 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -128,7 +128,8 @@ computer(int v __unused) switch ((long)r->value) { case 1: /* star chart */ - printf("Computer record of galaxy for all long range sensor scans\n\n"); + printf("Computer record of galaxy for all long range " + "sensor scans\n\n"); printf(" "); /* print top header */ for (i = 0; i < NQUADS; i++) @@ -137,7 +138,8 @@ computer(int v __unused) for (i = 0; i < NQUADS; i++) { printf("%d ", i); for (j = 0; j < NQUADS; j++) { - if (i == Ship.quadx && j == Ship.quady) { + if (i == Ship.quadx && + j == Ship.quady) { printf("$$$ "); continue; } @@ -152,7 +154,8 @@ computer(int v __unused) if (q->scanned < 0) printf("... "); else - printf("%3d ", q->scanned); + printf("%3d ", + q->scanned); } printf("%d\n", i); } @@ -173,8 +176,11 @@ computer(int v __unused) } /* for each Klingon, give the course & distance */ for (i = 0; i < Etc.nkling; i++) { - printf("Klingon at %d,%d", Etc.klingon[i].x, Etc.klingon[i].y); - course = kalc(Ship.quadx, Ship.quady, Etc.klingon[i].x, Etc.klingon[i].y, &dist); + printf("Klingon at %d,%d", + Etc.klingon[i].x, Etc.klingon[i].y); + course = kalc(Ship.quadx, Ship.quady, + Etc.klingon[i].x, + Etc.klingon[i].y, &dist); prkalc(course, dist); } break; @@ -205,7 +211,8 @@ computer(int v __unused) break; } printf("%d,%d/%d,%d to %d,%d/%d,%d", - Ship.quadx, Ship.quady, Ship.sectx, Ship.secty, tqx, tqy, ix, iy); + Ship.quadx, Ship.quady, Ship.sectx, Ship.secty, + tqx, tqy, ix, iy); prkalc(course, dist); break; @@ -219,7 +226,8 @@ computer(int v __unused) break; dist *= 10.0; cost = pow(0.90, dist) * 98.0 + 0.5; - printf("Phasers are %d%% effective at that range\n", cost); + printf("Phasers are %d%% effective at that range\n", + cost); break; case 6: /* warp cost (time/energy) */ @@ -231,7 +239,8 @@ computer(int v __unused) warpfact = Ship.warp; cost = (dist + 0.05) * warpfact * warpfact * warpfact; time = Param.warptime * dist / (warpfact * warpfact); - printf("Warp %.2f distance %.2f cost %.2f stardates %d (%d w/ shlds up) units\n", + printf("Warp %.2f distance %.2f cost %.2f " + "stardates %d (%d w/ shlds up) units\n", warpfact, dist, time, cost, cost + cost); break; @@ -257,15 +266,18 @@ computer(int v __unused) switch (e->evcode & E_EVENT) { case E_KDESB: - printf("Klingon is attacking starbase in quadrant %d,%d\n", + printf("Klingon is attacking starbase " + "in quadrant %d,%d\n", e->x, e->y); j = 0; break; case E_ENSLV: case E_REPRO: - printf("Starsystem %s in quadrant %d,%d is distressed\n", - Systemname[e->systemname], e->x, e->y); + printf("Starsystem %s in quadrant " + "%d,%d is distressed\n", + Systemname[e->systemname], + e->x, e->y); j = 0; break; } diff --git a/trek/dcrept.c b/trek/dcrept.c index e12ea304..eebd0349 100644 --- a/trek/dcrept.c +++ b/trek/dcrept.c @@ -1,4 +1,4 @@ -/* $NetBSD: dcrept.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: dcrept.c,v 1.10 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dcrept.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dcrept.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: dcrept.c,v 1.10 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -89,7 +89,8 @@ dcrept(int v __unused) /* compute time till fixed, then adjust by the magic factors */ x = e->date - Now.date; printf("%-24s%7.2f %7.2f\n", - Device[e->systemname].name, x * m1 + 0.005, x * m2 + 0.005); + Device[e->systemname].name, x * m1 + 0.005, + x * m2 + 0.005); /* do a little consistancy checking */ } diff --git a/trek/dock.c b/trek/dock.c index 9abab3f7..2e93600d 100644 --- a/trek/dock.c +++ b/trek/dock.c @@ -1,4 +1,4 @@ -/* $NetBSD: dock.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: dock.c,v 1.10 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dock.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dock.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: dock.c,v 1.10 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -83,7 +83,8 @@ dock(int v __unused) } } if (!ok) { - printf("Chekov: But captain, we are not adjacent to a starbase.\n"); + printf("Chekov: But captain, we are not adjacent to a " + "starbase.\n"); return; } diff --git a/trek/dumpme.c b/trek/dumpme.c index d723d4d4..ce53d5d6 100644 --- a/trek/dumpme.c +++ b/trek/dumpme.c @@ -1,4 +1,4 @@ -/* $NetBSD: dumpme.c,v 1.7 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: dumpme.c,v 1.8 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dumpme.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dumpme.c,v 1.7 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: dumpme.c,v 1.8 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -71,8 +71,10 @@ dumpme(int flag) if (f) { printf("%s falls into a black hole.\n", Ship.shipname); } else { - printf("Computer applies full reverse power to avoid hitting the\n"); - printf(" negative energy barrier. A space warp was entered.\n"); + printf("Computer applies full reverse power to avoid hitting " + "the\n"); + printf(" negative energy barrier. A space warp was " + "entered.\n"); } /* bump repair dates forward */ for (i = 0; i < MAXEVENTS; i++) { diff --git a/trek/dumpssradio.c b/trek/dumpssradio.c index ce147392..1312a908 100644 --- a/trek/dumpssradio.c +++ b/trek/dumpssradio.c @@ -1,4 +1,4 @@ -/* $NetBSD: dumpssradio.c,v 1.7 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: dumpssradio.c,v 1.8 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dumpssradio.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dumpssradio.c,v 1.7 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: dumpssradio.c,v 1.8 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -60,7 +60,8 @@ dumpssradio(void) continue; if (e->evcode & E_GHOST) { unschedule(e); - printf("Starsystem %s in quadrant %d,%d is no longer distressed\n", + printf("Starsystem %s in quadrant %d,%d is no longer " + "distressed\n", systemname(&Quad[e->x][e->y]), e->x, e->y); continue; } @@ -75,7 +76,8 @@ dumpssradio(void) case E_ENSLV: case E_REPRO: - printf("Starsystem %s in quadrant %d,%d is distressed\n", + printf("Starsystem %s in quadrant %d,%d is " + "distressed\n", systemname(&Quad[e->x][e->y]), e->x, e->y); chkrest++; break; 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; } diff --git a/trek/help.c b/trek/help.c index 027f7aa8..021a30ee 100644 --- a/trek/help.c +++ b/trek/help.c @@ -1,4 +1,4 @@ -/* $NetBSD: help.c,v 1.11 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: help.c,v 1.12 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)help.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: help.c,v 1.11 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: help.c,v 1.12 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -140,7 +140,8 @@ help(int v __unused) if (dx < 0 || dx >= NSECTS) continue; dy = Etc.starbase.y + ranf(3) - 1; - if (dy < 0 || dy >= NSECTS || Sect[dx][dy] != EMPTY) + if (dy < 0 || dy >= NSECTS || + Sect[dx][dy] != EMPTY) continue; break; } diff --git a/trek/impulse.c b/trek/impulse.c index b1491d0a..49358bd2 100644 --- a/trek/impulse.c +++ b/trek/impulse.c @@ -1,4 +1,4 @@ -/* $NetBSD: impulse.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: impulse.c,v 1.10 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)impulse.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: impulse.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: impulse.c,v 1.10 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -68,7 +68,8 @@ impulse(int v __unused) power = 20 + 100 * dist; percent = 100 * power / Ship.energy + 0.5; if (percent >= 85) { - printf("Scotty: That would consume %d%% of our remaining energy.\n", + printf("Scotty: That would consume %d%% of our remaining " + "energy.\n", percent); if (!getynpar("Are you sure that is wise")) return; diff --git a/trek/kill.c b/trek/kill.c index 51818827..5f321204 100644 --- a/trek/kill.c +++ b/trek/kill.c @@ -1,4 +1,4 @@ -/* $NetBSD: kill.c,v 1.10 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: kill.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[] = "@(#)kill.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: kill.c,v 1.10 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: kill.c,v 1.11 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -125,11 +125,14 @@ killb(int qx, int qy) Sect[Etc.starbase.x][Etc.starbase.y] = EMPTY; if (Ship.cond == DOCKED) undock(0); - printf("Starbase at %d,%d destroyed\n", Etc.starbase.x, Etc.starbase.y); + printf("Starbase at %d,%d destroyed\n", + Etc.starbase.x, Etc.starbase.y); } else { if (!damaged(SSRADIO)) { - printf("Uhura: Starfleet command reports that the starbase in\n"); - printf(" quadrant %d,%d has been destroyed\n", qx, qy); + printf("Uhura: Starfleet command reports that the " + "starbase in\n"); + printf(" quadrant %d,%d has been destroyed\n", + qx, qy); } else schedule(E_KATSB | E_GHOST, TOOLARGE, qx, qy, 0); @@ -200,7 +203,8 @@ killd(int x, int y, int f) switch (e->evcode) { case E_KDESB: if (f) { - printf("Distress call for starbase in %d,%d nullified\n", + printf("Distress call for starbase in " + "%d,%d nullified\n", x, y); unschedule(e); } @@ -209,7 +213,8 @@ killd(int x, int y, int f) case E_ENSLV: case E_REPRO: if (f) { - printf("Distress call for %s in quadrant %d,%d nullified\n", + printf("Distress call for %s in quadrant " + "%d,%d nullified\n", Systemname[e->systemname], x, y); q->qsystemname = e->systemname; unschedule(e); diff --git a/trek/klmove.c b/trek/klmove.c index 328b8a86..4963f6be 100644 --- a/trek/klmove.c +++ b/trek/klmove.c @@ -1,4 +1,4 @@ -/* $NetBSD: klmove.c,v 1.8 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: klmove.c,v 1.9 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)klmove.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: klmove.c,v 1.8 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: klmove.c,v 1.9 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -114,7 +114,8 @@ klmove(int fl) for (; motion > 0; motion--) { lookx = nextx + dx; looky = nexty + dy; - if (lookx < 0 || lookx >= NSECTS || looky < 0 || looky >= NSECTS) { + if (lookx < 0 || lookx >= NSECTS || + looky < 0 || looky >= NSECTS) { /* new quadrant */ qx = Ship.quadx; qy = Ship.quady; @@ -128,18 +129,23 @@ klmove(int fl) else if (looky >= NSECTS) qy += 1; - if (qx < 0 || qx >= NQUADS || qy < 0 || qy >= NQUADS || - Quad[qx][qy].stars < 0 || Quad[qx][qy].klings > MAXKLQUAD - 1) + if (qx < 0 || qx >= NQUADS || + qy < 0 || qy >= NQUADS || + Quad[qx][qy].stars < 0 || + Quad[qx][qy].klings > MAXKLQUAD - 1) break; if (!damaged(SRSCAN)) { - printf("Klingon at %d,%d escapes to quadrant %d,%d\n", + printf("Klingon at %d,%d escapes to " + "quadrant %d,%d\n", k->x, k->y, qx, qy); motion = Quad[qx][qy].scanned; if (motion >= 0 && motion < 1000) Quad[qx][qy].scanned += 100; - motion = Quad[Ship.quadx][Ship.quady].scanned; + motion = Quad[Ship.quadx][Ship.quady] + .scanned; if (motion >= 0 && motion < 1000) - Quad[Ship.quadx][Ship.quady].scanned -= 100; + Quad[Ship.quadx][Ship.quady] + .scanned -= 100; } Sect[k->x][k->y] = EMPTY; Quad[qx][qy].klings += 1; @@ -156,7 +162,8 @@ klmove(int fl) if (Sect[lookx][looky] != EMPTY) { fudgex = -fudgex; looky = nexty + fudgey; - if (looky < 0 || looky >= NSECTS || Sect[lookx][looky] != EMPTY) { + if (looky < 0 || looky >= NSECTS || + Sect[lookx][looky] != EMPTY) { fudgey = -fudgey; break; } diff --git a/trek/lrscan.c b/trek/lrscan.c index 78b53ed9..7501fee0 100644 --- a/trek/lrscan.c +++ b/trek/lrscan.c @@ -1,4 +1,4 @@ -/* $NetBSD: lrscan.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: lrscan.c,v 1.10 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)lrscan.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: lrscan.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: lrscan.c,v 1.10 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -63,7 +63,8 @@ lrscan(int v __unused) if (check_out(LRSCAN)) { return; } - printf("Long range scan for quadrant %d,%d\n\n", Ship.quadx, Ship.quady); + printf("Long range scan for quadrant %d,%d\n\n", + Ship.quadx, Ship.quady); /* print the header on top */ for (j = Ship.quady - 1; j <= Ship.quady + 1; j++) { diff --git a/trek/main.c b/trek/main.c index f82a18d2..e95bb50a 100644 --- a/trek/main.c +++ b/trek/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.16 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: main.c,v 1.17 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.16 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.17 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -230,7 +230,8 @@ main(int argc, char **argv) f_log = fopen(av[0], opencode); */ - printf("\n * * * S T A R T R E K * * *\n\nPress return to continue.\n"); + printf("\n * * * S T A R T R E K * * *\n\n" + "Press return to continue.\n"); if (setjmp(env)) { if ( !getynpar("Another game") ) diff --git a/trek/move.c b/trek/move.c index 14edb4fa..2ba6106b 100644 --- a/trek/move.c +++ b/trek/move.c @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: move.c,v 1.10 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: move.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: move.c,v 1.10 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -118,7 +118,8 @@ move(int ramflag, int course, double time, double speed) evtime = Now.eventptr[E_LRTB]->date - Now.date; #ifdef xTRACE if (Trace) - printf("E.ep = %p, ->evcode = %d, ->date = %.2f, evtime = %.2f\n", + printf("E.ep = %p, ->evcode = %d, ->date = %.2f, " + "evtime = %.2f\n", Now.eventptr[E_LRTB], Now.eventptr[E_LRTB]->evcode, Now.eventptr[E_LRTB]->date, evtime); #endif @@ -138,7 +139,8 @@ move(int ramflag, int course, double time, double speed) n = xn + 0.5; #ifdef xTRACE if (Trace) - printf("dx = %.2f, dy = %.2f, xn = %.2f, n = %d\n", dx, dy, xn, n); + printf("dx = %.2f, dy = %.2f, xn = %.2f, n = %d\n", + dx, dy, xn, n); #endif Move.free = 0; @@ -147,7 +149,8 @@ move(int ramflag, int course, double time, double speed) iy = (y += dy); #ifdef xTRACE if (Trace) - printf("ix = %d, x = %.2f, iy = %d, y = %.2f\n", ix, x, iy, y); + printf("ix = %d, x = %.2f, iy = %d, y = %.2f\n", + ix, x, iy, y); #endif if (x < 0.0 || y < 0.0 || x >= sectsize || y >= sectsize) { /* enter new quadrant */ @@ -191,7 +194,8 @@ move(int ramflag, int course, double time, double speed) if (!damaged(COMPUTER) && ramflag <= 0) { ix = x - dx; iy = y - dy; - printf("Computer reports navigation error; %s stopped at %d,%d\n", + printf("Computer reports navigation error; " + "%s stopped at %d,%d\n", Ship.shipname, ix, iy); Ship.energy -= Param.stopengy * speed; break; diff --git a/trek/phaser.c b/trek/phaser.c index e3cfbfdc..cb2c0791 100644 --- a/trek/phaser.c +++ b/trek/phaser.c @@ -1,4 +1,4 @@ -/* $NetBSD: phaser.c,v 1.13 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: phaser.c,v 1.14 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)phaser.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: phaser.c,v 1.13 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: phaser.c,v 1.14 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -121,7 +121,8 @@ phaser(int v __unused) return; } if (Ship.cloaked) { - printf("Sulu: Captain, surely you must realize that we cannot fire\n"); + printf("Sulu: Captain, surely you must realize that we cannot " + "fire\n"); printf(" phasers with the cloaking device up.\n"); return; } @@ -190,7 +191,8 @@ phaser(int v __unused) } else { /* automatic distribution of power */ if (Etc.nkling <= 0) { - printf("Sulu: But there are no Klingons in this quadrant\n"); + printf("Sulu: But there are no Klingons in this " + "quadrant\n"); return; } printf("Phasers locked on target. "); @@ -215,7 +217,8 @@ phaser(int v __unused) k = &Etc.klingon[i]; b = &bank[i]; distfactor = k->dist; - anglefactor = ALPHA * BETA * OMEGA / (distfactor * distfactor + EPSILON); + anglefactor = ALPHA * BETA * OMEGA / + (distfactor * distfactor + EPSILON); anglefactor *= GAMMA; distfactor = k->power; distfactor /= anglefactor; diff --git a/trek/ram.c b/trek/ram.c index ee706a25..ee6b67d3 100644 --- a/trek/ram.c +++ b/trek/ram.c @@ -1,4 +1,4 @@ -/* $NetBSD: ram.c,v 1.7 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: ram.c,v 1.8 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)ram.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: ram.c,v 1.7 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: ram.c,v 1.8 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -72,7 +72,8 @@ ram(int ix, int iy) case INHABIT: printf("Yeoman Rand: Captain, isn't it getting hot in here?\n"); sleep(2); - printf("Spock: Hull temperature approaching 550 Degrees Kelvin.\n"); + printf("Spock: Hull temperature approaching 550 Degrees " + "Kelvin.\n"); lose(L_STAR); case BASE: diff --git a/trek/schedule.c b/trek/schedule.c index 286eb252..89576f06 100644 --- a/trek/schedule.c +++ b/trek/schedule.c @@ -1,4 +1,4 @@ -/* $NetBSD: schedule.c,v 1.10 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: schedule.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[] = "@(#)schedule.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: schedule.c,v 1.10 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: schedule.c,v 1.11 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -69,7 +69,8 @@ schedule(int type, double offset, int x, int y, int z) /* got a slot */ #ifdef xTRACE if (Trace) - printf("schedule: type %d @ %.2f slot %d parm %d %d %d\n", + printf("schedule: type %d @ %.2f " + "slot %d parm %d %d %d\n", type, date, i, x, y, z); #endif e->evcode = type; @@ -146,9 +147,11 @@ struct event * xsched(int ev1, int factor, int x, int y, int z) { int ev; + double when; ev = ev1; - return (schedule(ev, -Param.eventdly[ev] * Param.time * log(franf()) / factor, x, y, z)); + when = -Param.eventdly[ev] * Param.time * log(franf()) / factor; + return (schedule(ev, when, x, y, z)); } @@ -164,8 +167,10 @@ xresched(struct event *e1, int ev1, int factor) { int ev; struct event *e; + double when; ev = ev1; e = e1; - reschedule(e, -Param.eventdly[ev] * Param.time * log(franf()) / factor); + when = -Param.eventdly[ev] * Param.time * log(franf()) / factor; + reschedule(e, when); } diff --git a/trek/score.c b/trek/score.c index c19c7cbc..eff3f8d8 100644 --- a/trek/score.c +++ b/trek/score.c @@ -1,4 +1,4 @@ -/* $NetBSD: score.c,v 1.7 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: score.c,v 1.8 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: score.c,v 1.7 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: score.c,v 1.8 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -69,10 +69,12 @@ score(void) r /= Game.killk + 1; s += (t = -400 * r); if (t != 0) - printf("Penalty for %d klingons remaining\t%6d\n", Now.klings, t); + printf("Penalty for %d klingons remaining\t%6d\n", Now.klings, + t); if (Move.endgame > 0) { s += (t = 100 * (u = Game.skill)); - printf("Bonus for winning a %s%s game\t\t%6d\n", Skitab[u - 1].abrev, Skitab[u - 1].full, t); + printf("Bonus for winning a %s%s game\t\t%6d\n", + Skitab[u - 1].abrev, Skitab[u - 1].full, t); } if (Game.killed) { s -= 500; diff --git a/trek/shield.c b/trek/shield.c index d1030dbf..ed484300 100644 --- a/trek/shield.c +++ b/trek/shield.c @@ -1,4 +1,4 @@ -/* $NetBSD: shield.c,v 1.10 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: shield.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[] = "@(#)shield.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: shield.c,v 1.10 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: shield.c,v 1.11 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -80,7 +80,8 @@ shield(int f) if (f < 0) { /* cloaking device */ if (Ship.ship == QUEENE) { - printf("Ye Faire Queene does not have the cloaking device.\n"); + printf("Ye Faire Queene does not have the " + "cloaking device.\n"); return; } device = "Cloaking device"; @@ -110,9 +111,11 @@ shield(int f) i = (long) r->value; } else { if (*stat) - (void)sprintf(s, "%s %s up. Do you want %s down", device, dev2, dev3); + (void)sprintf(s, "%s %s up. Do you want %s down", + device, dev2, dev3); else - (void)sprintf(s, "%s %s down. Do you want %s up", device, dev2, dev3); + (void)sprintf(s, "%s %s down. Do you want %s up", + device, dev2, dev3); if (!getynpar(s)) return; i = !*stat; diff --git a/trek/snova.c b/trek/snova.c index b3b3ed46..d391292a 100644 --- a/trek/snova.c +++ b/trek/snova.c @@ -1,4 +1,4 @@ -/* $NetBSD: snova.c,v 1.8 2009/05/24 21:55:24 dholland Exp $ */ +/* $NetBSD: snova.c,v 1.9 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)snova.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: snova.c,v 1.8 2009/05/24 21:55:24 dholland Exp $"); +__RCSID("$NetBSD: snova.c,v 1.9 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -89,7 +89,8 @@ snova(int x, int y) n = ranf(q->stars); for (ix = 0; ix < NSECTS; ix++) { for (iy = 0; iy < NSECTS; iy++) - if (Sect[ix][iy] == STAR || Sect[ix][iy] == INHABIT) + if (Sect[ix][iy] == STAR || + Sect[ix][iy] == INHABIT) if ((n -= 1) <= 0) break; if (n <= 0) @@ -120,8 +121,10 @@ snova(int x, int y) } else { if (!damaged(SSRADIO)) { q->scanned = 1000; - printf("\nUhura: Captain, Starfleet Command reports a supernova\n"); - printf(" in quadrant %d,%d. Caution is advised\n", qx, qy); + printf("\nUhura: Captain, Starfleet Command reports " + "a supernova\n"); + printf(" in quadrant %d,%d. Caution is advised\n", + qx, qy); } } @@ -143,7 +146,8 @@ snova(int x, int y) q->stars = -1; q->klings = 0; if (Now.klings <= 0) { - printf("Lucky devil, that supernova destroyed the last klingon\n"); + printf("Lucky devil, that supernova destroyed the last " + "klingon\n"); win(); } return; diff --git a/trek/srscan.c b/trek/srscan.c index df3010ab..4d6272c8 100644 --- a/trek/srscan.c +++ b/trek/srscan.c @@ -1,4 +1,4 @@ -/* $NetBSD: srscan.c,v 1.8 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: srscan.c,v 1.9 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)srscan.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: srscan.c,v 1.8 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: srscan.c,v 1.9 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -120,7 +120,8 @@ srscan(int f) printf(", CLOAKED"); break; case 2: - printf("position %d,%d/%d,%d",Ship.quadx, Ship.quady, Ship.sectx, Ship.secty); + printf("position %d,%d/%d,%d", Ship.quadx, + Ship.quady, Ship.sectx, Ship.secty); break; case 3: printf("warp factor %.1f", Ship.warp); @@ -149,7 +150,8 @@ srscan(int f) case 9: printf("life support "); if (damaged(LIFESUP)) { - printf("damaged, reserves = %.2f", Ship.reserves); + printf("damaged, reserves = %.2f", + Ship.reserves); break; } printf("active"); diff --git a/trek/torped.c b/trek/torped.c index 3f655ae8..388f69e1 100644 --- a/trek/torped.c +++ b/trek/torped.c @@ -1,4 +1,4 @@ -/* $NetBSD: torped.c,v 1.12 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: torped.c,v 1.13 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)torped.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: torped.c,v 1.12 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: torped.c,v 1.13 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -80,7 +80,8 @@ torped(int v __unused) int n; if (Ship.cloaked) { - printf("Federation regulations do not permit attack while cloaked.\n"); + printf("Federation regulations do not permit attack while " + "cloaked.\n"); return; } if (check_out(TORPED)) @@ -150,7 +151,8 @@ torped(int v __unused) while (1) { ix = x += dx; iy = y += dy; - if (x < 0.0 || x >= sectsize || y < 0.0 || y >= sectsize) { + if (x < 0.0 || x >= sectsize || + y < 0.0 || y >= sectsize) { printf("Torpedo missed\n"); break; } @@ -160,16 +162,20 @@ torped(int v __unused) continue; case HOLE: - printf("Torpedo disappears into a black hole\n"); + printf("Torpedo disappears into a black " + "hole\n"); break; case KLINGON: for (k = 0; k < Etc.nkling; k++) { - if (Etc.klingon[k].x != ix || Etc.klingon[k].y != iy) + if (Etc.klingon[k].x != ix || + Etc.klingon[k].y != iy) continue; Etc.klingon[k].power -= 500 + ranf(501); if (Etc.klingon[k].power > 0) { - printf("*** Hit on Klingon at %d,%d: extensive damages\n", + printf("*** Hit on Klingon at " + "%d,%d: extensive " + "damages\n", ix, iy); break; } diff --git a/trek/trek.h b/trek/trek.h index a30d9976..26fe2e28 100644 --- a/trek/trek.h +++ b/trek/trek.h @@ -1,4 +1,4 @@ -/* $NetBSD: trek.h,v 1.14 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: trek.h,v 1.15 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -232,7 +232,7 @@ struct Ship_struct { int secty; /* sector y coord */ unsigned char cond; /* condition code */ /* sinsbad is set if SINS is working but not calibrated */ - char sinsbad; /* Space Inertial Navigation System condition */ + char sinsbad; /* Space Inertial Navigation System condition*/ const char *shipname; /* name of current starship */ char ship; /* current starship */ int distressed; /* number of distress calls */ @@ -321,13 +321,14 @@ extern struct Now_struct Now; /* Other stuff, not dumped in a snapshot */ struct Etc_struct { - struct kling klingon[MAXKLQUAD]; /* sorted Klingon list */ - short nkling; /* number of Klingons in this sector */ - /* < 0 means automatic override mode */ - char fast; /* set if speed > 300 baud */ - struct xy starbase; /* starbase in current quadrant */ - char snapshot[sizeof Quad + sizeof Event + sizeof Now]; /* snapshot for time warp */ - char statreport; /* set to get a status report on a srscan */ + struct kling klingon[MAXKLQUAD];/* sorted Klingon list */ + short nkling; /* number of Klingons in this sector */ + /* < 0 means automatic override mode */ + char fast; /* set if speed > 300 baud */ + struct xy starbase; /* starbase in current quadrant */ + char snapshot[sizeof Quad + sizeof Event + sizeof Now]; + /* snapshot for time warp */ + char statreport; /* set to get a status report on a srscan */ }; extern struct Etc_struct Etc; diff --git a/trek/warp.c b/trek/warp.c index 14e9e8bd..1e792ebc 100644 --- a/trek/warp.c +++ b/trek/warp.c @@ -1,4 +1,4 @@ -/* $NetBSD: warp.c,v 1.10 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: warp.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[] = "@(#)warp.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: warp.c,v 1.10 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: warp.c,v 1.11 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -84,6 +84,7 @@ warp(int fl, int c, double d) double frac; int percent; int i; + double repairs; if (Ship.cond == DOCKED) { printf("%s is docked\n", Ship.shipname); @@ -101,7 +102,8 @@ warp(int fl, int c, double d) power = (dist + 0.05) * Ship.warp3; percent = 100 * power / Ship.energy + 0.5; if (percent >= 85) { - printf("Scotty: That would consume %d%% of our remaining energy.\n", + printf("Scotty: That would consume %d%% of our remaining " + "energy.\n", percent); if (!getynpar("Are you sure that is wise")) return; @@ -125,7 +127,8 @@ warp(int fl, int c, double d) frac = franf(); dist *= frac; time *= frac; - damage(WARP, (frac + 1.0) * Ship.warp * (franf() + 0.25) * 0.20); + repairs = (frac + 1.0) * Ship.warp * (franf() + 0.25) * 0.20; + damage(WARP, repairs); } /* do the move */ @@ -157,7 +160,8 @@ warp(int fl, int c, double d) /* positive time warp */ time = (Ship.warp - 8.0) * dist * (franf() + 1.0); Now.date += time; - printf("Positive time portal entered -- it is now Stardate %.2f\n", + printf("Positive time portal entered -- " + "it is now Stardate %.2f\n", Now.date); for (i = 0; i < MAXEVENTS; i++) { percent = Event[i].evcode; @@ -175,7 +179,8 @@ warp(int fl, int c, double d) memcpy(p, Event, sizeof Event); p += sizeof Event; memcpy(p, &Now, sizeof Now); - printf("Negative time portal entered -- it is now Stardate %.2f\n", + printf("Negative time portal entered -- " + "it is now Stardate %.2f\n", Now.date); for (i = 0; i < MAXEVENTS; i++) if (Event[i].evcode == E_FIXDV) @@ -186,7 +191,8 @@ warp(int fl, int c, double d) /* test for just a lot of damage */ if (percent < 80) lose(L_TOOFAST); - printf("Equilibrium restored -- extreme damage occurred to ship systems\n"); + printf("Equilibrium restored -- " + "extreme damage occurred to ship systems\n"); for (i = 0; i < NDEV; i++) damage(i, (3.0 * (franf() + franf()) + 1.0) * Param.damfac[i]); Ship.shldup = 0; diff --git a/trek/win.c b/trek/win.c index 2516113e..d0c6328c 100644 --- a/trek/win.c +++ b/trek/win.c @@ -1,4 +1,4 @@ -/* $NetBSD: win.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: win.c,v 1.10 2009/05/24 22:55:03 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)win.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: win.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: win.c,v 1.10 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -73,8 +73,9 @@ win(void) s = score(); /* decide if she gets a promotion */ - if (Game.helps == 0 && Game.killb == 0 && Game.killinhab == 0 && 5 * Game.kills + Game.deaths < 100 && - s >= 1000 && Ship.ship == ENTERPRISE) { + if (Game.helps == 0 && Game.killb == 0 && Game.killinhab == 0 && + 5 * Game.kills + Game.deaths < 100 && + s >= 1000 && Ship.ship == ENTERPRISE) { printf("In fact, you are promoted one step in rank,\n"); if (Game.skill >= 6) { printf("to the exalted rank of Commodore Emeritus\n"); -- cgit v1.2.3-56-ge451