Decompile fn_17882 (CPathFinder::AddNeighbor)

Batch #12513 by cremane: 0 byte-identical, 1 confirmed by peer review.

- fn_17882 CPathFinder::AddNeighbor: logic confirmed by peer review

Peer-reviewed-by: Yommy, dori
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-05 16:18:10 +00:00
commit ee48eb4340

View file

@ -133,35 +133,35 @@ bool CPathFinder::AddNeighbor(PathNode* current, int cost, int nextX, int nextY,
return false;
}
if (next->state == 0) {
next->parent = current;
next->state = 1;
next->cost = totalCost;
next->estimatedCost = totalCost + 10 * (std::abs(nextX - this->destinationX) + std::abs(nextY - this->destinationY));
next->metadata = metadata;
this->openList.Push(next);
if (next->state != 0) {
if (next->cost > totalCost) {
next->parent = current;
next->cost = totalCost;
next->estimatedCost = totalCost + 10 * (std::abs(nextX - this->destinationX) + std::abs(nextY - this->destinationY));
next->metadata = metadata;
if (next->state == 1) {
std::vector<PathNode*>& open = this->openList.Nodes();
for (auto it = open.begin(); it != open.end(); ++it) {
if ((*it)->x == next->x && (*it)->y == next->y) {
std::push_heap(open.begin(), it + 1, NodeTotalGreater());
return true;
}
}
} else if (next->state == 2) {
next->state = 1;
}
}
return true;
}
if (next->cost > totalCost) {
next->parent = current;
next->cost = totalCost;
next->estimatedCost = totalCost + 10 * (std::abs(nextX - this->destinationX) + std::abs(nextY - this->destinationY));
next->metadata = metadata;
if (next->state == 1) {
std::vector<PathNode*>& open = this->openList.Nodes();
for (auto it = open.begin(); it != open.end(); ++it) {
if ((*it)->x == next->x && (*it)->y == next->y) {
std::push_heap(open.begin(), it + 1, NodeTotalGreater());
return true;
}
}
} else if (next->state == 2) {
next->state = 1;
}
}
next->parent = current;
next->state = 1;
next->cost = totalCost;
next->estimatedCost = totalCost + 10 * (std::abs(nextX - this->destinationX) + std::abs(nextY - this->destinationY));
next->metadata = metadata;
this->openList.Push(next);
return true;
}