/** * Reverts a cell to the value stored in the original state of the level as known by physicalMap. * * @param pt */ public void resetCell(Coord pt) { if (!initialized || !pt.isWithin(width, height)) return; gradientMap[pt.x][pt.y] = physicalMap[pt.x][pt.y]; }
/** * Marks a cell's cost for pathfinding as cost, unless the cell is a wall or unreachable area (then it always sets * the cost to the value of the WALL field). * * @param pt * @param cost */ public void setCost(Coord pt, double cost) { if (!initialized || !pt.isWithin(width, height)) return; if (physicalMap[pt.x][pt.y] > FLOOR) { costMap[pt.x][pt.y] = 1.0; return; } if(cost != 1.0) standardCosts = false; costMap[pt.x][pt.y] = cost; }
public void setCenter(Coord center) { if (center.isWithin(mapWidth, mapHeight) && AreaUtils.verifyReach(reach, origin, center)) { this.center = center; } }
public void setCenter(Coord center) { if (dungeon != null && center.isWithin(dungeon.length, dungeon[0].length) && AreaUtils.verifyReach(reach, origin, center)) { this.center = center; } }
public void setCenter(Coord center) { if (map != null && center.isWithin(map.length, map[0].length) && AreaUtils.verifyReach(reach, origin, center)) { this.center = center; } }
public void setCenter(Coord center) { if (map != null && center.isWithin(map.length, map[0].length) && AreaUtils.verifyReach(reach, origin, center)) { this.center = center; } }
private void setFresh(final Coord pt, double counter) { if (!pt.isWithin(width, height) || gradientMap[pt.x][pt.y] < counter) return; gradientMap[pt.x][pt.y] = counter; fresh.add(encode(pt)); }
/** * Marks a cell as a goal for pathfinding, unless the cell is a wall or unreachable area (then it does nothing). * * @param pt */ public void setGoal(Coord pt) { if (!initialized || !pt.isWithin(width, height)) return; if (physicalMap[pt.x][pt.y] > FLOOR) { return; } goals.add(encode(pt)); gradientMap[pt.x][pt.y] = 0.0; } /**
public void setEnd(Coord end) { if (dungeon != null && end.isWithin(dungeon.length, dungeon[0].length) && AreaUtils.verifyReach(reach, origin, end)) { this.end = end; dijkstra.resetMap(); dijkstra.clearGoals(); } }
if(!pt.isWithin(width, height)) continue; if (gradientMap[pt.x][pt.y] < best) {
if(!pt.isWithin(width, height)) continue; if (gradientMap[pt.x][pt.y] < best) {
if(!adj.isWithin(width, height)) continue; double h = heuristic(dirs[d]);
if(!pt.isWithin(width, height)) continue; if (gradientMap[pt.x][pt.y] < best && !impassable2.contains(pt)) {
if(!pt.isWithin(width, height)) continue; if (gradientMap[pt.x][pt.y] < best && !impassable2.contains(pt)) {
if(!adj.isWithin(width, height)) continue; double h = heuristic(dirs[d]);
if(!pt.isWithin(width, height)) continue; if (gradientMap[pt.x][pt.y] < best && !impassable2.contains(pt)) {
if(!pt.isWithin(width, height)) continue; if (gradientMap[pt.x][pt.y] < best && !impassable2.contains(pt)) {
if (impassable != null && !impassable.isEmpty()) { for (Coord pt : impassable) { if(pt != null && pt.isWithin(width, height)) gradientMap[pt.x][pt.y] = WALL; if(pt != null && pt.isWithin(width, height)) gradientMap[pt.x][pt.y] = physicalMap[pt.x][pt.y]; if(pt != null && pt.isWithin(width, height)) gradientMap[pt.x][pt.y] = physicalMap[pt.x][pt.y];
if (impassable != null && !impassable.isEmpty()) { for (Coord pt : impassable) { if(pt != null && pt.isWithin(width, height)) gradientMap[pt.x][pt.y] = WALL; if(pt != null && pt.isWithin(width, height)) gradientMap[pt.x][pt.y] = physicalMap[pt.x][pt.y]; if(pt != null && pt.isWithin(width, height)) gradientMap[pt.x][pt.y] = physicalMap[pt.x][pt.y];
if (impassable != null && !impassable.isEmpty()) { for (Coord pt : impassable) { if(pt != null && pt.isWithin(width, height)) gradientMap[pt.x][pt.y] = WALL; if(pt != null && pt.isWithin(width, height)) { for (int xs = pt.x, xi = 0; xi < size && xs >= 0; xs--, xi++) { for (int ys = pt.y, yi = 0; yi < size && ys >= 0; ys--, yi++) { if(pt != null && pt.isWithin(width, height)) { for (int xs = pt.x, xi = 0; xi < size && xs >= 0; xs--, xi++) { for (int ys = pt.y, yi = 0; yi < size && ys >= 0; ys--, yi++) {