|
From: <mp...@us...> - 2012-01-20 07:50:44
|
Revision: 9566
http://freecol.svn.sourceforge.net/freecol/?rev=9566&view=rev
Author: mpope
Date: 2012-01-20 07:50:33 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
Move shouldTakeTransportToTile upwards to Mission. It will be needed widely.
Modified Paths:
--------------
freecol/trunk/src/net/sf/freecol/server/ai/mission/Mission.java
freecol/trunk/src/net/sf/freecol/server/ai/mission/WorkInsideColonyMission.java
Modified: freecol/trunk/src/net/sf/freecol/server/ai/mission/Mission.java
===================================================================
--- freecol/trunk/src/net/sf/freecol/server/ai/mission/Mission.java 2012-01-18 10:44:47 UTC (rev 9565)
+++ freecol/trunk/src/net/sf/freecol/server/ai/mission/Mission.java 2012-01-20 07:50:33 UTC (rev 9566)
@@ -88,6 +88,13 @@
}
/**
+ * Disposes this mission by removing any references to it.
+ */
+ public void dispose() {
+ // Nothing to do yet.
+ }
+
+ /**
* Moves the unit owning this mission towards the given
* <code>Tile</code>. This is done in a loop until the tile is
* reached, there are no moves left, the path to the target cannot
@@ -359,10 +366,23 @@
}
/**
- * Disposes this mission by removing any references to it.
+ * Should the unit use transport to get to a specified tile?
+ *
+ * True if the unit is not there already and:
+ * - the unit is already has transport, this will always be faster
+ * (TODO: mounted units on good roads might be faster, check for this)
+ * - if not on the map
+ * - if on the map can not find a path to the tile
+ *
+ * @param tile The <code>Tile</code> to go to.
+ * @return True if the unit should use transport.
*/
- public void dispose() {
- // Nothing to do yet.
+ protected boolean shouldTakeTransportToTile(Tile tile) {
+ final Unit unit = getUnit();
+ return (unit.getTile() != tile)
+ && (unit.isOnCarrier()
+ || unit.getTile() == null
+ || unit.findPath(tile) == null);
}
Modified: freecol/trunk/src/net/sf/freecol/server/ai/mission/WorkInsideColonyMission.java
===================================================================
--- freecol/trunk/src/net/sf/freecol/server/ai/mission/WorkInsideColonyMission.java 2012-01-18 10:44:47 UTC (rev 9565)
+++ freecol/trunk/src/net/sf/freecol/server/ai/mission/WorkInsideColonyMission.java 2012-01-20 07:50:33 UTC (rev 9566)
@@ -113,26 +113,6 @@
}
/**
- * Should the unit use transport to get to a specified tile?
- *
- * True if the unit is not there already and:
- * - the unit is already has transport, this will always be faster
- * (TODO: mounted units on good roads might be faster, check for this)
- * - if not on the map
- * - if on the map can not find a path to the tile
- *
- * @param tile The <code>Tile</code> to go to.
- * @return True if the unit should use transport.
- */
- private boolean shouldTakeTransportToTile(Tile tile) {
- final Unit unit = getUnit();
- return (unit.getTile() != tile)
- && (unit.isOnCarrier()
- || unit.getTile() == null
- || unit.findPath(tile) == null);
- }
-
- /**
* Gets the destination for units with this mission.
*
* @return Usually the colony tile unless the unit is there
@@ -146,17 +126,6 @@
}
/**
- * Gets the priority of getting the unit to the colony.
- *
- * @return The transport priority.
- */
- public int getTransportPriority() {
- return (shouldTakeTransportToTile(aiColony.getColony().getTile()))
- ? NORMAL_TRANSPORT_PRIORITY
- : 0;
- }
-
- /**
* Performs this mission.
*
* @param connection The <code>Connection</code> to the server.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|