From: Holger Schemel Date: Sun, 25 Jan 2004 12:54:10 +0000 (+0100) Subject: rnd-20040125-4-src X-Git-Tag: 3.1.0^2~84 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=19e06988520133ca644c533c8f6932738788a7a5;p=rocksndiamonds.git rnd-20040125-4-src --- diff --git a/src/conftime.h b/src/conftime.h index 39be8fc7..63f8de9c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-01-25 02:38]" +#define COMPILE_DATE_STRING "[2004-01-25 13:45]" diff --git a/src/files.c b/src/files.c index 61deafb4..e365cd1f 100644 --- a/src/files.c +++ b/src/files.c @@ -328,7 +328,7 @@ static char *getLevelFilenameFromBasename(char *basename) static int getFileTypeFromBasename(char *basename) { - char *filename = getLevelFilenameFromBasename(basename); + static char *filename = NULL; struct stat file_status; /* ---------- try to determine file type from filename ---------- */ @@ -340,6 +340,9 @@ static int getFileTypeFromBasename(char *basename) /* ---------- try to determine file type from filesize ---------- */ + checked_free(filename); + filename = getPath2(getCurrentLevelDir(), basename); + if (stat(filename, &file_status) == 0) { /* check for typical filesize of a Supaplex level package file */ @@ -353,10 +356,10 @@ static int getFileTypeFromBasename(char *basename) static char *getSingleLevelBasename(int nr, int type) { static char basename[MAX_FILENAME_LEN]; + char *level_filename = getStringCopy(leveldir_current->level_filename); - if (leveldir_current->level_filename == NULL) - leveldir_current->level_filename = - getStringCat2("%03d.", LEVELFILE_EXTENSION); + if (level_filename == NULL) + level_filename = getStringCat2("%03d.", LEVELFILE_EXTENSION); switch (type) { @@ -373,10 +376,12 @@ static char *getSingleLevelBasename(int nr, int type) case LEVEL_FILE_TYPE_UNKNOWN: default: - sprintf(basename, leveldir_current->level_filename, nr); + sprintf(basename, level_filename, nr); break; } + free(level_filename); + return basename; }