+/* $NetBSD: nova.c,v 1.5 1998/08/30 09:19:40 veego 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[] = "from: @(#)nova.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: nova.c,v 1.2 1993/08/01 18:50:15 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)nova.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: nova.c,v 1.5 1998/08/30 09:19:40 veego 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);