| 1 | #ifndef lint |
| 2 | static char *sccsid = "@(#)dr_4.c 2.1 83/10/31"; |
| 3 | #endif |
| 4 | #include "externs.h" |
| 5 | |
| 6 | ungrap(from, to) |
| 7 | register struct ship *from, *to; |
| 8 | { |
| 9 | register k; |
| 10 | register struct snag *sp = from->file->grapples; |
| 11 | |
| 12 | if (grappled2(from, to)) { |
| 13 | for (k = 0; k < NSHIP; k++, sp++) { |
| 14 | if (sp->turnfoul == 0 || to != sp->toship) |
| 15 | continue; |
| 16 | if (from->nationality == to->nationality && die() >= 3) |
| 17 | continue; |
| 18 | cleangrapple(from, to, k); |
| 19 | makesignal(from, "ungrappling %s (%c%c)", to); |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | grap(from, to) |
| 25 | register struct ship *from, *to; |
| 26 | { |
| 27 | register l; |
| 28 | |
| 29 | if (from->nationality != capship(to)->nationality && die() >= 3) |
| 30 | return; |
| 31 | for (l = 0; l < NSHIP && from->file->grapples[l].turnfoul; l++) |
| 32 | ; |
| 33 | if (l < NSHIP) |
| 34 | Write(W_GRAP, from, 0, l, turn, to-SHIP(0), 0); |
| 35 | for (l = 0; l < NSHIP && to->file->grapples[l].turnfoul; l++) |
| 36 | ; |
| 37 | if (l < NSHIP) |
| 38 | Write(W_GRAP, to, 0, l, turn, from-SHIP(0), 0); |
| 39 | makesignal(from, "grappled with %s (%c%c)", to); |
| 40 | } |