}
}
+static boolean checkForPackageFromBasename_BD(char *basename)
+{
+ // check for native BD level file extensions
+ if (!strSuffixLower(basename, ".bd") &&
+ !strSuffixLower(basename, ".bdr") &&
+ !strSuffixLower(basename, ".brc") &&
+ !strSuffixLower(basename, ".gds"))
+ return FALSE;
+
+ // check for standard single-level BD files (like "001.bd")
+ if (strSuffixLower(basename, ".bd") &&
+ strlen(basename) == 6 &&
+ basename[0] >= '0' && basename[0] <= '9' &&
+ basename[1] >= '0' && basename[1] <= '9' &&
+ basename[2] >= '0' && basename[2] <= '9')
+ return FALSE;
+
+ // this is a level package in native BD file format
+ return TRUE;
+}
+
static char *getLevelFilenameFromBasename(char *basename)
{
static char *filename = NULL;
return LEVEL_FILE_TYPE_SB;
// check for typical filename of a Boulder Dash (GDash) level package file
- if (strSuffixLower(basename, ".bd") ||
- strSuffixLower(basename, ".bdr") ||
- strSuffixLower(basename, ".brc") ||
- strSuffixLower(basename, ".gds"))
+ if (checkForPackageFromBasename_BD(basename))
return LEVEL_FILE_TYPE_BD;
// ---------- try to determine file type from filesize ----------
if (fileExists(lfi->filename))
return;
+ // check for native Boulder Dash level file
+ setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_BD, "%03d.bd", nr);
+ if (fileExists(lfi->filename))
+ return;
+
// check for Emerald Mine level file (V1)
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_EM, "a%c%c",
'a' + (nr / 10) % 26, '0' + nr % 10);