static char *sccsid
= "@(#)pl_2.c 1.5 83/10/10";
#define turnfirst(buf) (*buf == 'r' || *buf == 'l')
if (mf
->FS
&& (!mc
->rig1
|| windspeed
== 6))
Write(W_FS
, ms
, 0, 0, 0, 0, 0);
char buf
[60], last
= '\0';
Signal("Already moved.", (struct ship
*)0);
Signal("move (%d,%c%d): ", (struct ship
*)0, ma
, af
? '\'' : ' ', ta
);
sgetstr(buf
, sizeof buf
);
buf
[sizeof movebuf
- 1] = '\0';
Signal("Ship can't turn that fast.",
vma
= min(ma
, maxmove(ms
, dir
, 0));
if (ta
< 0 && moved
|| vma
< 0 && moved
)
if (ta
< 0 && moved
|| vma
< 0 && moved
)
case '1': case '2': case '3': case '4':
case '5': case '6': case '7':
Signal("Can't move that fast.",
if (ta
< 0 && moved
|| vma
< 0 && moved
)
Signal("Input error.", (struct ship
*)0);
if (ta
< 0 && moved
|| vma
< 0 && moved
|| af
&& turnfirst(buf
) && moved
) {
Signal("Movement error.", (struct ship
*)0);
Write(W_FS
, ms
, 0, 0, 0, 0, 0);
Signal("No hands to set full sails.",
Write(W_FS
, ms
, 0, 0, 0, 0, 0);
Signal("No hands to set full sails.",
(void) strcpy(movebuf
, buf
);
(void) strcpy(movebuf
, "d");
Write(W_LAST
, ms
, 1, (int)movebuf
, 0, 0, 0);
Signal("Helm: %s.", (struct ship
*)0, movebuf
);
register struct ship
*sp
;
for (n
= 0; n
< NBP
; n
++) {
men
+= mf
->OBP
[n
].turnsent
;
for (n
= 0; n
< NBP
; n
++) {
men
+= mf
->DBP
[n
].turnsent
;
crew
[0] = men
/100 ? 0 : crew
[0] != 0;
crew
[1] = (men
%100)/10 ? 0 : crew
[1] != 0;
crew
[2] = men
%10 ? 0 : crew
[2] != 0;
if (sp
== ms
|| sp
->file
->dir
== 0 || range(ms
, sp
) > 1)
if (ms
->nationality
== capship(sp
)->nationality
)
if (meleeing(ms
, sp
) && crew
[2]) {
Signal("How many more to board the %s (%c%c)? ", sp
);
} else if ((fouled2(ms
, sp
) || grappled2(ms
, sp
)) && crew
[2]) {
Signal("Crew sections to board the %s (%c%c) (3 max) ?",
Signal("How many sections to repel boarders? ",
parties(crew
, to
, isdefense
)
register struct ship
*to
;
ptr
= isdefense
? to
->file
->DBP
: to
->file
->OBP
;
for (j
= 0; j
< NBP
&& ptr
[j
].turnsent
; j
++)
if (!ptr
[j
].turnsent
&& buf
> '0') {
for (k
=0; k
< 3 && buf
> '0'; k
++) {
men
+= crew
[k
] * power(10, 2-k
);
Signal("Sending all crew sections.",
Write(isdefense
? W_DBP
: W_OBP
, ms
, 0,
j
, turn
, to
-SHIP(0), men
);
(void) wmove(slot_w
, 2, 0);
(void) waddch(slot_w
, k
+ '1');
(void) wmove(slot_w
, 2, 1 + k
);
(void) mvwaddstr(slot_w
, 3, 0, "DBP");
makesignal(ms
, "repelling boarders",
(void) wmove(slot_w
, 0, 0);
(void) waddch(slot_w
, k
+ '1');
(void) wmove(slot_w
, 0, 1 + k
);
(void) mvwaddstr(slot_w
, 1, 0, "OBP");
makesignal(ms
, "boarding the %s (%c%c)", to
);
Signal("Sending no crew sections.", (struct ship
*)0);
if (repaired
|| loaded
|| fired
|| changed
|| turned()) {
Signal("No hands free to repair", (struct ship
*)0);
Signal("Repair (hull, guns, rigging)? ", (struct ship
*)0);
Signal("Avast heaving!", (struct ship
*)0);
if (ptr
->hull
< ptr
->guns
/4)
if (ptr
->gunL
< ptr
->gunR
) {
if (ptr
->gunL
+ ptr
->carL
< ptr
->guns
/5)
ptr
->gunL
+ 2, ptr
->carL
, 0, 0);
if (ptr
->gunR
+ ptr
->carR
< ptr
->guns
/5)
ptr
->gunR
+ 2, ptr
->carR
, 0, 0);
Write(W_RIG3
, ms
, 0, 2, 0, 0, 0);
Write(W_RIG2
, ms
, 0, 2, 0, 0, 0);
Write(W_RIG1
, ms
, 0, 2, 0, 0, 0);
Signal("Repairs completed.", (struct ship
*)0);
for (p
= movebuf
; *p
; p
++)
if (*p
== 'r' || *p
== 'l')
register loadL
, loadR
, ready
, load
;
Signal("Out of crew", (struct ship
*)0);
Signal("Load which broadside (left or right)? ",
if (!loadL
&& loadR
|| loadL
&& !loadR
) {
Signal("Reload with (round, double, chain, grape)? ",
Signal("Broadside not loaded.",
mf
->readyR
= ready
|R_LOADING
;
mf
->readyL
= ready
|R_LOADING
;