-/* $NetBSD: dr_2.c,v 1.23 2009/03/14 19:35:13 dholland Exp $ */
+/* $NetBSD: dr_2.c,v 1.27 2019/02/03 10:48:46 mrg Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_2.c,v 1.23 2009/03/14 19:35:13 dholland Exp $");
+__RCSID("$NetBSD: dr_2.c,v 1.27 2019/02/03 10:48:46 mrg Exp $");
#endif
#endif /* not lint */
short *, short *, int *);
static void try(struct ship *f, struct ship *t,
char *command, size_t commandmax, char *temp, size_t tempmax,
- int ma, int ta, int af, int vma, int dir, int *high,
+ int ma, int ta, bool af, int vma, int dir, int *high,
int rakeme);
static void rmend(char *);
continue;
if (dieroll() < 5)
continue;
- Write(sink == 1 ? W_SINK : W_EXPLODE, sp, 2, 0, 0, 0);
- Write(W_DIR, sp, 0, 0, 0, 0);
+ if (sink == 1) {
+ send_sink(sp, 2);
+ } else {
+ send_explode(sp, 2);
+ }
+ send_dir(sp, 0);
if (snagged(sp))
foreachship(sq)
cleansnag(sp, sq, 1);
continue;
if (sp->specs->crew1 + sp->specs->crew2 + sp->specs->crew3 >
sp->file->pcrew * 6) {
- Writestr(W_SIGNAL, sp, "prize crew overthrown");
- Write(W_POINTS, sp->file->captured,
+ send_signal(sp, "prize crew overthrown");
+ send_points(sp->file->captured,
sp->file->captured->file->points
- - 2 * sp->specs->pts,
- 0, 0, 0);
- Write(W_CAPTURED, sp, -1, 0, 0, 0);
+ - 2 * sp->specs->pts);
+ send_captured(sp, -1);
}
}
}
void
closeon(struct ship *from, struct ship *to, char *command, size_t commandmax,
- int ta, int ma, int af)
+ int ta, int ma, bool af)
{
int high;
char temp[10];
try(struct ship *f, struct ship *t,
char *command, size_t commandmax,
char *temp, size_t tempmax,
- int ma, int ta, int af, int vma, int dir, int *high, int rakeme)
+ int ma, int ta, bool af, int vma, int dir, int *high, int rakeme)
{
int new, n;
- char st[4];
+ char st[11];
#define rakeyou (gunsbear(f, t) && !gunsbear(t, f))
if ((n = str_end(temp)) < '1' || n > '9')
}
if ((ma > 0 && ta > 0 && (n = str_end(temp)) != 'l' && n != 'r') ||
!strlen(temp)) {
- strlcat(temp, "l", sizeof(temp));
+ strlcat(temp, "l", tempmax);
new = score(f, t, temp, tempmax, rakeme);
if (new > *high && (!rakeme ||
(gunsbear(f, t) && !gunsbear(t, f)))) {