fixed sorting in tutorial and classic level groups
authorHolger Schemel <info@artsoft.org>
Tue, 16 Feb 2021 00:48:54 +0000 (01:48 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 16 Feb 2021 00:48:54 +0000 (01:48 +0100)
src/libgame/setup.h

index 8ec6b4d8dc14fd616eea7c3ee8ff06564ded463e..367bbbc37c415e06ff8fe24e376e6820737a7b55 100644 (file)
@@ -228,17 +228,19 @@ typedef struct hashtable     SetupFileHash;
                         ARTWORKCLASS_UNDEFINED)
 
 #define TREE_SORTING_DIR(ti)                                           \
-       (((ti)->parent_link                                     ? 0 :   \
-         (ti)->in_user_dir                                     ? 4 :   \
-         (ti)->sort_priority >= LEVELCLASS_CLASSICS_START      ? 3 :   \
-         (ti)->sort_priority >= LEVELCLASS_TUTORIAL_START      ? 2 :   \
-         1) * 2 +                                                      \
-        ((ti)->level_group ? 0 : 1))
+       (((ti)->parent_link                                ? 0 :        \
+         (ti)->in_user_dir                                ? 4 * 200 :  \
+         (ti)->sort_priority >= LEVELCLASS_CLASSICS_START ? 3 * 200 +  \
+         (ti)->sort_priority % 100 :                                   \
+         (ti)->sort_priority >= LEVELCLASS_TUTORIAL_START ? 2 * 200 +  \
+         (ti)->sort_priority % 100 :                                   \
+         1 * 200) +                                                    \
+        ((ti)->level_group ? 0 : 100))
 
 #define TREE_COLOR_DIR(ti, active)                                     \
        ((active)                       ? FC_YELLOW :                   \
-        TREE_SORTING(ti) / 2 == 4      ? FC_GREEN :                    \
-        TREE_SORTING(ti) / 2 == 2      ? FC_BLUE :                     \
+        TREE_SORTING(ti) / 200 == 4    ? FC_GREEN :                    \
+        TREE_SORTING(ti) / 200 == 2    ? FC_BLUE :                     \
         FC_RED)
 
 #define TREE_SORTING(ti)                                               \