fixed graphical bug when snap-pushing with smooth movement in BD engine
[rocksndiamonds.git] / src / game_bd / bd_caveset.c
index e7f292b6386a60381d8d1bb157fd1340b04a0566..0ee9c3b82d9ee59208d0bd0b0d2c2bc8f2f6ee25 100644 (file)
@@ -87,6 +87,9 @@ GdCavesetData *gd_caveset_data_new(void)
 
   gd_struct_set_defaults_from_array(data, gd_caveset_properties, caveset_defaults);
 
+  if (leveldir_current != NULL)
+    data->levelset_subdir = getStringCopy(leveldir_current->subdir);
+
   return data;
 }
 
@@ -99,7 +102,9 @@ void gd_caveset_data_free(GdCavesetData *data)
     if (gd_caveset_properties[i].type == GD_TYPE_LONGSTRING)
       checked_free(STRUCT_MEMBER(char *, data, gd_caveset_properties[i].offset));
 
-  free(data);
+  checked_free(data->levelset_subdir);
+
+  checked_free(data);
 }
 
 // ============================================================================
@@ -125,7 +130,9 @@ void gd_caveset_clear(void)
   // always newly create this
   // create pseudo cave containing default values
   gd_caveset_data = gd_caveset_data_new();
-  gd_strcpy(gd_caveset_data->name, getCurrentLevelsetName());
+
+  if (leveldir_current != NULL)
+    gd_strcpy(gd_caveset_data->name, leveldir_current->name);
 }
 
 // return number of caves currently in memory.