Package megamek.common.pathfinder
Class BoardClusterTracker
java.lang.Object
megamek.common.pathfinder.BoardClusterTracker
This class handles the tracking of "clusters" of movable areas for various
movement types,
either with or without destruction awareness.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A data structure representing a set of coordinates to which an entity can move.static enum
Movement types that are relevant for "destruction-aware pathfinding" Have a close relationship but are not exactly one to one with entity movement modes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Resets board clustersboolean
coordinatesShareCluster
(Coords first, Coords second, int firstElevation, int secondElevation, BoardClusterTracker.BoardCluster cluster) Determines if the given cluster contains both the given sets of coordinates.boolean
coordinatesShareCluster
(Entity mover, Coords first, Coords second, int firstElevation, int secondElevation) Determines whether, for the given entity, the two sets of coordinates share any cluster.generateClusters
(Entity entity, boolean destructionAware, boolean useBridgeTop) Returns accessible clusters for the given entity.int
getBoardClusterSize
(Entity entity, Coords actualCoords, boolean terrainReduction) Returns the size of the biggest terrain-reduced or non-terrain-reduced board cluster in which the given coordinates currently reside.getDestinationCoords
(Entity entity, CardinalEdge edge, boolean terrainReduction) Returns a set of coordinates on a given board edge that intersects with the cluster in which the given entity resides.getDestinationCoords
(Entity entity, Coords destination, boolean terrainReduction) Returns a set of coordinates that intersect with the cluster in which the given entity resides.void
updateMovableAreas
(Entity entity) Updates and stores accessible clusters for the given entity, both for destruction and non-destruction-aware path finding.
-
Constructor Details
-
BoardClusterTracker
public BoardClusterTracker()
-
-
Method Details
-
getBoardClusterSize
Returns the size of the biggest terrain-reduced or non-terrain-reduced board cluster in which the given coordinates currently reside. -
getDestinationCoords
Returns a set of coordinates on a given board edge that intersects with the cluster in which the given entity resides. May return an empty set. -
getDestinationCoords
public Set<Coords> getDestinationCoords(Entity entity, Coords destination, boolean terrainReduction) Returns a set of coordinates that intersect with the cluster in which the given entity resides.- Parameters:
entity
-destination
-terrainReduction
-- Returns:
-
clearMovableAreas
public void clearMovableAreas()Resets board clusters -
updateMovableAreas
Updates and stores accessible clusters for the given entity, both for destruction and non-destruction-aware path finding. -
generateClusters
public Map<Coords,BoardClusterTracker.BoardCluster> generateClusters(Entity entity, boolean destructionAware, boolean useBridgeTop) Returns accessible clusters for the given entity.
-