From 6a76cc7a291230abe7c9b8064ec1960cdea5f01c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 19 Oct 2023 16:20:43 -0400 Subject: [PATCH] Patrol points loaded --- src/engine/db/handlers/dbBuildingHandler.java | 23 +++++++++++++++++++ src/engine/gameManager/BuildingManager.java | 1 + 2 files changed, 24 insertions(+) diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index d1786e1f..21a20fe6 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/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 LOAD_PATROL_POINTS(Building building) { if (building == null) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 096fce75..bde12730 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -43,6 +43,7 @@ public enum BuildingManager { public static HashMap> _buildingFriends = new HashMap<>(); public static HashMap> _buildingCondemned = new HashMap<>(); + public static HashMap> _buildingPatrolPoints = new HashMap<>(); public static int getAvailableSlot(Building building) { ArrayList slotLocations = _slotLocations.get(building.meshUUID);