qbsp: delete leftover areaportal leak files on startup
This commit is contained in:
parent
d7db2bdae5
commit
4569ab1b33
|
|
@ -237,6 +237,7 @@ struct mapdata_t
|
|||
// Q2 stuff
|
||||
int32_t c_areas = 0;
|
||||
int32_t numareaportals = 0;
|
||||
int32_t numareaportal_leaks = 0;
|
||||
// running total
|
||||
uint32_t brush_offset = 0;
|
||||
// Small cache for image meta in the current map
|
||||
|
|
|
|||
|
|
@ -838,10 +838,8 @@ static void DebugAreaPortalBothSidesLeak(node_t *node)
|
|||
|
||||
// write `longest_path` as the leak
|
||||
|
||||
mapentity_t *entity = AreanodeEntityForLeaf(node);
|
||||
|
||||
fs::path name = qbsp_options.bsp_path;
|
||||
name.replace_extension(fmt::format("areaportal{}_leak.pts", entity - map.entities.data()));
|
||||
name.replace_extension(fmt::format("areaportal_leak{}.pts", map.numareaportal_leaks));
|
||||
|
||||
std::ofstream ptsfile(name);
|
||||
|
||||
|
|
@ -862,6 +860,8 @@ static void DebugAreaPortalBothSidesLeak(node_t *node)
|
|||
}
|
||||
|
||||
logging::print("Wrote {}\n", name);
|
||||
|
||||
++map.numareaportal_leaks;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
10
qbsp/qbsp.cc
10
qbsp/qbsp.cc
|
|
@ -1628,6 +1628,16 @@ void InitQBSP(int argc, const char **argv)
|
|||
fs::path porfile = qbsp_options.bsp_path;
|
||||
porfile.replace_extension("por");
|
||||
remove(porfile);
|
||||
|
||||
// areaportal leaks
|
||||
for (int i = 0;; i++) {
|
||||
fs::path name = qbsp_options.bsp_path;
|
||||
name.replace_extension(fmt::format("areaportal_leak{}.pts", i));
|
||||
|
||||
if (!remove(name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// onlyents might not load this yet
|
||||
|
|
|
|||
Loading…
Reference in New Issue