char *getGlobalLevelTemplateFilename(void)
{
- // global variable "leveldir_current" must be modified in the loop below
- LevelDirTree *leveldir_current_last = leveldir_current;
- char *filename = NULL;
-
- // check for template level in path from current to topmost tree node
-
- while (leveldir_current != NULL)
- {
- filename = getDefaultLevelFilename(-1);
-
- if (fileExists(filename))
- break;
-
- leveldir_current = leveldir_current->node_parent;
- }
-
- // restore global variable "leveldir_current" modified in above loop
- leveldir_current = leveldir_current_last;
-
- return filename;
+ return getFilenameFromCurrentLevelDirUpward(LEVELTEMPLATE_FILENAME);
}
static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi)
return filename;
}
+char *getFilenameFromCurrentLevelDirUpward(char *basename)
+{
+ // global variable "leveldir_current" must be modified in the loop below
+ LevelDirTree *leveldir_current_last = leveldir_current;
+ static char *filename = NULL;
+
+ // check for filename in path from current to topmost tree node
+
+ while (leveldir_current != NULL)
+ {
+ checked_free(filename);
+
+ filename = getPath2(getCurrentLevelDir(), basename);
+
+ if (fileExists(filename))
+ break;
+
+ leveldir_current = leveldir_current->node_parent;
+ }
+
+ // restore global variable "leveldir_current" modified in above loop
+ leveldir_current = leveldir_current_last;
+
+ return filename;
+}
+
char *getHelpAnimFilename(void)
{
static char *filename = NULL;
char *getDefaultSetupFilename(void);
char *getPlatformSetupFilename(void);
char *getEditorSetupFilename(void);
+char *getFilenameFromCurrentLevelDirUpward(char *);
char *getHelpAnimFilename(void);
char *getHelpTextFilename(void);
char *getLevelSetInfoFilename(int);