From 70f117c8c62d425f592afb8ddb0e1b252e2d244b Mon Sep 17 00:00:00 2001 From: molivier Date: Sat, 19 Oct 2002 09:43:46 +0000 Subject: [PATCH] Added a test when freeing textures (glt->image can be NULL if the program exits because of a lack of memory at startup). Also, Transfusion doesn't have a "start" map, so Transfusion dedicated servers shouldn't use it as their default map. Removed a preprocessor warning in r_shadow.c git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2540 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 29 ++++++++++++++++------------- host_cmd.c | 7 ++++++- r_shadow.c | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/gl_textures.c b/gl_textures.c index 558b1f59..edd0b7db 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -222,20 +222,23 @@ void R_FreeTexture(rtexture_t *rt) // note: if freeing a fragment texture, this will not make the claimed // space available for new textures unless all other fragments in the // image are also freed - image = glt->image; - image->texturecount--; - if (image->texturecount < 1) + if (glt->image) { - for (gltimagepointer = &glt->pool->imagechain;*gltimagepointer && *gltimagepointer != image;gltimagepointer = &(*gltimagepointer)->imagechain); - if (*gltimagepointer == image) - *gltimagepointer = image->imagechain; - else - Host_Error("R_FreeTexture: image not linked in pool\n"); - if (image->texnum) - qglDeleteTextures(1, &image->texnum); - if (image->blockallocation) - Mem_Free(image->blockallocation); - Mem_Free(image); + image = glt->image; + image->texturecount--; + if (image->texturecount < 1) + { + for (gltimagepointer = &glt->pool->imagechain;*gltimagepointer && *gltimagepointer != image;gltimagepointer = &(*gltimagepointer)->imagechain); + if (*gltimagepointer == image) + *gltimagepointer = image->imagechain; + else + Host_Error("R_FreeTexture: image not linked in pool\n"); + if (image->texnum) + qglDeleteTextures(1, &image->texnum); + if (image->blockallocation) + Mem_Free(image->blockallocation); + Mem_Free(image); + } } if (glt->identifier) diff --git a/host_cmd.c b/host_cmd.c index b026fa8b..da2705a4 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1533,7 +1533,12 @@ void Host_Startdemos_f (void) if (cls.state == ca_dedicated) { if (!sv.active && !sv_spawnmap[0]) - Cbuf_AddText ("map start\n"); + { + if (gamemode == GAME_TRANSFUSION) + Cbuf_AddText ("map bb1\n"); + else + Cbuf_AddText ("map start\n"); + } return; } diff --git a/r_shadow.c b/r_shadow.c index e6db5529..65a1dfe1 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -225,7 +225,7 @@ void R_Shadow_Volume(int numverts, int numtris, float *vertex, int *elements, in out[5] = e[2] + numverts; out += 6; tris += 2; -#else if 1 +#elif 1 // rear cap out[0] = e[0] + numverts; out[1] = e[1] + numverts; -- 2.39.2