| 1713 | } |
| 1714 | |
| 1715 | bool CanExpandToBox(LOTInfo* LOT, int fromBox, int toBox, int overlapFlags, int searchZone, const std::vector<int>& zone) |
| 1716 | { |
| 1717 | if (fromBox == NO_VALUE || toBox == NO_VALUE) |
| 1718 | return false; |
| 1719 | |
| 1720 | auto& from = g_Level.PathfindingBoxes[fromBox]; |
| 1721 | auto& to = g_Level.PathfindingBoxes[toBox]; |
| 1722 | |
| 1723 | // PENALTY CHECK: Ignore box, if it is memorized as bad. |
| 1724 | if (IsBoxInCooldown(LOT, toBox)) |
| 1725 | return false; |
| 1726 | |
| 1727 | // ZONE CHECK: Only flyer creatures can bypass zone check. |
| 1728 | if (LOT->Zone != ZoneType::Flyer && searchZone != zone[toBox]) |
| 1729 | return false; |
| 1730 | |
| 1731 | // AMPHIBIOUS: if the overlap is not traversable, avoid this branch. |
| 1732 | if (LOT->Zone == ZoneType::Amphibious && !(overlapFlags & OVERLAP_AMPHIBIOUS_TRAVERSABLE)) |
| 1733 | return false; |
| 1734 | |
| 1735 | // HEIGHT CHECK: Can creature traverse the height difference? |
| 1736 | int delta = to.height - from.height; |
| 1737 | if ((delta > LOT->Step || delta < LOT->Drop) && (!(overlapFlags & OVERLAP_MONKEY) || !LOT->CanMonkey)) |
| 1738 | return false; |
| 1739 | |
| 1740 | // JUMP CHECK: Does this overlap require jumping? |
| 1741 | if ((overlapFlags & OVERLAP_JUMP) && !LOT->CanJump) |
| 1742 | return false; |
| 1743 | |
| 1744 | return true; |
| 1745 | } |
| 1746 | |
| 1747 | /** |
| 1748 | * @brief Core breadth-first search for pathfinding through boxes. |
no test coverage detected