From: cloudwalk Date: Wed, 6 Jan 2021 17:57:00 +0000 (+0000) Subject: model_shared: Avoid Mod_MakeSortedSurfaces if dedicated. Fixes crash. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=acd4f0e0f50927ae327a4c235f04a4d09086e655;p=xonotic%2Fdarkplaces.git model_shared: Avoid Mod_MakeSortedSurfaces if dedicated. Fixes crash. 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 --- diff --git a/model_shared.c b/model_shared.c index f9a33348..3213a050 100644 --- a/model_shared.c +++ b/model_shared.c @@ -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