]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/com6.c
1 /* $NetBSD: com6.c,v 1.16 2000/09/10 10:51:17 jsm Exp $ */
4 * Copyright (c) 1983, 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
[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95";
41 __RCSID("$NetBSD: com6.c,v 1.16 2000/09/10 10:51:17 jsm Exp $");
46 #include "pathnames.h"
51 if (testbit(location
[position
].objects
, VIPER
) && !notes
[CANTLAUNCH
]) {
53 clearbit(location
[position
].objects
, VIPER
);
54 position
= location
[position
].up
;
58 puts("You climb into the viper and prepare for launch.");
59 puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
62 puts("Not enough fuel to launch.");
64 puts("Can't launch.");
71 if (notes
[LAUNCHED
] && testbit(location
[position
].objects
, LAND
) &&
72 location
[position
].down
) {
74 position
= location
[position
].down
;
75 setbit(location
[position
].objects
, VIPER
);
78 puts("You are down.");
81 puts("You can't land here.");
88 printf("bye.\nYour rating was %s.\n", rate());
95 int dummy
__attribute__((__unused__
));
108 static FILE *score_fp
;
113 score_fp
= fopen(_PATH_SCORE
, "a");
114 if (score_fp
== NULL
)
115 warn("open %s for append", _PATH_SCORE
);
116 if (score_fp
!= NULL
&& fileno(score_fp
) < 3)
126 sigset_t sigset
, osigset
;
128 sigemptyset(&sigset
);
129 sigaddset(&sigset
, SIGINT
);
130 sigprocmask(SIG_BLOCK
, &sigset
, &osigset
);
134 if (score_fp
!= NULL
) {
135 fprintf(score_fp
, "%s %8s %c%20s", date
, username
, ch
, rate());
137 fprintf(score_fp
, " wizard\n");
140 fprintf(score_fp
, " WIZARD!\n");
142 fprintf(score_fp
, "\n");
144 sigprocmask(SIG_SETMASK
, &osigset
, (sigset_t
*) 0);
152 score
= max(max(pleasure
, power
), ego
);
153 if (score
== pleasure
) {
158 return ("junior voyeur");
163 return ("Marquis De Sade");
165 if (score
== power
) {
176 return ("Darth Vader");
178 return ("Sauron the Great");
184 return ("philanthropist");
189 return ("Mr. Roarke");
196 if (testbit(location
[position
].objects
, CAR
)) {
197 puts("You hop in the car and turn the key. There is a perceptible grating noise,");
198 puts("and an explosion knocks you unconscious...");
199 clearbit(location
[position
].objects
, CAR
);
200 setbit(location
[position
].objects
, CRASH
);
201 injuries
[5] = injuries
[6] = injuries
[7] = injuries
[8] = 1;
206 puts("There is nothing to drive here.");
213 if (testbit(location
[position
].objects
, HORSE
)) {
214 puts("You climb onto the stallion and kick it in the guts. The stupid steed launches");
215 puts("forward through bush and fern. You are thrown and the horse gallops off.");
216 clearbit(location
[position
].objects
, HORSE
);
217 while (!(position
= rnd(NUMOFROOMS
+ 1)) || !OUTSIDE
|| !beenthere
[position
] || location
[position
].flyhere
);
218 setbit(location
[position
].objects
, HORSE
);
219 if (location
[position
].north
)
220 position
= location
[position
].north
;
222 if (location
[position
].south
)
223 position
= location
[position
].south
;
225 if (location
[position
].east
)
226 position
= location
[position
].east
;
228 position
= location
[position
].west
;
231 puts("There is no horse here.");
237 { /* synonyms = {strike, smoke} *//* for
239 if (testbit(inven
, MATCHES
) && matchcount
) {
240 puts("Your match splutters to life.");
244 if (position
== 217) {
245 puts("The whole bungalow explodes with an intense blast.");
249 puts("You're out of matches.");