{
int i;
+ printf("Dumping TreeInfo:\n");
+
while (node)
{
- for (i=0; i<depth * 3; i++)
+ for (i=0; i<(depth + 1) * 3; i++)
printf(" ");
printf("filename == '%s' [%s]\n", node->filename, node->name);
{ TYPE_BOOLEAN, &ldi.readonly, "readonly" }
};
-static void setTreeInfoToDefaults(TreeInfo *ldi)
+static void setTreeInfoToDefaults(TreeInfo *ldi, int type)
{
- /* ldi->type is expected to be already set! */
-
- if (ldi->type == 0)
- Error(ERR_EXIT, "ldi->type == 0");
+ ldi->type = type;
ldi->node_top = (ldi->type == TREE_TYPE_LEVEL_DIR ? &leveldir_first :
ldi->type == TREE_TYPE_GRAPHICS_DIR ? &artwork.gfx_first :
{
if (parent == NULL)
{
- setTreeInfoToDefaults(ldi);
+ Error(ERR_WARN, "setTreeInfoToDefaultsFromParent(): parent == NULL");
+
+ setTreeInfoToDefaults(ldi, TREE_TYPE_GENERIC);
return;
}
return;
ti_new = newTreeInfo();
- ti_new->type = node_parent->type;
-
- setTreeInfoToDefaults(ti_new);
+ setTreeInfoToDefaults(ti_new, node_parent->type);
ti_new->node_parent = node_parent;
ti_new->parent_link = TRUE;
}
leveldir_new = newTreeInfo();
- leveldir_new->type = TREE_TYPE_LEVEL_DIR;
+
+ if (node_parent)
+ setTreeInfoToDefaultsFromParent(leveldir_new, node_parent);
+ else
+ setTreeInfoToDefaults(leveldir_new, TREE_TYPE_LEVEL_DIR);
checkSetupFileListIdentifier(setup_file_list, getCookie("LEVELINFO"));
- setTreeInfoToDefaultsFromParent(leveldir_new, node_parent);
/* set all structure fields according to the token/value pairs */
ldi = *leveldir_new;
}
artwork_new = newTreeInfo();
- artwork_new->type = type;
- setTreeInfoToDefaultsFromParent(artwork_new, node_parent);
+ if (node_parent)
+ setTreeInfoToDefaultsFromParent(artwork_new, node_parent);
+ else
+ setTreeInfoToDefaults(artwork_new, type);
artwork_new->filename = getStringCopy(directory_name);
- if (setup_file_list)
+ if (setup_file_list) /* (before defining ".color" and ".class_desc") */
{
#if 0
checkSetupFileListIdentifier(setup_file_list, getCookie("..."));
if (artwork_new->name_sorting == NULL)
artwork_new->name_sorting = getStringCopy(artwork_new->name);
}
- else
- {
- if (artwork_new->name != NULL)
- free(artwork_new->name);
-
- if (strcmp(artwork_new->filename, ".") == 0)
- artwork_new->name = getStringCopy("default");
- else
- artwork_new->name = getStringCopy(artwork_new->filename);
-
- artwork_new->name_short = getStringCopy(artwork_new->name);
- artwork_new->name_sorting = getStringCopy(artwork_new->name);
- }
if (node_parent == NULL) /* top level group */
{
artwork_new->user_defined =
(artwork_new->basepath == check_dir ? FALSE : TRUE);
-#if 0
+ /* (may use ".sort_priority" from "setup_file_list" above) */
artwork_new->color = LEVELCOLOR(artwork_new);
artwork_new->class_desc = getLevelClassDescription(artwork_new);
-#endif
+
+ if (setup_file_list == NULL) /* (after determining ".user_defined") */
+ {
+ if (artwork_new->name != NULL)
+ free(artwork_new->name);
+
+ if (strcmp(artwork_new->filename, ".") == 0)
+ {
+ if (artwork_new->user_defined)
+ artwork_new->name = getStringCopy("private");
+ else
+ artwork_new->name = getStringCopy("default");
+ }
+ else
+ artwork_new->name = getStringCopy(artwork_new->filename);
+
+ artwork_new->name_short = getStringCopy(artwork_new->name);
+ artwork_new->name_sorting = getStringCopy(artwork_new->name);
+ }
pushTreeInfo(node_first, artwork_new);
getUserMusicDir(NULL),
TREE_TYPE_MUSIC_DIR);
+ /* before sorting, the first entries will be from the user directory */
artwork.gfx_current = artwork.gfx_first;
artwork.snd_current = artwork.snd_first;
artwork.mus_current = artwork.mus_first;
sortTreeInfo(&artwork.snd_first, compareTreeInfoEntries);
sortTreeInfo(&artwork.mus_first, compareTreeInfoEntries);
-#if 0
+#if 1
dumpTreeInfo(artwork.gfx_first, 0);
dumpTreeInfo(artwork.snd_first, 0);
dumpTreeInfo(artwork.mus_first, 0);
}
/* always start with reliable default values */
- setTreeInfoToDefaults(&ldi);
+ setTreeInfoToDefaults(&ldi, TREE_TYPE_LEVEL_DIR);
ldi.name = getLoginName();
ldi.author = getRealName();