Implemented PathSearch::UpdatePathwaysForBadPlace

This commit is contained in:
smallmodel 2023-09-12 23:59:38 +02:00
parent bcf3aad1b2
commit c9c7a4beed
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
2 changed files with 24 additions and 0 deletions

View file

@ -2183,6 +2183,29 @@ void PathSearch::ResetNodes
}
}
void PathSearch::UpdatePathwaysForBadPlace(const Vector& origin, float radius, int dir, int team)
{
float radiusSqr;
int i, j, k;
radiusSqr = radius * radius;
for (i = 0; i < nodecount; i++) {
PathNode* node = pathnodes[i];
for (j = node->virtualNumChildren; j > 0; j--) {
pathway_t& pathway = node->Child[j - 1];
if (PointToSegmentDistanceSquared(origin, pathway.pos1, pathway.pos2) < radiusSqr) {
for (k = 0; k < 2; k++) {
if ((1 << i) & team) {
pathway.numBlockers += dir;
}
}
}
}
}
}
PathInfo *PathSearch::GeneratePath
(
PathInfo *path