X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/963f40fabfbfc47378585a05f5b465cbd4e0c7b6..cc53fc319970619b25fdfa3545d62eab5ffa55dd:/sail/dr_1.c diff --git a/sail/dr_1.c b/sail/dr_1.c index 3395deec..6106190d 100644 --- a/sail/dr_1.c +++ b/sail/dr_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_1.c,v 1.10 1999/09/30 18:01:33 jsm Exp $ */ +/* $NetBSD: dr_1.c,v 1.14 2001/01/04 03:21:16 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,15 +38,24 @@ #if 0 static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_1.c,v 1.10 1999/09/30 18:01:33 jsm Exp $"); +__RCSID("$NetBSD: dr_1.c,v 1.14 2001/01/04 03:21:16 jwise Exp $"); #endif #endif /* not lint */ -#include "driver.h" +#include #include +#include "extern.h" +#include "driver.h" + +void unfoul(void); +void boardcomp(void); +static int fightitout(struct ship *, struct ship *, int); +void resolve(void); +void compcombat(void); +int next(void); void -unfoul() +unfoul(void) { struct ship *sp; struct ship *to; @@ -62,14 +71,14 @@ unfoul() !is_toughmelee(sp, to, 0, 0)) continue; for (i = fouled2(sp, to); --i >= 0;) - if (die() <= 2) + if (dieroll() <= 2) cleanfoul(sp, to, 0); } } } void -boardcomp() +boardcomp(void) { int crew[3]; struct ship *sp, *sq; @@ -133,10 +142,8 @@ boardcomp() } } -int -fightitout(from, to, key) -struct ship *from, *to; -int key; +static int +fightitout(struct ship *from, struct ship *to, int key) { struct ship *fromcap, *tocap; int crewfrom[3], crewto[3], menfrom, mento; @@ -173,12 +180,12 @@ int key; index = fromstrength/10; if (index > 8) index = 8; - toinjured = MT[index][2 - die() / 3]; + toinjured = MT[index][2 - dieroll() / 3]; totalto += toinjured; index = strengthto/10; if (index > 8) index = 8; - frominjured = MT[index][2 - die() / 3]; + frominjured = MT[index][2 - dieroll() / 3]; totalfrom += frominjured; menfrom -= frominjured; mento -= toinjured; @@ -190,7 +197,7 @@ int key; subtract(from, totalfrom, crewfrom, fromcap, pcfrom); subtract(to, totalto, crewto, tocap, pcto); makemsg(from, "boarders from %s repelled", to->shipname); - (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); if (key) @@ -222,8 +229,7 @@ int key; subtract(to, mento, crewto, tocap, pcto); subtract(from, - mento, crewfrom, to, 0); } - (void) sprintf(message, "captured by the %s!", - to->shipname); + sprintf(message, "captured by the %s!", to->shipname); Writestr(W_SIGNAL, from, message); (void) sprintf(message, "killed in melee: %d. %s: %d", totalto, from->shipname, totalfrom); @@ -236,7 +242,7 @@ int key; } void -resolve() +resolve(void) { int thwart; struct ship *sp, *sq; @@ -246,7 +252,7 @@ resolve() continue; for (sq = sp + 1; sq < ls; sq++) if (sq->file->dir && meleeing(sp, sq) && meleeing(sq, sp)) - (void) fightitout(sp, sq, 0); + fightitout(sp, sq, 0); thwart = 2; foreachship(sq) { if (sq->file->dir && meleeing(sq, sp)) @@ -267,7 +273,7 @@ resolve() } void -compcombat() +compcombat(void) { int n; struct ship *sp; @@ -392,14 +398,14 @@ compcombat() if (hit >= 0) { if (load != L_GRAPE) hit = hit > 10 ? 10 : hit; - table(shootat, load, hit, closest, sp, die()); + table(shootat, load, hit, closest, sp, dieroll()); } } } } int -next() +next(void) { if (++turn % 55 == 0) { if (alive) @@ -430,7 +436,7 @@ next() *tp = toupper(*tp); p = tp; } - (void) strncpy(bestship->file->captain, p, + strncpy(bestship->file->captain, p, sizeof bestship->file->captain); bestship->file->captain [sizeof bestship->file->captain - 1] = 0; @@ -439,8 +445,8 @@ next() return -1; } Write(W_TURN, SHIP(0), turn, 0, 0, 0); - if (turn % 7 == 0 && (die() >= cc->windchange || !windspeed)) { - switch (die()) { + if (turn % 7 == 0 && (dieroll() >= cc->windchange || !windspeed)) { + switch (dieroll()) { case 1: winddir = 1; break; @@ -464,7 +470,7 @@ next() if (winddir < 1) winddir += 8; if (windspeed) - switch (die()) { + switch (dieroll()) { case 1: case 2: windspeed--;