]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
now unloads all stale submodels and the old world model before loading the new one...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 16 Nov 2004 12:18:58 +0000 (12:18 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 16 Nov 2004 12:18:58 +0000 (12:18 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4760 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index 6addcf6250fc095045d866b9b2cb15e4cf70aa2c..c5e9d2f6c2e7581ae3a7db81d7dd528616e2337c 100644 (file)
@@ -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;