games@tekred.TEK.COM (04/14/88)
Submitted by: bostic@okeeffe.Berkeley.EDU (Keith Bostic) Comp.sources.games: Volume 4, Issue 10 Archive-name: sail/Part02 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 2 (of 4)." # Contents: :specs assorted.c dr_3.c globals.c pl_7.c sync.c # Wrapped by billr@saab on Wed Apr 13 13:38:21 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f :specs -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \":specs\" else echo shar: Extracting \":specs\" \(119 characters\) sed "s/^X//" >:specs <<'END_OF_:specs' X./"bs bs ta guns class hull qual"n3b+d3b X+/"crew1 crew2 crew3 gunL gunR carL carR"n8b X+/"rig1 rig2 rig3 rig4 pts"n4b+d END_OF_:specs if test 119 -ne `wc -c <:specs`; then echo shar: \":specs\" unpacked with wrong size! fi # end of overwriting check fi if test -f assorted.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"assorted.c\" else echo shar: Extracting \"assorted.c\" \(6061 characters\) sed "s/^X//" >assorted.c <<'END_OF_assorted.c' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that this notice is preserved and that due credit is given X * to the University of California at Berkeley. The name of the University X * may not be used to endorse or promote products derived from this X * software without specific prior written permission. This software X * is provided ``as is'' without express or implied warranty. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)assorted.c 5.2 (Berkeley) 3/9/88"; X#endif /* not lint */ X X#include "externs.h" X Xtable(rig, shot, hittable, on, from, roll) Xstruct ship *on, *from; Xint rig, shot, hittable, roll; X{ X register int hhits = 0, chits = 0, ghits = 0, rhits = 0; X int Ghit = 0, Hhit = 0, Rhit = 0, Chit = 0; X int guns, car, pc, hull; X int crew[3]; X register int n; X int rigg[4]; X char *message; X struct Tables *tp; X X pc = on->file->pcrew; X hull = on->specs->hull; X crew[0] = on->specs->crew1; X crew[1] = on->specs->crew2; X crew[2] = on->specs->crew3; X rigg[0] = on->specs->rig1; X rigg[1] = on->specs->rig2; X rigg[2] = on->specs->rig3; X rigg[3] = on->specs->rig4; X if (shot == L_GRAPE) X Chit = chits = hittable; X else { X tp = &(rig ? RigTable : HullTable)[hittable][roll-1]; X Chit = chits = tp->C; X Rhit = rhits = tp->R; X Hhit = hhits = tp->H; X Ghit = ghits = tp->G; X if (on->file->FS) X rhits *= 2; X if (shot == L_CHAIN) { X Ghit = ghits = 0; X Hhit = hhits = 0; X } X } X if (on->file->captured != 0) { X pc -= (chits + 1) / 2; X chits /= 2; X } X for (n = 0; n < 3; n++) X if (chits > crew[n]) { X chits -= crew[n]; X crew[n] = 0; X } else { X crew[n] -= chits; X chits = 0; X } X for (n = 0; n < 3; n++) X if (rhits > rigg[n]){ X rhits -= rigg[n]; X rigg[n] = 0; X } else { X rigg[n] -= rhits; X rhits = 0; X } X if (rigg[3] != -1 && rhits > rigg[3]) { X rhits -= rigg[3]; X rigg[3] = 0; X } else if (rigg[3] != -1) { X rigg[3] -= rhits; X } X if (rig && !rigg[2] && (!rigg[3] || rigg[3] == -1)) X makesignal(on, "dismasted!", (struct ship *)0); X if (portside(from, on, 0)) { X guns = on->specs->gunR; X car = on->specs->carR; X } else { X guns = on->specs->gunL; X car = on->specs->carL; X } X if (ghits > car) { X ghits -= car; X car = 0; X } else { X car -= ghits; X ghits = 0; X } X if (ghits > guns){ X ghits -= guns; X guns = 0; X } else { X guns -= ghits; X ghits = 0; X } X hull -= ghits; X if (Ghit) X Write(portside(from, on, 0) ? W_GUNR : W_GUNL, X on, 0, guns, car, 0, 0); X hull -= hhits; X hull = hull < 0 ? 0 : hull; X if (on->file->captured != 0 && Chit) X Write(W_PCREW, on, 0, pc, 0, 0, 0); X if (Hhit) X Write(W_HULL, on, 0, hull, 0, 0, 0); X if (Chit) X Write(W_CREW, on, 0, crew[0], crew[1], crew[2], 0); X if (Rhit) X Write(W_RIGG, on, 0, rigg[0], rigg[1], rigg[2], rigg[3]); X switch (shot) { X case L_ROUND: X message = "firing round shot on %s (%c%c)"; X break; X case L_GRAPE: X message = "firing grape shot on %s (%c%c)"; X break; X case L_CHAIN: X message = "firing chain shot on %s (%c%c)"; X break; X case L_DOUBLE: X message = "firing double shot on %s (%c%c)"; X break; X case L_EXPLODE: X message = "exploding shot on %s (%c%c)"; X } X makesignal(from, message, on); X if (roll == 6 && rig) { X switch(Rhit) { X case 0: X message = "fore topsail sheets parted"; X break; X case 1: X message = "mizzen shrouds parted"; X break; X case 2: X message = "main topsail yard shot away"; X break; X case 4: X message = "fore topmast and foremast shrouds shot away"; X break; X case 5: X message = "mizzen mast and yard shot through"; X break; X case 6: X message = "foremast and spritsail yard shattered"; X break; X case 7: X message = "main topmast and mizzen mast shattered"; X break; X } X makesignal(on, message, (struct ship *)0); X } else if (roll == 6) { X switch (Hhit) { X case 0: X message = "anchor cables severed"; X break; X case 1: X message = "two anchor stocks shot away"; X break; X case 2: X message = "quarterdeck bulwarks damaged"; X break; X case 3: X message = "three gun ports shot away"; X break; X case 4: X message = "four guns dismounted"; X break; X case 5: X message = "rudder cables shot through"; X Write(W_TA, on, 0, 0, 0, 0, 0); X break; X case 6: X message = "shot holes below the water line"; X break; X } X makesignal(on, message, (struct ship *)0); X } X /* X if (Chit > 1 && on->file->readyL&R_INITIAL && on->file->readyR&R_INITIAL) { X on->specs->qual--; X if (on->specs->qual <= 0) { X makesignal(on, "crew mutinying!", (struct ship *)0); X on->specs->qual = 5; X Write(W_CAPTURED, on, 0, on->file->index, 0, 0, 0); X } else X makesignal(on, "crew demoralized", (struct ship *)0); X Write(W_QUAL, on, 0, on->specs->qual, 0, 0, 0); X } X */ X if (!hull) X strike(on, from); X} X XCleansnag(from, to, all, flag) Xregister struct ship *from, *to; Xchar all, flag; X{ X if (flag & 1) { X Write(W_UNGRAP, from, 0, to->file->index, all, 0, 0); X Write(W_UNGRAP, to, 0, from->file->index, all, 0, 0); X } X if (flag & 2) { X Write(W_UNFOUL, from, 0, to->file->index, all, 0, 0); X Write(W_UNFOUL, to, 0, from->file->index, all, 0, 0); X } X if (!snagged2(from, to)) { X if (!snagged(from)) { X unboard(from, from, 1); /* defense */ X unboard(from, from, 0); /* defense */ X } else X unboard(from, to, 0); /* offense */ X if (!snagged(to)) { X unboard(to, to, 1); /* defense */ X unboard(to, to, 0); /* defense */ X } else X unboard(to, from, 0); /* offense */ X } X} X Xstrike(ship, from) Xregister struct ship *ship, *from; X{ X int points; X X if (ship->file->struck) X return; X Write(W_STRUCK, ship, 0, 1, 0, 0, 0); X points = ship->specs->pts + from->file->points; X Write(W_POINTS, from, 0, points, 0, 0, 0); X unboard(ship, ship, 0); /* all offense */ X unboard(ship, ship, 1); /* all defense */ X switch (die()) { X case 3: X case 4: /* ship may sink */ X Write(W_SINK, ship, 0, 1, 0, 0, 0); X break; X case 5: X case 6: /* ship may explode */ X Write(W_EXPLODE, ship, 0, 1, 0, 0, 0); X break; X } X Write(W_SIGNAL, ship, 1, (int) "striking her colours!", 0, 0, 0); X} END_OF_assorted.c if test 6061 -ne `wc -c <assorted.c`; then echo shar: \"assorted.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f dr_3.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dr_3.c\" else echo shar: Extracting \"dr_3.c\" \(7061 characters\) sed "s/^X//" >dr_3.c <<'END_OF_dr_3.c' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that this notice is preserved and that due credit is given X * to the University of California at Berkeley. The name of the University X * may not be used to endorse or promote products derived from this X * software without specific prior written permission. This software X * is provided ``as is'' without express or implied warranty. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)dr_3.c 5.2 (Berkeley) 3/9/88"; X#endif /* not lint */ X X#include "driver.h" X Xmoveall() /* move all comp ships */ X{ X register struct ship *sp, *sq; /* r11, r10 */ X register int n; /* r9 */ X register int k, l; /* r8, r7 */ X int row[NSHIP], col[NSHIP], dir[NSHIP], drift[NSHIP]; X char moved[NSHIP]; X X /* X * first try to create moves for OUR ships X */ X foreachship(sp) { X struct ship *closest; X int ma, ta; X char af; X X if (sp->file->captain[0] || sp->file->dir == 0) X continue; X if (!sp->file->struck && windspeed && !snagged(sp) X && sp->specs->crew3) { X ta = maxturns(sp, &af); X ma = maxmove(sp, sp->file->dir, 0); X closest = closestenemy(sp, 0, 0); X if (closest == 0) X *sp->file->movebuf = '\0'; X else X closeon(sp, closest, sp->file->movebuf, X ta, ma, af); X } else X *sp->file->movebuf = '\0'; X } X /* X * Then execute the moves for ALL ships (dead ones too), X * checking for collisions and snags at each step. X * The old positions are saved in row[], col[], dir[]. X * At the end, we compare and write out the changes. X */ X n = 0; X foreachship(sp) { X if (snagged(sp)) X (void) strcpy(sp->file->movebuf, "d"); X else X if (*sp->file->movebuf != 'd') X (void) strcat(sp->file->movebuf, "d"); X row[n] = sp->file->row; X col[n] = sp->file->col; X dir[n] = sp->file->dir; X drift[n] = sp->file->drift; X moved[n] = 0; X n++; X } X /* X * Now resolve collisions. X * This is the tough part. X */ X for (k = 0; stillmoving(k); k++) { X /* X * Step once. X * And propagate the nulls at the end of sp->file->movebuf. X */ X n = 0; X foreachship(sp) { X if (!sp->file->movebuf[k]) X sp->file->movebuf[k+1] = '\0'; X else if (sp->file->dir) X step(sp->file->movebuf[k], sp, &moved[n]); X n++; X } X /* X * The real stuff. X */ X n = 0; X foreachship(sp) { X if (sp->file->dir == 0 || isolated(sp)) X goto cont1; X l = 0; X foreachship(sq) { X char snap = 0; X X if (sp == sq) X goto cont2; X if (sq->file->dir == 0) X goto cont2; X if (!push(sp, sq)) X goto cont2; X if (snagged2(sp, sq) && range(sp, sq) > 1) X snap++; X if (!range(sp, sq) && !fouled2(sp, sq)) { X makesignal(sp, X "collision with %s (%c%c)", sq); X if (die() < 4) { X makesignal(sp, X "fouled with %s (%c%c)", X sq); X Write(W_FOUL, sp, 0, l, 0, 0, 0); X Write(W_FOUL, sq, 0, n, 0, 0, 0); X } X snap++; X } X if (snap) { X sp->file->movebuf[k + 1] = 0; X sq->file->movebuf[k + 1] = 0; X sq->file->row = sp->file->row - 1; X if (sp->file->dir == 1 X || sp->file->dir == 5) X sq->file->col = X sp->file->col - 1; X else X sq->file->col = sp->file->col; X sq->file->dir = sp->file->dir; X } X cont2: X l++; X } X cont1: X n++; X } X } X /* X * Clear old moves. And write out new pos. X */ X n = 0; X foreachship(sp) { X if (sp->file->dir != 0) { X *sp->file->movebuf = 0; X if (row[n] != sp->file->row) X Write(W_ROW, sp, 0, sp->file->row, 0, 0, 0); X if (col[n] != sp->file->col) X Write(W_COL, sp, 0, sp->file->col, 0, 0, 0); X if (dir[n] != sp->file->dir) X Write(W_DIR, sp, 0, sp->file->dir, 0, 0, 0); X if (drift[n] != sp->file->drift) X Write(W_DRIFT, sp, 0, sp->file->drift, 0, 0, 0); X } X n++; X } X} X Xstillmoving(k) Xregister int k; X{ X register struct ship *sp; X X foreachship(sp) X if (sp->file->movebuf[k]) X return 1; X return 0; X} X Xisolated(ship) Xregister struct ship *ship; X{ X register struct ship *sp; X X foreachship(sp) { X if (ship != sp && range(ship, sp) <= 10) X return 0; X } X return 1; X} X Xpush(from, to) Xregister struct ship *from, *to; X{ X register int bs, sb; X X sb = to->specs->guns; X bs = from->specs->guns; X if (sb > bs) X return 1; X if (sb < bs) X return 0; X return from < to; X} X Xstep(com, sp, moved) Xchar com; Xregister struct ship *sp; Xchar *moved; X{ X register int dist; X X switch (com) { X case 'r': X if (++sp->file->dir == 9) X sp->file->dir = 1; X break; X case 'l': X if (--sp->file->dir == 0) X sp->file->dir = 8; X break; X case '0': case '1': case '2': case '3': X case '4': case '5': case '6': case '7': X if (sp->file->dir % 2 == 0) X dist = dtab[com - '0']; X else X dist = com - '0'; X sp->file->row -= dr[sp->file->dir] * dist; X sp->file->col -= dc[sp->file->dir] * dist; X *moved = 1; X break; X case 'b': X break; X case 'd': X if (!*moved) { X if (windspeed != 0 && ++sp->file->drift > 2 && X (sp->specs->class >= 3 && !snagged(sp) X || (turn & 1) == 0)) { X sp->file->row -= dr[winddir]; X sp->file->col -= dc[winddir]; X } X } else X sp->file->drift = 0; X break; X } X} X Xsendbp(from, to, sections, isdefense) Xregister struct ship *from, *to; Xint sections; Xchar isdefense; X{ X int n; X register struct BP *bp; X X bp = isdefense ? from->file->DBP : from->file->OBP; X for (n = 0; n < NBP && bp[n].turnsent; n++) X ; X if (n < NBP && sections) { X Write(isdefense ? W_DBP : W_OBP, from, 0, X n, turn, to->file->index, sections); X if (isdefense) X makesignal(from, "repelling boarders", X (struct ship *)0); X else X makesignal(from, "boarding the %s (%c%c)", to); X } X} X Xtoughmelee(ship, to, isdefense, count) Xregister struct ship *ship, *to; Xint isdefense, count; X{ X register struct BP *bp; X register obp = 0; X int n, OBP = 0, DBP = 0, dbp = 0; X int qual; X X qual = ship->specs->qual; X bp = isdefense ? ship->file->DBP : ship->file->OBP; X for (n = 0; n < NBP; n++, bp++) { X if (bp->turnsent && (to == bp->toship || isdefense)) { X obp += bp->mensent / 100 X ? ship->specs->crew1 * qual : 0; X obp += (bp->mensent % 100)/10 X ? ship->specs->crew2 * qual : 0; X obp += bp->mensent % 10 X ? ship->specs->crew3 * qual : 0; X } X } X if (count || isdefense) X return obp; X OBP = toughmelee(to, ship, 0, count + 1); X dbp = toughmelee(ship, to, 1, count + 1); X DBP = toughmelee(to, ship, 1, count + 1); X if (OBP > obp + 10 || OBP + DBP >= obp + dbp + 10) X return 1; X else X return 0; X} X Xreload() X{ X register struct ship *sp; X X foreachship(sp) { X sp->file->loadwith = 0; X } X} X Xchecksails() X{ X register struct ship *sp; X register int rig, full; X struct ship *close; X X foreachship(sp) { X if (sp->file->captain[0] != 0) X continue; X rig = sp->specs->rig1; X if (windspeed == 6 || windspeed == 5 && sp->specs->class > 4) X rig = 0; X if (rig && sp->specs->crew3) { X close = closestenemy(sp, 0, 0); X if (close != 0) { X if (range(sp, close) > 9) X full = 1; X else X full = 0; X } else X full = 0; X } else X full = 0; X if ((sp->file->FS != 0) != full) X Write(W_FS, sp, 0, full, 0, 0, 0); X } X} END_OF_dr_3.c if test 7061 -ne `wc -c <dr_3.c`; then echo shar: \"dr_3.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f globals.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"globals.c\" else echo shar: Extracting \"globals.c\" \(19388 characters\) sed "s/^X//" >globals.c <<'END_OF_globals.c' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that this notice is preserved and that due credit is given X * to the University of California at Berkeley. The name of the University X * may not be used to endorse or promote products derived from this X * software without specific prior written permission. This software X * is provided ``as is'' without express or implied warranty. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)globals.c 5.2 (Berkeley) 3/9/88"; X#endif /* not lint */ X X#include "externs.h" X Xstruct scenario scene[] = { X /* X * int winddir; X * int windspeed; X * int windchange; X * int vessels; X * char *name; X * struct ship ship[NSHIP]; X */ X 5, 3, 5, 2, "Ranger vs. Drake", X { X { "Ranger", specs+0, N_A, 7, 20, 4, 0 }, X { "Drake", specs+1, N_B, 7, 31, 5, 0 } X }, X 1, 3, 6, 2, "The Battle of Flamborough Head", X { X { "Bonhomme Rich", specs+2, N_A, 13, 40, 2, 0 }, X { "Serapis", specs+3, N_B, 2, 42, 2, 0 } X }, X 5, 5, 5, 10, "Arbuthnot and Des Touches", X { X { "America", specs+4, N_B, 7, 37, 4, 0 }, X { "Befford", specs+5, N_B, 5, 35, 4, 0 }, X { "Adamant", specs+6, N_B, 3, 33, 4, 0 }, X { "London", specs+7, N_B, 1, 31, 4, 0 }, X { "Royal Oak", specs+8, N_B, -1, 29, 4, 0 }, X { "Neptune", specs+9, N_F, 6, 44, 4, 0 }, X { "Duc Bougogne", specs+10, N_F, 8, 46, 4, 0 }, X { "Conquerant", specs+48, N_F, 10, 48, 4, 0 }, X { "Provence", specs+11, N_F, 12, 50, 4, 0 }, X { "Romulus", specs+12, N_F, 20, 58, 4, 0 } X }, X 1, 3, 5, 10, "Suffren and Hughes", X { X { "Monmouth", specs+52, N_B, 9, 45, 2, 0 }, X { "Hero", specs+5, N_B, 13, 49, 2, 0 }, X { "Isis", specs+6, N_B, 12, 48, 2, 0 }, X { "Superb", specs+50, N_B, 10, 46, 2, 0 }, X { "Burford", specs+48, N_B, 11, 47, 2, 0 }, X { "Flamband", specs+13, N_F, 7, 59, 4, 0 }, X { "Annibal", specs+9, N_F, 4, 56, 4, 0 }, X { "Severe", specs+11, N_F, 2, 54, 4, 0 }, X { "Brilliant", specs+49, N_F, -1, 51, 4, 0 }, X { "Sphinx", specs+51, N_F, -5, 47, 4, 0 } X }, X 1, 3, 4, 2, "Nymphe vs. Cleopatre", X { X { "Nymphe", specs+14, N_B, 13, 30, 2, 0 }, X { "Cleopatre", specs+15, N_F, 3, 41, 2, 0 } X }, X 1, 3, 5, 2, "Mars vs. Hercule", X { X { "Mars", specs+16, N_B, 13, 30, 2, 0 }, X { "Hercule", specs+17, N_F, 3, 41, 2, 0 } X }, X 5, 3, 5, 2, "Ambuscade vs. Baionnaise", X { X { "Ambuscade", specs+18, N_B, 13, 30, 2, 0 }, X { "Baionnaise", specs+19, N_F, 3, 41, 2, 0 } X }, X 1, 5, 6, 2, "Constellation vs. Insurgent", X { X { "Constellation", specs+20, N_A, 9, 50, 8, 0 }, X { "Insurgent", specs+22, N_F, 4, 24, 2, 0 } X }, X 1, 3, 5, 2, "Constellation vs. Vengeance", X { X { "Constellation", specs+20, N_A, 12, 40, 2, 0 }, X { "Vengeance", specs+21, N_F, 1, 43, 2, 0 } X }, X 1, 3, 6, 10, "The Battle of Lissa", X { X { "Amphion", specs+23, N_B, 8, 50, 4, 0 }, X { "Active", specs+24, N_B, 6, 48, 4, 0 }, X { "Volage", specs+25, N_B, 4, 46, 4, 0 }, X { "Cerberus", specs+26, N_B, 2, 44, 4, 0 }, X { "Favorite", specs+27, N_F, 9, 34, 2, 0 }, X { "Flore", specs+21, N_F, 13, 39, 2, 0 }, X { "Danae", specs+64, N_F, 15, 37, 2, 0 }, X { "Bellona", specs+28, N_F, 17, 35, 2, 0 }, X { "Corona", specs+29, N_F, 12, 31, 2, 0 }, X { "Carolina", specs+30, N_F, 15, 28, 2, 0 } X }, X 2, 5, 6, 2, "Constitution vs. Guerriere", X { X { "Constitution", specs+31, N_A, 7, 35, 1, 0 }, X { "Guerriere", specs+32, N_B, 7, 47, 4, 0 } X }, X 1, 3, 5, 2, "United States vs. Macedonian", X { X { "United States", specs+33, N_A, 1, 52, 6, 0 }, X { "Macedonian", specs+34, N_B, 14, 40, 1, 0 } X }, X 1, 3, 6, 2, "Constitution vs. Java", X { X { "Constitution", specs+31, N_A, 1, 40, 2, 0 }, X { "Java", specs+35, N_B, 11, 40, 2, 0 } X }, X 1, 3, 5, 2, "Chesapeake vs. Shannon", X { X { "Chesapeake", specs+36, N_A, 13, 40, 2, 0 }, X { "Shannon", specs+37, N_B, 1, 42, 2, 0 } X }, X 1, 1, 6, 5, "The Battle of Lake Erie", X { X { "Lawrence", specs+38, N_A, 4, 55, 8, 0 }, X { "Niagara", specs+42, N_A, 7, 61, 8, 0 }, X { "Lady Prevost", specs+39, N_B, 4, 25, 2, 0 }, X { "Detroit", specs+40, N_B, 7, 22, 2, 0 }, X { "Q. Charlotte", specs+41, N_B, 10, 19, 2, 0 } X }, X 1, 1, 5, 2, "Wasp vs. Reindeer", X { X { "Wasp", specs+42, N_A, 3, 41, 2, 0 }, X { "Reindeer", specs+43, N_B, 10, 48, 2, 0 } X }, X 1, 2, 5, 3, "Constitution vs. Cyane and Levant", X { X { "Constitution", specs+31, N_A, 10, 45, 2, 0 }, X { "Cyane", specs+44, N_B, 3, 37, 2, 0 }, X { "Levant", specs+45, N_B, 5, 35, 2, 0 } X }, X 5, 5, 5, 3, "Pellew vs. Droits de L'Homme", X { X { "Indefatigable", specs+46, N_B, 12, 45, 6, 0 }, X { "Amazon", specs+47, N_B, 9, 48, 6, 0 }, X { "Droits L'Hom", specs+48, N_F, 3, 28, 5, 0 } X }, X 2, 2, 3, 10, "Algeciras", X { X { "Caesar", specs+49, N_B, 7, 70, 6, 0 }, X { "Pompee", specs+50, N_B, 5, 72, 6, 0 }, X { "Spencer", specs+5, N_B, 3, 74, 6, 0 }, X { "Hannibal", specs+7, N_B, 1, 76, 6, 0 }, X { "Real-Carlos", specs+53, N_S, 9, 20, 3, 0 }, X { "San Fernando", specs+54, N_S, 11, 16, 3, 0 }, X { "Argonauta", specs+55, N_S, 10, 14, 4, 0 }, X { "San Augustine", specs+56, N_S, 6, 22, 4, 0 }, X { "Indomptable", specs+51, N_F, 7, 23, 5, 0 }, X { "Desaix", specs+52, N_F, 7, 27, 7, 0 } X }, X 5, 3, 6, 7, "Lake Champlain", X { X { "Saratoga", specs+60, N_A, 8, 10, 1, 0 }, X { "Eagle", specs+61, N_A, 9, 13, 2, 0 }, X { "Ticonderoga", specs+62, N_A, 12, 17, 3, 0 }, X { "Preble", specs+63, N_A, 14, 20, 2, 0 }, X { "Confiance", specs+57, N_B, 4, 70, 6, 0 }, X { "Linnet", specs+58, N_B, 7, 68, 6, 0 }, X { "Chubb", specs+59, N_B, 10, 65, 6, 0 } X }, X 5, 3, 6, 4, "Last Voyage of the USS President", X { X { "President", specs+67, N_A, 12, 42, 5, 0 }, X { "Endymion", specs+64, N_B, 5, 42, 5, 0 }, X { "Pomone", specs+65, N_B, 7, 82, 6, 0 }, X { "Tenedos", specs+66, N_B, 7, -1, 4, 0 } X }, X 7, 5, 5, 2, "Hornblower and the Natividad", X { X { "Lydia", specs+68, N_B, 12, 40, 2, 0 }, X { "Natividad", specs+69, N_S, 2, 40, 4, 0 } X }, X 1, 3, 6, 2, "Curse of the Flying Dutchman", X { X { "Piece of Cake", specs+19, N_S, 7, 40, 2, 0 }, X { "Flying Dutchy", specs+71, N_F, 7, 41, 1, 0 } X }, X 1, 4, 1, 4, "The South Pacific", X { X { "USS Scurvy", specs+70, N_A, 7, 40, 1, 0 }, X { "HMS Tahiti", specs+71, N_B, 12, 60, 1, 0 }, X { "Australian", specs+18, N_S, 5, 20, 8, 0 }, X { "Bikini Atoll", specs+63, N_F, 2, 60, 4, 0 } X }, X 7, 3, 6, 5, "Hornblower and the battle of Rosas bay", X { X { "Sutherland", specs+5, N_B, 13, 30, 2, 0 }, X { "Turenne", specs+10, N_F, 9, 35, 6, 0 }, X { "Nightmare", specs+9, N_F, 7, 37, 6, 0 }, X { "Paris", specs+53, N_F, 3, 45, 4, 0 }, X { "Napolean", specs+56, N_F, 1, 40, 6, 0 } X }, X 6, 4, 7, 5, "Cape Horn", X { X { "Concord", specs+51, N_A, 3, 20, 4, 0 }, X { "Berkeley", specs+7, N_A, 5, 50, 5, 0 }, X { "Thames", specs+71, N_B, 10, 40, 1, 0 }, X { "Madrid", specs+53, N_S, 13, 60, 8, 0 }, X { "Musket", specs+10, N_F, 10, 60, 7, 0 } X }, X 8, 3, 7, 3, "New Orleans", X { X { "Alligator", specs+71, N_A, 13, 5, 1, 0 }, X { "Firefly", specs+50, N_B, 10, 20, 8, 0 }, X { "Cypress", specs+46, N_B, 5, 10, 6, 0 } X }, X 5, 3, 7, 3, "Botany Bay", X { X { "Shark", specs+11, N_B, 6, 15, 4, 0 }, X { "Coral Snake", specs+31, N_F, 3, 30, 6, 0 }, X { "Sea Lion", specs+33, N_F, 13, 50, 8, 0 } X }, X 4, 3, 6, 4, "Voyage to the Bottom of the Sea", X { X { "Seaview", specs+71, N_A, 6, 3, 3, 0 }, X { "Flying Sub", specs+64, N_A, 8, 3, 3, 0 }, X { "Mermaid", specs+70, N_B, 2, 5, 5, 0 }, X { "Giant Squid", specs+53, N_S, 10, 30, 8, 0 } X }, X 7, 3, 6, 3, "Frigate Action", X { X { "Killdeer", specs+21, N_A, 7, 20, 8, 0 }, X { "Sandpiper", specs+27, N_B, 5, 40, 8, 0 }, X { "Curlew", specs+34, N_S, 10, 60, 8, 0 } X }, X 7, 2, 5, 6, "The Battle of Midway", X { X { "Enterprise", specs+49, N_A, 10, 70, 8, 0 }, X { "Yorktown", specs+51, N_A, 3, 70, 7, 0 }, X { "Hornet", specs+52, N_A, 6, 70, 7, 0 }, X { "Akagi", specs+53, N_J, 6, 10, 4, 0 }, X { "Kaga", specs+54, N_J, 4, 12, 4, 0 }, X { "Soryu", specs+55, N_J, 2, 14, 4, 0 } X }, X 1, 3, 4, 8, "Star Trek", X { X { "Enterprise", specs+76, N_D,-10, 60, 7, 0 }, X { "Yorktown", specs+77, N_D, 0, 70, 7, 0 }, X { "Reliant", specs+78, N_D, 10, 70, 7, 0 }, X { "Galileo", specs+79, N_D, 20, 60, 7, 0 }, X { "Kobayashi Maru", specs+80, N_K, 0,120, 7, 0 }, X { "Klingon II", specs+81, N_K, 10,120, 7, 0 }, X { "Red Orion", specs+82, N_O, 0, 0, 3, 0 }, X { "Blue Orion", specs+83, N_O, 10, 0, 3, 0 } X } X}; Xint nscene = sizeof scene / sizeof (struct scenario); X Xstruct shipspecs specs[] = { X/* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */ X/* class qual crew2 gunL carL rig1 rig3 */ X/*00*/ 4, 7, 3, 19, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 4, 4, 4, 4, 7, X/*01*/ 4, 7, 3, 17, 5, 5, 4, 2, 2, 2, 0, 0, 4, 4, 3, 3, 3, 3, 6, X/*02*/ 3, 5, 2, 42, 4, 7, 4, 2, 2, 2, 2, 2, 0, 0, 5, 5, 5, -1, 11, X/*03*/ 4, 6, 3, 44, 3, 7, 4, 2, 2, 2, 3, 3, 0, 0, 5, 5, 5, 5, 12, X/*04*/ 3, 5, 2, 64, 2, 17, 4, 8, 6, 6, 12, 12, 2, 2, 7, 7, 7, -1, 20, X/*05*/ 3, 5, 2, 74, 2, 20, 4, 8, 8, 8, 16, 16, 2, 2, 7, 7, 7, -1, 26,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*70*/ 3, 5, 1, 136, 1, 30, 1, 8, 14, 14, 28, 28, 0, 0, 9, 9, 9, -1, 27, X/*71*/ 3, 5, 1, 120, 1, 27, 5, 16, 14, 14, 28, 28, 2, 2, 9, 9, 9, -1, 43, X/*72*/ 3, 5, 1, 120, 2, 21, 5, 15, 17, 15, 25, 25, 7, 7, 9, 9, 9, -1, 36, X/*73*/ 3, 5, 1, 90, 3, 18, 4, 13, 15, 13, 20, 20, 6, 6, 5, 5, 5, 5, 28, X/*74*/ 4, 7, 3, 6, 6, 3, 4, 2, 2, 2, 20, 20, 6, 6, 2, 2, 3, 3, 5, X/*75*/ 3, 5, 1, 110, 2, 20, 4, 14, 15, 11, 26, 26, 8, 8, 7, 8, 9, -1, 34, X/*76*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, X/*77*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, X/*78*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, X/*79*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, X/*80*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, X/*81*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, X/*82*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, X/*83*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, X/* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */ X/* class qual crew2 gunL carL rig1 rig3 */ X}; X Xstruct windeffects WET[7][6] = { X { {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9} }, X { {3,2,2,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {2,1,0,0}, {2,1,0,0} }, X { {1,1,1,0}, {1,1,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0} }, X { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }, X { {0,0,0,0}, {1,0,0,0}, {1,1,0,0}, {1,1,0,0}, {2,2,1,0}, {2,2,1,0} }, X { {1,0,0,0}, {1,1,0,0}, {1,1,1,0}, {1,1,1,0}, {3,2,2,0}, {3,2,2,0} }, X { {2,1,1,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {3,3,2,0}, {3,3,2,0} } X}; X Xstruct Tables RigTable[11][6] = { X { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,1}, {0,0,1,0} }, X { {0,0,0,0}, {0,0,0,0}, {0,0,0,1}, {0,0,1,0}, {1,0,0,1}, {0,1,1,1} }, X { {0,0,0,0}, {0,0,0,1}, {0,0,1,1}, {0,1,0,1}, {0,1,0,1}, {1,0,1,2} }, X { {0,0,0,0}, {0,0,1,1}, {0,1,0,1}, {0,0,0,2}, {0,1,0,2}, {1,0,1,2} }, X { {0,1,0,1}, {1,0,0,1}, {0,1,1,2}, {0,1,0,2}, {0,0,1,3}, {1,0,1,4} }, X { {0,0,1,1}, {0,1,0,2}, {1,0,0,3}, {0,1,1,3}, {1,0,0,4}, {1,1,1,4} }, X { {0,0,1,2}, {0,1,1,2}, {1,1,0,3}, {0,1,0,4}, {1,0,0,4}, {1,0,1,5} }, X { {0,0,1,2}, {0,1,0,3}, {1,1,0,3}, {1,0,2,4}, {0,2,1,5}, {2,1,0,5} }, X { {0,2,1,3}, {1,0,0,3}, {2,1,0,4}, {0,1,1,4}, {0,1,0,5}, {1,0,2,6} }, X { {1,1,0,4}, {1,0,1,4}, {2,0,0,5}, {0,2,1,5}, {0,1,2,6}, {0,2,0,7} }, X { {1,0,1,5}, {0,2,0,6}, {1,2,0,6}, {1,1,1,6}, {2,0,2,6}, {1,1,2,7} } X}; Xstruct Tables HullTable[11][6] = { X { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {1,0,0,0}, {0,1,0,0} }, X { {0,0,0,0}, {0,0,0,0}, {0,1,0,0}, {1,1,0,0}, {1,0,1,0}, {1,0,1,1} }, X { {0,1,0,0}, {1,0,0,0}, {1,1,0,0}, {1,0,1,0}, {1,0,1,1}, {2,1,0,0} }, X { {0,1,1,0}, {1,0,0,0}, {1,1,1,0}, {2,0,0,1}, {2,0,1,0}, {2,2,0,0} }, X { {0,1,1,0}, {1,0,0,1}, {2,1,0,1}, {2,2,1,0}, {3,0,1,0}, {3,1,0,0} }, X { {1,1,1,0}, {2,0,2,1}, {2,1,1,0}, {2,2,0,0}, {3,1,0,1}, {3,1,1,0} }, X { {1,2,2,0}, {2,0,2,1}, {2,1,0,1}, {2,2,0,0}, {3,1,1,0}, {4,2,1,0} }, X { {2,1,1,0}, {2,0,1,1}, {3,2,2,0}, {3,2,0,0}, {4,2,1,0}, {4,2,1,1} }, X { {2,1,2,0}, {3,1,1,1}, {3,2,2,0}, {4,2,1,0}, {4,1,0,2}, {4,2,2,0} }, X { {2,3,1,0}, {3,2,2,0}, {3,2,2,1}, {4,2,2,0}, {4,1,0,3}, {5,1,2,0} }, X { {2,2,4,0}, {3,3,1,1}, {4,2,1,1}, {5,1,0,2}, {5,1,2,1}, {6,2,2,0} }, X}; X Xchar AMMO[9][4] = { X { -1, 1, 0, 1 }, X { -1, 1, 0, 1 }, X { -1, 1, 0, 1 }, X { -2, 1, 0, 2 }, X { -2, 2, 0, 2 }, X { -2, 2, 0, 2 }, X { -3, 2, 0, 2 }, X { -3, 2, 0, 3 }, X { -3, 2, 0, 3 } X}; X Xchar HDT[9][10] = { X { 1, 0,-1,-2,-3,-3,-4,-4,-4,-4 }, X { 1, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, X { 2, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, X { 2, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, X { 3, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, X { 3, 3, 2, 1, 0, 0,-1,-1,-1,-1 }, X { 4, 3, 2, 1, 0, 0,-1,-1,-1,-1 }, X { 4, 4, 3, 2, 1, 1, 0, 0, 0, 0 }, X { 5, 4, 3, 2, 1, 1, 0, 0, 0, 0 } X}; X Xchar HDTrake[9][10] = { X { 2, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, X { 2, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, X { 3, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, X { 4, 3, 2, 1, 0, 0,-1,-1,-1,-1 }, X { 5, 4, 3, 2, 1, 1, 0, 0, 0, 0 }, X { 6, 5, 4, 3, 2, 2, 1, 1, 1, 1 }, X { 7, 6, 5, 4, 3, 3, 2, 2, 2, 2 }, X { 8, 7, 6, 5, 4, 4, 3, 3, 3, 3 }, X { 9, 8, 7, 6, 5, 5, 4, 4, 4, 4 } X}; X Xchar QUAL[9][5] = { X { -1, 0, 0, 1, 1 }, X { -1, 0, 0, 1, 1 }, X { -1, 0, 0, 1, 2 }, X { -1, 0, 0, 1, 2 }, X { -1, 0, 0, 2, 2 }, X { -1,-1, 0, 2, 2 }, X { -2,-1, 0, 2, 2 }, X { -2,-1, 0, 2, 2 }, X { -2,-1, 0, 2, 3 } X}; X Xchar MT[9][3] = { X { 1, 0, 0 }, X { 1, 1, 0 }, X { 2, 1, 0 }, X { 2, 1, 1 }, X { 2, 2, 1 }, X { 3, 2, 1 }, X { 3, 2, 2 }, X { 4, 3, 2 }, X { 4, 4, 2 } X}; X Xchar rangeofshot[] = { X 0, X 1, /* grape */ X 3, /* chain */ X 10, /* round */ X 1 /* double */ X}; X Xchar *countryname[] = { X "American", "British", "Spanish", "French", "Japanese", X "Federation", "Klingon", "Orion" X}; X Xchar *classname[] = { X "Drift wood", X "Ship of the Line", X "Ship of the Line", X "Frigate", X "Corvette", X "Sloop", X "Brig" X}; X Xchar *directionname[] = { X "dead ahead", X "off the starboard bow", X "off the starboard beam", X "off the starboard quarter", X "dead astern", X "off the port quarter", X "off the port beam", X "off the port bow", X "dead ahead" X}; X Xchar *qualname[] = { "dead", "mutinous", "green", "mundane", "crack", "elite" }; X Xchar loadname[] = { '-', 'G', 'C', 'R', 'D', 'E' }; X Xchar dr[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 }; Xchar dc[] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 }; END_OF_globals.c if test 19388 -ne `wc -c <globals.c`; then echo shar: \"globals.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f pl_7.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"pl_7.c\" else echo shar: Extracting \"pl_7.c\" \(9776 characters\) sed "s/^X//" >pl_7.c <<'END_OF_pl_7.c' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that this notice is preserved and that due credit is given X * to the University of California at Berkeley. The name of the University X * may not be used to endorse or promote products derived from this X * software without specific prior written permission. This software X * is provided ``as is'' without express or implied warranty. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)pl_7.c 5.4 (Berkeley) 3/9/88"; X#endif /* not lint */ X X#define CTRL(c) ('c'&037) X#include "player.h" X X/* X * Display interface X */ X Xstatic char sc_hasprompt; Xstatic char *sc_prompt; Xstatic char *sc_buf; Xstatic int sc_line; X Xinitscreen() X{ X /* initscr() already done in SCREENTEST() */ X view_w = newwin(VIEW_Y, VIEW_X, VIEW_T, VIEW_L); X slot_w = newwin(SLOT_Y, SLOT_X, SLOT_T, SLOT_L); X scroll_w = newwin(SCROLL_Y, SCROLL_X, SCROLL_T, SCROLL_L); X stat_w = newwin(STAT_Y, STAT_X, STAT_T, STAT_L); X turn_w = newwin(TURN_Y, TURN_X, TURN_T, TURN_L); X done_curses++; X (void) leaveok(view_w, 1); X (void) leaveok(slot_w, 1); X (void) leaveok(stat_w, 1); X (void) leaveok(turn_w, 1); X#ifdef SIGTSTP X { X int susp(); X (void) signal(SIGTSTP, susp); X } X#endif X noecho(); X crmode(); X} X Xcleanupscreen() X{ X /* alarm already turned off */ X if (done_curses) { X (void) wmove(scroll_w, SCROLL_Y - 1, 0); X (void) wclrtoeol(scroll_w); X draw_screen(); X endwin(); X } X} X Xnewturn() X{ X repaired = loaded = fired = changed = 0; X movebuf[0] = '\0'; X X (void) alarm(0); X if (mf->readyL & R_LOADING) X if (mf->readyL & R_DOUBLE) X mf->readyL = R_LOADING; X else X mf->readyL = R_LOADED; X if (mf->readyR & R_LOADING) X if (mf->readyR & R_DOUBLE) X mf->readyR = R_LOADING; X else X mf->readyR = R_LOADED; X if (!hasdriver) X Write(W_DDEAD, SHIP(0), 0, 0, 0, 0, 0); X X if (sc_hasprompt) { X (void) wmove(scroll_w, sc_line, 0); X (void) wclrtoeol(scroll_w); X } X if (Sync() < 0) X leave(LEAVE_SYNC); X if (!hasdriver) X leave(LEAVE_DRIVER); X if (sc_hasprompt) X (void) wprintw(scroll_w, "%s%s", sc_prompt, sc_buf); X X if (turn % 50 == 0) X Write(W_ALIVE, SHIP(0), 0, 0, 0, 0, 0); X if (mf->FS && (!mc->rig1 || windspeed == 6)) X Write(W_FS, ms, 0, 0, 0, 0, 0); X if (mf->FS == 1) X Write(W_FS, ms, 0, 2, 0, 0, 0); X X if (mf->struck) X leave(LEAVE_QUIT); X if (mf->captured != 0) X leave(LEAVE_CAPTURED); X if (windspeed == 7) X leave(LEAVE_HURRICAN); X X adjustview(); X draw_screen(); X X (void) signal(SIGALRM, newturn); X (void) alarm(7); X} X X/*VARARGS2*/ XSignal(fmt, ship, a, b, c, d) Xchar *fmt; Xregister struct ship *ship; Xint a, b, c, d; X{ X if (!done_curses) X return; X if (*fmt == '\7') X putchar(*fmt++); X if (ship == 0) X (void) wprintw(scroll_w, fmt, a, b, c, d); X else X (void) wprintw(scroll_w, fmt, ship->shipname, X colours(ship), sterncolour(ship), a, b, c, d); X Scroll(); X} X XScroll() X{ X if (++sc_line >= SCROLL_Y) X sc_line = 0; X (void) wmove(scroll_w, sc_line, 0); X (void) wclrtoeol(scroll_w); X} X Xprompt(p, ship) Xregister char *p; Xstruct ship *ship; X{ X static char buf[60]; X X if (ship != 0) { X (void)sprintf(buf, p, ship->shipname, colours(ship), X sterncolour(ship)); X p = buf; X } X sc_prompt = p; X sc_buf = ""; X sc_hasprompt = 1; X (void) waddstr(scroll_w, p); X} X Xendprompt(flag) Xchar flag; X{ X sc_hasprompt = 0; X if (flag) X Scroll(); X} X Xsgetch(p, ship, flag) Xchar *p; Xstruct ship *ship; Xchar flag; X{ X register c; X X prompt(p, ship); X blockalarm(); X (void) wrefresh(scroll_w); X unblockalarm(); X while ((c = wgetch(scroll_w)) == EOF) X ; X if (flag && c >= ' ' && c < 0x7f) X (void) waddch(scroll_w, c); X endprompt(flag); X return c; X} X Xsgetstr(pr, buf, n) Xchar *pr; Xregister char *buf; Xregister n; X{ X register c; X register char *p = buf; X X prompt(pr, (struct ship *)0); X sc_buf = buf; X for (;;) { X *p = 0; X blockalarm(); X (void) wrefresh(scroll_w); X unblockalarm(); X while ((c = wgetch(scroll_w)) == EOF) X ; X switch (c) { X case '\n': X case '\r': X endprompt(1); X return; X case '\b': X if (p > buf) { X (void) waddstr(scroll_w, "\b \b"); X p--; X } X break; X default: X if (c >= ' ' && c < 0x7f && p < buf + n - 1) { X *p++ = c; X (void) waddch(scroll_w, c); X } else X (void) putchar(CTRL(g)); X } X } X} X Xdraw_screen() X{ X draw_view(); X draw_turn(); X draw_stat(); X draw_slot(); X (void) wrefresh(scroll_w); /* move the cursor */ X} X Xdraw_view() X{ X register struct ship *sp; X X (void) werase(view_w); X foreachship(sp) { X if (sp->file->dir X && sp->file->row > viewrow X && sp->file->row < viewrow + VIEW_Y X && sp->file->col > viewcol X && sp->file->col < viewcol + VIEW_X) { X (void) wmove(view_w, sp->file->row - viewrow, X sp->file->col - viewcol); X (void) waddch(view_w, colours(sp)); X (void) wmove(view_w, X sternrow(sp) - viewrow, X sterncol(sp) - viewcol); X (void) waddch(view_w, sterncolour(sp)); X } X } X (void) wrefresh(view_w); X} X Xdraw_turn() X{ X (void) wmove(turn_w, 0, 0); X (void) wprintw(turn_w, "%cTurn %d", dont_adjust?'*':'-', turn); X (void) wrefresh(turn_w); X} X Xdraw_stat() X{ X (void) wmove(stat_w, STAT_1, 0); X (void) wprintw(stat_w, "Points %3d\n", mf->points); X (void) wprintw(stat_w, "Fouls %2d\n", fouled(ms)); X (void) wprintw(stat_w, "Grapples %2d\n", grappled(ms)); X X (void) wmove(stat_w, STAT_2, 0); X (void) wprintw(stat_w, " 0 %c(%c)\n", X maxmove(ms, winddir + 3, -1) + '0', X maxmove(ms, winddir + 3, 1) + '0'); X (void) waddstr(stat_w, " \\|/\n"); X (void) wprintw(stat_w, " -^-%c(%c)\n", X maxmove(ms, winddir + 2, -1) + '0', X maxmove(ms, winddir + 2, 1) + '0'); X (void) waddstr(stat_w, " /|\\\n"); X (void) wprintw(stat_w, " | %c(%c)\n", X maxmove(ms, winddir + 1, -1) + '0', X maxmove(ms, winddir + 1, 1) + '0'); X (void) wprintw(stat_w, " %c(%c)\n", X maxmove(ms, winddir, -1) + '0', X maxmove(ms, winddir, 1) + '0'); X X (void) wmove(stat_w, STAT_3, 0); X (void) wprintw(stat_w, "Load %c%c %c%c\n", X loadname[mf->loadL], readyname(mf->readyL), X loadname[mf->loadR], readyname(mf->readyR)); X (void) wprintw(stat_w, "Hull %2d\n", mc->hull); X (void) wprintw(stat_w, "Crew %2d %2d %2d\n", X mc->crew1, mc->crew2, mc->crew3); X (void) wprintw(stat_w, "Guns %2d %2d\n", mc->gunL, mc->gunR); X (void) wprintw(stat_w, "Carr %2d %2d\n", mc->carL, mc->carR); X (void) wprintw(stat_w, "Rigg %d %d %d ", mc->rig1, mc->rig2, mc->rig3); X if (mc->rig4 < 0) X (void) waddch(stat_w, '-'); X else X (void) wprintw(stat_w, "%d", mc->rig4); X (void) wrefresh(stat_w); X} X Xdraw_slot() X{ X if (!boarding(ms, 0)) { X (void) mvwaddstr(slot_w, 0, 0, " "); X (void) mvwaddstr(slot_w, 1, 0, " "); X } else X (void) mvwaddstr(slot_w, 1, 0, "OBP"); X if (!boarding(ms, 1)) { X (void) mvwaddstr(slot_w, 2, 0, " "); X (void) mvwaddstr(slot_w, 3, 0, " "); X } else X (void) mvwaddstr(slot_w, 3, 0, "DBP"); X X (void) wmove(slot_w, SLOT_Y-4, 0); X if (mf->RH) X (void) wprintw(slot_w, "%dRH", mf->RH); X else X (void) waddstr(slot_w, " "); X (void) wmove(slot_w, SLOT_Y-3, 0); X if (mf->RG) X (void) wprintw(slot_w, "%dRG", mf->RG); X else X (void) waddstr(slot_w, " "); X (void) wmove(slot_w, SLOT_Y-2, 0); X if (mf->RR) X (void) wprintw(slot_w, "%dRR", mf->RR); X else X (void) waddstr(slot_w, " "); X X#define Y (SLOT_Y/2) X (void) wmove(slot_w, 7, 1); X (void) wprintw(slot_w,"%d", windspeed); X (void) mvwaddch(slot_w, Y, 0, ' '); X (void) mvwaddch(slot_w, Y, 2, ' '); X (void) mvwaddch(slot_w, Y-1, 0, ' '); X (void) mvwaddch(slot_w, Y-1, 1, ' '); X (void) mvwaddch(slot_w, Y-1, 2, ' '); X (void) mvwaddch(slot_w, Y+1, 0, ' '); X (void) mvwaddch(slot_w, Y+1, 1, ' '); X (void) mvwaddch(slot_w, Y+1, 2, ' '); X (void) wmove(slot_w, Y - dr[winddir], 1 - dc[winddir]); X switch (winddir) { X case 1: X case 5: X (void) waddch(slot_w, '|'); X break; X case 2: X case 6: X (void) waddch(slot_w, '/'); X break; X case 3: X case 7: X (void) waddch(slot_w, '-'); X break; X case 4: X case 8: X (void) waddch(slot_w, '\\'); X break; X } X (void) mvwaddch(slot_w, Y + dr[winddir], 1 + dc[winddir], '+'); X (void) wrefresh(slot_w); X} X Xdraw_board() X{ X register int n; X X (void) clear(); X (void) werase(view_w); X (void) werase(slot_w); X (void) werase(scroll_w); X (void) werase(stat_w); X (void) werase(turn_w); X X sc_line = 0; X X (void) move(BOX_T, BOX_L); X for (n = 0; n < BOX_X; n++) X (void) addch('-'); X (void) move(BOX_B, BOX_L); X for (n = 0; n < BOX_X; n++) X (void) addch('-'); X for (n = BOX_T+1; n < BOX_B; n++) { X (void) mvaddch(n, BOX_L, '|'); X (void) mvaddch(n, BOX_R, '|'); X } X (void) mvaddch(BOX_T, BOX_L, '+'); X (void) mvaddch(BOX_T, BOX_R, '+'); X (void) mvaddch(BOX_B, BOX_L, '+'); X (void) mvaddch(BOX_B, BOX_R, '+'); X (void) refresh(); X X#define WSaIM "Wooden Ships & Iron Men" X (void) wmove(view_w, 2, (VIEW_X - sizeof WSaIM - 1) / 2); X (void) waddstr(view_w, WSaIM); X (void) wmove(view_w, 4, (VIEW_X - strlen(cc->name)) / 2); X (void) waddstr(view_w, cc->name); X (void) wrefresh(view_w); X X (void) move(LINE_T, LINE_L); X (void) printw("Class %d %s (%d guns) '%s' (%c%c)", X mc->class, X classname[mc->class], X mc->guns, X ms->shipname, X colours(ms), X sterncolour(ms)); X (void) refresh(); X} X Xcenterview() X{ X viewrow = mf->row - VIEW_Y / 2; X viewcol = mf->col - VIEW_X / 2; X} X Xupview() X{ X viewrow -= VIEW_Y / 3; X} X Xdownview() X{ X viewrow += VIEW_Y / 3; X} X Xleftview() X{ X viewcol -= VIEW_X / 5; X} X Xrightview() X{ X viewcol += VIEW_X / 5; X} X Xadjustview() X{ X if (dont_adjust) X return; X if (mf->row < viewrow + VIEW_Y/4) X viewrow = mf->row - (VIEW_Y - VIEW_Y/4); X else if (mf->row > viewrow + (VIEW_Y - VIEW_Y/4)) X viewrow = mf->row - VIEW_Y/4; X if (mf->col < viewcol + VIEW_X/8) X viewcol = mf->col - (VIEW_X - VIEW_X/8); X else if (mf->col > viewcol + (VIEW_X - VIEW_X/8)) X viewcol = mf->col - VIEW_X/8; X} X X#ifdef SIGTSTP Xsusp() X{ X blockalarm(); X tstp(); X (void) signal(SIGTSTP, susp); X unblockalarm(); X} X#endif END_OF_pl_7.c if test 9776 -ne `wc -c <pl_7.c`; then echo shar: \"pl_7.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f sync.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"sync.c\" else echo shar: Extracting \"sync.c\" \(7951 characters\) sed "s/^X//" >sync.c <<'END_OF_sync.c' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that this notice is preserved and that due credit is given X * to the University of California at Berkeley. The name of the University X * may not be used to endorse or promote products derived from this X * software without specific prior written permission. This software X * is provided ``as is'' without express or implied warranty. X */ X X#ifndef lint Xstatic char sccsid[] = "@(#)sync.c 5.3 (Berkeley) 3/9/88"; X#endif /* not lint */ X X#include "externs.h" X#include <sys/file.h> X#include <sys/errno.h> X X#define BUFSIZE 4096 X Xstatic char sync_buf[BUFSIZE]; Xstatic char *sync_bp = sync_buf; Xstatic char sync_lock[25]; Xstatic char sync_file[25]; Xstatic long sync_seek; Xstatic FILE *sync_fp; X#define SF "/tmp/#sailsink.%d" X#define LF "/tmp/#saillock.%d" X X/*VARARGS3*/ Xmakesignal(from, fmt, ship, a, b, c) X struct ship *from; X char *fmt; X register struct ship *ship; X{ X char message[80]; X X if (ship == 0) X (void) sprintf(message, fmt, a, b, c); X else X (void) sprintf(message, fmt, X ship->shipname, colours(ship), X sterncolour(ship), a, b, c); X Write(W_SIGNAL, from, 1, (int)message, 0, 0, 0); X} X X#include <sys/types.h> X#include <sys/stat.h> Xsync_exists(game) X{ X char buf[sizeof sync_file]; X struct stat s; X time_t t; X X (void) sprintf(buf, SF, game); X (void) time(&t); X if (stat(buf, &s) < 0) X return 0; X if (s.st_mtime < t - 60*60*2) { /* 2 hours */ X (void) unlink(buf); X (void) sprintf(buf, LF, game); X (void) unlink(buf); X return 0; X } else X return 1; X} X Xsync_open() X{ X if (sync_fp != NULL) X (void) fclose(sync_fp); X (void) sprintf(sync_lock, LF, game); X (void) sprintf(sync_file, SF, game); X if (access(sync_file, 0) < 0) { X int omask = umask(issetuid ? 077 : 011); X sync_fp = fopen(sync_file, "w+"); X (void) umask(omask); X } else X sync_fp = fopen(sync_file, "r+"); X if (sync_fp == NULL) X return -1; X sync_seek = 0; X return 0; X} X Xsync_close(remove) X char remove; X{ X if (sync_fp != 0) X (void) fclose(sync_fp); X if (remove) X (void) unlink(sync_file); X} X XWrite(type, ship, isstr, a, b, c, d) X int type; X struct ship *ship; X char isstr; X int a, b, c, d; X{ X if (isstr) X (void) sprintf(sync_bp, "%d %d %d %s\n", X type, ship->file->index, isstr, a); X else X (void) sprintf(sync_bp, "%d %d %d %d %d %d %d\n", X type, ship->file->index, isstr, a, b, c, d); X while (*sync_bp++) X ; X sync_bp--; X if (sync_bp >= &sync_buf[sizeof sync_buf]) X abort(); X (void) sync_update(type, ship, a, b, c, d); X} X XSync() X{ X int (*sighup)(), (*sigint)(); X register n; X int type, shipnum, isstr, a, b, c, d; X char buf[80]; X char erred = 0; X extern errno; X X sighup = signal(SIGHUP, SIG_IGN); X sigint = signal(SIGINT, SIG_IGN); X for (n = TIMEOUT; --n >= 0;) { X#ifdef LOCK_EX X if (flock(fileno(sync_fp), LOCK_EX|LOCK_NB) >= 0) X break; X if (errno != EWOULDBLOCK) X return -1; X#else X if (link(sync_file, sync_lock) >= 0) X break; X if (errno != EEXIST) X return -1; X#endif X sleep(1); X } X if (n <= 0) X return -1; X (void) fseek(sync_fp, sync_seek, 0); X for (;;) { X switch (fscanf(sync_fp, "%d%d%d", &type, &shipnum, &isstr)) { X case 3: X break; X case EOF: X goto out; X default: X goto bad; X } X if (shipnum < 0 || shipnum >= cc->vessels) X goto bad; X if (isstr != 0 && isstr != 1) X goto bad; X if (isstr) { X register char *p; X for (p = buf;;) { X switch (*p++ = getc(sync_fp)) { X case '\n': X p--; X case EOF: X break; X default: X if (p >= buf + sizeof buf) X p--; X continue; X } X break; X } X *p = 0; X for (p = buf; *p == ' '; p++) X ; X a = (int)p; X b = c = d = 0; X } else X if (fscanf(sync_fp, "%d%d%d%d", &a, &b, &c, &d) != 4) X goto bad; X if (sync_update(type, SHIP(shipnum), a, b, c, d) < 0) X goto bad; X } Xbad: X erred++; Xout: X if (!erred && sync_bp != sync_buf) { X (void) fseek(sync_fp, 0L, 2); X (void) fwrite(sync_buf, sizeof *sync_buf, sync_bp - sync_buf, X sync_fp); X (void) fflush(sync_fp); X sync_bp = sync_buf; X } X sync_seek = ftell(sync_fp); X#ifdef LOCK_EX X (void) flock(fileno(sync_fp), LOCK_UN); X#else X (void) unlink(sync_lock); X#endif X (void) signal(SIGHUP, sighup); X (void) signal(SIGINT, sigint); X return erred ? -1 : 0; X} X Xsync_update(type, ship, a, b, c, d) X int type; X register struct ship *ship; X int a, b, c, d; X{ X switch (type) { X case W_DBP: { X register struct BP *p = &ship->file->DBP[a]; X p->turnsent = b; X p->toship = SHIP(c); X p->mensent = d; X break; X } X case W_OBP: { X register struct BP *p = &ship->file->OBP[a]; X p->turnsent = b; X p->toship = SHIP(c); X p->mensent = d; X break; X } X case W_FOUL: { X register struct snag *p = &ship->file->foul[a]; X if (SHIP(a)->file->dir == 0) X break; X if (p->sn_count++ == 0) X p->sn_turn = turn; X ship->file->nfoul++; X break; X } X case W_GRAP: { X register struct snag *p = &ship->file->grap[a]; X if (SHIP(a)->file->dir == 0) X break; X if (p->sn_count++ == 0) X p->sn_turn = turn; X ship->file->ngrap++; X break; X } X case W_UNFOUL: { X register struct snag *p = &ship->file->foul[a]; X if (p->sn_count > 0) X if (b) { X ship->file->nfoul -= p->sn_count; X p->sn_count = 0; X } else { X ship->file->nfoul--; X p->sn_count--; X } X break; X } X case W_UNGRAP: { X register struct snag *p = &ship->file->grap[a]; X if (p->sn_count > 0) X if (b) { X ship->file->ngrap -= p->sn_count; X p->sn_count = 0; X } else { X ship->file->ngrap--; X p->sn_count--; X } X break; X } X case W_SIGNAL: X if (mode == MODE_PLAYER) X if (nobells) X Signal("%s (%c%c): %s", ship, a); X else X Signal("\7%s (%c%c): %s", ship, a); X break; X case W_CREW: { X register struct shipspecs *s = ship->specs; X s->crew1 = a; X s->crew2 = b; X s->crew3 = c; X break; X } X case W_CAPTAIN: X (void) strncpy(ship->file->captain, (char *)a, X sizeof ship->file->captain - 1); X ship->file->captain[sizeof ship->file->captain - 1] = 0; X break; X case W_CAPTURED: X if (a < 0) X ship->file->captured = 0; X else X ship->file->captured = SHIP(a); X break; X case W_CLASS: X ship->specs->class = a; X break; X case W_DRIFT: X ship->file->drift = a; X break; X case W_EXPLODE: X if ((ship->file->explode = a) == 2) X ship->file->dir = 0; X break; X case W_FS: X ship->file->FS = a; X break; X case W_GUNL: { X register struct shipspecs *s = ship->specs; X s->gunL = a; X s->carL = b; X break; X } X case W_GUNR: { X register struct shipspecs *s = ship->specs; X s->gunR = a; X s->carR = b; X break; X } X case W_HULL: X ship->specs->hull = a; X break; X case W_MOVE: X (void) strncpy(ship->file->movebuf, (char *)a, X sizeof ship->file->movebuf - 1); X ship->file->movebuf[sizeof ship->file->movebuf - 1] = 0; X break; X case W_PCREW: X ship->file->pcrew = a; X break; X case W_POINTS: X ship->file->points = a; X break; X case W_QUAL: X ship->specs->qual = a; X break; X case W_RIGG: { X register struct shipspecs *s = ship->specs; X s->rig1 = a; X s->rig2 = b; X s->rig3 = c; X s->rig4 = d; X break; X } X case W_RIG1: X ship->specs->rig1 = a; X break; X case W_RIG2: X ship->specs->rig2 = a; X break; X case W_RIG3: X ship->specs->rig3 = a; X break; X case W_RIG4: X ship->specs->rig4 = a; X break; X case W_COL: X ship->file->col = a; X break; X case W_DIR: X ship->file->dir = a; X break; X case W_ROW: X ship->file->row = a; X break; X case W_SINK: X if ((ship->file->sink = a) == 2) X ship->file->dir = 0; X break; X case W_STRUCK: X ship->file->struck = a; X break; X case W_TA: X ship->specs->ta = a; X break; X case W_ALIVE: X alive = 1; X break; X case W_TURN: X turn = a; X break; X case W_WIND: X winddir = a; X windspeed = b; X break; X case W_BEGIN: X (void) strcpy(ship->file->captain, "begin"); X people++; X break; X case W_END: X *ship->file->captain = 0; X ship->file->points = 0; X people--; X break; X case W_DDEAD: X hasdriver = 0; X break; X default: X fprintf(stderr, "sync_update: unknown type %d\r\n", type); X return -1; X } X return 0; X} END_OF_sync.c if test 7951 -ne `wc -c <sync.c`; then echo shar: \"sync.c\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 2 \(of 4\). cp /dev/null ark2isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0