Skip to content

Account for static blockers in frontier reachability#1924

Open
DevOpsOfChaos wants to merge 5 commits into
Return-To-The-Roots:masterfrom
DevOpsOfChaos:sidequest/frontier-distance-static-blockers
Open

Account for static blockers in frontier reachability#1924
DevOpsOfChaos wants to merge 5 commits into
Return-To-The-Roots:masterfrom
DevOpsOfChaos:sidequest/frontier-distance-static-blockers

Conversation

@DevOpsOfChaos
Copy link
Copy Markdown
Contributor

Summary

  • account for blocking static map objects in frontier-distance reachability checks
  • keep terrain-based reachability behavior otherwise unchanged
  • add regression coverage for static blockers in the frontier-distance path check

Motivation

The FRONTIER_DISTANCE_REACHABLE addon previously checked terrain reachability only. This meant blocking static map objects, such as decorative objects used as permanent path blockers, could be ignored when determining whether enemy military buildings were reachable.

This keeps the check intentionally narrow: it only treats blocking Staticobjects as blockers and does not switch to full human pathing behavior.

Validation

  • Built Test_integration locally with Visual Studio 2022 / Debug
  • Ran Test_integration.exe --run_test=FrontierDistanceSuite --report_level=short
  • Result: 8 test cases passed, 68 assertions passed

Fixes #979

Flamefire
Flamefire previously approved these changes May 2, 2026
@Flamefire Flamefire enabled auto-merge May 2, 2026 11:30
auto-merge was automatically disabled May 2, 2026 11:42

Head branch was pushed to by a user without write access

Flamefire
Flamefire previously approved these changes May 2, 2026
@Flamefire Flamefire enabled auto-merge May 2, 2026 11:48
@Spikeone
Copy link
Copy Markdown
Member

Spikeone commented May 2, 2026

Just asking: Does this by chance also take into account, that objects can change (due to scripts) so an object that is static, could become env.

Also not sure, pineapple trees are also static, are they? They can be passed though.

auto-merge was automatically disabled May 6, 2026 13:03

Head branch was pushed to by a user without write access

@DevOpsOfChaos DevOpsOfChaos force-pushed the sidequest/frontier-distance-static-blockers branch from 5468f5f to 5b07479 Compare May 6, 2026 13:03
@DevOpsOfChaos
Copy link
Copy Markdown
Contributor Author

Just asking: Does this by chance also take into account, that objects can change (due to scripts) so an object that is static, could become env.

Also not sure, pineapple trees are also static, are they? They can be passed though.

Good point, I added a small regression test for that.

Passable size-0 static objects and environment objects are still treated as passable. Only current static objects with actual blocking behavior affect this reachability check.

No production code change in this follow-up, just test coverage.

Validation:

  • built Test_integration
  • ran FrontierDistanceSuite: 8 test cases, 70 assertions passed
  • git diff --check

Flamefire
Flamefire previously approved these changes May 6, 2026
Copy link
Copy Markdown
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checked and looks good. Just a few minor comments.

The first on is because it confused me to now have 3 classes:
PathConditionHuman, PathConditionReachable, PathConditionReachableWithStaticBlockers and why the code of this new one can't be in the existing one(s).
So this needs at least a comment

Comment thread tests/s25Main/integration/testFrontierDistance.cpp Outdated
Comment thread tests/s25Main/integration/testFrontierDistance.cpp Outdated
Comment thread tests/s25Main/integration/testFrontierDistance.cpp Outdated
Comment thread tests/s25Main/integration/testFrontierDistance.cpp Outdated
Comment thread libs/s25main/pathfinding/FindPathReachable.cpp
@DevOpsOfChaos
Copy link
Copy Markdown
Contributor Author

Addressed the remaining minor review comments.

I added a short explanation for PathConditionReachableWithStaticBlockers, simplified the repeated corridor loops with helpers::range(...), and used RTTR_FOREACH_PT for the full-map setup loop.

Validation:

  • built Test_integration
  • ran FrontierDistanceSuite: 8 test cases, 70 assertions passed
  • git diff --check upstream/master...HEAD

Comment thread libs/s25main/pathfinding/FindPathReachable.cpp
@Flamefire Flamefire enabled auto-merge May 11, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frontier distance addon not working correctly

3 participants