more cleanup; sail, driver, sail.log merged into single program
[unix-history] / usr / src / games / sail / parties.c
CommitLineData
0bcf0267 1#ifndef lint
6ca45914 2static char *sccsid = "@(#)parties.c 2.2 83/12/17";
0bcf0267 3#endif
b3a57661 4
0bcf0267
CL
5#include "externs.h"
6
7meleeing(from, to)
b3a57661
EW
8struct ship *from;
9register struct ship *to;
0bcf0267 10{
b3a57661
EW
11 register struct BP *p = from->file->OBP;
12 register struct BP *q = p + NBP;
0bcf0267 13
b3a57661
EW
14 for (; p < q; p++)
15 if (p->turnsent && p->toship == to)
16 return 1;
17 return 0;
0bcf0267
CL
18}
19
b3a57661
EW
20boarding(from, isdefense)
21register struct ship *from;
22char isdefense;
0bcf0267 23{
b3a57661
EW
24 register struct BP *p = isdefense ? from->file->DBP : from->file->OBP;
25 register struct BP *q = p + NBP;
0bcf0267 26
b3a57661
EW
27 for (; p < q; p++)
28 if (p->turnsent)
29 return 1;
30 return 0;
0bcf0267
CL
31}
32
b3a57661
EW
33unboard(ship, to, isdefense)
34register struct ship *ship, *to;
35register char isdefense;
0bcf0267 36{
b3a57661
EW
37 register struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP;
38 register n;
0bcf0267 39
b3a57661
EW
40 for (n = 0; n < NBP; p++, n++)
41 if (p->turnsent && (p->toship == to || isdefense || ship == to))
42 Write(isdefense ? W_DBP : W_OBP, ship, 0, n, 0, 0, 0);
0bcf0267 43}