Browse Source

Patrol points loaded

combat-2
MagicBot 1 year ago
parent
commit
6a76cc7a29
  1. 23
      src/engine/db/handlers/dbBuildingHandler.java
  2. 1
      src/engine/gameManager/BuildingManager.java

23
src/engine/db/handlers/dbBuildingHandler.java

@ -489,6 +489,29 @@ public class dbBuildingHandler extends dbHandlerBase {
} }
} }
public void LOAD_BARRACKS_PATROL_POINTS() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_patrol_points`")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
int buildingUUID = rs.getInt("buildingUID");
if (!BuildingManager._buildingPatrolPoints.containsKey(buildingUUID))
BuildingManager._buildingPatrolPoints.put(buildingUUID, new ArrayList<>());
Vector3fImmutable patrolPoint = new Vector3fImmutable(rs.getFloat("patrolX"), rs.getFloat("patrolY"), rs.getFloat("patrolZ"));
BuildingManager._buildingPatrolPoints.get(buildingUUID).add(patrolPoint);
}
} catch (SQLException e) {
Logger.error(e);
}
}
public ArrayList<Vector3fImmutable> LOAD_PATROL_POINTS(Building building) { public ArrayList<Vector3fImmutable> LOAD_PATROL_POINTS(Building building) {
if (building == null) if (building == null)

1
src/engine/gameManager/BuildingManager.java

@ -43,6 +43,7 @@ public enum BuildingManager {
public static HashMap<Integer, ConcurrentHashMap<Integer, BuildingFriends>> _buildingFriends = new HashMap<>(); public static HashMap<Integer, ConcurrentHashMap<Integer, BuildingFriends>> _buildingFriends = new HashMap<>();
public static HashMap<Integer, ConcurrentHashMap<Integer, Condemned>> _buildingCondemned = new HashMap<>(); public static HashMap<Integer, ConcurrentHashMap<Integer, Condemned>> _buildingCondemned = new HashMap<>();
public static HashMap<Integer, ArrayList<Vector3fImmutable>> _buildingPatrolPoints = new HashMap<>();
public static int getAvailableSlot(Building building) { public static int getAvailableSlot(Building building) {
ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID); ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID);

Loading…
Cancel
Save