From: Eric S. Raymond Date: Sun, 6 Feb 2005 00:06:05 +0000 (+0000) Subject: Better command suppression. X-Git-Tag: 2.0~360 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=aba642f488174f640e8099f07d46f0a64dbb5052;p=super-star-trek.git Better command suppression. --- diff --git a/battle.c b/battle.c index 9b35e4f..e405471 100644 --- a/battle.c +++ b/battle.c @@ -203,7 +203,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i if (iquad==IHDOT) continue; /* hit something */ setwnd(message_window); - prout(""); /* start new line after text track */ + skip(1); /* start new line after text track */ switch(iquad) { case IHE: /* Hit our ship */ case IHF: diff --git a/reports.c b/reports.c index bdb0e94..bca7bb7 100644 --- a/reports.c +++ b/reports.c @@ -322,7 +322,7 @@ int srscan(int l) { case 6: proutn("Energy %.2f", energy); if (icrystl) - proutn(" (crystals on board)"); + proutn(" (have crystals)"); break; case 7: proutn("Torpedoes %d", torps); diff --git a/sst-doc.xml b/sst-doc.xml index fd03ba6..852c462 100644 --- a/sst-doc.xml +++ b/sst-doc.xml @@ -326,9 +326,9 @@ Full commands: SRSCAN -If you are using the screen-oriented interface, it should never -be necessary to call this command explicitly; a short-range scan will -always be present on the screen. +If you are using the screen-oriented interface, this command is +suppressed; instead, a short-range scan will always be present on the +screen. The short-range scan gives you a considerable amount of information about the quadrant your starship is in. A short-range scan is best @@ -381,6 +381,11 @@ Mnemonic: STATUS Shortest abbreviation: ST + +If you are using the screen-oriented interface, this command is +suppressed; instead, a full status report will always be present on the +screen. + This command gives you information about the current state of your starship as follows: @@ -491,10 +496,10 @@ Mnemonic: LRSCAN Shortest abbreviation: L - -If you are using the screen-oriented interface, it should never -be necessary to call this command explicitly; a long-range scan will -always be present on the screen. + +If you are using the screen-oriented interface, this command is +suppressed; instead, a long-range scan will always be present on the +screen. A long-range scan gives you general information about where you are and what is around you. Here is an example output. @@ -1257,6 +1262,11 @@ Shortest abbreviation: REQ Full command: REQUEST <ITEM> + +If you are using the screen-oriented interface, this command is +suppressed; instead, a full status report will always be present on the +screen. + This command allows you to get any single piece of information from the <STATUS> command. <ITEM> specifies which information as follows: diff --git a/sst.c b/sst.c index 55cdaea..89e069d 100644 --- a/sst.c +++ b/sst.c @@ -89,10 +89,13 @@ Eric Raymond's changes: 1. "sos" and "call" becomes "mayday", "freeze" and "save" are both good. + 2. Status report now indicates when dilithium crystals are on board. + */ /* the input queue */ static char line[128], *linep = line; +static usecurses = TRUE; static struct { @@ -100,91 +103,94 @@ static struct int value; } commands[] = { -#define SRSCAN 1 +#define SRSCAN 0 {"SRSCAN", SRSCAN}, -#define STATUS 2 +#define STATUS 1 {"STATUS", STATUS}, -#define REQUEST 3 +#define REQUEST 2 {"REQUEST", REQUEST}, -#define LRSCAN 4 +#define LRSCAN 3 {"LRSCAN", LRSCAN}, -#define PHASERS 5 +#define PHASERS 4 {"PHASERS", PHASERS}, -#define TORPEDO 6 +#define TORPEDO 5 {"TORPEDO", TORPEDO}, {"PHOTONS", TORPEDO}, -#define MOVE 7 +#define MOVE 6 {"MOVE", MOVE}, -#define SHIELDS 8 +#define SHIELDS 7 {"SHIELDS", SHIELDS}, -#define DOCK 9 +#define DOCK 8 {"DOCK", DOCK}, -#define DAMAGES 10 +#define DAMAGES 9 {"DAMAGES", DAMAGES}, -#define CHART 11 +#define CHART 10 {"CHART", CHART}, -#define IMPULSE 12 +#define IMPULSE 11 {"IMPULSE", IMPULSE}, -#define REST 13 +#define REST 12 {"REST", REST}, -#define WARP 14 +#define WARP 13 {"WARP", WARP}, -#define SCORE 15 +#define SCORE 14 {"SCORE", SCORE}, -#define SENSORS 16 +#define SENSORS 15 {"SENSORS", SENSORS}, -#define ORBIT 17 +#define ORBIT 16 {"ORBIT", ORBIT}, -#define TRANSPORT 18 +#define TRANSPORT 17 {"TRANSPORT", TRANSPORT}, -#define MINE 19 +#define MINE 18 {"MINE", MINE}, -#define CRYSTALS 20 +#define CRYSTALS 19 {"CRYSTALS", CRYSTALS}, -#define SHUTTLE 21 +#define SHUTTLE 20 {"SHUTTLE", SHUTTLE}, -#define PLANETS 22 +#define PLANETS 21 {"PLANETS", PLANETS}, -#define REPORT 23 +#define REPORT 22 {"REPORT", REPORT}, -#define COMPUTER 24 +#define COMPUTER 23 {"COMPUTER", COMPUTER}, -#define COMMANDS 25 +#define COMMANDS 24 {"COMMANDS", COMMANDS}, -#define EMEXIT 26 +#define EMEXIT 25 {"EMEXIT", EMEXIT}, -#define PROBE 27 +#define PROBE 26 {"PROBE", PROBE}, -#define SAVE 28 +#define SAVE 27 {"SAVE", SAVE}, {"FREEZE", SAVE}, -#define ABANDON 29 +#define ABANDON 28 {"ABANDON", ABANDON}, -#define DESTRUCT 30 +#define DESTRUCT 29 {"DESTRUCT", DESTRUCT}, -#define DEATHRAY 31 +#define DEATHRAY 30 {"DEATHRAY", DEATHRAY}, -#define DEBUGCMD 32 +#define DEBUGCMD 31 {"DEBUG", DEBUGCMD}, -#define MAYDAY 33 +#define MAYDAY 32 {"MAYDAY", MAYDAY}, {"SOS", MAYDAY}, {"CALL", MAYDAY}, -#define QUIT 34 +#define QUIT 33 {"QUIT", QUIT}, -#define HELP 35 +#define HELP 34 {"HELP", HELP}, }; #define NUMCOMMANDS sizeof(commands)/sizeof(commands[0]) -static void listCommands(int x) { - int i; - prout("LEGAL COMMANDS ARE:"); - for (i = 0; i < NUMCOMMANDS; i++) { - proutn("%-12s ", commands[i].name); - if (i % 5 == 4) +#define MIN_CURSES_COMMAND PHASERS /* might change someday */ + +static void listCommands(int usecurses) { + int i, k = 0; + proutn("LEGAL COMMANDS ARE:"); + for (i = usecurses ? MIN_CURSES_COMMAND : 0; i < NUMCOMMANDS; i++) { + if (k % 5 == 0) skip(1); + proutn("%-12s ", commands[i].name); + k++; } skip(1); } @@ -214,7 +220,7 @@ static void helpme(void) { if (i != NUMCOMMANDS) break; skip(1); prout("Valid commands:"); - listCommands(FALSE); + listCommands(usecurses); key = IHEOL; chew(); skip(1); @@ -303,8 +309,7 @@ static void makemoves(void) { break; } if (i < NUMCOMMANDS) break; - - listCommands(TRUE); + listCommands(usecurses); } commandhook(commands[i].name, TRUE); switch (i) { /* command switch */ @@ -393,7 +398,7 @@ static void makemoves(void) { eta(); break; case COMMANDS: - listCommands(TRUE); + listCommands(usecurses); break; case EMEXIT: // Emergency exit clrscr(); // Hide screen @@ -470,7 +475,7 @@ static void makemoves(void) { int main(int argc, char **argv) { - int i, option, usecurses = TRUE; + int i, option; while ((option = getopt(argc, argv, "t")) != -1) { switch (option) {