initialize people to 0
[unix-history] / usr / src / games / sail / parties.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
0bcf0267 7#ifndef lint
1e008c14
DF
8static char sccsid[] = "@(#)parties.c 5.1 (Berkeley) %G%";
9#endif not lint
b3a57661 10
0bcf0267
CL
11#include "externs.h"
12
13meleeing(from, to)
b3a57661
EW
14struct ship *from;
15register struct ship *to;
0bcf0267 16{
b3a57661
EW
17 register struct BP *p = from->file->OBP;
18 register struct BP *q = p + NBP;
0bcf0267 19
b3a57661
EW
20 for (; p < q; p++)
21 if (p->turnsent && p->toship == to)
22 return 1;
23 return 0;
0bcf0267
CL
24}
25
b3a57661
EW
26boarding(from, isdefense)
27register struct ship *from;
28char isdefense;
0bcf0267 29{
b3a57661
EW
30 register struct BP *p = isdefense ? from->file->DBP : from->file->OBP;
31 register struct BP *q = p + NBP;
0bcf0267 32
b3a57661
EW
33 for (; p < q; p++)
34 if (p->turnsent)
35 return 1;
36 return 0;
0bcf0267
CL
37}
38
b3a57661
EW
39unboard(ship, to, isdefense)
40register struct ship *ship, *to;
41register char isdefense;
0bcf0267 42{
b3a57661
EW
43 register struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP;
44 register n;
0bcf0267 45
b3a57661
EW
46 for (n = 0; n < NBP; p++, n++)
47 if (p->turnsent && (p->toship == to || isdefense || ship == to))
48 Write(isdefense ? W_DBP : W_OBP, ship, 0, n, 0, 0, 0);
0bcf0267 49}