Browse Source

Building set on load

combat-2
MagicBot 8 months ago
parent
commit
e38324af63
  1. 10
      src/engine/db/handlers/dbWarehouseHandler.java
  2. 1
      src/engine/objects/Warehouse.java

10
src/engine/db/handlers/dbWarehouseHandler.java

@ -13,6 +13,7 @@ import engine.Enum; @@ -13,6 +13,7 @@ import engine.Enum;
import engine.Enum.GameObjectType;
import engine.Enum.TransactionType;
import engine.gameManager.DbManager;
import engine.objects.Building;
import engine.objects.City;
import engine.objects.Transaction;
import engine.objects.Warehouse;
@ -114,6 +115,15 @@ public class dbWarehouseHandler extends dbHandlerBase { @@ -114,6 +115,15 @@ public class dbWarehouseHandler extends dbHandlerBase {
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("warehouse"));
City city = City.getCity(cityUID);
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) {

1
src/engine/objects/Warehouse.java

@ -52,7 +52,6 @@ public class Warehouse { @@ -52,7 +52,6 @@ public class Warehouse {
public Warehouse(JSONObject warehouse) throws SQLException {
JSONObject resources = (JSONObject) warehouse.get("resources");
for (Object key : resources.keySet()) {

Loading…
Cancel
Save