diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index 39f9032b..e2e165cb 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -28,6 +28,7 @@ import java.sql.SQLException; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; @@ -572,20 +573,30 @@ public class dbBuildingHandler extends dbHandlerBase { Logger.error("Prop : " + propID + " has less than 3 vertices."); continue; } + ArrayList vectors = new ArrayList<>(); + ArrayList floats = new ArrayList<>(); + for(String read : vertStrings){ + floats.add(Float.parseFloat(read)); + if(floats.size() == 2) { + vectors.add(new Vector2f(floats.get(0), floats.get(1))); + floats = new ArrayList<>(); + } + } + - for (int i = 0; i < vertStrings.length; i += 2) - vertArrayList.add(new Vector2f(Float.parseFloat(vertStrings[i]), Float.parseFloat(vertStrings[1 + 1]))); + //for (int i = 0; i < vertStrings.length; i += 2) + // vertArrayList.add(new Vector2f(Float.parseFloat(vertStrings[i]), Float.parseFloat(vertStrings[1 + 1]))); ArrayList> meshList; if (BuildingManager._hull_data.get(propID) == null) { meshList = new ArrayList<>(); - meshList.add(vertArrayList); + meshList.add(vectors); BuildingManager._hull_data.put(propID, meshList); } else { meshList = BuildingManager._hull_data.get(propID); - meshList.add(vertArrayList); + meshList.add(vectors); } }