From ca8341d432551ebe4e5eb76b548cff27ad927ca6 Mon Sep 17 00:00:00 2001 From: dnqbob Date: Fri, 9 Oct 2020 09:58:39 +0800 Subject: [PATCH] Avoid WaterCheck crash in base builder --- OpenRA.Mods.Common/AIUtils.cs | 2 +- .../Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/AIUtils.cs b/OpenRA.Mods.Common/AIUtils.cs index 8892287b4b..25459d52b0 100644 --- a/OpenRA.Mods.Common/AIUtils.cs +++ b/OpenRA.Mods.Common/AIUtils.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common { public enum BuildingType { Building, Defense, Refinery } - public enum WaterCheck { NotChecked, EnoughWater, NotEnoughWater } + public enum WaterCheck { NotChecked, EnoughWater, NotEnoughWater, DontCheck } public static class AIUtils { diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs index 637d564fd1..6cee35ba7b 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs @@ -51,6 +51,8 @@ namespace OpenRA.Mods.Common.Traits failRetryTicks = baseBuilder.Info.StructureProductionResumeDelay; minimumExcessPower = baseBuilder.Info.MinimumExcessPower; this.resourceTypeIndices = resourceTypeIndices; + if (!baseBuilder.Info.NavalProductionTypes.Any()) + waterState = WaterCheck.DontCheck; } public void Tick(IBot bot)