diff --git a/src/engine/gameManager/MaintenanceManager.java b/src/engine/gameManager/MaintenanceManager.java index f92d531e..c657b124 100644 --- a/src/engine/gameManager/MaintenanceManager.java +++ b/src/engine/gameManager/MaintenanceManager.java @@ -39,7 +39,7 @@ public enum MaintenanceManager { // Build list of buildings to apply maintenance on. - buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.Building)); + buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.City)); maintList = buildMaintList(buildingList); // Deduct upkeep and build list of buildings @@ -53,7 +53,10 @@ public enum MaintenanceManager { // Reset maintenance dates for these buildings for (Building building : maintList) { - setMaintDateTime(building, LocalDateTime.now().plusDays(7)); + if(derankList.contains(building) == false) + setMaintDateTime(building, LocalDateTime.now().plusDays(7)); + else + setMaintDateTime(building, LocalDateTime.now().plusDays(1)); } // Derak or destroy buildings that did not @@ -74,7 +77,10 @@ public enum MaintenanceManager { for (AbstractGameObject gameObject : buildingList) { - Building building = (Building) gameObject; + Building building = ((City)gameObject).getTOL();//(Building) gameObject; + + if(building == null) + continue; // No maintenance on NPC owned buildings (Cache loaded) @@ -154,7 +160,8 @@ public enum MaintenanceManager { // Cache maintenance cost value - maintCost = building.getMaintCost(); + //maintCost = building.getMaintCost(); + maintCost = 3000000; // Something went wrong. Missing buildinggroup from switch? @@ -225,9 +232,9 @@ public enum MaintenanceManager { // Add cash back to strongbox for lost rank if the building isn't being destroyed // and it's not an R8 deranking - if ((building.getRank() > 1) && (building.getRank() < 8)) { - building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7))); - } + //if ((building.getRank() > 1) && (building.getRank() < 8)) { + // building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7))); + //} return false; // Early exit for having failed to meet maintenance }