remove extraneous warnings when they don't matter

This commit is contained in:
Jonathan 2022-08-08 16:01:16 -04:00
parent e5602358c1
commit 5b56ecfb28
3 changed files with 21 additions and 14 deletions

View File

@ -73,7 +73,7 @@ struct bspbrush_t
qvec3d sphere_origin;
double sphere_radius;
bool update_bounds();
bool update_bounds(bool warn_on_failures);
std::unique_ptr<bspbrush_t> copy_unique() const;
};

View File

@ -246,7 +246,7 @@ bool CreateBrushWindings(bspbrush_t *brush)
}
}
return brush->update_bounds();
return brush->update_bounds(true);
}
/*
@ -578,7 +578,7 @@ void Brush_LoadEntity(mapentity_t *entity, const int hullnum, bspbrush_vector_t
qbsp_options.target_game->print_content_stats(*stats, "brushes");
}
bool bspbrush_t::update_bounds()
bool bspbrush_t::update_bounds(bool warn_on_failures)
{
this->bounds = {};
@ -591,11 +591,15 @@ bool bspbrush_t::update_bounds()
for (size_t i = 0; i < 3; i++) {
// todo: map_source_location in bspbrush_t
if (this->bounds.mins()[0] <= -qbsp_options.worldextent.value() || this->bounds.maxs()[0] >= qbsp_options.worldextent.value()) {
logging::print("WARNING: {}: brush bounds out of range\n", mapbrush ? mapbrush->line : parser_source_location());
if (warn_on_failures) {
logging::print("WARNING: {}: brush bounds out of range\n", mapbrush ? mapbrush->line : parser_source_location());
}
return false;
}
if (this->bounds.mins()[0] >= qbsp_options.worldextent.value() || this->bounds.maxs()[0] <= -qbsp_options.worldextent.value()) {
logging::print("WARNING: {}: no visible sides on brush\n", mapbrush ? mapbrush->line : parser_source_location());
if (warn_on_failures) {
logging::print("WARNING: {}: no visible sides on brush\n", mapbrush ? mapbrush->line : parser_source_location());
}
return false;
}
}

View File

@ -527,14 +527,18 @@ static twosided<std::unique_ptr<bspbrush_t>> SplitBrush(std::unique_ptr<bspbrush
// see if we have valid polygons on both sides
for (int i = 0; i < 2; i++) {
result[i]->update_bounds();
bool bogus = false;
for (int j = 0; j < 3; j++) {
if (result[i]->bounds.mins()[j] < -qbsp_options.worldextent.value() || result[i]->bounds.maxs()[j] > qbsp_options.worldextent.value()) {
stats.c_bogus++;
bogus = true;
break;
if (!result[i]->update_bounds(false)) {
stats.c_bogus++;
bogus = true;
} else {
for (int j = 0; j < 3; j++) {
if (result[i]->bounds.mins()[j] < -qbsp_options.worldextent.value() || result[i]->bounds.maxs()[j] > qbsp_options.worldextent.value()) {
stats.c_bogus++;
bogus = true;
break;
}
}
}
@ -1035,8 +1039,6 @@ static std::unique_ptr<tree_t> BrushBSP_internal(mapentity_t *entity, std::vecto
{
auto tree = std::make_unique<tree_t>();
logging::funcheader();
size_t c_faces = 0;
size_t c_nonvisfaces = 0;
size_t c_brushes = 0;
@ -1142,5 +1144,6 @@ static std::unique_ptr<tree_t> BrushBSP_internal(mapentity_t *entity, std::vecto
std::unique_ptr<tree_t> BrushBSP(mapentity_t *entity, const std::vector<std::unique_ptr<bspbrush_t>> &brushlist, std::optional<bool> forced_quick_tree)
{
logging::funcheader();
return BrushBSP_internal(entity, MakeBspBrushList(brushlist), forced_quick_tree);
}