diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-01-18 06:20:55 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-01-18 06:20:55 +0000 |
commit | 5134b02ec45c91ead7868a5b9f0cea921d296a7c (patch) | |
tree | 7a1b1519d35853321a624d35e4df02324a7b4e70 /games/sail/pl_5.c | |
parent | 44f356a1eef9aaed32b992d35566e9f7e7d0db8c (diff) |
NetBSD merge with additional fixes from jsm28@cam.ac.uk. This game still
needs much more work.
Diffstat (limited to 'games/sail/pl_5.c')
-rw-r--r-- | games/sail/pl_5.c | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/games/sail/pl_5.c b/games/sail/pl_5.c index f8df3291e55..fd78af65bd5 100644 --- a/games/sail/pl_5.c +++ b/games/sail/pl_5.c @@ -1,3 +1,4 @@ +/* $OpenBSD: pl_5.c,v 1.2 1999/01/18 06:20:53 pjanzen Exp $ */ /* $NetBSD: pl_5.c,v 1.4 1995/04/24 12:25:21 cgd Exp $ */ /* @@ -37,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pl_5.c,v 1.4 1995/04/24 12:25:21 cgd Exp $"; +static char rcsid[] = "$OpenBSD: pl_5.c,v 1.2 1999/01/18 06:20:53 pjanzen Exp $"; #endif #endif /* not lint */ @@ -45,6 +46,7 @@ static char rcsid[] = "$NetBSD: pl_5.c,v 1.4 1995/04/24 12:25:21 cgd Exp $"; #define turnfirst(x) (*x == 'r' || *x == 'l') +void acceptmove() { int ta; @@ -54,10 +56,10 @@ acceptmove() int vma, dir; char prompt[60]; char buf[60], last = '\0'; - register char *p; + char *p; if (!mc->crew3 || snagged(ms) || !windspeed) { - Signal("Unable to move", (struct ship *)0); + Msg("Unable to move"); return; } @@ -77,22 +79,21 @@ acceptmove() else if (dir == 9) dir = 1; if (last == 't') { - Signal("Ship can't turn that fast.", - (struct ship *)0); + Msg("Ship can't turn that fast."); *p-- = '\0'; } last = 't'; ma--; ta--; vma = min(ma, maxmove(ms, dir, 0)); - if (ta < 0 && moved || vma < 0 && moved) + if ((ta < 0 && moved) || (vma < 0 && moved)) *p-- = '\0'; break; case 'b': ma--; vma--; last = 'b'; - if (ta < 0 && moved || vma < 0 && moved) + if ((ta < 0 && moved) || (vma < 0 && moved)) *p-- = '\0'; break; case '0': @@ -105,54 +106,52 @@ acceptmove() case '1': case '2': case '3': case '4': case '5': case '6': case '7': if (last == '0') { - Signal("Can't move that fast.", - (struct ship *)0); + Msg("Can't move that fast."); *p-- = '\0'; } last = '0'; moved = 1; ma -= *p - '0'; vma -= *p - '0'; - if (ta < 0 && moved || vma < 0 && moved) + if ((ta < 0 && moved) || (vma < 0 && moved)) *p-- = '\0'; break; default: if (!isspace(*p)) { - Signal("Input error.", (struct ship *)0); + Msg("Input error."); *p-- = '\0'; } } - if (ta < 0 && moved || vma < 0 && moved - || af && turnfirst(buf) && moved) { - Signal("Movement error.", (struct ship *)0); + if ((ta < 0 && moved) || (vma < 0 && moved) + || (af && turnfirst(buf) && moved)) { + Msg("Movement error."); if (ta < 0 && moved) { if (mf->FS == 1) { - Write(W_FS, ms, 0, 0, 0, 0, 0); - Signal("No hands to set full sails.", - (struct ship *)0); + Write(W_FS, ms, 0, 0, 0, 0); + Msg("No hands to set full sails."); } } else if (ma >= 0) buf[1] = '\0'; } if (af && !moved) { if (mf->FS == 1) { - Write(W_FS, ms, 0, 0, 0, 0, 0); - Signal("No hands to set full sails.", - (struct ship *)0); + Write(W_FS, ms, 0, 0, 0, 0); + Msg("No hands to set full sails."); } } if (*buf) (void) strcpy(movebuf, buf); else (void) strcpy(movebuf, "d"); - Write(W_MOVE, ms, 1, (long)movebuf, 0, 0, 0); - Signal("Helm: %s.", (struct ship *)0, movebuf); + Writestr(W_MOVE, ms, movebuf); + Msg("Helm: %s.", movebuf); } +void acceptboard() { - register struct ship *sp; - register int n; + struct ship *sp; + int n; int crew[3]; int men = 0; char c; @@ -183,11 +182,11 @@ acceptboard() 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); } else if ((fouled2(ms, sp) || grappled2(ms, sp)) && crew[2]) { - c = sgetch("Crew sections to board the %s (%c%c) (3 max) ?", sp, 1); + c = sgetch("Crew sections to board the $$ (3 max) ?", sp, 1); parties(crew, sp, 0, c); } } @@ -201,13 +200,14 @@ acceptboard() unblockalarm(); } +void parties(crew, to, isdefense, buf) -register struct ship *to; -int crew[3]; -char isdefense; -char buf; + struct ship *to; + int crew[3]; + char isdefense; + char buf; { - register int k, j, men; + int k, j, men; struct BP *ptr; int temp[3]; @@ -227,9 +227,8 @@ char buf; buf--; } if (buf > '0') - Signal("Sending all crew sections.", - (struct ship *)0); - Write(isdefense ? W_DBP : W_OBP, ms, 0, + Msg("Sending all crew sections."); + Write(isdefense ? W_DBP : W_OBP, ms, j, turn, to->file->index, men); if (isdefense) { (void) wmove(slot_w, 2, 0); @@ -239,8 +238,7 @@ char buf; else (void) wmove(slot_w, 2, 1 + k); (void) mvwaddstr(slot_w, 3, 0, "DBP"); - makesignal(ms, "repelling boarders", - (struct ship *)0); + makemsg(ms, "repelling boarders"); } else { (void) wmove(slot_w, 0, 0); for (k=0; k < NBP; k++) @@ -249,12 +247,12 @@ char buf; else (void) wmove(slot_w, 0, 1 + k); (void) mvwaddstr(slot_w, 1, 0, "OBP"); - makesignal(ms, "boarding the %s (%c%c)", to); + makesignal(ms, "boarding the $$", to); } blockalarm(); (void) wrefresh(slot_w); unblockalarm(); } else - Signal("Sending no crew sections.", (struct ship *)0); + Msg("Sending no crew sections."); } } |