date and time created 83/03/17 21:09:56 by leres
authorCraig Leres <leres@ucbvax.Berkeley.EDU>
Fri, 18 Mar 1983 13:09:56 +0000 (05:09 -0800)
committerCraig Leres <leres@ucbvax.Berkeley.EDU>
Fri, 18 Mar 1983 13:09:56 +0000 (05:09 -0800)
SCCS-vsn: games/sail/parties.c 1.1

usr/src/games/sail/parties.c [new file with mode: 0644]

diff --git a/usr/src/games/sail/parties.c b/usr/src/games/sail/parties.c
new file mode 100644 (file)
index 0000000..5a1824c
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef lint
+static char *sccsid = "@(#)parties.c   1.1 83/03/17";
+#endif
+#include "externs.h"
+
+meleeing(from, to)
+int from, to;
+{
+    register int n;
+
+    for (n = 0; n < 3; n++)
+       {
+       if (scene[game].ship[from].file -> OBP[n].turnsent && scene[game].ship[from].file -> OBP[n].toship == to)
+           return(1);
+       }
+    return(0);
+}
+
+Fouled(shipnum, offset)
+int shipnum, offset;
+{
+    register int n, Fouls = 0;
+    struct snag *ptr;
+
+    ptr = offset == 342 ? scene[game].ship[shipnum].file -> fouls : scene[game].ship[shipnum].file -> grapples ;
+    for (n=0; n < 10; n++){
+       if (ptr[n].turnfoul)
+           Fouls++;
+    }
+    return(Fouls);
+}
+
+
+Grapple(shipnum, toship, offset)
+int shipnum, toship, offset;
+{
+    int test = 0;
+    register int n, Fouls = 0;
+    struct snag *ptr;
+
+    if (shipnum >= 100)
+       {
+       shipnum -= 100;
+       test = 1;
+       }
+    ptr = offset == 342 ? scene[game].ship[shipnum].file -> fouls : scene[game].ship[shipnum].file -> grapples ;
+    for (n=0; n < 10; n++)
+       {
+       if (ptr[n].turnfoul && ptr[n].toship == toship && (!test || (ptr[n].turnfoul < turn - 1 && (loadwith[shipnum] = GRAPE))))
+           Fouls++;
+       }
+    return(Fouls);
+}
+
+unboard(shipnum, toship, defense)
+int shipnum, toship, defense;
+{
+    register int n;
+    struct BP *ptr;
+
+    ptr = defense ? scene[game].ship[shipnum].file -> DBP : scene[game].ship[shipnum].file -> OBP ; 
+    for (n=0; n < 3; n++)
+       if (ptr[n].turnsent && (ptr[n].toship == toship || defense || shipnum == toship))
+           Write(FILES + shipnum, 0, 30 + 18*defense + 6*n, 0);
+}