Class: TransportPlan

TransportPlan()

Describes a transport plan Constructor assign units (units is an ID array), a destination (position). The naval manager will try to deal with it accordingly. By this I mean that the naval manager will find how to go from access point 1 to access point 2 and then carry units from there. Note: only assign it units currently over land, or it won't work. Also: destination should probably be land, otherwise the units will be lost at sea. metadata for units: transport = this.ID onBoard = ship.id() when affected to a ship but not yet garrisoned = "onBoard" when garrisoned in a ship = undefined otherwise endPos = position of destination metadata for ships transporter = this.ID

Constructor

new TransportPlan()

Source:

Methods

addUnit()

add a unit to this plan
Source:

cancelTransport()

TODO not currently used ... to be fixed
Source:

countFreeSlots()

count available slots
Source:

getBoardingPos()

when avoidEnnemy is true, we try to not board/unboard in ennemy territory
Source:

isOnBoard()

tell if a unit is garrisoned in one of the ships of this plan, and update its metadata if yes
Source:

removeUnit()

remove a unit from this plan, if not yet on board
Source:

update()

try to move on. There are two states: - "boarding" means we're trying to board units onto our ships - "sailing" means we're moving ships and eventually unload units - then the plan is cleared
Source: