From: Holger Schemel Date: Wed, 17 Feb 2021 22:50:17 +0000 (+0100) Subject: fixed sort priorities of special tree nodes to prevent bad sort results X-Git-Tag: 4.2.3.0~6 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=42f2880cf77f775665ed25badf639e963a6dbdbf;p=rocksndiamonds.git fixed sort priorities of special tree nodes to prevent bad sort results --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 7b3168ab..315c615f 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -2856,7 +2856,7 @@ static TreeInfo *createParentTreeInfoNode(TreeInfo *node_parent) setString(&ti_new->subdir, STRING_PARENT_DIRECTORY); setString(&ti_new->fullpath, node_parent->fullpath); - ti_new->sort_priority = node_parent->sort_priority; + ti_new->sort_priority = LEVELCLASS_PARENT; ti_new->latest_engine = node_parent->latest_engine; setString(&ti_new->class_desc, getLevelClassDescription(ti_new)); @@ -2879,14 +2879,14 @@ static TreeInfo *createTopTreeInfoNode(TreeInfo *node_first) ti_new->node_parent = NULL; ti_new->parent_link = FALSE; - setString(&ti_new->identifier, node_first->identifier); + setString(&ti_new->identifier, "top_tree_node"); setString(&ti_new->name, TREE_INFOTEXT(type)); setString(&ti_new->name_sorting, ti_new->name); setString(&ti_new->subdir, STRING_TOP_DIRECTORY); setString(&ti_new->fullpath, "."); - ti_new->sort_priority = node_first->sort_priority;; + ti_new->sort_priority = LEVELCLASS_TOP; ti_new->latest_engine = node_first->latest_engine; setString(&ti_new->class_desc, TREE_INFOTEXT(type)); @@ -4508,6 +4508,7 @@ static void InitLastPlayedLevels_ParentNode(void) setTreeInfoToDefaultsFromParent(leveldir_new, leveldir_first); leveldir_new->level_group = TRUE; + leveldir_new->sort_priority = LEVELCLASS_LAST_PLAYED_LEVEL; setString(&leveldir_new->identifier, TOKEN_STR_LAST_LEVEL_SERIES); setString(&leveldir_new->name, "<< (last played level sets)"); diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 367bbbc3..2d290b80 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -114,6 +114,11 @@ typedef struct hashtable SetupFileHash; } \ +// sort priorities of special tree entries +#define LEVELCLASS_TOP 0 +#define LEVELCLASS_PARENT 1 +#define LEVELCLASS_LAST_PLAYED_LEVEL 2 + // sort priorities of level series (also used as level series classes) #define LEVELCLASS_TUTORIAL_START 10 #define LEVELCLASS_TUTORIAL_END 99