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