qbsp: throw exception in ExportLeaf if a leaf bounds is invalid

add check in test suite that qbspfeatures.map doesn't get upgraded to BSP2 due to invalid leaf bounds
This commit is contained in:
Eric Wasylishen 2022-06-18 16:11:29 -06:00
parent ea985eb5ac
commit ccf605794e
2 changed files with 7 additions and 0 deletions

View File

@ -908,6 +908,8 @@ TEST_CASE("features", "[testmaps_q1]")
const auto [bsp, bspx, prt] = LoadTestmapQ1("qbspfeatures.map");
REQUIRE(prt.has_value());
CHECK(bsp.loadversion == &bspver_q1);
}
bool PortalMatcher(const prtfile_winding_t& a, const prtfile_winding_t &b)

View File

@ -30,6 +30,7 @@
#include <common/json.hh>
#include <fstream>
#include <stdexcept>
using nlohmann::json;
/**
@ -156,6 +157,10 @@ static void ExportLeaf(mapentity_t *entity, node_t *node)
dleaf.contents = remapped.native;
if (node->bounds.maxs()[0] < node->bounds.mins()[0]) {
throw std::runtime_error("leaf bounds was unassigned");
}
/*
* write bounding box info
*/