]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - sail/pl_2.c
Add braces to make the new egcs happy.
[bsdgames-darwin.git] / sail / pl_2.c
1 /* $NetBSD: pl_2.c,v 1.4 1997/10/13 19:45:01 christos Exp $ */
2
3 /*
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
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.
22 *
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
33 * SUCH DAMAGE.
34 */
35
36 #include <sys/cdefs.h>
37 #ifndef lint
38 #if 0
39 static char sccsid[] = "@(#)pl_2.c 8.1 (Berkeley) 5/31/93";
40 #else
41 __RCSID("$NetBSD: pl_2.c,v 1.4 1997/10/13 19:45:01 christos Exp $");
42 #endif
43 #endif /* not lint */
44
45 #include "player.h"
46
47 void
48 play()
49 {
50 struct ship *sp;
51
52 for (;;) {
53 switch (sgetch("~\b", (struct ship *)0, 0)) {
54 case 'm':
55 acceptmove();
56 break;
57 case 's':
58 acceptsignal();
59 break;
60 case 'g':
61 grapungrap();
62 break;
63 case 'u':
64 unfoulplayer();
65 break;
66 case 'v':
67 Msg("%s", version);
68 break;
69 case 'b':
70 acceptboard();
71 break;
72 case 'f':
73 acceptcombat();
74 break;
75 case 'l':
76 loadplayer();
77 break;
78 case 'c':
79 changesail();
80 break;
81 case 'r':
82 repair();
83 break;
84 case 'B':
85 Msg("'Hands to stations!'");
86 unboard(ms, ms, 1); /* cancel DBP's */
87 unboard(ms, ms, 0); /* cancel offense */
88 break;
89 case '\f':
90 centerview();
91 blockalarm();
92 draw_board();
93 draw_screen();
94 unblockalarm();
95 break;
96 case 'L':
97 mf->loadL = L_EMPTY;
98 mf->loadR = L_EMPTY;
99 mf->readyL = R_EMPTY;
100 mf->readyR = R_EMPTY;
101 Msg("Broadsides unloaded");
102 break;
103 case 'q':
104 Msg("Type 'Q' to quit");
105 break;
106 case 'Q':
107 leave(LEAVE_QUIT);
108 break;
109 case 'I':
110 foreachship(sp)
111 if (sp != ms)
112 eyeball(sp);
113 break;
114 case 'i':
115 if ((sp = closestenemy(ms, 0, 1)) == 0)
116 Msg("No more ships left.");
117 else
118 eyeball(sp);
119 break;
120 case 'C':
121 centerview();
122 blockalarm();
123 draw_view();
124 unblockalarm();
125 break;
126 case 'U':
127 upview();
128 blockalarm();
129 draw_view();
130 unblockalarm();
131 break;
132 case 'D':
133 case 'N':
134 downview();
135 blockalarm();
136 draw_view();
137 unblockalarm();
138 break;
139 case 'H':
140 leftview();
141 blockalarm();
142 draw_view();
143 unblockalarm();
144 break;
145 case 'J':
146 rightview();
147 blockalarm();
148 draw_view();
149 unblockalarm();
150 break;
151 case 'F':
152 lookout();
153 break;
154 case 'S':
155 dont_adjust = !dont_adjust;
156 blockalarm();
157 draw_turn();
158 unblockalarm();
159 break;
160 }
161 }
162 }