From 58cf778ce4a983c571bbe4e7f023ae133570fa30 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 2 Jun 2024 21:55:31 -0500 Subject: [PATCH] FOURTH AFTER ROLLBACK: error catching for attempt ot upgrade warehouses --- src/engine/net/client/handlers/UpgradeAssetMsgHandler.java | 2 ++ src/engine/net/client/msg/ManageCityAssetsMsg.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/net/client/handlers/UpgradeAssetMsgHandler.java b/src/engine/net/client/handlers/UpgradeAssetMsgHandler.java index 3638c2ec..255c71d5 100644 --- a/src/engine/net/client/handlers/UpgradeAssetMsgHandler.java +++ b/src/engine/net/client/handlers/UpgradeAssetMsgHandler.java @@ -66,6 +66,8 @@ public class UpgradeAssetMsgHandler extends AbstractClientMsgHandler { Logger.error("Attempt to upgrade null building by " + player.getName()); return true; } + if(buildingToRank.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE)) + return true; // Early exit for building that is already ranking diff --git a/src/engine/net/client/msg/ManageCityAssetsMsg.java b/src/engine/net/client/msg/ManageCityAssetsMsg.java index 473082b2..1e45f2e2 100644 --- a/src/engine/net/client/msg/ManageCityAssetsMsg.java +++ b/src/engine/net/client/msg/ManageCityAssetsMsg.java @@ -9,6 +9,7 @@ package engine.net.client.msg; +import engine.Enum; import engine.Enum.*; import engine.gameManager.BuildingManager; import engine.gameManager.ZoneManager; @@ -531,7 +532,10 @@ public class ManageCityAssetsMsg extends ClientNetMsg { else if (building.getRank() == building.getBlueprint().getMaxRank()) this.upgradeCost = Integer.MAX_VALUE; else - this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7)); + if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE)) + this.upgradeCost = Integer.MAX_VALUE; + else + this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7)); writer.putInt(this.upgradeCost); } else