-/* $NetBSD: dr_1.c,v 1.12 2001/01/01 21:57:37 jwise Exp $ */
+/* $NetBSD: dr_1.c,v 1.18 2001/02/05 01:10:08 christos Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_1.c,v 1.12 2001/01/01 21:57:37 jwise Exp $");
+__RCSID("$NetBSD: dr_1.c,v 1.18 2001/02/05 01:10:08 christos Exp $");
#endif
#endif /* not lint */
-#include "driver.h"
+#include <ctype.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include "extern.h"
+#include "driver.h"
+
+static int fightitout(struct ship *, struct ship *, int);
void
unfoul(void)
}
}
-int
+static int
fightitout(struct ship *from, struct ship *to, int key)
{
struct ship *fromcap, *tocap;
}
if (fromstrength >= strengthto * 3 || count == 4) {
unboard(to, from, 0);
- subtract(from, totalfrom, crewfrom, fromcap, pcfrom);
- subtract(to, totalto, crewto, tocap, pcto);
+ subtract(from, fromcap, totalfrom, crewfrom, pcfrom);
+ subtract(to, tocap, totalto, crewto, pcto);
makemsg(from, "boarders from %s repelled", to->shipname);
sprintf(message, "killed in melee: %d. %s: %d",
totalto, from->shipname, totalfrom);
return 1;
} else if (strengthto >= fromstrength * 3) {
unboard(from, to, 0);
- subtract(from, totalfrom, crewfrom, fromcap, pcfrom);
- subtract(to, totalto, crewto, tocap, pcto);
+ subtract(from, fromcap, totalfrom, crewfrom, pcfrom);
+ subtract(to, tocap, totalto, crewto, pcto);
if (key) {
if (fromcap != from)
Write(W_POINTS, fromcap,
Write(W_POINTS, to, topoints, 0, 0, 0);
mento = crewto[0] ? crewto[0] : crewto[1];
if (mento) {
- subtract(to, mento, crewto, tocap, pcto);
- subtract(from, - mento, crewfrom, to, 0);
+ subtract(to, tocap, mento, crewto, pcto);
+ subtract(from, to, - mento, crewfrom, 0);
}
sprintf(message, "captured by the %s!", to->shipname);
Writestr(W_SIGNAL, from, message);
- (void) sprintf(message, "killed in melee: %d. %s: %d",
+ sprintf(message, "killed in melee: %d. %s: %d",
totalto, from->shipname, totalfrom);
Writestr(W_SIGNAL, to, message);
mento = 0;
if (hit >= 0) {
if (load != L_GRAPE)
hit = hit > 10 ? 10 : hit;
- table(shootat, load, hit, closest, sp, dieroll());
+ table(sp, closest, shootat, load, hit, dieroll());
}
}
}