.getType() == MovePath.STEP_RECOVER))) {
md.removeLastStep();
}
// get the start and end
Coords start = en.getPosition();
Coords end = Compute.getFinalPosition(start, md.getFinalVectors());
// Coords end = md.getFinalVectors().getFinalPosition(start);
// TODO: deal with lines that hit boundaries exactly
// (see LosEffects.java)
ArrayList<Coords> in = Coords.intervening(start, end);
// first check whether we are splitting hexes
boolean split = false;
double degree = start.degree(end);
if (degree % 60 == 30) {
split = true;
in = Coords.intervening(start, end, true);
}
Coords current = start;
int facing = md.getFinalFacing();
for (int i = 1; i < in.size(); i++) {
// check for split hexes
// check for some number after a multiple of 3 (1,4,7,etc)
if (((i % 3) == 1) && split) {
Coords left = in.get(i);
Coords right = in.get(i + 1);
// get the total tonnage in each hex
Enumeration<Entity> leftTargets = client.game.getEntities(left);
double leftTonnage = 0;
while (leftTargets.hasMoreElements()) {
leftTonnage += leftTargets.nextElement().getWeight();
}
Enumeration<Entity> rightTargets = client.game
.getEntities(right);
double rightTonnage = 0;
while (rightTargets.hasMoreElements()) {
rightTonnage += rightTargets.nextElement().getWeight();
}
// TODO: I will need to update this to account for asteroids
// I need to consider both of these passed through
// for purposes of bombing
en.addPassedThrough(right);
en.addPassedThrough(left);
client.sendUpdateEntity(en);
// if the left is preferred, increment i so next one is skipped
if (leftTonnage < rightTonnage) {
i++;
} else {
continue;
}
}
Coords c = in.get(i);
// check if the next move would put vessel off the map
if (!client.game.getBoard().contains(c)) {
md.addStep(MovePath.STEP_OFF);
break;