]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - sail/dr_1.c
Use standard AUTHORS section header. From YOMURA Masanori in private mail
[bsdgames-darwin.git] / sail / dr_1.c
index 658df26a12b2ad00e258ce2cafbc718bb94438c3..df2ade32be14619e131c396b07c948818a3e7463 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: dr_1.c,v 1.16 2001/01/04 05:34:56 jwise Exp $  */
+/*     $NetBSD: dr_1.c,v 1.21 2004/11/05 21:30:32 dsl Exp $    */
 
 /*
  * Copyright (c) 1983, 1993
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -38,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)dr_1.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dr_1.c,v 1.16 2001/01/04 05:34:56 jwise Exp $");
+__RCSID("$NetBSD: dr_1.c,v 1.21 2004/11/05 21:30:32 dsl Exp $");
 #endif
 #endif /* not lint */
 
@@ -49,12 +45,7 @@ __RCSID("$NetBSD: dr_1.c,v 1.16 2001/01/04 05:34:56 jwise Exp $");
 #include "extern.h"
 #include "driver.h"
 
-void   unfoul(void);
-void   boardcomp(void);
 static int     fightitout(struct ship *, struct ship *, int);
-void   resolve(void);
-void   compcombat(void);
-int    next(void);
 
 void
 unfoul(void)
@@ -196,8 +187,8 @@ fightitout(struct ship *from, struct ship *to, int key)
        }
        if (fromstrength >= strengthto * 3 || count == 4) {
                unboard(to, from, 0);
-               subtract(from, totalfrom, crewfrom, fromcap, pcfrom);
-               subtract(to, totalto, crewto, tocap, pcto);
+               subtract(from, fromcap, totalfrom, crewfrom, pcfrom);
+               subtract(to, tocap, totalto, crewto, pcto);
                makemsg(from, "boarders from %s repelled", to->shipname);
                sprintf(message, "killed in melee: %d.  %s: %d",
                        totalto, from->shipname, totalfrom);
@@ -206,8 +197,8 @@ fightitout(struct ship *from, struct ship *to, int key)
                        return 1;
        } else if (strengthto >= fromstrength * 3) {
                unboard(from, to, 0);
-               subtract(from, totalfrom, crewfrom, fromcap, pcfrom);
-               subtract(to, totalto, crewto, tocap, pcto);
+               subtract(from, fromcap, totalfrom, crewfrom, pcfrom);
+               subtract(to, tocap, totalto, crewto, pcto);
                if (key) {
                        if (fromcap != from)
                                Write(W_POINTS, fromcap,
@@ -228,8 +219,8 @@ fightitout(struct ship *from, struct ship *to, int key)
                        Write(W_POINTS, to, topoints, 0, 0, 0);
                        mento = crewto[0] ? crewto[0] : crewto[1];
                        if (mento) {
-                               subtract(to, mento, crewto, tocap, pcto);
-                               subtract(from, - mento, crewfrom, to, 0);
+                               subtract(to, tocap, mento, crewto, pcto);
+                               subtract(from, to, - mento, crewfrom, 0);
                        }
                        sprintf(message, "captured by the %s!", to->shipname);
                        Writestr(W_SIGNAL, from, message);
@@ -400,7 +391,7 @@ compcombat(void)
                        if (hit >= 0) {
                                if (load != L_GRAPE)
                                        hit = hit > 10 ? 10 : hit;
-                               table(shootat, load, hit, closest, sp, dieroll());
+                               table(sp, closest, shootat, load, hit, dieroll());
                        }
                }
        }
@@ -434,14 +425,11 @@ next(void)
                        if (tp == 0)
                                p = "Driver";
                        else {
-                               if (islower(*tp))
-                                       *tp = toupper(*tp);
+                               *tp = toupper((unsigned char)*tp);
                                p = tp;
                        }
-                       strncpy(bestship->file->captain, p,
+                       strlcpy(bestship->file->captain, p,
                                sizeof bestship->file->captain);
-                       bestship->file->captain
-                               [sizeof bestship->file->captain - 1] = 0;
                        logger(bestship);
                }
                return -1;