rnd-20040125-4-src
authorHolger Schemel <info@artsoft.org>
Sun, 25 Jan 2004 12:54:10 +0000 (13:54 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:45:38 +0000 (10:45 +0200)
src/conftime.h
src/files.c

index 39be8fc7865c7eb037c43fd379c290f8a86722ab..63f8de9cd6c71e705e4d83a7c47888165d1a67d2 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2004-01-25 02:38]"
+#define COMPILE_DATE_STRING "[2004-01-25 13:45]"
index 61deafb48c552e6145f074f944a55f2b0581e613..e365cd1f8c8dd4f28916a38b8541d6b43e9fa990 100644 (file)
@@ -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;
 }