+/* $NetBSD: capture.c,v 1.12 2009/08/12 08:54:54 dholland 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
* 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
-/*static char sccsid[] = "from: @(#)capture.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: capture.c,v 1.2 1993/08/01 18:50:51 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)capture.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: capture.c,v 1.12 2009/08/12 08:54:54 dholland Exp $");
+#endif
#endif /* not lint */
-# include "trek.h"
+#include <stdio.h>
+#include "trek.h"
+
+static struct kling *selectklingon(void);
/*
** Ask a Klingon To Surrender
** etc.
*/
-capture()
+/*ARGSUSED*/
+void
+capture(int v __unused)
{
- register int i;
- register struct kling *k;
+ int i;
+ struct kling *k;
double x;
- extern struct kling *selectklingon();
/* check for not cloaked */
- if (Ship.cloaked)
- {
+ if (Ship.cloaked) {
printf("Ship-ship communications out when cloaked\n");
return;
}
- if (damaged(SSRADIO))
- return (out(SSRADIO));
+ if (damaged(SSRADIO)) {
+ out(SSRADIO);
+ return;
+ }
/* find out if there are any at all */
- if (Etc.nkling <= 0)
- {
+ if (Etc.nkling <= 0) {
printf("Uhura: Getting no response, sir\n");
return;
}
x /= k->power * Etc.nkling;
x *= Param.srndrprob;
i = x;
-# ifdef xTRACE
+#ifdef xTRACE
if (Trace)
printf("Prob = %d (%.4f)\n", i, x);
-# endif
- if (i > ranf(100))
- {
+#endif
+ if (i > ranf(100)) {
/* guess what, he surrendered!!! */
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;
** Cruddy, just takes one at random. Should ask the captain.
*/
-struct kling *selectklingon()
+static struct kling *
+selectklingon(void)
{
- register int i;
+ int i;
if (Etc.nkling < 2)
i = 0;