1 /* 2 * Copyright (c) 1983 Regents of the University of California, 3 * All rights reserved. Redistribution permitted subject to 4 * the terms of the Berkeley Software License Agreement. 5 */ 6 7 #ifndef lint 8 static char *sccsid = "@(#)parties.c 2.3 85/04/23"; 9 #endif 10 11 #include "externs.h" 12 13 meleeing(from, to) 14 struct ship *from; 15 register struct ship *to; 16 { 17 register struct BP *p = from->file->OBP; 18 register struct BP *q = p + NBP; 19 20 for (; p < q; p++) 21 if (p->turnsent && p->toship == to) 22 return 1; 23 return 0; 24 } 25 26 boarding(from, isdefense) 27 register struct ship *from; 28 char isdefense; 29 { 30 register struct BP *p = isdefense ? from->file->DBP : from->file->OBP; 31 register struct BP *q = p + NBP; 32 33 for (; p < q; p++) 34 if (p->turnsent) 35 return 1; 36 return 0; 37 } 38 39 unboard(ship, to, isdefense) 40 register struct ship *ship, *to; 41 register char isdefense; 42 { 43 register struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP; 44 register n; 45 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); 49 } 50