Class IndustrialElevator.ElevatorCall

java.lang.Object
megamek.common.IndustrialElevator.ElevatorCall
All Implemented Interfaces:
Serializable
Enclosing class:
IndustrialElevator

public static class IndustrialElevator.ElevatorCall extends Object implements Serializable
Represents a call to an industrial elevator.

Calls are queued in CALL_PRIORITY_ORDER: distance from the platform (nearest first), with ties broken by turn called (earlier first), then by initiative (higher first). The ordering is intentionally a separate Comparator rather than Comparable: it deliberately ignores fields such as the calling player, so it would be inconsistent with equals(Object).

See Also:
  • Field Details

    • CALL_PRIORITY_ORDER

      public static final Comparator<IndustrialElevator.ElevatorCall> CALL_PRIORITY_ORDER
      Queue priority: nearest to the platform first, then earliest turn called, then highest initiative.
  • Constructor Details

    • ElevatorCall

      public ElevatorCall(int playerId, Coords callerPosition, int targetLevel, int turnCalled, int initiativeBonus, int currentPlatformLevel)
      Creates a new elevator call.
      Parameters:
      playerId - The ID of the calling player
      callerPosition - The position of the calling unit
      targetLevel - The level the caller wants the elevator at
      turnCalled - The game turn when the call was made
      initiativeBonus - The player's initiative for tie-breaking
      currentPlatformLevel - The current platform level (for distance calculation)
  • Method Details

    • getPlayerId

      public int getPlayerId()
    • getCallerPosition

      public Coords getCallerPosition()
    • getTargetLevel

      public int getTargetLevel()
    • getTurnCalled

      public int getTurnCalled()
    • getInitiativeBonus

      public int getInitiativeBonus()
    • getDistanceFromPlatform

      public int getDistanceFromPlatform()
    • updateDistance

      public void updateDistance(int currentPlatformLevel)
      Updates the distance from the current platform position.
      Parameters:
      currentPlatformLevel - The current platform level
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object