]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - sail/pl_3.c
Fix the old leftover license note
[bsdgames-darwin.git] / sail / pl_3.c
index e22ccffa68c40ea58bd5ad51a2eb77c088bed473..b638acc4158d597c732af91bfeb12085a8d6fc03 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: pl_3.c,v 1.4 1997/10/13 19:45:10 christos Exp $        */
+/*     $NetBSD: pl_3.c,v 1.20 2009/03/15 03:33:56 dholland 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.
  *
 #if 0
 static char sccsid[] = "@(#)pl_3.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: pl_3.c,v 1.4 1997/10/13 19:45:10 christos Exp $");
+__RCSID("$NetBSD: pl_3.c,v 1.20 2009/03/15 03:33:56 dholland Exp $");
 #endif
 #endif /* not lint */
 
-#include "player.h"
+#include <signal.h>
 #include <stdlib.h>
+#include "extern.h"
+#include "player.h"
 
 void
-acceptcombat()
+acceptcombat(void)
 {
        int men = 0;
        int target, temp;
@@ -87,7 +85,8 @@ acceptcombat()
                        guns = mc->gunL;
                        car = mc->carL;
                }
-               if ((!guns && !car) || load == L_EMPTY || (ready & R_LOADED) == 0)
+               if ((!guns && !car) || load == L_EMPTY ||
+                   (ready & R_LOADED) == 0)
                        goto cant;
                if (mf->struck || !crew[2])
                        goto cant;
@@ -99,7 +98,7 @@ acceptcombat()
                target = range(ms, closest);
                if (target > rangeofshot[load] || (!guns && target >= 3))
                        goto cant;
-               Signal("%$ within range of %s broadside.",
+               Signal("$$ within range of %s broadside.",
                        closest, r ? "right" : "left");
                if (load > L_CHAIN && target < 6) {
                        switch (sgetch("Aim for hull or rigging? ",
@@ -131,11 +130,13 @@ acceptcombat()
                else if (temp > 8)
                        temp -= 8;
                sternrake = temp > 4 && temp < 6;
-               if (rakehim)
+               if (rakehim) {
                        if (!sternrake)
-                               Signal("%$ Raking the %s!", closest);
+                               Msg("Raking the %s!", closest->shipname);
                        else
-                               Signal("%$ Stern Rake! %s splintering!", closest);
+                               Msg("Stern Rake! %s splintering!",
+                                   closest->shipname);
+               }
                index = guns;
                if (target < 3)
                        index += car;
@@ -149,21 +150,24 @@ acceptcombat()
                        hit++;
                hit += QUAL[index][mc->qual-1];
                for (n = 0; n < 3 && mf->captured == 0; n++)
-                       if (!crew[n])
+                       if (!crew[n]) {
                                if (index <= 5)
                                        hit--;
                                else
                                        hit -= 2;
-               if (ready & R_INITIAL)
+                       }
+               if (ready & R_INITIAL) {
                        if (index <= 3)
                                hit++;
                        else
                                hit += 2;
-               if (mf->captured != 0)
+               }
+               if (mf->captured != 0) {
                        if (index <= 1)
                                hit--;
                        else
                                hit -= 2;
+               }
                hit += AMMO[index][load - 1];
                if (((temp = mc->class) >= 5 || temp == 1) && windspeed == 5)
                        hit--;
@@ -172,11 +176,11 @@ acceptcombat()
                if (windspeed == 6 && temp <= 3)
                        hit--;
                if (hit >= 0) {
-                       roll = die();
+                       roll = dieroll();
                        if (load == L_GRAPE)
                                chits = hit;
                        else {
-                               struct Tables *t;
+                               const struct Tables *t;
                                if (hit > 10)
                                        hit = 10;
                                t = &(shootat == RIGGING ? RigTable : HullTable)
@@ -192,7 +196,7 @@ acceptcombat()
                                        hhits = 0;
                                }
                        }
-                       table(shootat, load, hit, closest, ms, roll);
+                       table(ms, closest, shootat, load, hit, roll);
                }
                Msg("Damage inflicted on the %s:", closest->shipname);
                Msg("\t%d HULL, %d GUNS, %d CREW, %d RIGGING",
@@ -208,13 +212,10 @@ acceptcombat()
        cant:
                Msg("Unable to fire %s broadside", r ? "right" : "left");
        }
-       blockalarm();
-       draw_stat();
-       unblockalarm();
 }
 
 void
-grapungrap()
+grapungrap(void)
 {
        struct ship *sp;
        int i;
@@ -224,15 +225,15 @@ grapungrap()
                        continue;
                if (range(ms, sp) > 1 && !grappled2(ms, sp))
                        continue;
-               switch (sgetch("Attempt to grapple or ungrapple %s (%c%c): ",
+               switch (sgetch("Attempt to grapple or ungrapple $$: ",
                        sp, 1)) {
                case 'g':
-                       if (die() < 3
+                       if (dieroll() < 3
                            || ms->nationality == capship(sp)->nationality) {
-                               Write(W_GRAP, ms, 0, sp->file->index, 0, 0, 0);
-                               Write(W_GRAP, sp, 0, player, 0, 0, 0);
+                               send_grap(ms, sp->file->index);
+                               send_grap(sp, player);
                                Msg("Attempt succeeds!");
-                               makesignal(ms, "grappled with %s (%c%c)", sp);
+                               makesignal(ms, "grappled with $$", sp);
                        } else
                                Msg("Attempt fails.");
                        break;
@@ -240,11 +241,10 @@ grapungrap()
                        for (i = grappled2(ms, sp); --i >= 0;) {
                                if (ms->nationality
                                        == capship(sp)->nationality
-                                   || die() < 3) {
+                                   || dieroll() < 3) {
                                        cleangrapple(ms, sp, 0);
                                        Msg("Attempt succeeds!");
-                                       makesignal(ms,
-                                               "ungrappling with %s (%c%c)",
+                                       makesignal(ms, "ungrappling with $$",
                                                sp);
                                } else
                                        Msg("Attempt fails.");
@@ -255,7 +255,7 @@ grapungrap()
 }
 
 void
-unfoulplayer()
+unfoulplayer(void)
 {
        struct ship *to;
        int i;
@@ -263,13 +263,13 @@ unfoulplayer()
        foreachship(to) {
                if (fouled2(ms, to) == 0)
                        continue;
-               if (sgetch("Attempt to unfoul with the %s (%c%c)? ", to, 1) != 'y')
+               if (sgetch("Attempt to unfoul with the $$? ", to, 1) != 'y')
                        continue;
                for (i = fouled2(ms, to); --i >= 0;) {
-                       if (die() <= 2) {
+                       if (dieroll() <= 2) {
                                cleanfoul(ms, to, 0);
                                Msg("Attempt succeeds!");
-                               makesignal(ms, "Unfouling %s (%c%c)", to);
+                               makesignal(ms, "Unfouling $$", to);
                        } else
                                Msg("Attempt fails.");
                }