From ab2ec644d69ff61e1d6fa10b8c025393aa4b772e Mon Sep 17 00:00:00 2001
From: Bill Currie <bill@taniwha.org>
Date: Mon, 28 Nov 2011 08:57:42 +0900
Subject: [PATCH] Clip the portals when running the test cases.

When the portals are too big, floats break down and break the tests. This
might not be much of an issue in real maps, but my tests use "infinite"
planes.
---
 libs/models/test/testclip.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libs/models/test/testclip.c b/libs/models/test/testclip.c
index f0f1b154f..bd33ddfe7 100644
--- a/libs/models/test/testclip.c
+++ b/libs/models/test/testclip.c
@@ -477,6 +477,14 @@ run_test (test_t *test)
 			goto nodeleaf_bail;
 		}
 		for (p = portal_list; p; p = p->next) {
+			for (j = 0; j < p->portal->winding->numpoints; j++) {
+				p->portal->winding->points[j][0]
+					= bound (-8192, p->portal->winding->points[j][0], 8192);
+				p->portal->winding->points[j][1]
+					= bound (-8192, p->portal->winding->points[j][1], 8192);
+				p->portal->winding->points[j][2]
+					= bound (-8192, p->portal->winding->points[j][2], 8192);
+			}
 			for (j = 0; j < 2; j++) {
 				int         found = 0;