Added a test when freeing textures (glt->image can be NULL if the program exits becau...
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 19 Oct 2002 09:43:46 +0000 (09:43 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 19 Oct 2002 09:43:46 +0000 (09:43 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2540 d7cf8633-e32d-0410-b094-e92efae38249

gl_textures.c
host_cmd.c
r_shadow.c

index 558b1f5..edd0b7d 100644 (file)
@@ -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)
index b026fa8..da2705a 100644 (file)
@@ -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;
        }
 
index e6db552..65a1dfe 100644 (file)
@@ -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;