+/* $NetBSD: phaser.c,v 1.7 1999/09/08 21:45:33 jsm 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[] = "@(#)phaser.c 5.4 (Berkeley) 6/1/90";
+#if 0
+static char sccsid[] = "@(#)phaser.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: phaser.c,v 1.7 1999/09/08 21:45:33 jsm Exp $");
+#endif
#endif /* not lint */
-# include "trek.h"
-# include "getpar.h"
+#include <stdio.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
/* factors for phaser hits; see description below */
struct cvntab Matab[] =
{
- "m", "anual", (int (*)())1, 0,
- "a", "utomatic", 0, 0,
- 0
+ { "m", "anual", (cmdfun) 1, 0 },
+ { "a", "utomatic", (cmdfun) 0, 0 },
+ { NULL, NULL, NULL, 0 }
};
struct banks
-phaser()
+/*ARGSUSED*/
+void
+phaser(v)
+ int v __attribute__((__unused__));
{
- register int i;
- int j;
- register struct kling *k;
- double dx, dy;
- double anglefactor, distfactor;
- register struct banks *b;
- int manual, flag, extra;
- int hit;
- double tot;
- int n;
- int hitreqd[NBANKS];
- struct banks bank[NBANKS];
- struct cvntab *ptr;
+ int i;
+ int j;
+ struct kling *k;
+ double dx, dy;
+ double anglefactor, distfactor;
+ struct banks *b;
+ int manual, flag, extra = 0;
+ int hit;
+ double tot;
+ int n;
+ int hitreqd[NBANKS];
+ struct banks bank[NBANKS];
+ const struct cvntab *ptr;
- if (Ship.cond == DOCKED)
- return(printf("Phasers cannot fire through starbase shields\n"));
- if (damaged(PHASER))
- return (out(PHASER));
- if (Ship.shldup)
- return (printf("Sulu: Captain, we cannot fire through shields.\n"));
+ if (Ship.cond == DOCKED) {
+ printf("Phasers cannot fire through starbase shields\n");
+ return;
+ }
+ if (damaged(PHASER)) {
+ out(PHASER);
+ return;
+ }
+ if (Ship.shldup) {
+ printf("Sulu: Captain, we cannot fire through shields.\n");
+ return;
+ }
if (Ship.cloaked)
{
printf("Sulu: Captain, surely you must realize that we cannot fire\n");
if (!manual)
{
ptr = getcodpar("Manual or automatic", Matab);
- manual = (int) ptr->value;
+ manual = (long) ptr->value;
}
if (!manual && damaged(COMPUTER))
{
else
{
/* automatic distribution of power */
- if (Etc.nkling <= 0)
- return (printf("Sulu: But there are no Klingons in this quadrant\n"));
+ if (Etc.nkling <= 0) {
+ printf("Sulu: But there are no Klingons in this quadrant\n");
+ return;
+ }
printf("Phasers locked on target. ");
while (flag)
{