changeset 286:08a9c960e17f

Fixes #97: Default army size * Merge default army size branch with trunk code * Fix issues with UTF-8 encoding and new line characters
author IBBoard <dev@ibboard.co.uk>
date Mon, 13 Dec 2010 20:20:00 +0000
parents 40362a9adf20
children 3e74bf7b0f72 5ed39187b0e3
files IBBoard.WarFoundry.API.csproj api/Exporters/WarFoundryHtmlExporter.cs api/Factories/Xml/WarFoundryXmlGameSystemFactory.cs api/Factories/Xml/WarFoundryXmlRaceFactory.cs api/Objects/GameSystem.cs schemas/system.xsd
diffstat 6 files changed, 23 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/IBBoard.WarFoundry.API.csproj	Sat Oct 30 14:28:44 2010 +0000
     1.2 +++ b/IBBoard.WarFoundry.API.csproj	Mon Dec 13 20:20:00 2010 +0000
     1.3 @@ -60,7 +60,6 @@
     1.4    </Target>
     1.5    -->
     1.6    <ItemGroup>
     1.7 -    <None Include="app.config" />
     1.8      <None Include="COPYING" />
     1.9      <Compile Include="api\Objects\ICostedWarFoundryObject.cs" />
    1.10      <Compile Include="api\Commands\CreateAndAddUnitCommand.cs" />
     2.1 --- a/api/Exporters/WarFoundryHtmlExporter.cs	Sat Oct 30 14:28:44 2010 +0000
     2.2 +++ b/api/Exporters/WarFoundryHtmlExporter.cs	Mon Dec 13 20:20:00 2010 +0000
     2.3 @@ -57,7 +57,7 @@
     2.4  			metaCharset.SetAttribute("content", "text/html;charset=UTF-8");
     2.5  			head.AppendChild(metaCharset);
     2.6  			XmlElement style = doc.CreateElement("style");
     2.7 -			style.InnerText = "able, th, td { border: 1px solid #000; border-spacing: 0; border-collapse: collapse; margin: 0 }\n"
     2.8 +			style.InnerText = "table, th, td { border: 1px solid #000; border-spacing: 0; border-collapse: collapse; margin: 0 }\n"
     2.9  				+"table table { width: 100%; border-width: 0; margin: -2px }\n"
    2.10  				+"table table td { border-width:0 1px }";
    2.11  			head.AppendChild(style);
     3.1 --- a/api/Factories/Xml/WarFoundryXmlGameSystemFactory.cs	Sat Oct 30 14:28:44 2010 +0000
     3.2 +++ b/api/Factories/Xml/WarFoundryXmlGameSystemFactory.cs	Mon Dec 13 20:20:00 2010 +0000
     3.3 @@ -40,6 +40,8 @@
     3.4  			string id = elem.GetAttribute("id");
     3.5  			string name = elem.GetAttribute("name");
     3.6  			GameSystem system = new GameSystem(id, name, mainFactory);
     3.7 +            int defaultarmysize = XmlTools.GetIntValueFromAttribute(elem,"defaultArmySize");
     3.8 +            system.SystemArmyDefaultSize = defaultarmysize;
     3.9  			StoreExtraData(system, elem);
    3.10  			return system;
    3.11  		}		
     4.1 Binary file api/Factories/Xml/WarFoundryXmlRaceFactory.cs has changed
     5.1 --- a/api/Objects/GameSystem.cs	Sat Oct 30 14:28:44 2010 +0000
     5.2 +++ b/api/Objects/GameSystem.cs	Mon Dec 13 20:20:00 2010 +0000
     5.3 @@ -17,16 +17,34 @@
     5.4  	/// </summary>
     5.5  	public class GameSystem : WarFoundryStagedLoadingObject
     5.6  	{
     5.7 -		private bool warnOnError;
     5.8 +        private static int SYSTEM_DEFAULT_ARMY_SIZE = 1000;
     5.9 +        private bool warnOnError;
    5.10  		private bool allowAllies;
    5.11  		private Dictionary<string, Category> categories = new Dictionary<string,Category>();
    5.12  		private Dictionary<string, SystemStats> stats = new Dictionary<string,SystemStats>();
    5.13  		private string defaultStats;
    5.14 +        private int defaultArmySize;
    5.15  
    5.16  		public GameSystem(string systemID, string systemName, IWarFoundryFactory creatingFactory) : base(systemID, systemName, creatingFactory)
    5.17  		{
    5.18  			stats = new Dictionary<string,SystemStats>();
    5.19  		}
    5.20 +
    5.21 +        public int SystemArmyDefaultSize
    5.22 +        {
    5.23 +            get { return  defaultArmySize; }
    5.24 +            set
    5.25 +            {
    5.26 +                if (value == 0)
    5.27 +                {
    5.28 +                    defaultArmySize = SYSTEM_DEFAULT_ARMY_SIZE;
    5.29 +                }
    5.30 +                else
    5.31 +                {
    5.32 +                    defaultArmySize = value;
    5.33 +                }
    5.34 +            }
    5.35 +        }
    5.36  		
    5.37  		public bool AllowAllies
    5.38  		{
     6.1 --- a/schemas/system.xsd	Sat Oct 30 14:28:44 2010 +0000
     6.2 +++ b/schemas/system.xsd	Mon Dec 13 20:20:00 2010 +0000
     6.3 @@ -39,6 +39,7 @@
     6.4  		</xs:sequence>
     6.5  		<xs:attribute name="id" type="xs:string" />
     6.6  		<xs:attribute name="name" type="xs:string" use="required"/>
     6.7 +		<xs:attribute name="defaultArmySize" type="core:nonNegativeNonInfiniteDouble" default="0"/>
     6.8  		<xs:attribute name="warn" type="xs:boolean" default="false"/>
     6.9  		<xs:attribute name="allowAllies" type="xs:boolean" default="true"/>
    6.10  		<xs:anyAttribute processContents="lax"/>