+/* $NetBSD: abandon.c,v 1.9 2009/05/24 21:44:56 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: @(#)abandon.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: abandon.c,v 1.2 1993/08/01 18:50:53 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)abandon.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: abandon.c,v 1.9 2009/05/24 21:44:56 dholland Exp $");
+#endif
#endif /* not lint */
-# include "trek.h"
+#include <stdio.h>
+#include "trek.h"
/*
** Abandon Ship
** Uses trace flag 40
*/
-abandon()
+/*ARGSUSED*/
+void
+abandon(int v __unused)
{
- register struct quad *q;
- register int i;
- int j;
- register struct event *e;
+ struct quad *q;
+ int i;
+ int j;
+ struct event *e;
- if (Ship.ship == QUEENE)
- return (printf("You may not abandon ye Faire Queene\n"));
- if (Ship.cond != DOCKED)
- {
- if (damaged(SHUTTLE))
- return (out(SHUTTLE));
+ if (Ship.ship == QUEENE) {
+ printf("You may not abandon ye Faire Queene\n");
+ return;
+ }
+ if (Ship.cond != DOCKED) {
+ if (damaged(SHUTTLE)) {
+ out(SHUTTLE);
+ return;
+ }
printf("Officers escape in shuttlecraft\n");
/* decide on fate of crew */
q = &Quad[Ship.quadx][Ship.quady];
- if (q->qsystemname == 0 || damaged(XPORTER))
- {
+ if (q->qsystemname == 0 || damaged(XPORTER)) {
printf("Entire crew of %d left to die in outer space\n",
Ship.crew);
Game.deaths += Ship.crew;
- }
- else
- {
+ } else {
printf("Crew beams down to planet %s\n", systemname(q));
}
}
Ship.warp3 = 125.0;
Ship.cond = GREEN;
/* clear out damages on old ship */
- for (i = 0; i < MAXEVENTS; i++)
- {
+ for (i = 0; i < MAXEVENTS; i++) {
e = &Event[i];
if (e->evcode != E_FIXDV)
continue;
i = Param.damprob[SHUTTLE] + Param.damprob[CLOAK];
Param.damprob[SHUTTLE] = Param.damprob[CLOAK] = 0;
while (i > 0)
- for (j = 0; j < NDEV; j++)
- {
- if (Param.damprob[j] != 0)
- {
+ for (j = 0; j < NDEV; j++) {
+ if (Param.damprob[j] != 0) {
Param.damprob[j] += 1;
i--;
if (i <= 0)
Ship.quadx = Now.base[i].x;
Ship.quady = Now.base[i].y;
/* setup that quadrant */
- while (1)
- {
+ while (1) {
initquad(1);
Sect[Ship.sectx][Ship.secty] = EMPTY;
- for (i = 0; i < 5; i++)
- {
+ for (i = 0; i < 5; i++) {
Ship.sectx = Etc.starbase.x + ranf(3) - 1;
if (Ship.sectx < 0 || Ship.sectx >= NSECTS)
continue;
Ship.secty = Etc.starbase.y + ranf(3) - 1;
if (Ship.secty < 0 || Ship.secty >= NSECTS)
continue;
- if (Sect[Ship.sectx][Ship.secty] == EMPTY)
- {
+ if (Sect[Ship.sectx][Ship.secty] == EMPTY) {
Sect[Ship.sectx][Ship.secty] = QUEENE;
- dock();
+ dock(0);
compkldist(0);
return;
}