|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.amis.pogamut.defcon.communication.worldview.modules.managers.fleets.FleetsManager
public class FleetsManager
Manages all known fleets. Be they either own or enemies. Also takes care of updating of all you fleets AIs.
Nested Class Summary | |
---|---|
class |
FleetsManager.FleetWithAI
Fleet and AI pair. |
protected class |
FleetsManager.QueuedPlacing
|
Field Summary | |
---|---|
protected SortedMap<Integer,List<Fleet>> |
enemyFleets
|
protected IWorldObjectListener<Fleet> |
listener
|
protected DefConAgentLogicController<?> |
logic
|
protected ILogicUpdateListener |
logicUpdateListener
|
protected LinkedList<FleetsManager.QueuedPlacing> |
oldPlacings
|
protected ArrayList<FleetsManager.FleetWithAI> |
ownFleets
|
protected int |
ownTeamId
|
protected LinkedList<FleetsManager.QueuedPlacing> |
queuedPlacings
|
Constructor Summary | |
---|---|
FleetsManager(DefConAgentLogicController<?> logic)
|
Method Summary | |
---|---|
protected void |
addEnemyFleet(Fleet fleet)
|
protected void |
addFleet(Fleet fleet)
|
protected void |
addOwnFleet(Fleet fleet)
|
boolean |
assignAI(Fleet fleet,
IFleetAI ai)
Assigns AI to the given fleet. |
boolean |
assignAI(int fleetId,
IFleetAI ai)
This wont work most likely, because of the quirky WorldObjectId |
SortedMap<Integer,List<Fleet>> |
getEnemyFleets()
Returns the list of enemy fleets. |
List<Fleet> |
getEnemyFleets(int enemyId)
Returns the list of enemy fleets. |
List<FleetsManager.FleetWithAI> |
getOwnFleets()
Returns the list of own fleets. |
protected boolean |
isValidPlacement(Location location,
int count)
|
boolean |
placeFleet(DefConLocation location,
UnitType[] ships,
Object initData,
IPlacingFinishedListener finishedListener)
Tries to place fleet on a given location (queues the command). |
boolean |
placeFleet(List<DefConLocation> orderedPlacements,
UnitType[] fleetComposition,
int fleetsCount,
Object initData,
IPlacingFinishedListener finishedListener)
Tries to place the fleet on one of the given positions (queues the command, if it finds suitable place), starting from the head. |
protected boolean |
placeFleetWorker(DefConLocation location,
UnitType[] ships)
|
protected boolean |
queuePlacingsContain(Location location)
|
protected void |
removeEnemyFleet(Fleet fleet)
|
protected void |
removeFleet(Fleet fleet)
|
protected void |
removeOwnFleet(Fleet fleet)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final DefConAgentLogicController<?> logic
protected final SortedMap<Integer,List<Fleet>> enemyFleets
protected final ArrayList<FleetsManager.FleetWithAI> ownFleets
protected final int ownTeamId
protected final LinkedList<FleetsManager.QueuedPlacing> queuedPlacings
protected final LinkedList<FleetsManager.QueuedPlacing> oldPlacings
protected final IWorldObjectListener<Fleet> listener
protected final ILogicUpdateListener logicUpdateListener
Constructor Detail |
---|
@Inject public FleetsManager(DefConAgentLogicController<?> logic)
Method Detail |
---|
protected boolean queuePlacingsContain(Location location)
protected void addFleet(Fleet fleet)
protected void removeFleet(Fleet fleet)
protected void addEnemyFleet(Fleet fleet)
protected void removeEnemyFleet(Fleet fleet)
protected void addOwnFleet(Fleet fleet)
protected void removeOwnFleet(Fleet fleet)
public SortedMap<Integer,List<Fleet>> getEnemyFleets()
public List<Fleet> getEnemyFleets(int enemyId)
public List<FleetsManager.FleetWithAI> getOwnFleets()
public boolean assignAI(Fleet fleet, IFleetAI ai)
fleet
- ai
-
public boolean assignAI(int fleetId, IFleetAI ai)
fleetId
- ai
-
public boolean placeFleet(DefConLocation location, UnitType[] ships, Object initData, IPlacingFinishedListener finishedListener)
location
- ships
-
protected boolean isValidPlacement(Location location, int count)
protected boolean placeFleetWorker(DefConLocation location, UnitType[] ships)
public boolean placeFleet(List<DefConLocation> orderedPlacements, UnitType[] fleetComposition, int fleetsCount, Object initData, IPlacingFinishedListener finishedListener)
orderedPlacements
- given positions with preferencefleetComposition
- ship types
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |