private boolean worryAboutBridges() { if (mapHasBridges != null) { return mapHasBridges.get(); } synchronized (BRIDGE_LOCK) { if (mapHasBridges != null) { return mapHasBridges.get(); } mapHasBridges = new AtomicBoolean(getGame().getBoard() .containsBridges()); } return mapHasBridges.get(); } }
@Override public boolean shouldStay(MovePath movePath) { boolean isLegal = movePath.isMoveLegal(); return isLegal && (Compute.stackingViolation(getGame(), mover.getId(), movePath.getFinalCoords()) == null); } };
private void adjustPathForBridge(MovePath path) { boolean needsAdjust = false; for (Coords c : path.getCoordsSet()) { IHex hex = getGame().getBoard().getHex(c); if ((hex != null) && hex.containsTerrain(Terrains.BRIDGE)) { if (getGame().getBoard().getBuildingAt(c).getCurrentCF(c) >= path.getEntity().getWeight()) { needsAdjust = true; break; } else { needsAdjust = false; break; } } } if (!needsAdjust) { return; } MovePath adjusted = new MovePath(getGame(), path.getEntity()); adjusted.addStep(MoveStepType.CLIMB_MODE_ON); adjusted.addSteps(path.getStepVector(), true); adjusted.addStep(MoveStepType.CLIMB_MODE_OFF); path.replaceSteps(adjusted.getStepVector()); }
AeroGroundPathFinder apf = AeroGroundPathFinder.getInstance(getGame()); MovePath startPath = new MovePath(getGame(), mover); apf.run(startPath); paths.addAll(apf.getAllComputedPathsUncategorized()); NewtonianAerospacePathFinder npf = NewtonianAerospacePathFinder.getInstance(getGame()); npf.run(new MovePath(game, mover)); paths.addAll(npf.getAllComputedPathsUncategorized()); AeroSpacePathFinder apf = AeroSpacePathFinder.getInstance(getGame()); apf.run(new MovePath(game, mover)); paths.addAll(apf.getAllComputedPathsUncategorized()); AeroLowAltitudePathFinder apf = AeroLowAltitudePathFinder.getInstance(getGame()); apf.run(new MovePath(game, mover)); paths.addAll(apf.getAllComputedPathsUncategorized()); InfantryPathFinder ipf = InfantryPathFinder.getInstance(getGame()); ipf.run(new MovePath(game, mover)); paths.addAll(ipf.getAllComputedPathsUncategorized()); MoveStepType.FORWARDS, getGame()); lpf.run(new MovePath(game, mover)); paths.addAll(lpf.getLongestComputedPaths()); mover.getWalkMP(), MoveStepType.BACKWARDS, getGame()); lpf.run(new MovePath(getGame(), mover)); paths.addAll(lpf.getLongestComputedPaths());