From: molivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sat, 19 Oct 2002 09:43:46 +0000 (+0000)
Subject: Added a test when freeing textures (glt->image can be NULL if the program exits becau... 
X-Git-Tag: RELEASE_0_2_0_RC1~126
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=70f117c8c62d425f592afb8ddb0e1b252e2d244b;p=xonotic%2Fdarkplaces.git

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
---

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;