diff --git a/qbsp/outside.cc b/qbsp/outside.cc index 65b3d9ca..caa9ae72 100644 --- a/qbsp/outside.cc +++ b/qbsp/outside.cc @@ -72,18 +72,6 @@ static node_t *PointInLeaf(node_t *node, const qvec3d &point) } } -static std::ofstream InitPtsFile(void) -{ - options.szBSPName.replace_extension("pts"); - - std::ofstream ptsfile(options.szBSPName); - - if (!ptsfile) - FError("Failed to open {}: {}", options.szBSPName, strerror(errno)); - - return ptsfile; -} - static void ClearOccupied_r(node_t *node) { if (node->planenum != PLANENUM_LEAF) { @@ -271,7 +259,13 @@ leakline should be a sequence of portals leading from leakentity to the void */ static void WriteLeakLine(const mapentity_t *leakentity, const std::vector &leakline) { - std::ofstream ptsfile = InitPtsFile(); + fs::path name = options.szBSPName; + name.replace_extension("pts"); + + std::ofstream ptsfile(name); + + if (!ptsfile) + FError("Failed to open {}: {}", name, strerror(errno)); qvec3d prevpt = leakentity->origin; @@ -284,7 +278,7 @@ static void WriteLeakLine(const mapentity_t *leakentity, const std::vector