Building set on load

This commit is contained in:
2024-03-17 11:34:36 -04:00
parent 5db5a26037
commit e38324af63
2 changed files with 10 additions and 1 deletions
@@ -13,6 +13,7 @@ import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.TransactionType; import engine.Enum.TransactionType;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.Building;
import engine.objects.City; import engine.objects.City;
import engine.objects.Transaction; import engine.objects.Transaction;
import engine.objects.Warehouse; import engine.objects.Warehouse;
@@ -114,6 +115,15 @@ public class dbWarehouseHandler extends dbHandlerBase {
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("warehouse")); JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("warehouse"));
City city = City.getCity(cityUID); City city = City.getCity(cityUID);
city.warehouse = new Warehouse(jsonObject); city.warehouse = new Warehouse(jsonObject);
// Locate warehouse building
for (Building building : city.parentZone.zoneBuildingSet) {
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE)) {
city.warehouse.building = building;
break;
}
}
} }
} catch (Exception e) { } catch (Exception e) {
-1
View File
@@ -52,7 +52,6 @@ public class Warehouse {
public Warehouse(JSONObject warehouse) throws SQLException { public Warehouse(JSONObject warehouse) throws SQLException {
JSONObject resources = (JSONObject) warehouse.get("resources"); JSONObject resources = (JSONObject) warehouse.get("resources");
for (Object key : resources.keySet()) { for (Object key : resources.keySet()) {