1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 */ 17 18 #ifndef lint 19 static char sccsid[] = "@(#)parties.c 5.3 (Berkeley) 06/18/88"; 20 #endif /* not lint */ 21 22 #include "externs.h" 23 24 meleeing(from, to) 25 struct ship *from; 26 register struct ship *to; 27 { 28 register struct BP *p = from->file->OBP; 29 register struct BP *q = p + NBP; 30 31 for (; p < q; p++) 32 if (p->turnsent && p->toship == to) 33 return 1; 34 return 0; 35 } 36 37 boarding(from, isdefense) 38 register struct ship *from; 39 char isdefense; 40 { 41 register struct BP *p = isdefense ? from->file->DBP : from->file->OBP; 42 register struct BP *q = p + NBP; 43 44 for (; p < q; p++) 45 if (p->turnsent) 46 return 1; 47 return 0; 48 } 49 50 unboard(ship, to, isdefense) 51 register struct ship *ship, *to; 52 register char isdefense; 53 { 54 register struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP; 55 register n; 56 57 for (n = 0; n < NBP; p++, n++) 58 if (p->turnsent && (p->toship == to || isdefense || ship == to)) 59 Write(isdefense ? W_DBP : W_OBP, ship, 0, n, 0, 0, 0); 60 } 61