Building set on load
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
@@ -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()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user