From: Rudolf Polzer <divverent@xonotic.org>
Date: Tue, 14 Feb 2012 12:24:05 +0000 (+0100)
Subject: also select the best entity when a leak was found
X-Git-Tag: xonotic-v0.6.0~10^2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=312f954913e47b4831629683be63a124c8b13583;p=xonotic%2Fnetradiant.git

also select the best entity when a leak was found
---

diff --git a/tools/quake3/q3map2/portals.c b/tools/quake3/q3map2/portals.c
index bb70e1ac..e3fc635b 100644
--- a/tools/quake3/q3map2/portals.c
+++ b/tools/quake3/q3map2/portals.c
@@ -665,10 +665,11 @@ int FloodEntities( tree_t *tree )
 {
 	int			i, s;
 	vec3_t		origin, offset, scale, angles;
-	qboolean	r, inside, tripped, skybox;
+	qboolean	r, inside, skybox;
 	node_t		*headnode;
-	entity_t	*e;
+	entity_t	*e, *tripped;
 	const char	*value;
+	int		tripcount;
 	
 	
 	headnode = tree->headnode;
@@ -746,12 +747,18 @@ int FloodEntities( tree_t *tree )
 		{
 			Sys_Printf( "Entity %i, Brush %i: Entity in solid\n", e->mapEntityNum, 0);
 		}
-		else if( tree->outside_node.occupied && !tripped )
+		else if( tree->outside_node.occupied )
 		{
-			xml_Select( "Entity leaked", e->mapEntityNum, 0, qfalse );
-			tripped = qtrue;
+			if(!tripped || tree->outside_node.occupied < tripcount)
+			{
+				tripped = e;
+				tripcount = tree->outside_node.occupied;
+			}
 		}
 	}
+
+	if(tripped)
+		xml_Select( "Entity leaked", e->mapEntityNum, 0, qfalse );
 	
 	Sys_FPrintf( SYS_VRB, "%9d flooded leafs\n", c_floodedleafs );