* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)assorted.c 5.1 (Berkeley) %G%";
table(rig
, shot
, hittable
, on
, from
, roll
)
int rig
, shot
, hittable
, roll
;
register int hhits
= 0, chits
= 0, ghits
= 0, rhits
= 0;
int Ghit
= 0, Hhit
= 0, Rhit
= 0, Chit
= 0;
crew
[0] = on
->specs
->crew1
;
crew
[1] = on
->specs
->crew2
;
crew
[2] = on
->specs
->crew3
;
rigg
[0] = on
->specs
->rig1
;
rigg
[1] = on
->specs
->rig2
;
rigg
[2] = on
->specs
->rig3
;
rigg
[3] = on
->specs
->rig4
;
tp
= &(rig
? RigTable
: HullTable
)[hittable
][roll
-1];
if (on
->file
->captured
!= 0) {
if (rigg
[3] != -1 && rhits
> rigg
[3]) {
} else if (rigg
[3] != -1) {
if (rig
&& !rigg
[2] && (!rigg
[3] || rigg
[3] == -1))
makesignal(on
, "dismasted!", (struct ship
*)0);
if (portside(from
, on
, 0)) {
Write(portside(from
, on
, 0) ? W_GUNR
: W_GUNL
,
hull
= hull
< 0 ? 0 : hull
;
if (on
->file
->captured
!= 0 && Chit
)
Write(W_PCREW
, on
, 0, pc
, 0, 0, 0);
Write(W_HULL
, on
, 0, hull
, 0, 0, 0);
Write(W_CREW
, on
, 0, crew
[0], crew
[1], crew
[2], 0);
Write(W_RIGG
, on
, 0, rigg
[0], rigg
[1], rigg
[2], rigg
[3]);
message
= "firing round shot on %s (%c%c)";
message
= "firing grape shot on %s (%c%c)";
message
= "firing chain shot on %s (%c%c)";
message
= "firing double shot on %s (%c%c)";
message
= "exploding shot on %s (%c%c)";
makesignal(from
, message
, on
);
message
= "fore topsail sheets parted";
message
= "mizzen shrouds parted";
message
= "main topsail yard shot away";
message
= "fore topmast and foremast shrouds shot away";
message
= "mizzen mast and yard shot through";
message
= "foremast and spritsail yard shattered";
message
= "main topmast and mizzen mast shattered";
makesignal(on
, message
, (struct ship
*)0);
message
= "anchor cables severed";
message
= "two anchor stocks shot away";
message
= "quarterdeck bulwarks damaged";
message
= "three gun ports shot away";
message
= "four guns dismounted";
message
= "rudder cables shot through";
Write(W_TA
, on
, 0, 0, 0, 0, 0);
message
= "shot holes below the water line";
makesignal(on
, message
, (struct ship
*)0);
if (Chit > 1 && on->file->readyL&R_INITIAL && on->file->readyR&R_INITIAL) {
if (on->specs->qual <= 0) {
makesignal(on, "crew mutinying!", (struct ship *)0);
Write(W_CAPTURED, on, 0, on->file->index, 0, 0, 0);
makesignal(on, "crew demoralized", (struct ship *)0);
Write(W_QUAL, on, 0, on->specs->qual, 0, 0, 0);
Cleansnag(from
, to
, all
, flag
)
register struct ship
*from
, *to
;
Write(W_UNGRAP
, from
, 0, to
->file
->index
, all
, 0, 0);
Write(W_UNGRAP
, to
, 0, from
->file
->index
, all
, 0, 0);
Write(W_UNFOUL
, from
, 0, to
->file
->index
, all
, 0, 0);
Write(W_UNFOUL
, to
, 0, from
->file
->index
, all
, 0, 0);
if (!snagged2(from
, to
)) {
unboard(from
, from
, 1); /* defense */
unboard(from
, from
, 0); /* defense */
unboard(from
, to
, 0); /* offense */
unboard(to
, to
, 1); /* defense */
unboard(to
, to
, 0); /* defense */
unboard(to
, from
, 0); /* offense */
register struct ship
*ship
, *from
;
Write(W_STRUCK
, ship
, 0, 1, 0, 0, 0);
points
= ship
->specs
->pts
+ from
->file
->points
;
Write(W_POINTS
, from
, 0, points
, 0, 0, 0);
unboard(ship
, ship
, 0); /* all offense */
unboard(ship
, ship
, 1); /* all defense */
case 4: /* ship may sink */
Write(W_SINK
, ship
, 0, 1, 0, 0, 0);
case 6: /* ship may explode */
Write(W_EXPLODE
, ship
, 0, 1, 0, 0, 0);
Write(W_SIGNAL
, ship
, 1, (int) "striking her colours!", 0, 0, 0);