Save/resume fail test coverage -- test works in Docker now
[open-adventure.git] / main.c
diff --git a/main.c b/main.c
index 9fc8fa97ad827e24e15511e2fbcf621acbab1f8b..7a179212619ba34b306182894dde4205a0032cb9 100644 (file)
--- a/main.c
+++ b/main.c
@@ -77,7 +77,14 @@ int main(int argc, char *argv[])
 
     /*  Options. */
 
-    while ((ch = getopt(argc, argv, "l:or:s")) != EOF) {
+#ifndef ADVENT_NOSAVE
+    char* opts = "l:or:s";
+    char* usage = "Usage: %s [-l logfilename] [-o] [-r restorefilename] [-s] \n";
+#else
+    char* opts = "l:os";
+    char* usage = "Usage: %s [-l logfilename] [-o] [-s] \n";
+#endif
+    while ((ch = getopt(argc, argv, opts)) != EOF) {
         switch (ch) {
         case 'l':
             logfp = fopen(optarg, "w");
@@ -91,6 +98,7 @@ int main(int argc, char *argv[])
             oldstyle = true;
             editline = prompt = false;
             break;
+#ifndef ADVENT_NOSAVE
         case 'r':
             rfp = fopen(optarg, "r");
             if (rfp == NULL)
@@ -99,18 +107,21 @@ int main(int argc, char *argv[])
                         optarg);
             signal(SIGINT, sig_handler);
             break;
+#endif
         case 's':
             editline = false;
             break;
         default:
             fprintf(stderr,
-                    "Usage: %s [-l logfilename] [-o] [-r restorefilename] [-s] \n", argv[0]);
+                    usage, argv[0]);
             fprintf(stderr,
                     "  where -l creates a log file of your game named as specified'\n");
             fprintf(stderr,
                     "        -o 'oldstyle' (no prompt, no command editing, displays 'Initialising...')\n");
+#ifndef ADVENT_NOSAVE
             fprintf(stderr,
                     "        -r indicates restoring from specified saved game file\n");
+#endif
             fprintf(stderr,
                     "        -s indicates playing with command editing suppressed\n");
             exit(-1);
@@ -498,8 +509,7 @@ static void croak(void)
          *  death and exit. */
         RSPEAK(DEATH_CLOSING);
         terminate(endgame);
-    }
-    else if (game.numdie == maximum_deaths || !YES(query, yes_response, arbitrary_messages[OK_MAN]))
+    } else if (game.numdie == maximum_deaths || !YES(query, yes_response, arbitrary_messages[OK_MAN]))
         terminate(endgame);
     else {
         game.place[WATER] = game.place[OIL] = NOWHERE;
@@ -644,7 +654,7 @@ static bool playermove(token_t verb, int motion)
                     ++kk;
                     game.newloc = labs(TRAVEL[kk]) / 1000;
                 } while
-                    (game.newloc == scratchloc);
+                (game.newloc == scratchloc);
                 scratchloc = game.newloc;
             }
 
@@ -678,7 +688,7 @@ static bool playermove(token_t verb, int motion)
                         ++kk;
                         game.newloc = labs(TRAVEL[kk]) / 1000;
                     } while
-                        (game.newloc == scratchloc);
+                    (game.newloc == scratchloc);
                     scratchloc = game.newloc;
                     continue; /* goto L12 */
                 case 3:
@@ -711,7 +721,7 @@ static bool playermove(token_t verb, int motion)
                         game.prop[BEAR] = 3;
                         game.oldlc2 = game.newloc;
                         croak();
-                       return true;
+                        return true;
                     }
                 }
                 BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST);
@@ -983,7 +993,8 @@ static bool do_command(FILE *cmdin)
             else
                 continue;      /* back to top of main interpreter loop */
         }
-        if (game.loc == 33 && PCT(25) && !game.closng)RSPEAK(SAYS_PLUGH);
+        if (game.loc == LOC_Y2 && PCT(25) && !game.closng)
+            RSPEAK(SAYS_PLUGH);
 
         listobjects();