1 /*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8 #ifndef lint
9 static char sccsid[] = "@(#)parties.c 8.2 (Berkeley) 04/28/95";
10 #endif /* not lint */
11
12 #include "extern.h"
13
14 meleeing(from, to)
15 struct ship *from;
16 register struct ship *to;
17 {
18 register struct BP *p = from->file->OBP;
19 register struct BP *q = p + NBP;
20
21 for (; p < q; p++)
22 if (p->turnsent && p->toship == to)
23 return 1;
24 return 0;
25 }
26
boarding(from,isdefense)27 boarding(from, isdefense)
28 register struct ship *from;
29 char isdefense;
30 {
31 register struct BP *p = isdefense ? from->file->DBP : from->file->OBP;
32 register struct BP *q = p + NBP;
33
34 for (; p < q; p++)
35 if (p->turnsent)
36 return 1;
37 return 0;
38 }
39
unboard(ship,to,isdefense)40 unboard(ship, to, isdefense)
41 register struct ship *ship, *to;
42 register char isdefense;
43 {
44 register struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP;
45 register n;
46
47 for (n = 0; n < NBP; p++, n++)
48 if (p->turnsent && (p->toship == to || isdefense || ship == to))
49 Write(isdefense ? W_DBP : W_OBP, ship, 0, n, 0, 0, 0);
50 }
51