xref: /csrg-svn/games/sail/parties.c (revision 69068)
118701Sedward /*
260846Sbostic  * Copyright (c) 1983, 1993
360846Sbostic  *	The Regents of the University of California.  All rights reserved.
433695Sbostic  *
542604Sbostic  * %sccs.include.redist.c%
618701Sedward  */
718701Sedward 
811596Sleres #ifndef lint
9*69068Sbostic static char sccsid[] = "@(#)parties.c	8.2 (Berkeley) 04/28/95";
1033695Sbostic #endif /* not lint */
1114016Sedward 
12*69068Sbostic #include "extern.h"
1311596Sleres 
1411596Sleres meleeing(from, to)
1514016Sedward struct ship *from;
1614016Sedward register struct ship *to;
1711596Sleres {
1814016Sedward 	register struct BP *p = from->file->OBP;
1914016Sedward 	register struct BP *q = p + NBP;
2011596Sleres 
2114016Sedward 	for (; p < q; p++)
2214016Sedward 		if (p->turnsent && p->toship == to)
2314016Sedward 			return 1;
2414016Sedward 	return 0;
2511596Sleres }
2611596Sleres 
boarding(from,isdefense)2714016Sedward boarding(from, isdefense)
2814016Sedward register struct ship *from;
2914016Sedward char isdefense;
3011596Sleres {
3114016Sedward 	register struct BP *p = isdefense ? from->file->DBP : from->file->OBP;
3214016Sedward 	register struct BP *q = p + NBP;
3311596Sleres 
3414016Sedward 	for (; p < q; p++)
3514016Sedward 		if (p->turnsent)
3614016Sedward 			return 1;
3714016Sedward 	return 0;
3811596Sleres }
3911596Sleres 
unboard(ship,to,isdefense)4014016Sedward unboard(ship, to, isdefense)
4114016Sedward register struct ship *ship, *to;
4214016Sedward register char isdefense;
4311596Sleres {
4414016Sedward 	register struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP;
4514016Sedward 	register n;
4611596Sleres 
4714016Sedward 	for (n = 0; n < NBP; p++, n++)
4814016Sedward 		if (p->turnsent && (p->toship == to || isdefense || ship == to))
4914016Sedward 			Write(isdefense ? W_DBP : W_OBP, ship, 0, n, 0, 0, 0);
5011596Sleres }
51