date and time created 83/03/17 21:09:31 by leres
[unix-history] / usr / src / games / sail / dr_4.c
CommitLineData
a3715b77
CL
1#ifndef lint
2static char *sccsid = "@(#)dr_4.c 1.1 83/03/17";
3#endif
4#include "externs.h"
5
6ungrap(from,to)
7int from, to;
8{
9 int k;
10
11 if(grapple(from, to)){
12 for (k = 0; k < 10; k++){
13 if (scene[game].ship[from].file -> grapples[k].turnfoul && to == scene[game].ship[from].file -> grapples[k].toship && (die() < 3 || scene[game].ship[from].nationality == scene[game].ship[to].nationality)){
14 cleangrapple(from, to, k);
15 makesignal("ungrappling %s (%c%c)", to, from);
16 }
17 }
18 }
19}
20
21grap(from, to)
22int from,to;
23{
24 int number, captured, l;
25
26 if ((captured = scene[game].ship[to].file -> captured) < 0)
27 captured = to;
28 number = die() < 3;
29 if (!number && scene[game].ship[from].nationality == scene[game].ship[captured].nationality)
30 number = 1;
31 if (number){
32 for (l=0; l < 10 && scene[game].ship[from].file -> grapples[l].turnfoul; l++);
33 if (l < 10){
34 Write(FILES + from, 0, 124 + l*4, turn);
35 Write(FILES + from, 0, 124 + l*4 + 2, to);
36 }
37 for (l=0; l < 10 && scene[game].ship[to].file -> grapples[l].turnfoul; l++);
38 if (l < 10){
39 Write(FILES + to, 0, 124 + l*4, turn);
40 Write(FILES + to, 0, 124 + l*4 + 2, from);
41 }
42 makesignal("grappled with %s (%c%c)", to, from);
43 }
44}
45
46