kernel - Add KERN_PROC_SIGTRAMP
[dragonfly.git] / games / sail / pl_2.c
blobc20f104d6fe317cbf1cf33ce307874e362a5a8ff
1 /*-
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
29 * @(#)pl_2.c 8.1 (Berkeley) 5/31/93
30 * $FreeBSD: src/games/sail/pl_2.c,v 1.4 1999/11/30 03:49:36 billf Exp $
33 #include "player.h"
35 void
36 play(void)
38 struct ship *sp;
40 for (;;) {
41 switch (sgetch("~\b", NULL, 0)) {
42 case 'm':
43 acceptmove();
44 break;
45 case 's':
46 acceptsignal();
47 break;
48 case 'g':
49 grapungrap();
50 break;
51 case 'u':
52 unfoulplayer();
53 break;
54 case 'v':
55 Signal("%s", NULL, version);
56 break;
57 case 'b':
58 acceptboard();
59 break;
60 case 'f':
61 acceptcombat();
62 break;
63 case 'l':
64 loadplayer();
65 break;
66 case 'c':
67 changesail();
68 break;
69 case 'r':
70 repair();
71 break;
72 case 'B':
73 Signal("'Hands to stations!'", NULL);
74 unboard(ms, ms, 1); /* cancel DBP's */
75 unboard(ms, ms, 0); /* cancel offense */
76 break;
77 case '\f':
78 centerview();
79 blockalarm();
80 draw_board();
81 draw_screen();
82 unblockalarm();
83 break;
84 case 'L':
85 mf->loadL = L_EMPTY;
86 mf->loadR = L_EMPTY;
87 mf->readyL = R_EMPTY;
88 mf->readyR = R_EMPTY;
89 Signal("Broadsides unloaded", NULL);
90 break;
91 case 'q':
92 Signal("Type 'Q' to quit", NULL);
93 break;
94 case 'Q':
95 leave(LEAVE_QUIT);
96 break;
97 case 'I':
98 foreachship(sp)
99 if (sp != ms)
100 eyeball(sp);
101 break;
102 case 'i':
103 if ((sp = closestenemy(ms, 0, 1)) == NULL)
104 Signal("No more ships left.", NULL);
105 else
106 eyeball(sp);
107 break;
108 case 'C':
109 centerview();
110 blockalarm();
111 draw_view();
112 unblockalarm();
113 break;
114 case 'U':
115 upview();
116 blockalarm();
117 draw_view();
118 unblockalarm();
119 break;
120 case 'D':
121 case 'N':
122 downview();
123 blockalarm();
124 draw_view();
125 unblockalarm();
126 break;
127 case 'H':
128 leftview();
129 blockalarm();
130 draw_view();
131 unblockalarm();
132 break;
133 case 'J':
134 rightview();
135 blockalarm();
136 draw_view();
137 unblockalarm();
138 break;
139 case 'F':
140 lookout();
141 break;
142 case 'S':
143 dont_adjust = !dont_adjust;
144 blockalarm();
145 draw_turn();
146 unblockalarm();
147 break;