diff --git a/bin/net/grosinger/nomads/DroneTools.class b/bin/net/grosinger/nomads/DroneTools.class index 2bf1f3e..47ad856 100644 Binary files a/bin/net/grosinger/nomads/DroneTools.class and b/bin/net/grosinger/nomads/DroneTools.class differ diff --git a/bin/net/grosinger/nomads/NeighborBuilding.class b/bin/net/grosinger/nomads/NeighborBuilding.class index ef0dc2d..c3c55b3 100644 Binary files a/bin/net/grosinger/nomads/NeighborBuilding.class and b/bin/net/grosinger/nomads/NeighborBuilding.class differ diff --git a/src/net/grosinger/nomads/DroneTools.java b/src/net/grosinger/nomads/DroneTools.java index 20ba9eb..ee0121e 100644 --- a/src/net/grosinger/nomads/DroneTools.java +++ b/src/net/grosinger/nomads/DroneTools.java @@ -131,20 +131,46 @@ public class DroneTools { */ public Point getTownCenter() { if (townCenter == null) { - townCenter = new Point(30, 50); + townCenter = new Point(40, 50); } return townCenter; } - - public ArrayList checkBuildings() { - return worldReference.buildingsInRange(getX(), getY(), listItem.getVisibleDistance()); + + /** + * Retrieve a list of all Buildings that are visible within your sight + * range. (Sight range can be upgraded) + * + * @return ArrayList of NeigborBuildings + */ + public ArrayList checkBuildings() { + ArrayList neighbors = new ArrayList(); + int maxDistance = listItem.getVisibleDistance(); + for (int i = maxDistance * -1; i <= maxDistance; i++) { + for (int j = maxDistance * -1; j <= maxDistance; j++) { + if (getX() + i >= worldSize - 1 || getX() + i < 0 + || getY() + j >= worldSize - 1 || getY() + j < 0) { + + } else if (i != 0 && j != 0) { + GameObject objectHere = worldReference.getObjectAt(getX() + + i, getY() + j); + if (objectHere instanceof Building) { + Building buildingHere = (Building) objectHere; + NeighborBuilding aWildNeighbor = new NeighborBuilding( + buildingHere.getX(), buildingHere.getY(), + buildingHere.getName(), buildingHere); + neighbors.add(aWildNeighbor); + } + } + } + } + return neighbors; } /** * Retrieve a list of all Drones that are visible within your sight range. * (Sight range can be upgraded) * - * @return ArrayList of Neighbors + * @return ArrayList of Neighbor Drones */ public ArrayList checkRadar() { ArrayList neighbors = new ArrayList(); diff --git a/src/net/grosinger/nomads/NeighborBuilding.java b/src/net/grosinger/nomads/NeighborBuilding.java index 4c0f1da..f5b8dc6 100644 --- a/src/net/grosinger/nomads/NeighborBuilding.java +++ b/src/net/grosinger/nomads/NeighborBuilding.java @@ -11,7 +11,6 @@ public class NeighborBuilding implements GameObject { private String name; private int x; private int y; - private String UID; private Building building; /** @@ -24,12 +23,10 @@ public class NeighborBuilding implements GameObject { * @param name * - Name of the Building */ - public NeighborBuilding(int x, int y, String name, String UID, - Building building) { + public NeighborBuilding(int x, int y, String name, Building building) { this.x = x; this.y = y; this.name = name; - this.UID = UID; this.building = building; } @@ -65,15 +62,6 @@ public class NeighborBuilding implements GameObject { return building.getType(); } - /** - * Retrieve UID of this Neighbor - * - * @return String - UID - */ - public String getUID() { - return UID; - } - @Override public void setName(String newName) { name = newName;