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 diff
     1.1 --- a/IBBoard.WarFoundry.API.csproj	Tue Sep 07 20:02:44 2010 +0000
     1.2 +++ b/IBBoard.WarFoundry.API.csproj	Sat Sep 11 18:02:50 2010 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4 -<?xml version="1.0" encoding="utf-8"?>
     1.5 -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     1.6 +<?xml version="1.0" encoding="utf-8"?>
     1.7 +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     1.8    <PropertyGroup>
     1.9      <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    1.10      <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    1.11 @@ -13,7 +13,6 @@
    1.12      <FileUpgradeFlags>
    1.13      </FileUpgradeFlags>
    1.14      <OldToolsVersion>2.0</OldToolsVersion>
    1.15 -    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    1.16      <UpgradeBackupLocation>
    1.17      </UpgradeBackupLocation>
    1.18    </PropertyGroup>
    1.19 @@ -168,10 +167,6 @@
    1.20      <Content Include="libs\ICSharpCode.SharpZipLib.dll" />
    1.21    </ItemGroup>
    1.22    <ItemGroup>
    1.23 -    <Reference Include="IBBoard, Version=1.0.3896.41664, Culture=neutral, processorArchitecture=MSIL">
    1.24 -      <SpecificVersion>False</SpecificVersion>
    1.25 -      <HintPath>..\IBBoard\bin\Release\IBBoard.dll</HintPath>
    1.26 -    </Reference>
    1.27      <Reference Include="System.Data" />
    1.28      <Reference Include="System.Xml" />
    1.29      <Reference Include="System" />
    1.30 @@ -180,4 +175,10 @@
    1.31        <HintPath>libs\ICSharpCode.SharpZipLib.dll</HintPath>
    1.32      </Reference>
    1.33    </ItemGroup>
    1.34 +  <ItemGroup>
    1.35 +    <ProjectReference Include="..\IBBoard\IBBoard.csproj">
    1.36 +      <Project>{5DFD64F6-FC2B-4B4F-B92E-483BAC468105}</Project>
    1.37 +      <Name>IBBoard</Name>
    1.38 +    </ProjectReference>
    1.39 +  </ItemGroup>
    1.40  </Project>
    1.41 \ No newline at end of file
     2.1 --- a/api/Factories/Xml/WarFoundryXmlArmyParser.cs	Tue Sep 07 20:02:44 2010 +0000
     2.2 +++ b/api/Factories/Xml/WarFoundryXmlArmyParser.cs	Sat Sep 11 18:02:50 2010 +0000
     2.3 @@ -106,33 +106,24 @@
     2.4  			foreach (XmlElement elem in WarFoundryXmlFactoryUtils.SelectNodes(unitElem, "army:equipment/army:equipItem"))
     2.5  			{
     2.6  				string equipID = elem.GetAttribute("id");
     2.7 -				bool isCustom = XmlTools.GetBoolValueFromAttribute(elem, "isCustomEquipment");
     2.8 +				UnitEquipmentItem item = unit.UnitType.GetEquipmentItem(equipID);
     2.9 +	
    2.10 +				if (item == null)
    2.11 +				{
    2.12 +					throw new RequiredDataMissingException(file.Name, "Equipment Item", equipID);
    2.13 +				}
    2.14  
    2.15 -				if (!isCustom)
    2.16 +				double amount = XmlTools.GetDoubleValueFromAttribute(elem, "amount");
    2.17 +				string equipTypeString = elem.GetAttribute("amountType");
    2.18 +
    2.19 +				if (equipTypeString == "ratio")
    2.20  				{
    2.21 -					UnitEquipmentItem item = unit.UnitType.GetEquipmentItem(equipID);
    2.22 -	
    2.23 -					if (item == null)
    2.24 -					{
    2.25 -						throw new RequiredDataMissingException(file.Name, "Equipment Item", equipID);
    2.26 -					}
    2.27 -	
    2.28 -					double amount = XmlTools.GetDoubleValueFromAttribute(elem, "amount");
    2.29 -					string equipTypeString = elem.GetAttribute("amountType");
    2.30 -
    2.31 -					if (equipTypeString == "ratio")
    2.32 -					{
    2.33 -						unit.SetEquipmentRatio(item, amount);
    2.34 -					}
    2.35 -					else
    2.36 -					{
    2.37 -						//amount should be a whole number, so do type-cast rounding
    2.38 -						unit.SetEquipmentAmount(item, (int) amount);
    2.39 -					}
    2.40 +					unit.SetEquipmentRatio(item, amount);
    2.41  				}
    2.42  				else
    2.43  				{
    2.44 -					//TODO: Load custom equipment
    2.45 +					//amount should be a whole number, so do type-cast rounding
    2.46 +					unit.SetEquipmentAmount(item, (int) amount);
    2.47  				}
    2.48  			}
    2.49  		}