use -10 for sterncolour
[unix-history] / usr / src / games / sail / dr_4.c
CommitLineData
a3715b77 1#ifndef lint
ce837792 2static char *sccsid = "@(#)dr_4.c 2.1 83/10/31";
a3715b77
CL
3#endif
4#include "externs.h"
5
b3a57661
EW
6ungrap(from, to)
7register struct ship *from, *to;
a3715b77 8{
b3a57661
EW
9 register k;
10 register struct snag *sp = from->file->grapples;
a3715b77 11
b3a57661
EW
12 if (grappled2(from, to)) {
13 for (k = 0; k < NSHIP; k++, sp++) {
14 if (sp->turnfoul == 0 || to != sp->toship)
15 continue;
16 if (from->nationality == to->nationality && die() >= 3)
17 continue;
18 cleangrapple(from, to, k);
19 makesignal(from, "ungrappling %s (%c%c)", to);
a3715b77
CL
20 }
21 }
22}
23
24grap(from, to)
b3a57661 25register struct ship *from, *to;
a3715b77 26{
b3a57661 27 register l;
a3715b77 28
b3a57661
EW
29 if (from->nationality != capship(to)->nationality && die() >= 3)
30 return;
31 for (l = 0; l < NSHIP && from->file->grapples[l].turnfoul; l++)
32 ;
33 if (l < NSHIP)
34 Write(W_GRAP, from, 0, l, turn, to-SHIP(0), 0);
35 for (l = 0; l < NSHIP && to->file->grapples[l].turnfoul; l++)
36 ;
37 if (l < NSHIP)
38 Write(W_GRAP, to, 0, l, turn, from-SHIP(0), 0);
39 makesignal(from, "grappled with %s (%c%c)", to);
a3715b77 40}