From 06115c6043630b54a35b19fee651604274c3e158 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 16 Nov 2004 12:18:58 +0000 Subject: [PATCH] now unloads all stale submodels and the old world model before loading the new one (this relies on the world model being the first precache to trigger this code at the appropriate time) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4760 d7cf8633-e32d-0410-b094-e92efae38249 --- model_shared.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/model_shared.c b/model_shared.c index 6addcf62..c5e9d2f6 100644 --- a/model_shared.c +++ b/model_shared.c @@ -308,6 +308,14 @@ static model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, Con_DPrintf("loading model %s\n", mod->name); // LordHavoc: unload the existing model in this slot (if there is one) Mod_UnloadModel(mod); + if (isworldmodel) + { + // clear out any stale submodels lying around, as well as the old world model itself + int i; + for (i = 0;i < MAX_MOD_KNOWN;i++) + if (mod_known[i].isworldmodel) + Mod_UnloadModel(mod_known + i); + } // load the model mod->isworldmodel = isworldmodel; -- 2.39.2