Class ShipRoutePlanner


  • public class ShipRoutePlanner
    extends RoutePlanner
    Works together with com.eressea.swing.RoutingDialog to calculate the route for a ship.
    Author:
    Ulrich Küster, Andreas, stm
    • Constructor Detail

      • ShipRoutePlanner

        public ShipRoutePlanner()
    • Method Detail

      • canPlan

        public static boolean canPlan​(Ship ship)
        Returns true if the ship is complete and ship's owner belongs to a privileged faction.
      • planShipRoute

        public Unit planShipRoute​(Ship ship,
                                  GameData data,
                                  java.awt.Component ui,
                                  RoutingDialogDataPicker picker)
        Creates a route for a ship. It is configured by the given dialog. The orders are added to the responsible unit that is then returned.
        Parameters:
        ship - The ship for which a route is planned
        data - GameData containing the units
        ui - The parent component for message panes
        picker - The dialog for selecting target region and other options
        Returns:
        the unit whose orders may have changed if orders were changed (i.e., the user didn't abort and a path existed)
      • getOrders

        public java.util.List<java.lang.String> getOrders​(Ship ship,
                                                          GameData data,
                                                          CoordinateID start,
                                                          CoordinateID destination,
                                                          java.awt.Component ui,
                                                          boolean useRange,
                                                          int mode,
                                                          boolean useVorlage)
        Creates movement orders for a ship.
        Parameters:
        ship - The ship for which a route is planned
        data - GameData containing the units
        start - The region where to start, not necessarily equal to the ship's region
        destination - The target region
        ui - The parent component for message panes
        useRange - If this is true, the orders are split into multiple orders, so that the ship's range is not exceeded.
        mode - a combination of RoutePlanner.MODE_CONTINUOUS, RoutePlanner.MODE_RETURN, RoutePlanner.MODE_STOP
        useVorlage - If this is true, Vorlage meta commands are produced.
        Returns:
        The list of new orders.