shithub: nanobsp

Download patch

ref: 5052250318e1ac0e85b4f9e8773d0334d630e615
parent: e97e03450cf94ad8b5e3fdef06a9a51f0cfe4ed6
author: Andrew Apted <ajapted@gmail.com>
date: Fri Dec 15 11:04:37 EST 2023

fixed a bug producing subsector indices.

--- a/nano_bsp.c
+++ b/nano_bsp.c
@@ -722,9 +722,7 @@
 
 		seg_t * seg;
 		for (seg = N->segs ; seg != NULL; seg = seg->next)
-		{
 			numsegs += 1;
-		}
 	}
 }
 
@@ -758,7 +756,12 @@
 
 unsigned int BSP_WriteNode (nanode_t * N)
 {
+	unsigned int index = N->index;
+
 	if (N->segs != NULL)
+		index |= NF_SUBSECTOR;
+
+	if (N->segs != NULL)
 	{
 		BSP_WriteSubsector (N);
 	}
@@ -783,11 +786,6 @@
 				out->bbox[c][k] = child->bbox[k];
 		}
 	}
-
-	unsigned int index = N->index;
-
-	if (N->segs != NULL)
-		index |= NF_SUBSECTOR;
 
 	Z_Free (N);
 
--