-/* $NetBSD: initquad.c,v 1.3 1995/04/22 10:59:04 cgd Exp $ */
+/* $NetBSD: initquad.c,v 1.7 2009/05/24 21:44:56 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
* 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
#if 0
static char sccsid[] = "@(#)initquad.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: initquad.c,v 1.3 1995/04/22 10:59:04 cgd Exp $";
+__RCSID("$NetBSD: initquad.c,v 1.7 2009/05/24 21:44:56 dholland Exp $");
#endif
#endif /* not lint */
-# include "trek.h"
+#include <stdio.h>
+#include "trek.h"
/*
** Paramize Quadrant Upon Entering
** to be docked, i.e., abandon() and help().
*/
-initquad(f)
-int f;
+void
+initquad(int f)
{
- register int i, j;
- int rx, ry;
- int nbases, nstars;
- register struct quad *q;
- int nholes;
+ int i, j;
+ int rx, ry;
+ int nbases, nstars;
+ struct quad *q;
+ int nholes;
q = &Quad[Ship.quadx][Ship.quady];
nholes = q->holes;
/* have we blundered into a battle zone w/ shields down? */
- if (Etc.nkling > 0 && !f)
- {
+ if (Etc.nkling > 0 && !f) {
printf("Condition RED\n");
Ship.cond = RED;
if (!damaged(COMPUTER))
Sect[Ship.sectx][Ship.secty] = Ship.ship;
/* initialize Klingons */
- for (i = 0; i < Etc.nkling; i++)
- {
+ for (i = 0; i < Etc.nkling; i++) {
sector(&rx, &ry);
Sect[rx][ry] = KLINGON;
Etc.klingon[i].x = rx;
compkldist(1);
/* initialize star base */
- if (nbases > 0)
- {
+ if (nbases > 0) {
sector(&rx, &ry);
Sect[rx][ry] = BASE;
Etc.starbase.x = rx;
}
/* initialize inhabited starsystem */
- if (q->qsystemname != 0)
- {
+ if (q->qsystemname != 0) {
sector(&rx, &ry);
Sect[rx][ry] = INHABIT;
nstars -= 1;
}
/* initialize black holes */
- for (i = 0; i < nholes; i++)
- {
+ for (i = 0; i < nholes; i++) {
sector(&rx, &ry);
Sect[rx][ry] = HOLE;
}
/* initialize stars */
- for (i = 0; i < nstars; i++)
- {
+ for (i = 0; i < nstars; i++) {
sector(&rx, &ry);
Sect[rx][ry] = STAR;
}
}
-sector(x, y)
-int *x, *y;
+void
+sector(int *x, int *y)
{
- register int i, j;
+ int i, j;
- do
- {
+ do {
i = ranf(NSECTS);
j = ranf(NSECTS);
} while (Sect[i][j] != EMPTY);