added storing current level set identifier in caveset structure
authorHolger Schemel <info@artsoft.org>
Sat, 16 Mar 2024 11:49:11 +0000 (12:49 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 16 Mar 2024 11:49:11 +0000 (12:49 +0100)
src/game_bd/bd_caveset.c
src/game_bd/bd_caveset.h

index e7f292b6386a60381d8d1bb157fd1340b04a0566..deb46a24793e8743d280cd3eb5a7bfe6b3d222f3 100644 (file)
@@ -87,6 +87,8 @@ GdCavesetData *gd_caveset_data_new(void)
 
   gd_struct_set_defaults_from_array(data, gd_caveset_properties, caveset_defaults);
 
+  data->levelset_subdir = getStringCopy(leveldir_current->subdir);
+
   return data;
 }
 
@@ -99,7 +101,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);
 }
 
 // ============================================================================
index 368d7ff52ba12d3e578611a0a1b2e764aff2cdee..7cd23f660ec8ce1d55360c40f84275b051cc6af3 100644 (file)
@@ -45,6 +45,8 @@ typedef struct _gd_caveset_data
 
   // and this one the highscores
   GdHighScore highscore[GD_HIGHSCORE_NUM];
+
+  char *levelset_subdir;       // current level set identifier
 } GdCavesetData;
 
 extern const GdStructDescriptor gd_caveset_properties[];