Mercurial > repos > IBDev-IBBoard.WarFoundry.API
changeset 181:8c6f55d289b0
Fixes #200: Stats names should be case-insensitive
* ToLower() all stat names/IDs so that they are case-insensitive
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 24 Oct 2009 15:18:00 +0000 |
parents | 55dc7c97fcfe |
children | 6fe336109128 |
files | api/Objects/Stats.cs api/Objects/SystemStats.cs api/Objects/UnitType.cs |
diffstat | 3 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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()); } }
--- 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)