X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/7e5c0c57606f0f1e9335aa74ef5ea8c8048a9b2c..86af82ece770d2d27871e6083bc8eb4f7d2bbd3f:/sail/assorted.c diff --git a/sail/assorted.c b/sail/assorted.c index a9b8963b..cfc7d2ae 100644 --- a/sail/assorted.c +++ b/sail/assorted.c @@ -1,4 +1,4 @@ -/* $NetBSD: assorted.c,v 1.5 1997/10/13 19:43:05 christos Exp $ */ +/* $NetBSD: assorted.c,v 1.15 2003/08/07 09:37:41 agc Exp $ */ /* * Copyright (c) 1983, 1993 @@ -12,11 +12,7 @@ * 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,21 +34,18 @@ #if 0 static char sccsid[] = "@(#)assorted.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: assorted.c,v 1.5 1997/10/13 19:43:05 christos Exp $"); +__RCSID("$NetBSD: assorted.c,v 1.15 2003/08/07 09:37:41 agc Exp $"); #endif #endif /* not lint */ -#include "extern.h" #include -#include #include +#include "extern.h" -static void strike __P((struct ship *, struct ship *)); +static void strike (struct ship *, struct ship *); void -table(rig, shot, hittable, on, from, roll) -struct ship *on, *from; -int rig, shot, hittable, roll; +table(struct ship *from, struct ship *on, int rig, int shot, int hittable, int roll) { int hhits = 0, chits = 0, ghits = 0, rhits = 0; int Ghit = 0, Hhit = 0, Rhit = 0, Chit = 0; @@ -60,8 +53,8 @@ int rig, shot, hittable, roll; int crew[3]; int n; int rigg[4]; - char *message; - struct Tables *tp; + const char *message; + const struct Tables *tp; pc = on->file->pcrew; hull = on->specs->hull; @@ -114,7 +107,7 @@ int rig, shot, hittable, roll; rigg[3] -= rhits; } if (rig && !rigg[2] && (!rigg[3] || rigg[3] == -1)) - makesignal(on, "dismasted!", (struct ship *)0); + makemsg(on, "dismasted!"); if (portside(from, on, 0)) { guns = on->specs->gunR; car = on->specs->carR; @@ -139,32 +132,32 @@ int rig, shot, hittable, roll; hull -= ghits; if (Ghit) Write(portside(from, on, 0) ? W_GUNR : W_GUNL, - on, 0, guns, car, 0, 0); + on, guns, car, 0, 0); hull -= hhits; hull = hull < 0 ? 0 : hull; if (on->file->captured != 0 && Chit) - Write(W_PCREW, on, 0, pc, 0, 0, 0); + Write(W_PCREW, on, pc, 0, 0, 0); if (Hhit) - Write(W_HULL, on, 0, hull, 0, 0, 0); + Write(W_HULL, on, hull, 0, 0, 0); if (Chit) - Write(W_CREW, on, 0, crew[0], crew[1], crew[2], 0); + Write(W_CREW, on, crew[0], crew[1], crew[2], 0); if (Rhit) - Write(W_RIGG, on, 0, rigg[0], rigg[1], rigg[2], rigg[3]); + Write(W_RIGG, on, rigg[0], rigg[1], rigg[2], rigg[3]); switch (shot) { case L_ROUND: - message = "firing round shot on %s (%c%c)"; + message = "firing round shot on $$"; break; case L_GRAPE: - message = "firing grape shot on %s (%c%c)"; + message = "firing grape shot on $$"; break; case L_CHAIN: - message = "firing chain shot on %s (%c%c)"; + message = "firing chain shot on $$"; break; case L_DOUBLE: - message = "firing double shot on %s (%c%c)"; + message = "firing double shot on $$"; break; case L_EXPLODE: - message = "exploding shot on %s (%c%c)"; + message = "exploding shot on $$"; break; default: errx(1, "Unknown shot type %d", shot); @@ -197,7 +190,7 @@ int rig, shot, hittable, roll; default: errx(1, "Bad Rhit = %d", Rhit); } - makesignal(on, message, (struct ship *)0); + makemsg(on, message); } else if (roll == 6) { switch (Hhit) { case 0: @@ -217,7 +210,7 @@ int rig, shot, hittable, roll; break; case 5: message = "rudder cables shot through"; - Write(W_TA, on, 0, 0, 0, 0, 0); + Write(W_TA, on, 0, 0, 0, 0); break; case 6: message = "shot holes below the water line"; @@ -225,18 +218,18 @@ int rig, shot, hittable, roll; default: errx(1, "Bad Hhit = %d", Hhit); } - makesignal(on, message, (struct ship *)0); + makemsg(on, message); } /* if (Chit > 1 && on->file->readyL&R_INITIAL && on->file->readyR&R_INITIAL) { on->specs->qual--; if (on->specs->qual <= 0) { - makesignal(on, "crew mutinying!", (struct ship *)0); + makemsg(on, "crew mutinying!"); on->specs->qual = 5; - Write(W_CAPTURED, on, 0, on->file->index, 0, 0, 0); + Write(W_CAPTURED, on, on->file->index, 0, 0, 0); } else - makesignal(on, "crew demoralized", (struct ship *)0); - Write(W_QUAL, on, 0, on->specs->qual, 0, 0, 0); + makemsg(on, "crew demoralized"); + Write(W_QUAL, on, on->specs->qual, 0, 0, 0); } */ if (!hull) @@ -244,17 +237,15 @@ int rig, shot, hittable, roll; } void -Cleansnag(from, to, all, flag) -struct ship *from, *to; -char all, flag; +Cleansnag(struct ship *from, struct ship *to, int all, int flag) { if (flag & 1) { - Write(W_UNGRAP, from, 0, to->file->index, all, 0, 0); - Write(W_UNGRAP, to, 0, from->file->index, all, 0, 0); + Write(W_UNGRAP, from, to->file->index, all, 0, 0); + Write(W_UNGRAP, to, from->file->index, all, 0, 0); } if (flag & 2) { - Write(W_UNFOUL, from, 0, to->file->index, all, 0, 0); - Write(W_UNFOUL, to, 0, from->file->index, all, 0, 0); + Write(W_UNFOUL, from, to->file->index, all, 0, 0); + Write(W_UNFOUL, to, from->file->index, all, 0, 0); } if (!snagged2(from, to)) { if (!snagged(from)) { @@ -271,27 +262,26 @@ char all, flag; } static void -strike(ship, from) -struct ship *ship, *from; +strike(struct ship *ship, struct ship *from) { int points; if (ship->file->struck) return; - Write(W_STRUCK, ship, 0, 1, 0, 0, 0); + Write(W_STRUCK, ship, 1, 0, 0, 0); points = ship->specs->pts + from->file->points; - Write(W_POINTS, from, 0, points, 0, 0, 0); + Write(W_POINTS, from, points, 0, 0, 0); unboard(ship, ship, 0); /* all offense */ unboard(ship, ship, 1); /* all defense */ - switch (die()) { + switch (dieroll()) { case 3: case 4: /* ship may sink */ - Write(W_SINK, ship, 0, 1, 0, 0, 0); + Write(W_SINK, ship, 1, 0, 0, 0); break; case 5: case 6: /* ship may explode */ - Write(W_EXPLODE, ship, 0, 1, 0, 0, 0); + Write(W_EXPLODE, ship, 1, 0, 0, 0); break; } - Write(W_SIGNAL, ship, 1, (int) "striking her colours!", 0, 0, 0); + Writestr(W_SIGNAL, ship, "striking her colours!"); }