From b5c7a00552073655f0917607f48d46be6b7dc227 Mon Sep 17 00:00:00 2001 From: Bob Date: Tue, 20 Oct 2009 18:38:58 +1300 Subject: [PATCH] Prerequisites now uses the array-loading stuff in FieldLoader. It's use (in techtree) was also simplified. --- OpenRa.Game/GameRules/UnitInfo.cs | 2 +- OpenRa.Game/TechTree/Item.cs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/OpenRa.Game/GameRules/UnitInfo.cs b/OpenRa.Game/GameRules/UnitInfo.cs index d4893ac17c..7da2ac2480 100755 --- a/OpenRa.Game/GameRules/UnitInfo.cs +++ b/OpenRa.Game/GameRules/UnitInfo.cs @@ -35,7 +35,7 @@ namespace OpenRa.Game.GameRules public readonly bool Invisible = false; public readonly string Owner = "allies,soviet"; // TODO: make this an enum public readonly int Points = 0; - public readonly string Prerequisite = ""; + public readonly string[] Prerequisite = new string[ 0 ]; public readonly string Primary = null; public readonly string Secondary = null; public readonly int ROT = 0; diff --git a/OpenRa.Game/TechTree/Item.cs b/OpenRa.Game/TechTree/Item.cs index cf09781cd7..a76fe37767 100755 --- a/OpenRa.Game/TechTree/Item.cs +++ b/OpenRa.Game/TechTree/Item.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using OpenRa.FileFormats; using OpenRa.Game.GameRules; @@ -38,11 +39,9 @@ namespace OpenRa.TechTree return race; } - static Tuple ParsePrerequisites(string prerequisites, string tag) + static Tuple ParsePrerequisites(string[] prerequisites, string tag) { - List allied = new List(prerequisites.ToLowerInvariant().Split( - new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); - + List allied = prerequisites.Select( x => x.ToLowerInvariant() ).ToList(); List soviet = new List(allied); if (allied.Remove("stek"))