qbsp: only print "doesn't touch two areas" once per entity

log source location as well
This commit is contained in:
Eric Wasylishen 2023-03-27 20:15:19 -06:00
parent 2a2bc5d966
commit 8830a949e6
2 changed files with 11 additions and 4 deletions

View File

@ -146,6 +146,9 @@ public:
std::array<int32_t, 2> portalareas = {};
parser_source_location location;
// warnings
bool wrote_doesnt_touch_two_areas_warning = false;
};
struct maptexdata_t

View File

@ -891,10 +891,14 @@ static void SetAreaPortalAreas_r(node_t *node)
node->area = entity->portalareas[0];
if (!entity->portalareas[1]) {
logging::print(
"WARNING: areaportal entity {} with targetname {} doesn't touch two areas\n Node bounds: {} -> {}\n",
entity - map.entities.data(), entity->epairs.get("targetname"), node->bounds.mins(), node->bounds.maxs());
DebugAreaPortalBothSidesLeak(node);
if (!entity->wrote_doesnt_touch_two_areas_warning) {
entity->wrote_doesnt_touch_two_areas_warning = true;
logging::print(
"WARNING: {}: areaportal entity {} with targetname {} doesn't touch two areas\n Node bounds: {} -> {}\n",
entity->location, entity - map.entities.data(), entity->epairs.get("targetname"), node->bounds.mins(),
node->bounds.maxs());
DebugAreaPortalBothSidesLeak(node);
}
return;
}
}