-/* $NetBSD: pl_5.c,v 1.5 1997/10/13 19:45:26 christos Exp $ */
+/* $NetBSD: pl_5.c,v 1.15 2001/02/05 01:10:11 christos Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_5.c,v 1.5 1997/10/13 19:45:26 christos Exp $");
+__RCSID("$NetBSD: pl_5.c,v 1.15 2001/02/05 01:10:11 christos Exp $");
#endif
#endif /* not lint */
+#include <ctype.h>
+#include <curses.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include "extern.h"
#include "player.h"
+#include "display.h"
#define turnfirst(x) (*x == 'r' || *x == 'l')
+static void parties(struct ship *, int *, int, int);
+
void
-acceptmove()
+acceptmove(void)
{
int ta;
int ma;
ta = maxturns(ms, &af);
ma = maxmove(ms, mf->dir, 0);
- (void) sprintf(prompt, "move (%d,%c%d): ", ma, af ? '\'' : ' ', ta);
+ sprintf(prompt, "move (%d,%c%d): ", ma, af ? '\'' : ' ', ta);
sgetstr(prompt, buf, sizeof buf);
dir = mf->dir;
vma = ma;
Msg("Movement error.");
if (ta < 0 && moved) {
if (mf->FS == 1) {
- Write(W_FS, ms, 0, 0, 0, 0, 0);
+ Write(W_FS, ms, 0, 0, 0, 0);
Msg("No hands to set full sails.");
}
} else if (ma >= 0)
}
if (af && !moved) {
if (mf->FS == 1) {
- Write(W_FS, ms, 0, 0, 0, 0, 0);
+ Write(W_FS, ms, 0, 0, 0, 0);
Msg("No hands to set full sails.");
}
}
if (*buf)
- (void) strcpy(movebuf, buf);
+ strcpy(movebuf, buf);
else
- (void) strcpy(movebuf, "d");
- Write(W_MOVE, ms, 1, (long)movebuf, 0, 0, 0);
+ strcpy(movebuf, "d");
+ Writestr(W_MOVE, ms, movebuf);
Msg("Helm: %s.", movebuf);
}
void
-acceptboard()
+acceptboard(void)
{
struct ship *sp;
int n;
if (ms->nationality == capship(sp)->nationality)
continue;
if (meleeing(ms, sp) && crew[2]) {
- c = sgetch("How many more to board the %s (%c%c)? ",
+ c = sgetch("How many more to board the $$? ",
sp, 1);
- parties(crew, sp, 0, c);
+ parties(sp, crew, 0, c);
} else if ((fouled2(ms, sp) || grappled2(ms, sp)) && crew[2]) {
- c = sgetch("Crew sections to board the %s (%c%c) (3 max) ?", sp, 1);
- parties(crew, sp, 0, c);
+ c = sgetch("Crew sections to board the $$ (3 max) ?", sp, 1);
+ parties(sp, crew, 0, c);
}
}
if (crew[2]) {
c = sgetch("How many sections to repel boarders? ",
(struct ship *)0, 1);
- parties(crew, ms, 1, c);
+ parties(ms, crew, 1, c);
}
blockalarm();
draw_slot();
unblockalarm();
}
-void
-parties(crew, to, isdefense, buf)
-struct ship *to;
-int crew[3];
-char isdefense;
-char buf;
+static void
+parties(struct ship *to, int *crew, int isdefense, int buf)
{
int k, j, men;
struct BP *ptr;
}
if (buf > '0')
Msg("Sending all crew sections.");
- Write(isdefense ? W_DBP : W_OBP, ms, 0,
+ Write(isdefense ? W_DBP : W_OBP, ms,
j, turn, to->file->index, men);
if (isdefense) {
- (void) wmove(slot_w, 2, 0);
+ wmove(slot_w, 2, 0);
for (k=0; k < NBP; k++)
if (temp[k] && !crew[k])
- (void) waddch(slot_w, k + '1');
+ waddch(slot_w, k + '1');
else
- (void) wmove(slot_w, 2, 1 + k);
- (void) mvwaddstr(slot_w, 3, 0, "DBP");
- makesignal(ms, "repelling boarders",
- (struct ship *)0);
+ wmove(slot_w, 2, 1 + k);
+ mvwaddstr(slot_w, 3, 0, "DBP");
+ makemsg(ms, "repelling boarders");
} else {
- (void) wmove(slot_w, 0, 0);
+ wmove(slot_w, 0, 0);
for (k=0; k < NBP; k++)
if (temp[k] && !crew[k])
- (void) waddch(slot_w, k + '1');
+ waddch(slot_w, k + '1');
else
- (void) wmove(slot_w, 0, 1 + k);
- (void) mvwaddstr(slot_w, 1, 0, "OBP");
- makesignal(ms, "boarding the %s (%c%c)", to);
+ wmove(slot_w, 0, 1 + k);
+ mvwaddstr(slot_w, 1, 0, "OBP");
+ makesignal(ms, "boarding the $$", to);
}
blockalarm();
- (void) wrefresh(slot_w);
+ wrefresh(slot_w);
unblockalarm();
} else
Msg("Sending no crew sections.");