From 60359cc6f5aa66ab35447c4c29244e1b647720bb Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 6 Sep 2015 22:59:49 +0200 Subject: [PATCH] Use HashSets for AI --- OpenRA.Mods.Common/AI/BaseBuilder.cs | 2 +- OpenRA.Mods.Common/AI/HackyAI.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/AI/BaseBuilder.cs b/OpenRA.Mods.Common/AI/BaseBuilder.cs index 79f269fe05..d3ad9a7907 100644 --- a/OpenRA.Mods.Common/AI/BaseBuilder.cs +++ b/OpenRA.Mods.Common/AI/BaseBuilder.cs @@ -186,7 +186,7 @@ namespace OpenRA.Mods.Common.AI ActorInfo GetProducibleBuilding(string commonName, IEnumerable buildables, Func orderBy = null) { - string[] actors; + HashSet actors; if (!ai.Info.BuildingCommonNames.TryGetValue(commonName, out actors)) throw new InvalidOperationException("Can't find {0} in the HackyAI BuildingCommonNames definition.".F(commonName)); diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs index 09ed8ae0cd..0cbc82adea 100644 --- a/OpenRA.Mods.Common/AI/HackyAI.cs +++ b/OpenRA.Mods.Common/AI/HackyAI.cs @@ -123,10 +123,10 @@ namespace OpenRA.Mods.Common.AI public readonly Dictionary BuildingFractions = null; [Desc("Tells the AI what unit types fall under the same common name.")] - public readonly Dictionary UnitsCommonNames = null; + public readonly Dictionary> UnitsCommonNames = null; [Desc("Tells the AI what building types fall under the same common name.")] - public readonly Dictionary BuildingCommonNames = null; + public readonly Dictionary> BuildingCommonNames = null; [Desc("What buildings should the AI have a maximum limit to build.")] public readonly Dictionary BuildingLimits = null; @@ -378,7 +378,7 @@ namespace OpenRA.Mods.Common.AI return GetInfoByCommonName(Info.UnitsCommonNames, commonName, owner); } - public ActorInfo GetInfoByCommonName(Dictionary names, string commonName, Player owner) + public ActorInfo GetInfoByCommonName(Dictionary> names, string commonName, Player owner) { if (!names.Any() || !names.ContainsKey(commonName)) throw new InvalidOperationException("Can't find {0} in the HackyAI UnitsCommonNames definition.".F(commonName));