Fixed klingon count to avoid winning the game before all the klingons
[super-star-trek.git] / sst.c
diff --git a/sst.c b/sst.c
index 2dca29e412550cde4c44e2c0804f12f7a0b8110d..eabe0ffccb061dd508e68989c21eda21a0e0f177 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -82,7 +82,7 @@ Here are Stas Sergeev's changes:
       chasing SCom can take an eternity).
 
    5. Probe target you enter is now the destination quadrant. Before I don't 
-      remember what it was, but it was something I had difficulty using)
+      remember what it was, but it was something I had difficulty using.
 
    6. Secret password is now autogenerated.
 
@@ -195,8 +195,8 @@ commands[] = {
        {"DEBUG",       DEBUGCMD,       0},
 #define MAYDAY 32
        {"MAYDAY",      MAYDAY,         0},
-       {"SOS",         MAYDAY,         0},
-       {"CALL",        MAYDAY,         0},
+       //{"SOS",               MAYDAY,         0},
+       //{"CALL",      MAYDAY,         0},
 #define QUIT   33
        {"QUIT",        QUIT,           0},
 #define HELP   34
@@ -204,12 +204,13 @@ commands[] = {
 };
 
 #define NUMCOMMANDS    sizeof(commands)/sizeof(commands[0])
+#define ACCEPT(i)      (!commands[i].option || (commands[i].option & game.options))
 
 static void listCommands(void) {
     int i, k = 0;
     proutn("LEGAL COMMANDS ARE:");
     for (i = 0; i < NUMCOMMANDS; i++) {
-       if (commands[i].option && !(commands[i].option & game.options))
+       if (!ACCEPT(i))
            continue;
        if (k % 5 == 0)
            skip(1);
@@ -237,7 +238,7 @@ static void helpme(void)
        setwnd(message_window);
        if (key == IHEOL) return;
        for (i = 0; i < NUMCOMMANDS; i++) {
-           if (strcasecmp(commands[i].name, citem)==0) {
+           if (ACCEPT(i) && strcasecmp(commands[i].name, citem)==0) {
                i = commands[i].value;
                break;
            }
@@ -325,14 +326,14 @@ static void makemoves(void)
            setwnd(message_window);
            clrscr();
            for (i=0; i < ABANDON; i++)
-               if (isit(commands[i].name)) {
+               if (ACCEPT(i) && isit(commands[i].name)) {
                    v = commands[i].value;
                    break;
                }
            if (i < ABANDON && (!commands[i].option || (commands[i].option & game.options))) 
                break;
            for (; i < NUMCOMMANDS; i++)
-               if (strcasecmp(commands[i].name, citem) == 0) {
+               if (ACCEPT(i) && strcasecmp(commands[i].name, citem) == 0) {
                    v = commands[i].value;
                    break;
                }
@@ -396,7 +397,7 @@ static void makemoves(void)
            score();
            break;
        case SENSORS:                   // sensors
-           sensor(TRUE);
+           sensor();
            break;
        case ORBIT:                     // orbit
            orbit();
@@ -507,9 +508,9 @@ int main(int argc, char **argv)
 {
     int i, option;
 
-    game.options = OPTION_ALL &~ OPTION_IOMODES;
+    game.options = OPTION_ALL &~ (OPTION_IOMODES | OPTION_SHOWME);
     if (getenv("TERM"))
-       game.options |= OPTION_CURSES;
+       game.options |= OPTION_CURSES | OPTION_SHOWME;
     else
        game.options |= OPTION_TTY;
 
@@ -536,7 +537,7 @@ int main(int argc, char **argv)
     while (TRUE) { /* Play a game */
        setwnd(fullscreen_window);
 #ifdef DEBUG
-       prout("INITIAL OPTIONS: %0lx\n", game.options);
+       prout("INITIAL OPTIONS: %0lx", game.options);
 #endif /* DEBUG */
        clrscr();
        prelim();
@@ -750,7 +751,6 @@ void debugme(void)
        for (i=0; i < NDEVICES; i++) 
            if (game.damage[i] > 0.0) 
                game.damage[i] = 0.0;
-       stdamtim = 1e30;
     }
     proutn("Toggle idebug? ");
     if (ja() != 0) {
@@ -769,7 +769,6 @@ void debugme(void)
            key = scan();
            if (key == IHALPHA &&  isit("y")) {
                game.damage[i] = 10.0;
-               if (i == DRADIO) stdamtim = game.state.date;
            }
        }
     }
@@ -778,7 +777,7 @@ void debugme(void)
        int i;
        for (i = 1; i < NEVENTS; i++) {
            int key;
-           if (game.future[i] == 1e30) continue;
+           if (game.future[i] == FOREVER) continue;
            switch (i) {
            case FSNOVA:  proutn("Supernova       "); break;
            case FTBEAM:  proutn("T Beam          "); break;
@@ -798,5 +797,10 @@ void debugme(void)
        }
        chew();
     }
+    proutn("Induce supernova here? ");
+    if (ja() != 0) {
+       game.state.galaxy[quadx][quady].supernova = TRUE;
+       atover(1);
+    }
 }
 #endif