From: Jeremy Mates Subject: Enterprise support To: tech@openbsd.org Date: Mon, 29 Apr 2024 22:50:26 +0000 Instead of repeating commands to the computer, add an 'e'ngage command to apply the last saved computer course, if any. Meanwhile, is "games/trek/USD.doc/Makefile" broken? --- computer.c 7 Jan 2016 14:37:51 -0000 1.12 +++ computer.c 29 Apr 2024 22:48:24 -0000 @@ -213,6 +213,8 @@ computer(int v) } printf("%d,%d/%d,%d to %d,%d/%d,%d", Ship.quadx, Ship.quady, Ship.sectx, Ship.secty, tqx, tqy, ix, iy); + SaveCourse = course; + SaveDist = dist; prkalc(course, dist); break; --- play.c 26 May 2017 19:19:23 -0000 1.8 +++ play.c 29 Apr 2024 22:48:24 -0000 @@ -56,6 +56,7 @@ const struct cvntab Comtab[] = { "da", "mages", dcrept, 0 }, { "destruct", "", destruct, 0 }, { "do", "ck", dock, 0 }, + { "e", "ngage", engage, 0 }, { "help", "", help, 0 }, { "i", "mpulse", impulse, 0 }, { "l", "rscan", lrscan, 0 }, --- setup.c 26 May 2017 19:19:23 -0000 1.13 +++ setup.c 29 Apr 2024 22:48:24 -0000 @@ -210,6 +210,7 @@ setup(void) Game.killed = 0; Game.snap = 0; Move.endgame = 0; + SaveDist = NAN; /* setup stars */ for (i = 0; i < NQUADS; i++) --- trek.6 8 Mar 2021 02:47:26 -0000 1.17 +++ trek.6 29 Apr 2024 22:48:24 -0000 @@ -30,7 +30,7 @@ .\" .\" @(#)trek.6 8.2 (Berkeley) 12/30/93 .\" -.Dd $Mdocdate: March 8 2021 $ +.Dd $Mdocdate: April 29 2024 $ .Dt TREK 6 .Os .Sh NAME @@ -81,6 +81,8 @@ the game will tell you what it expects i .Ic destruct .It .Ic do Ns ck +.It +.Ic e Ns ngage .It .Ic help .It --- trek.h 27 Jan 2021 01:57:37 -0000 1.15 +++ trek.h 29 Apr 2024 22:48:24 -0000 @@ -343,6 +343,10 @@ extern struct Etc #define L_CAPTURED 12 /* captured by Klingons */ #define L_NOCREW 13 /* you ran out of crew */ +/* engage */ +extern double SaveDist; +extern int SaveCourse; + /****************** COMPILE OPTIONS ***********************/ /* Trace info */ @@ -493,6 +497,7 @@ void visual(int); /* warp.c */ void dowarp(int); +void engage(int); void warp(int, int, double); /* win.c */ --- warp.c 7 Jan 2016 14:37:51 -0000 1.8 +++ warp.c 29 Apr 2024 22:48:24 -0000 @@ -30,6 +30,7 @@ * SUCH DAMAGE. */ +#include #include #include #include @@ -37,6 +38,9 @@ #include "getpar.h" #include "trek.h" +double SaveDist; +int SaveCourse; + /* ** MOVE UNDER WARP POWER ** @@ -62,6 +66,22 @@ dowarp(int fl) if (getcodi(&c, &d)) return; warp(fl, c, d); +} + +void engage(int y) +{ + int c; + double d; + + d = SaveDist; + if (isnan(d)) { + printf("Chekov: But captain, we have no course.\n"); + return; + } + c = SaveCourse; + SaveDist = NAN; + + warp(y, c, d); } void --- USD.doc/trek.me 26 May 2017 19:48:28 -0000 1.7 +++ USD.doc/trek.me 29 Apr 2024 22:48:24 -0000 @@ -552,6 +552,14 @@ apply as above. .pp There is no penalty to move under impulse power with shields up. +.bl "Engage" +Mnemonic: engage +Shortest Abbreviation: e +Full Command: engage +.FF +.pp +Causes the ship to warp to the last computed course, +if there is one. .bl "Deflector Shields" Mnemonic: shields Shortest Abbreviation: sh @@ -919,6 +927,8 @@ Command Requires Consumes \*fda\fRmages - - \*fdestruct\fR computer - \*fdo\fRck - - +\*fe\fRngage warp engines time, energy + computer, SINS \*fhelp\fR subspace radio - \*fi\fRmpulse course distance impulse engines time, energy computer, SINS