integrate with dm
[unix-history] / usr / src / games / sail / dr_4.c
CommitLineData
b5f0675e 1/*
1e008c14
DF
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
b5f0675e
EW
5 */
6
a3715b77 7#ifndef lint
1e008c14
DF
8static char sccsid[] = "@(#)dr_4.c 5.1 (Berkeley) %G%";
9#endif not lint
b5f0675e 10
a3715b77
CL
11#include "externs.h"
12
b3a57661
EW
13ungrap(from, to)
14register struct ship *from, *to;
a3715b77 15{
b3a57661 16 register k;
6ca45914 17 char friend;
a3715b77 18
6ca45914
EW
19 if ((k = grappled2(from, to)) == 0)
20 return;
21 friend = capship(from)->nationality == capship(to)->nationality;
22 while (--k >= 0) {
23 if (friend || die() < 3) {
24 cleangrapple(from, to, 0);
b3a57661 25 makesignal(from, "ungrappling %s (%c%c)", to);
a3715b77
CL
26 }
27 }
28}
29
30grap(from, to)
b3a57661 31register struct ship *from, *to;
a3715b77 32{
6ca45914 33 if (capship(from)->nationality != capship(to)->nationality && die() > 2)
b3a57661 34 return;
6ca45914
EW
35 Write(W_GRAP, from, 0, to->file->index, 0, 0, 0);
36 Write(W_GRAP, to, 0, from->file->index, 0, 0, 0);
b3a57661 37 makesignal(from, "grappled with %s (%c%c)", to);
a3715b77 38}