Commit | Line | Data |
---|---|---|
0bcf0267 | 1 | #ifndef lint |
ce837792 | 2 | static char *sccsid = "@(#)parties.c 2.1 83/10/31"; |
0bcf0267 | 3 | #endif |
b3a57661 | 4 | |
0bcf0267 CL |
5 | #include "externs.h" |
6 | ||
7 | meleeing(from, to) | |
b3a57661 EW |
8 | struct ship *from; |
9 | register 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 |
20 | boarding(from, isdefense) |
21 | register struct ship *from; | |
22 | char 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 |
33 | Snagged(ship, isgrap) |
34 | struct ship *ship; | |
35 | char isgrap; | |
36 | { | |
37 | register int Snags = 0; | |
38 | register struct snag *sp, *sq; | |
39 | ||
40 | sp = isgrap ? ship->file->grapples : ship->file->fouls; | |
41 | sq = sp + NSHIP; | |
42 | for (; sp < sq; sp++) | |
43 | if (sp->turnfoul) | |
44 | Snags++; | |
45 | return Snags; | |
46 | } | |
0bcf0267 | 47 | |
b3a57661 EW |
48 | Snagged2(ship, to, isgrap, isX) |
49 | struct ship *ship, *to; | |
50 | char isgrap, isX; | |
0bcf0267 | 51 | { |
b3a57661 EW |
52 | register Snags = 0; |
53 | register struct snag *sp, *sq; | |
0bcf0267 | 54 | |
b3a57661 EW |
55 | sp = isgrap ? ship->file->grapples : ship->file->fouls; |
56 | sq = sp + NSHIP; | |
57 | for (; sp < sq; sp++) { | |
58 | if (sp->turnfoul && sp->toship == to | |
59 | && (!isX || sp->turnfoul < turn - 1 | |
60 | && ship->file->loadwith==L_GRAPE)) | |
61 | Snags++; | |
0bcf0267 | 62 | } |
b3a57661 | 63 | return Snags; |
0bcf0267 CL |
64 | } |
65 | ||
b3a57661 EW |
66 | unboard(ship, to, isdefense) |
67 | register struct ship *ship, *to; | |
68 | register char isdefense; | |
0bcf0267 | 69 | { |
b3a57661 EW |
70 | register struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP; |
71 | register n; | |
0bcf0267 | 72 | |
b3a57661 EW |
73 | for (n = 0; n < NBP; p++, n++) |
74 | if (p->turnsent && (p->toship == to || isdefense || ship == to)) | |
75 | Write(isdefense ? W_DBP : W_OBP, ship, 0, n, 0, 0, 0); | |
0bcf0267 | 76 | } |