return "Unknown Level Class";
}
+static char *getCacheDir(void)
+{
+ static char *cache_dir = NULL;
+
+ if (cache_dir == NULL)
+ cache_dir = getPath2(getMainUserGameDataDir(), CACHE_DIRECTORY);
+
+ return cache_dir;
+}
+
static char *getScoreDir(char *level_subdir)
{
static char *score_dir = NULL;
return score_dir;
}
+static char *getScoreCacheDir(char *level_subdir)
+{
+ static char *score_dir = NULL;
+ static char *score_level_dir = NULL;
+ char *score_subdir = SCORES_DIRECTORY;
+
+ if (score_dir == NULL)
+ score_dir = getPath2(getCacheDir(), score_subdir);
+
+ if (level_subdir != NULL)
+ {
+ checked_free(score_level_dir);
+
+ score_level_dir = getPath2(score_dir, level_subdir);
+
+ return score_level_dir;
+ }
+
+ return score_dir;
+}
+
static char *getScoreTapeDir(char *level_subdir, int nr)
{
static char *score_tape_dir = NULL;
return levelsetup_dir;
}
-static char *getCacheDir(void)
-{
- static char *cache_dir = NULL;
-
- if (cache_dir == NULL)
- cache_dir = getPath2(getMainUserGameDataDir(), CACHE_DIRECTORY);
-
- return cache_dir;
-}
-
static char *getNetworkDir(void)
{
static char *network_dir = NULL;
return filename;
}
+char *getScoreCacheFilename(int nr)
+{
+ static char *filename = NULL;
+ char basename[MAX_FILENAME_LEN];
+
+ checked_free(filename);
+
+ sprintf(basename, "%03d.%s", nr, SCOREFILE_EXTENSION);
+
+ // used instead of "leveldir_current->subdir" (for network games)
+ filename = getPath2(getScoreCacheDir(levelset.identifier), basename);
+
+ return filename;
+}
+
char *getScoreTapeBasename(char *name)
{
static char basename[MAX_FILENAME_LEN];
createDirectory(getScoreDir(level_subdir), "level score", permissions);
}
+void InitScoreCacheDirectory(char *level_subdir)
+{
+ createDirectory(getMainUserGameDataDir(), "main user data", PERMS_PRIVATE);
+ createDirectory(getCacheDir(), "cache data", PERMS_PRIVATE);
+ createDirectory(getScoreCacheDir(NULL), "main score", PERMS_PRIVATE);
+ createDirectory(getScoreCacheDir(level_subdir), "level score", PERMS_PRIVATE);
+}
+
void InitScoreTapeDirectory(char *level_subdir, int nr)
{
int permissions = (program.global_scores ? PERMS_PUBLIC : PERMS_PRIVATE);
char *getTapeFilename(int);
char *getSolutionTapeFilename(int);
char *getScoreFilename(int);
+char *getScoreCacheFilename(int);
char *getScoreTapeBasename(char *);
char *getScoreTapeFilename(char *, int);
char *getSetupFilename(void);
void InitTapeDirectory(char *);
void InitScoreDirectory(char *);
+void InitScoreCacheDirectory(char *);
void InitScoreTapeDirectory(char *, int);
void InitUserLevelDirectory(char *);
void InitNetworkLevelDirectory(char *);