+/* $NetBSD: nova.c,v 1.6 2003/08/07 09:37:53 agc 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[] = "@(#)nova.c 5.4 (Berkeley) 6/1/90";
+#if 0
+static char sccsid[] = "@(#)nova.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: nova.c,v 1.6 2003/08/07 09:37:53 agc Exp $");
+#endif
#endif /* not lint */
-# include "trek.h"
+#include <stdio.h>
+#include "trek.h"
/*
** CAUSE A NOVA TO OCCUR
** If the zap is too much, it gets destroyed.
*/
+void
nova(x, y)
int x, y;
{
- register int i, j;
- register int se;
+ int i, j;
+ int se;
if (Sect[x][y] != STAR || Quad[Ship.quadx][Ship.quady].stars < 0)
return;
printf("Spock: Star at %d,%d failed to nova.\n", x, y);
return;
}
- if (ranf(100) < 5)
- return (snova(x, y));
+ if (ranf(100) < 5) {
+ snova(x, y);
+ return;
+ }
printf("Spock: Star at %d,%d gone nova\n", x, y);
if (ranf(4) != 0)
case ENTERPRISE:
case QUEENE:
se = 2000;
- if (Ship.shldup)
- if (Ship.shield >= se)
- {
+ if (Ship.shldup) {
+ if (Ship.shield >= se) {
Ship.shield -= se;
se = 0;
- }
- else
- {
+ } else {
se -= Ship.shield;
Ship.shield = 0;
}
+ }
Ship.energy -= se;
if (Ship.energy <= 0)
lose(L_SUICID);