TechTree now works in lower-case, the same as the rest of the game.

This commit is contained in:
Bob
2009-10-20 15:53:54 +13:00
parent 707ba7d957
commit a59265a661
5 changed files with 31 additions and 26 deletions

View File

@@ -54,13 +54,13 @@ namespace OpenRa.TechTree
.Concat( Lines( "infantry.txt", false ) );
foreach (Tuple<string, string, bool> p in definitions)
objects.Add(p.a, new Item(p.a, p.b, Rules.UnitInfo[p.a], p.c));
objects.Add(p.a.ToLowerInvariant(), new Item(p.a.ToLowerInvariant(), Rules.UnitInfo[p.a.ToLowerInvariant()], p.c));
}
public bool Build(string key, bool force)
{
if( string.IsNullOrEmpty( key ) ) return false;
key = key.ToUpperInvariant();
key = key.ToLowerInvariant();
Item b = objects[ key ];
if (!force && !b.CanBuild) return false;
built.Add(key);
@@ -75,7 +75,7 @@ namespace OpenRa.TechTree
public bool Unbuild(string key)
{
key = key.ToUpperInvariant();
key = key.ToLowerInvariant();
Item b = objects[key];
if (!built.Contains(key)) return false;
built.Remove(key);