added selecting new level set if dropped as zip file into window
authorHolger Schemel <info@artsoft.org>
Tue, 22 Jan 2019 00:18:52 +0000 (01:18 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 22 Jan 2019 00:18:52 +0000 (01:18 +0100)
src/events.c

index f33b311..05d4b35 100644 (file)
@@ -1546,7 +1546,23 @@ static void HandleDropFileEventExt(char *filename)
     char *top_dir = ExtractZipFileIntoDirectory(filename, directory, tree_type);
 
     if (top_dir != NULL)
+    {
       AddUserTreeSetToTreeInfo(top_dir, tree_type);
+
+      // when adding new level set, select it as the new current level set
+      if (tree_type == TREE_TYPE_LEVEL_DIR)
+      {
+       // change current level set to newly added level set from zip file
+       leveldir_current = getTreeInfoFromIdentifier(leveldir_first, top_dir);
+
+       // change current level number to first level of newly added level set
+       level_nr = leveldir_current->first_level;
+
+       // when in main menu, redraw screen to reflect changed level set
+       if (game_status == GAME_MODE_MAIN)
+         DrawMainMenu();
+      }
+    }
   }
 }