Mercurial > repos > IBDev-IBBoard.WarFoundry.API
changeset 175:996816199b72
Re #195: Min and max limits on equipment
* Set max before min in race loading to avoid problems when the minimum is zero
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 21 Oct 2009 19:01:13 +0000 |
parents | 33433862467f |
children | 22429737cd77 |
files | api/Factories/Xml/WarFoundryXmlRaceFactory.cs |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Tue Oct 20 19:14:30 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Wed Oct 21 19:01:13 2009 +0000 @@ -228,6 +228,15 @@ try { + unitEquipItem.MaxNumber = int.Parse(equip.GetAttribute("maxNum")); + } + catch (FormatException e) + { + throw new InvalidFileException("Attribute 'maxNum' of unit equipment item " + id + " for " + type.Name + " was not a valid integer", e); + } + + try + { unitEquipItem.MinNumber = int.Parse(equip.GetAttribute("minNum")); } catch (FormatException e) @@ -237,11 +246,11 @@ try { - unitEquipItem.MaxNumber = int.Parse(equip.GetAttribute("maxNum")); + unitEquipItem.MaxPercentage = double.Parse(equip.GetAttribute("maxPercentage")); } catch (FormatException e) { - throw new InvalidFileException("Attribute 'maxNum' of unit equipment item " + id + " for " + type.Name + " was not a valid integer", e); + throw new InvalidFileException("Attribute 'maxPercentage' of unit equipment item " + id + " for " + type.Name + " was not a valid decimal number", e); } try @@ -255,15 +264,6 @@ try { - unitEquipItem.MaxPercentage = double.Parse(equip.GetAttribute("maxPercentage")); - } - catch (FormatException e) - { - throw new InvalidFileException("Attribute 'maxPercentage' of unit equipment item " + id + " for " + type.Name + " was not a valid decimal number", e); - } - - try - { unitEquipItem.CostMultiplier = double.Parse(equip.GetAttribute("costMultiplier")); } catch (FormatException e)