Replace DomainIndex internals with a lookup from HierarchicalPathFinder instead

Teach HierarchicalPathFinder to keep a cache of domain indices, refreshing them only on demand and when invalidated by terrain changes. This provides an accurate and quick determination for checking if paths exist between given locations.

By exposing PathExistsForLocomotor on the IPathFinder interface, we can remove the DomainIndex trait entirely.
This commit is contained in:
RoosterDragon
2022-04-18 20:31:51 +01:00
committed by Matthias Mailänder
parent 5a8f91aa21
commit aef65d353d
15 changed files with 130 additions and 283 deletions

View File

@@ -815,5 +815,12 @@ namespace OpenRA.Mods.Common.Traits
Func<CPos, int> customCost = null,
Actor ignoreActor = null,
bool laneBias = true);
/// <summary>
/// Determines if a path exists between source and target.
/// Only terrain is taken into account, i.e. as if <see cref="BlockedByActor.None"/> was given.
/// This would apply for any actor using the given <see cref="Locomotor"/>.
/// </summary>
bool PathExistsForLocomotor(Locomotor locomotor, CPos source, CPos target);
}
}