diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 370f47180..45fc3ff47 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -2232,6 +2232,9 @@ void C_UndefineVolume(int32_t vol) { Bassert((unsigned)vol < MAXVOLUMES); + for (int32_t i = 0; i < MAXLEVELS; i++) + C_UndefineLevel(vol, i); + EpisodeNames[vol][0] = '\0'; g_numVolumes = 0; @@ -2270,10 +2273,12 @@ void C_UndefineLevel(int32_t vol, int32_t lev) { map_t *const map = &MapInfo[(MAXLEVELS*vol)+lev]; - Bfree(map->filename); + if (map->filename) + Bfree(map->filename); map->filename = NULL; - Bfree(map->name); + if (map->name) + Bfree(map->name); map->name = NULL; map->partime = 0; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 98854f71e..d73c0bb36 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -111,17 +111,17 @@ extern vmstate_t vm; void G_DoGameStartup(const int32_t *params); void C_DefineMusic(int32_t vol, int32_t lev, const char *fn); +void C_UndefineVolume(int32_t vol); +void C_UndefineSkill(int32_t skill); +void C_UndefineLevel(int32_t vol, int32_t lev); #if defined LUNATIC void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5]); void C_DefineQuote(int32_t qnum, const char *qstr); void C_DefineVolumeName(int32_t vol, const char *name); -void C_UndefineVolume(int32_t vol); void C_DefineSkillName(int32_t skill, const char *name); -void C_UndefineSkill(int32_t skill); void C_DefineLevelName(int32_t vol, int32_t lev, const char *fn, int32_t partime, int32_t designertime, const char *levelname); -void C_UndefineLevel(int32_t vol, int32_t lev); void C_DefineGameFuncName(int32_t idx, const char *name); void C_DefineGameType(int32_t idx, int32_t flags, const char *name); int32_t C_SetDefName(const char *name);