added command line option to dump level set info
[rocksndiamonds.git] / src / init.c
index 2529a8baba97aa4f9b16bab81a2a764ae82ff1d9..807a9a14e5d238bc94504f08e80c5b1956a937ae 100644 (file)
@@ -5196,6 +5196,7 @@ static void InitGlobal(void)
   global.autoplay_leveldir = NULL;
   global.patchtapes_leveldir = NULL;
   global.convert_leveldir = NULL;
+  global.dumplevelset_leveldir = NULL;
   global.dumplevel_leveldir = NULL;
   global.dumptape_leveldir = NULL;
   global.create_sketch_images_dir = NULL;
@@ -5307,6 +5308,23 @@ static void Execute_Command(char *command)
 
     exit(0);
   }
+  else if (strPrefix(command, "dump levelset "))
+  {
+    char *filename = &command[14];
+
+    if (fileExists(filename) && isLevelsetFilename_BD(filename))
+    {
+      DumpLevelsetFromFilename_BD(filename);
+
+      exit(0);
+    }
+
+    char *leveldir = getStringCopy(filename);  // read command parameters
+
+    global.dumplevelset_leveldir = leveldir;
+
+    program.headless = TRUE;
+  }
   else if (strPrefix(command, "dump level "))
   {
     char *filename = &command[11];
@@ -6691,6 +6709,11 @@ void OpenAll(void)
     ConvertLevels();
     return;
   }
+  else if (global.dumplevelset_leveldir)
+  {
+    DumpLevelset();
+    return;
+  }
   else if (global.dumplevel_leveldir)
   {
     DumpLevels();