From c77f38dec138070ac249ea1bb551c2cef754ecf9 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 14 Jan 2024 19:10:07 -0600 Subject: [PATCH] load mesh data and structure meshes --- src/engine/db/handlers/dbBuildingHandler.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index 935c7387..57810910 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -861,14 +861,14 @@ public class dbBuildingHandler extends dbHandlerBase { ResultSet rs = preparedStatement.executeQuery(); BuildingManager.prop_meshes = new HashMap<>(); while (rs.next()) { - if(BuildingManager.prop_meshes.containsKey(rs.getInt("propId")) == false){ + if(BuildingManager.prop_meshes.containsKey(rs.getInt("propID")) == false){ ArrayList meshList = new ArrayList<>(); meshList.add(rs.getInt("meshID")); - BuildingManager.prop_meshes.put(rs.getInt("propId"),meshList); + BuildingManager.prop_meshes.put(rs.getInt("propID"),meshList); } else { - BuildingManager.prop_meshes.get(rs.getInt("propId")).add(rs.getInt("meshID")); + BuildingManager.prop_meshes.get(rs.getInt("propID")).add(rs.getInt("meshID")); } } @@ -881,11 +881,10 @@ public class dbBuildingHandler extends dbHandlerBase { public void LOAD_MESH_DATA() { try (Connection connection = DbManager.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `new-static_mesh_triangles`")) { + PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_mesh_triangles`")) { ResultSet rs = preparedStatement.executeQuery(); BuildingManager.mesh_triangle_points = new HashMap<>(); - BuildingManager.mesh_heights = new HashMap<>(); while (rs.next()) { ArrayList floatPoints = new ArrayList<>(); @@ -907,6 +906,19 @@ public class dbBuildingHandler extends dbHandlerBase { { BuildingManager.mesh_triangle_points.get(rs.getInt("meshID")).add(triPoints); } + } + + } catch (SQLException e) { + Logger.error(e); + } + + try (Connection connection = DbManager.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_mesh_heights`")) { + + ResultSet rs = preparedStatement.executeQuery(); + BuildingManager.mesh_heights = new HashMap<>(); + while (rs.next()) { + if(BuildingManager.mesh_heights.containsKey(rs.getInt("meshID")) == false){ Vector2f heights = new Vector2f(rs.getFloat("maxY"),rs.getFloat("minY")); BuildingManager.mesh_heights.put(rs.getInt("meshID"),heights); @@ -916,6 +928,7 @@ public class dbBuildingHandler extends dbHandlerBase { } catch (SQLException e) { Logger.error(e); } + } public void LOAD_MESH_BOUNDING_BOXES() {