diff --git a/src/RealTime/CustomAI/RealTimeBuildingAI.cs b/src/RealTime/CustomAI/RealTimeBuildingAI.cs index f80559c4..991cec0f 100644 --- a/src/RealTime/CustomAI/RealTimeBuildingAI.cs +++ b/src/RealTime/CustomAI/RealTimeBuildingAI.cs @@ -158,7 +158,7 @@ public bool CanBuildOrUpgrade(ItemClass.Service buildingZone, ushort buildingId } HashSet buildings = buildingsInConstruction[index]; - buildings.RemoveWhere(IsBuildingCompleted); + buildings.RemoveWhere(IsBuildingCompletedOrMissing); int allowedCount = GetAllowedConstructingUpradingCount(buildingManager.GeBuildingsCount()); bool result = buildings.Count < allowedCount; @@ -417,9 +417,9 @@ private static int GetAllowedConstructingUpradingCount(int currentBuildingCount) return MaximumBuildingsInConstruction; } - private bool IsBuildingCompleted(ushort buildingId) + private bool IsBuildingCompletedOrMissing(ushort buildingId) { - return buildingManager.BuildingHasFlags(buildingId, Building.Flags.Completed); + return buildingManager.BuildingHasFlags(buildingId, Building.Flags.Completed | Building.Flags.Deleted, includeZero: true); } private void UpdateLightState()