re-enabled storing selection from "last played level set" menu
[rocksndiamonds.git] / src / libgame / setup.h
index 8ec6b4d8dc14fd616eea7c3ee8ff06564ded463e..c8c5feccd309922b6bcdc066de190fc7a528e8e6 100644 (file)
@@ -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
@@ -228,17 +233,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)                                               \
@@ -287,6 +294,7 @@ void pushTreeInfo(TreeInfo **, TreeInfo *);
 void removeTreeInfo(TreeInfo **);
 int numTreeInfo(TreeInfo *);
 boolean validLevelSeries(TreeInfo *);
+TreeInfo *getValidLevelSeries(TreeInfo *, TreeInfo *);
 TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *);
 TreeInfo *getTreeInfoFirstGroupEntry(TreeInfo *);
 int numTreeInfoInGroup(TreeInfo *);
@@ -367,6 +375,8 @@ boolean UpdateUserLevelSet(char *, char *, char *, int);
 boolean CreateUserLevelSet(char *, char *, char *, int, boolean);
 
 void UpdateLastPlayedLevels_TreeInfo(void);
+void StoreLastPlayedLevels(TreeInfo *);
+void RestoreLastPlayedLevels(TreeInfo **);
 
 void LoadLevelSetup_LastSeries(void);
 void SaveLevelSetup_LastSeries(void);