Mercurial > repos > IBBoard.WarFoundry.API
changeset 385:638c8b91ba76 default-army-name
Fixes #310: "Invalid boolean" in Army files
* Don't try to load and parse the "isCustomEquipment" attrib as it was removed in r614 because we don't actually use it
Also:
* Fix up config so that MonoDevelop can build from it
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 11 Sep 2010 18:02:50 +0000 |
parents | b21a85c079f5 |
children | ae9aa94e3bd7 |
files | IBBoard.WarFoundry.API.csproj api/Factories/Xml/WarFoundryXmlArmyParser.cs |
diffstat | 2 files changed, 21 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/IBBoard.WarFoundry.API.csproj Tue Sep 07 20:02:44 2010 +0000 +++ b/IBBoard.WarFoundry.API.csproj Sat Sep 11 18:02:50 2010 +0000 @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> @@ -13,7 +13,6 @@ <FileUpgradeFlags> </FileUpgradeFlags> <OldToolsVersion>2.0</OldToolsVersion> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <UpgradeBackupLocation> </UpgradeBackupLocation> </PropertyGroup> @@ -168,10 +167,6 @@ <Content Include="libs\ICSharpCode.SharpZipLib.dll" /> </ItemGroup> <ItemGroup> - <Reference Include="IBBoard, Version=1.0.3896.41664, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\IBBoard\bin\Release\IBBoard.dll</HintPath> - </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="System" /> @@ -180,4 +175,10 @@ <HintPath>libs\ICSharpCode.SharpZipLib.dll</HintPath> </Reference> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\IBBoard\IBBoard.csproj"> + <Project>{5DFD64F6-FC2B-4B4F-B92E-483BAC468105}</Project> + <Name>IBBoard</Name> + </ProjectReference> + </ItemGroup> </Project> \ No newline at end of file
--- a/api/Factories/Xml/WarFoundryXmlArmyParser.cs Tue Sep 07 20:02:44 2010 +0000 +++ b/api/Factories/Xml/WarFoundryXmlArmyParser.cs Sat Sep 11 18:02:50 2010 +0000 @@ -106,33 +106,24 @@ foreach (XmlElement elem in WarFoundryXmlFactoryUtils.SelectNodes(unitElem, "army:equipment/army:equipItem")) { string equipID = elem.GetAttribute("id"); - bool isCustom = XmlTools.GetBoolValueFromAttribute(elem, "isCustomEquipment"); - - if (!isCustom) - { - UnitEquipmentItem item = unit.UnitType.GetEquipmentItem(equipID); - - if (item == null) - { - throw new RequiredDataMissingException(file.Name, "Equipment Item", equipID); - } + UnitEquipmentItem item = unit.UnitType.GetEquipmentItem(equipID); - double amount = XmlTools.GetDoubleValueFromAttribute(elem, "amount"); - string equipTypeString = elem.GetAttribute("amountType"); + if (item == null) + { + throw new RequiredDataMissingException(file.Name, "Equipment Item", equipID); + } - if (equipTypeString == "ratio") - { - unit.SetEquipmentRatio(item, amount); - } - else - { - //amount should be a whole number, so do type-cast rounding - unit.SetEquipmentAmount(item, (int) amount); - } + double amount = XmlTools.GetDoubleValueFromAttribute(elem, "amount"); + string equipTypeString = elem.GetAttribute("amountType"); + + if (equipTypeString == "ratio") + { + unit.SetEquipmentRatio(item, amount); } else { - //TODO: Load custom equipment + //amount should be a whole number, so do type-cast rounding + unit.SetEquipmentAmount(item, (int) amount); } } }