]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
model_shared: Avoid Mod_MakeSortedSurfaces if dedicated. Fixes crash.
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 6 Jan 2021 17:57:00 +0000 (17:57 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 6 Jan 2021 17:57:00 +0000 (17:57 +0000)
R_FrameData_Alloc isn't available in dedicated builds and sorting
surfaces is not really necessary without a renderer.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13091 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index f9a3334856c3c7816021c8252f205cd36caaa197..3213a050f8a015f6d195dafc91a5415852c6d2ed 100644 (file)
@@ -2936,7 +2936,12 @@ void Mod_MakeSortedSurfaces(model_t *mod)
 {
        // make an optimal set of texture-sorted batches to draw...
        int j, k;
-       Mod_MakeSortedSurfaces_qsortsurface_t *info = (Mod_MakeSortedSurfaces_qsortsurface_t*)R_FrameData_Alloc(mod->num_surfaces * sizeof(*info));
+       Mod_MakeSortedSurfaces_qsortsurface_t *info;
+
+       if(cls.state == ca_dedicated)
+               return;
+
+       info = (Mod_MakeSortedSurfaces_qsortsurface_t*)R_FrameData_Alloc(mod->num_surfaces * sizeof(*info));
        if (!mod->modelsurfaces_sorted)
                mod->modelsurfaces_sorted = (int *) Mem_Alloc(loadmodel->mempool, mod->num_surfaces * sizeof(*mod->modelsurfaces_sorted));
        // the goal is to sort by submodel (can't change which submodel a surface belongs to), and then by effects and textures