Class BoardClusterTracker

java.lang.Object
megamek.common.pathfinder.BoardClusterTracker

public class BoardClusterTracker extends Object
This class handles the tracking of "clusters" of movable areas for various movement types, either with or without destruction awareness.
  • Constructor Details

    • BoardClusterTracker

      public BoardClusterTracker()
  • Method Details

    • getBoardClusterSize

      public 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.
    • coordinatesShareCluster

      public 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.
    • coordinatesShareCluster

      public boolean coordinatesShareCluster(Coords first, Coords second, int firstElevation, int secondElevation, BoardClusterTracker.BoardCluster cluster)
      Determines if the given cluster contains both the given sets of coordinates.
    • getDestinationCoords

      public Set<Coords> 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. 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

      public void updateMovableAreas(Entity entity)
      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.