added separate custom artwork sub-tree for dedicated custom artwork
authorHolger Schemel <info@artsoft.org>
Tue, 2 Feb 2021 00:25:16 +0000 (01:25 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 2 Feb 2021 00:25:16 +0000 (01:25 +0100)
src/libgame/setup.c

index 23579d277ba5b92503aac35cfabdcd26625613de..b24ac1035afb1de56ddf7830f52e6c0696be5e88 100644 (file)
@@ -3923,6 +3923,29 @@ void LoadArtworkInfo(void)
 #endif
 }
 
+static void MoveArtworkInfoIntoSubTree(ArtworkDirTree **artwork_node)
+{
+  ArtworkDirTree *artwork_new = newTreeInfo();
+  char *top_node_name = "dedicated custom artwork";
+
+  setTreeInfoToDefaults(artwork_new, (*artwork_node)->type);
+
+  artwork_new->level_group = TRUE;
+
+  setString(&artwork_new->identifier,   top_node_name);
+  setString(&artwork_new->name,         top_node_name);
+  setString(&artwork_new->name_sorting, top_node_name);
+
+  // create node to link back to current custom artwork directory
+  createParentTreeInfoNode(artwork_new);
+
+  // move existing custom artwork tree into newly created sub-tree
+  artwork_new->node_group->next = *artwork_node;
+
+  // change custom artwork tree to contain only newly created node
+  *artwork_node = artwork_new;
+}
+
 static void LoadArtworkInfoFromLevelInfoExt(ArtworkDirTree **artwork_node,
                                            ArtworkDirTree *node_parent,
                                            LevelDirTree *level_node,
@@ -4025,6 +4048,8 @@ static void LoadArtworkInfoFromLevelInfoExt(ArtworkDirTree **artwork_node,
 
 static void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node)
 {
+  MoveArtworkInfoIntoSubTree(artwork_node);
+
   LoadArtworkInfoFromLevelInfoExt(artwork_node, NULL, leveldir_first_all, TRUE);
   LoadArtworkInfoFromLevelInfoExt(artwork_node, NULL, leveldir_first_all, FALSE);
 }