Prerequisites now uses the array-loading stuff in FieldLoader. It's use (in techtree) was also simplified.

This commit is contained in:
Bob
2009-10-20 18:38:58 +13:00
parent 7332a8f79a
commit b5c7a00552
2 changed files with 4 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ namespace OpenRa.Game.GameRules
public readonly bool Invisible = false; public readonly bool Invisible = false;
public readonly string Owner = "allies,soviet"; // TODO: make this an enum public readonly string Owner = "allies,soviet"; // TODO: make this an enum
public readonly int Points = 0; public readonly int Points = 0;
public readonly string Prerequisite = ""; public readonly string[] Prerequisite = new string[ 0 ];
public readonly string Primary = null; public readonly string Primary = null;
public readonly string Secondary = null; public readonly string Secondary = null;
public readonly int ROT = 0; public readonly int ROT = 0;

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using OpenRa.FileFormats; using OpenRa.FileFormats;
using OpenRa.Game.GameRules; using OpenRa.Game.GameRules;
@@ -38,11 +39,9 @@ namespace OpenRa.TechTree
return race; return race;
} }
static Tuple<string[],string[]> ParsePrerequisites(string prerequisites, string tag) static Tuple<string[],string[]> ParsePrerequisites(string[] prerequisites, string tag)
{ {
List<string> allied = new List<string>(prerequisites.ToLowerInvariant().Split( List<string> allied = prerequisites.Select( x => x.ToLowerInvariant() ).ToList();
new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
List<string> soviet = new List<string>(allied); List<string> soviet = new List<string>(allied);
if (allied.Remove("stek")) if (allied.Remove("stek"))