diff --git a/deprecated/locations.txt b/deprecated/locations.txt index 64868ec..c1890a1 100644 --- a/deprecated/locations.txt +++ b/deprecated/locations.txt @@ -12,6 +12,7 @@ # Note that this is only necessary if there's connections to other buildings. Otherwise it's completely unused. # - main_floor[n]: nth floor is main floor. Defaults to 1. # - has_basement: index starts at 0 instead of 1 +# - unselectable # # # 2. Paths @@ -147,6 +148,11 @@ location PAC 2168 1044 floors 3 main_floor 2 ; +location TOWER 2688 1561 + floors 3 + main_floor 1 + unselectable +; @@ -515,6 +521,10 @@ path UWP RING_ROAD_CPH_S ; path E5 RING_ROAD_E3_NE ; +path TOWER UWP + p 2750 1508 + p 2798 1595 +; @@ -663,6 +673,17 @@ path DWE CPH p 2603 1514 p 2621 1499 ; +path CPH TOWER + type indoor_tunnel + connects 3 3 + p 2629 1500 +; +path DWE TOWER + type indoor_tunnel + connects 2 3 + p 2603 1514 + p 2625 1503 +; # SW neglected corner path EV3 EV2 diff --git a/workspace/RainBackend/src/com/lucky/watisrain/backend/MapFactory.java b/workspace/RainBackend/src/com/lucky/watisrain/backend/MapFactory.java index 7a77ef2..dab1122 100644 --- a/workspace/RainBackend/src/com/lucky/watisrain/backend/MapFactory.java +++ b/workspace/RainBackend/src/com/lucky/watisrain/backend/MapFactory.java @@ -66,6 +66,7 @@ private static void handleCommandLocation(Map map, Scanner scanner){ int num_floors = 1; int main_floor = 1; boolean zero_indexed = false; + boolean selectable = true; while(true){ if(!scanner.hasNext()) break; @@ -83,9 +84,13 @@ private static void handleCommandLocation(Map map, Scanner scanner){ if(s.equals("has_basement")){ zero_indexed = true; } + + if(s.equals("unselectable")){ + selectable = false; + } } - Building building = new Building(name, new Waypoint(pos_x, pos_y), num_floors, main_floor, zero_indexed); + Building building = new Building(name, new Waypoint(pos_x, pos_y), num_floors, main_floor, zero_indexed, selectable); map.addBuilding(building); } diff --git a/workspace/RainBackend/src/com/lucky/watisrain/backend/data/Building.java b/workspace/RainBackend/src/com/lucky/watisrain/backend/data/Building.java index 293e5eb..2656a90 100644 --- a/workspace/RainBackend/src/com/lucky/watisrain/backend/data/Building.java +++ b/workspace/RainBackend/src/com/lucky/watisrain/backend/data/Building.java @@ -29,6 +29,9 @@ public class Building { // Which of the floors is the main floor? By default, 1 private int main_floor; + // Show an icon on the map to select it? + private boolean selectable; + /** * Constructor. Assumes all floors have this same position, main_floor <= num_floors @@ -38,13 +41,16 @@ public class Building { * @param num_floors number of floors, including basement if there is one * @param main_floor the floor which you are in when you walk into the building * @param zero_indexed start counting floors from 0 instead of 1 + * @param selectable show selection icon on the map for building */ - public Building(String name, Waypoint position, int num_floors, int main_floor, boolean zero_indexed){ + public Building(String name, Waypoint position, int num_floors, int main_floor, + boolean zero_indexed, boolean selectable){ this.name = name; this.position = position; this.main_floor = main_floor; this.num_floors = num_floors; + this.selectable = selectable; // Populate list of floors floors = new ArrayList<>(); @@ -106,6 +112,10 @@ public int getNumberOfFloors(){ return num_floors; } + public boolean isSelectable(){ + return selectable; + } + public String toString(){ return floors.toString(); } diff --git a/workspace/WATisRain/assets/locations.txt b/workspace/WATisRain/assets/locations.txt index 64868ec..c1890a1 100644 --- a/workspace/WATisRain/assets/locations.txt +++ b/workspace/WATisRain/assets/locations.txt @@ -12,6 +12,7 @@ # Note that this is only necessary if there's connections to other buildings. Otherwise it's completely unused. # - main_floor[n]: nth floor is main floor. Defaults to 1. # - has_basement: index starts at 0 instead of 1 +# - unselectable # # # 2. Paths @@ -147,6 +148,11 @@ location PAC 2168 1044 floors 3 main_floor 2 ; +location TOWER 2688 1561 + floors 3 + main_floor 1 + unselectable +; @@ -515,6 +521,10 @@ path UWP RING_ROAD_CPH_S ; path E5 RING_ROAD_E3_NE ; +path TOWER UWP + p 2750 1508 + p 2798 1595 +; @@ -663,6 +673,17 @@ path DWE CPH p 2603 1514 p 2621 1499 ; +path CPH TOWER + type indoor_tunnel + connects 3 3 + p 2629 1500 +; +path DWE TOWER + type indoor_tunnel + connects 2 3 + p 2603 1514 + p 2625 1503 +; # SW neglected corner path EV3 EV2 diff --git a/workspace/WATisRain/src/com/lucky/watisrain/map/MapView.java b/workspace/WATisRain/src/com/lucky/watisrain/map/MapView.java index 310aebf..40d4431 100644 --- a/workspace/WATisRain/src/com/lucky/watisrain/map/MapView.java +++ b/workspace/WATisRain/src/com/lucky/watisrain/map/MapView.java @@ -98,6 +98,9 @@ protected void onDraw(Canvas canvas) { // Draw all locations for(Building building : map.getBuildings()){ + + if(!building.isSelectable()) continue; + Waypoint pos = building.getMainFloor().getPostion(); mapdraw.drawImageOnMap(imgs.get("default_location.png"),pos.getX(),pos.getY(),120); } @@ -276,6 +279,9 @@ private Building determineBuildingFromPosition(float x, float y, float threshold float closest_dist = Float.MAX_VALUE; for(Building building : buildings){ + + if(!building.isSelectable()) continue; + float dist = (float)building.getMainFloor().getPostion().distanceTo(new Waypoint((int)x,(int)y)); if(dist < closest_dist){ closest = building;