]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - trek/srscan.c
1 /* $NetBSD: srscan.c,v 1.5 1999/07/21 13:19:11 hubertf Exp $ */
4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include <sys/cdefs.h>
39 static char sccsid
[] = "@(#)srscan.c 8.1 (Berkeley) 5/31/93";
41 __RCSID("$NetBSD: srscan.c,v 1.5 1999/07/21 13:19:11 hubertf Exp $");
50 ** SHORT RANGE SENSOR SCAN
52 ** A short range scan is taken of the current quadrant. If the
53 ** flag 'f' is one, it is an "auto srscan", which is not done
54 ** unless in 'fast' mode. It does a status report and a srscan.
55 ** If 'f' is -1, you get a status report only. If it is zero,
56 ** you get a srscan and an optional status report. The status
57 ** report is taken if you enter "srscan yes"; for all srscans
58 ** thereafter you get a status report with your srscan until
59 ** you type "srscan no". It defaults to on.
61 ** The current quadrant is filled in on the computer chart.
64 const char *const Color
[4] =
80 struct quad
*q
= NULL
;
81 const struct cvntab
*p
;
83 if (f
>= 0 && check_out(SRSCAN
))
92 Etc
.statreport
= getynpar("status report");
93 statinfo
= Etc
.statreport
;
103 printf("\nShort range sensor scan\n");
104 q
= &Quad
[Ship
.quadx
][Ship
.quady
];
105 q
->scanned
= q
->klings
* 100 + q
->bases
* 10 + q
->stars
;
107 for (i
= 0; i
< NSECTS
; i
++)
114 for (i
= 0; i
< NSECTS
; i
++)
119 for (j
= 0; j
< NSECTS
; j
++)
120 printf("%c ", Sect
[i
][j
]);
129 printf("stardate %.2f", Now
.date
);
132 printf("condition %s", Color
[Ship
.cond
]);
137 printf("position %d,%d/%d,%d",Ship
.quadx
, Ship
.quady
, Ship
.sectx
, Ship
.secty
);
140 printf("warp factor %.1f", Ship
.warp
);
143 printf("total energy %d", Ship
.energy
);
146 printf("torpedoes %d", Ship
.torped
);
154 percent
= 100.0 * Ship
.shield
/ Param
.shield
;
155 printf("shields %s, %d%%", s
, percent
);
158 printf("Klingons left %d", Now
.klings
);
161 printf("time left %.2f", Now
.time
);
164 printf("life support ");
165 if (damaged(LIFESUP
))
167 printf("damaged, reserves = %.2f", Ship
.reserves
);
177 printf("current crew %d\n", Ship
.crew
);
178 printf("brig space %d\n", Ship
.brigfree
);
179 printf("Klingon power %d\n", Param
.klingpwr
);
180 p
= &Lentab
[Game
.length
- 1];
183 printf("Length, Skill %s%s, ", p
->abrev
, p
->full
);
184 p
= &Skitab
[Game
.skill
- 1];
185 printf("%s%s\n", p
->abrev
, p
->full
);
189 for (i
= 0; i
< NSECTS
; i
++)
193 if (q
->qsystemname
& Q_DISTRESSED
)
194 printf("Distressed ");
196 printf("Starsystem %s\n", systemname(q
));