X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/462fca95471224f85b85be911e72faee16cd1597..257d036dc21241f2c8202514775c399945bbd3e2:/sail/pl_3.c diff --git a/sail/pl_3.c b/sail/pl_3.c index d31a9e8c..81d012c2 100644 --- a/sail/pl_3.c +++ b/sail/pl_3.c @@ -1,6 +1,8 @@ +/* $NetBSD: pl_3.c,v 1.17 2003/08/07 09:37:43 agc Exp $ */ + /* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,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. * @@ -31,14 +29,22 @@ * SUCH DAMAGE. */ +#include #ifndef lint -/*static char sccsid[] = "from: @(#)pl_3.c 5.4 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$Id: pl_3.c,v 1.2 1993/08/01 18:51:39 mycroft Exp $"; +#if 0 +static char sccsid[] = "@(#)pl_3.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: pl_3.c,v 1.17 2003/08/07 09:37:43 agc Exp $"); +#endif #endif /* not lint */ +#include +#include +#include "extern.h" #include "player.h" -acceptcombat() +void +acceptcombat(void) { int men = 0; int target, temp; @@ -79,7 +85,7 @@ 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; @@ -89,9 +95,9 @@ acceptcombat() if (closest->file->struck) goto cant; target = range(ms, closest); - if (target > rangeofshot[load] || !guns && target >= 3) + if (target > rangeofshot[load] || (!guns && target >= 3)) goto cant; - Signal("%s (%c%c) 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? ", @@ -104,14 +110,12 @@ acceptcombat() break; default: shootat = -1; - Signal("'Avast there! Hold your fire.'", - (struct ship *)0); + Msg("'Avast there! Hold your fire.'"); } } else { if (sgetch("Fire? ", (struct ship *)0, 1) == 'n') { shootat = -1; - Signal("Belay that! Hold your fire.", - (struct ship *)0); + Msg("Belay that! Hold your fire."); } else shootat = RIGGING; } @@ -125,11 +129,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; @@ -143,21 +149,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--; @@ -166,11 +175,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) @@ -186,12 +195,11 @@ acceptcombat() hhits = 0; } } - table(shootat, load, hit, closest, ms, roll); + table(ms, closest, shootat, load, hit, roll); } - Signal("Damage inflicted on the %s:", - (struct ship *)0, closest->shipname); - Signal("\t%d HULL, %d GUNS, %d CREW, %d RIGGING", - (struct ship *)0, hhits, ghits, chits, rhits); + Msg("Damage inflicted on the %s:", closest->shipname); + Msg("\t%d HULL, %d GUNS, %d CREW, %d RIGGING", + hhits, ghits, chits, rhits); if (!r) { mf->loadL = L_EMPTY; mf->readyL = R_EMPTY; @@ -201,73 +209,71 @@ acceptcombat() } continue; cant: - Signal("Unable to fire %s broadside", - (struct ship *)0, r ? "right" : "left"); + Msg("Unable to fire %s broadside", r ? "right" : "left"); } blockalarm(); draw_stat(); unblockalarm(); } -grapungrap() +void +grapungrap(void) { - register struct ship *sp; - register int i; + struct ship *sp; + int i; foreachship(sp) { if (sp == ms || sp->file->dir == 0) 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); - Signal("Attempt succeeds!", (struct ship *)0); - makesignal(ms, "grappled with %s (%c%c)", sp); + Write(W_GRAP, ms, sp->file->index, 0, 0, 0); + Write(W_GRAP, sp, player, 0, 0, 0); + Msg("Attempt succeeds!"); + makesignal(ms, "grappled with $$", sp); } else - Signal("Attempt fails.", (struct ship *)0); + Msg("Attempt fails."); break; case 'u': for (i = grappled2(ms, sp); --i >= 0;) { if (ms->nationality == capship(sp)->nationality - || die() < 3) { + || dieroll() < 3) { cleangrapple(ms, sp, 0); - Signal("Attempt succeeds!", - (struct ship *)0); - makesignal(ms, - "ungrappling with %s (%c%c)", + Msg("Attempt succeeds!"); + makesignal(ms, "ungrappling with $$", sp); } else - Signal("Attempt fails.", - (struct ship *)0); + Msg("Attempt fails."); } break; } } } -unfoulplayer() +void +unfoulplayer(void) { - register struct ship *to; - register i; + struct ship *to; + int i; 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); - Signal("Attempt succeeds!", (struct ship *)0); - makesignal(ms, "Unfouling %s (%c%c)", to); + Msg("Attempt succeeds!"); + makesignal(ms, "Unfouling $$", to); } else - Signal("Attempt fails.", (struct ship *)0); + Msg("Attempt fails."); } } }