refactor: break some very long conditions
This commit is contained in:
parent
375a64b861
commit
c662f4a08f
11 changed files with 463 additions and 91 deletions
|
|
@ -201,7 +201,9 @@ void GraphAnalyze::optimize () {
|
|||
Array <int> indexes;
|
||||
|
||||
for (const auto &link : path.links) {
|
||||
if (graph.exists (link.index) && !m_optimizedNodes[link.index] && !AStarAlgo::cantSkipNode (path.number, link.index, true)) {
|
||||
if (graph.exists (link.index) && !m_optimizedNodes[link.index]
|
||||
&& !AStarAlgo::cantSkipNode (path.number, link.index, true)) {
|
||||
|
||||
indexes.emplace (link.index);
|
||||
}
|
||||
}
|
||||
|
|
@ -339,7 +341,9 @@ void GraphAnalyze::flood (const Vector &pos, const Vector &next, float range) {
|
|||
}
|
||||
auto testPos = m_isCrouch ? Vector { nextPos.x, nextPos.y, nextPos.z - 18.0f } : nextPos;
|
||||
|
||||
if ((graph.isNodeReacheable (targetPos, testPos) && graph.isNodeReacheable (testPos, targetPos)) || (graph.isNodeReacheableWithJump (testPos, targetPos) && graph.isNodeReacheableWithJump (targetPos, testPos))) {
|
||||
if ((graph.isNodeReacheable (targetPos, testPos)
|
||||
&& graph.isNodeReacheable (testPos, targetPos)) || (graph.isNodeReacheableWithJump (testPos, targetPos)
|
||||
&& graph.isNodeReacheableWithJump (targetPos, testPos))) {
|
||||
graph.add (NodeAddFlag::Normal, m_isCrouch ? Vector { nextPos.x, nextPos.y, nextPos.z - 9.0f } : nextPos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue