]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/nova.c
Fix some typos in ENIAC quote. From Zafer Aydogan and myself.
[bsdgames-darwin.git] / trek / nova.c
index fc5f584eee68e4e3587e0ad55c840301416c7808..7c5a87671f79f1af086e4b35fc5e1a33f959cd0b 100644 (file)
@@ -1,6 +1,8 @@
+/*     $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
@@ -51,11 +55,12 @@ static char sccsid[] = "@(#)nova.c  5.4 (Berkeley) 6/1/90";
 **     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;
@@ -64,8 +69,10 @@ int  x, y;
                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)
@@ -113,17 +120,15 @@ int       x, y;
                          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);