Package megamek.common
Class IndustrialElevator.ElevatorCall
java.lang.Object
megamek.common.IndustrialElevator.ElevatorCall
- All Implemented Interfaces:
Serializable
- Enclosing class:
IndustrialElevator
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<IndustrialElevator.ElevatorCall> Queue priority: nearest to the platform first, then earliest turn called, then highest initiative. -
Constructor Summary
ConstructorsConstructorDescriptionElevatorCall(int playerId, Coords callerPosition, int targetLevel, int turnCalled, int initiativeBonus, int currentPlatformLevel) Creates a new elevator call. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintintintintintinthashCode()toString()voidupdateDistance(int currentPlatformLevel) Updates the distance from the current platform position.
-
Field Details
-
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 playercallerPosition- The position of the calling unittargetLevel- The level the caller wants the elevator atturnCalled- The game turn when the call was madeinitiativeBonus- The player's initiative for tie-breakingcurrentPlatformLevel- The current platform level (for distance calculation)
-
-
Method Details
-
getPlayerId
public int getPlayerId() -
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
-
equals
-
hashCode
public int hashCode()
-