qbsp: stop clobbering szBSPName
This commit is contained in:
parent
c349e59524
commit
2c32177a69
|
|
@ -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<portal_t *> &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<porta
|
|||
prevpt = currpt;
|
||||
}
|
||||
|
||||
logging::print("Leak file written to {}\n", options.szBSPName);
|
||||
logging::print("Leak file written to {}\n", name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -485,8 +479,9 @@ bool FillOutside(mapentity_t *entity, node_t *node, const int hullnum)
|
|||
map.leakfile = true;
|
||||
|
||||
/* Get rid of the .prt file since the map has a leak */
|
||||
options.szBSPName.replace_extension("prt");
|
||||
remove(options.szBSPName);
|
||||
fs::path name = options.szBSPName;
|
||||
name.replace_extension("prt");
|
||||
remove(name);
|
||||
|
||||
if (options.leaktest.value()) {
|
||||
logging::print("Aborting because -leaktest was used.\n");
|
||||
|
|
|
|||
|
|
@ -251,11 +251,12 @@ static void WritePortalfile(node_t *headnode, portal_state_t *state)
|
|||
NumberLeafs_r(headnode, state, -1);
|
||||
|
||||
// write the file
|
||||
options.szBSPName.replace_extension("prt");
|
||||
fs::path name = options.szBSPName;
|
||||
name.replace_extension("prt");
|
||||
|
||||
std::ofstream portalFile(options.szBSPName, std::ios_base::binary | std::ios_base::out);
|
||||
std::ofstream portalFile(name, std::ios_base::binary | std::ios_base::out);
|
||||
if (!portalFile)
|
||||
FError("Failed to open {}: {}", options.szBSPName, strerror(errno));
|
||||
FError("Failed to open {}: {}", name, strerror(errno));
|
||||
|
||||
// q2 uses a PRT1 file, but with clusters.
|
||||
// (Since q2bsp natively supports clusters, we don't need PRT2.)
|
||||
|
|
|
|||
15
qbsp/qbsp.cc
15
qbsp/qbsp.cc
|
|
@ -1108,14 +1108,17 @@ static void InitQBSP(int argc, const char **argv)
|
|||
logging::print("Input file: {}\n", options.szMapName);
|
||||
logging::print("Output file: {}\n\n", options.szBSPName);
|
||||
|
||||
options.szBSPName.replace_extension("prt");
|
||||
remove(options.szBSPName);
|
||||
fs::path prtfile = options.szBSPName;
|
||||
prtfile.replace_extension("prt");
|
||||
remove(prtfile);
|
||||
|
||||
options.szBSPName.replace_extension("pts");
|
||||
remove(options.szBSPName);
|
||||
fs::path ptsfile = options.szBSPName;
|
||||
ptsfile.replace_extension("pts");
|
||||
remove(ptsfile);
|
||||
|
||||
options.szBSPName.replace_extension("por");
|
||||
remove(options.szBSPName);
|
||||
fs::path porfile = options.szBSPName;
|
||||
porfile.replace_extension("por");
|
||||
remove(porfile);
|
||||
}
|
||||
|
||||
// onlyents might not load this yet
|
||||
|
|
|
|||
Loading…
Reference in New Issue