# HG changeset patch # User IBBoard # Date 1256397480 0 # Node ID 8c6f55d289b0f53bb8d05288cdab06340107ad68 # Parent 55dc7c97fcfe54fb14aa8d40b596adb3c1963758 Fixes #200: Stats names should be case-insensitive * ToLower() all stat names/IDs so that they are case-insensitive diff -r 55dc7c97fcfe -r 8c6f55d289b0 api/Objects/Stats.cs --- a/api/Objects/Stats.cs Sat Oct 24 15:16:35 2009 +0000 +++ b/api/Objects/Stats.cs Sat Oct 24 15:18:00 2009 +0000 @@ -35,7 +35,7 @@ public void SetStatValue(string statName, string statValue) { - StatSlot slot = sysStats[statName]; + StatSlot slot = sysStats[statName.ToLower()]; if (slot!=null) { @@ -52,7 +52,7 @@ { get { - StatSlot slot = sysStats[id]; + StatSlot slot = sysStats[id.ToLower()]; int pos = sysStats.GetStatSlotPosition(slot); Stat stat = null; @@ -86,7 +86,7 @@ public string GetStatValue(string id) { - return this[id].SlotValueString; + return this[id.ToLower()].SlotValueString; } public int StatCount diff -r 55dc7c97fcfe -r 8c6f55d289b0 api/Objects/SystemStats.cs --- a/api/Objects/SystemStats.cs Sat Oct 24 15:16:35 2009 +0000 +++ b/api/Objects/SystemStats.cs Sat Oct 24 15:18:00 2009 +0000 @@ -27,7 +27,7 @@ { StatSlot slot = new StatSlot(slotName); slot.SystemStats = this; - statsByName[slot.Name] = slot; + statsByName[slot.Name.ToLower()] = slot; stats.Add(slot); } @@ -43,7 +43,7 @@ { get { - return DictionaryUtils.GetValue(statsByName, statName); + return DictionaryUtils.GetValue(statsByName, statName.ToLower()); } } diff -r 55dc7c97fcfe -r 8c6f55d289b0 api/Objects/UnitType.cs --- a/api/Objects/UnitType.cs Sat Oct 24 15:16:35 2009 +0000 +++ b/api/Objects/UnitType.cs Sat Oct 24 15:18:00 2009 +0000 @@ -213,7 +213,7 @@ get { Stat[] extendedStats = new Stat[stats.StatCount+1]; - extendedStats[0] = new Stat(new StatSlot("Name"), Name); + extendedStats[0] = new Stat(new StatSlot("name"), Name); stats.StatsArray.CopyTo(extendedStats, 1); return extendedStats; } @@ -226,7 +226,7 @@ public string GetStatValue(string statName) { - return stats.GetStatValue(statName); + return stats.GetStatValue(statName.ToLower()); } internal void AddEquipmentItem(UnitEquipmentItem item)