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 wrap: on
line diff
--- a/IBBoard.WarFoundry.API.csproj	Sat Oct 30 14:28:44 2010 +0000
+++ b/IBBoard.WarFoundry.API.csproj	Mon Dec 13 20:20:00 2010 +0000
@@ -60,7 +60,6 @@
   </Target>
   -->
   <ItemGroup>
-    <None Include="app.config" />
     <None Include="COPYING" />
     <Compile Include="api\Objects\ICostedWarFoundryObject.cs" />
     <Compile Include="api\Commands\CreateAndAddUnitCommand.cs" />
--- a/api/Exporters/WarFoundryHtmlExporter.cs	Sat Oct 30 14:28:44 2010 +0000
+++ b/api/Exporters/WarFoundryHtmlExporter.cs	Mon Dec 13 20:20:00 2010 +0000
@@ -57,7 +57,7 @@
 			metaCharset.SetAttribute("content", "text/html;charset=UTF-8");
 			head.AppendChild(metaCharset);
 			XmlElement style = doc.CreateElement("style");
-			style.InnerText = "able, th, td { border: 1px solid #000; border-spacing: 0; border-collapse: collapse; margin: 0 }\n"
+			style.InnerText = "table, th, td { border: 1px solid #000; border-spacing: 0; border-collapse: collapse; margin: 0 }\n"
 				+"table table { width: 100%; border-width: 0; margin: -2px }\n"
 				+"table table td { border-width:0 1px }";
 			head.AppendChild(style);
--- a/api/Factories/Xml/WarFoundryXmlGameSystemFactory.cs	Sat Oct 30 14:28:44 2010 +0000
+++ b/api/Factories/Xml/WarFoundryXmlGameSystemFactory.cs	Mon Dec 13 20:20:00 2010 +0000
@@ -40,6 +40,8 @@
 			string id = elem.GetAttribute("id");
 			string name = elem.GetAttribute("name");
 			GameSystem system = new GameSystem(id, name, mainFactory);
+            int defaultarmysize = XmlTools.GetIntValueFromAttribute(elem,"defaultArmySize");
+            system.SystemArmyDefaultSize = defaultarmysize;
 			StoreExtraData(system, elem);
 			return system;
 		}		
Binary file api/Factories/Xml/WarFoundryXmlRaceFactory.cs has changed
--- a/api/Objects/GameSystem.cs	Sat Oct 30 14:28:44 2010 +0000
+++ b/api/Objects/GameSystem.cs	Mon Dec 13 20:20:00 2010 +0000
@@ -17,16 +17,34 @@
 	/// </summary>
 	public class GameSystem : WarFoundryStagedLoadingObject
 	{
-		private bool warnOnError;
+        private static int SYSTEM_DEFAULT_ARMY_SIZE = 1000;
+        private bool warnOnError;
 		private bool allowAllies;
 		private Dictionary<string, Category> categories = new Dictionary<string,Category>();
 		private Dictionary<string, SystemStats> stats = new Dictionary<string,SystemStats>();
 		private string defaultStats;
+        private int defaultArmySize;
 
 		public GameSystem(string systemID, string systemName, IWarFoundryFactory creatingFactory) : base(systemID, systemName, creatingFactory)
 		{
 			stats = new Dictionary<string,SystemStats>();
 		}
+
+        public int SystemArmyDefaultSize
+        {
+            get { return  defaultArmySize; }
+            set
+            {
+                if (value == 0)
+                {
+                    defaultArmySize = SYSTEM_DEFAULT_ARMY_SIZE;
+                }
+                else
+                {
+                    defaultArmySize = value;
+                }
+            }
+        }
 		
 		public bool AllowAllies
 		{
--- a/schemas/system.xsd	Sat Oct 30 14:28:44 2010 +0000
+++ b/schemas/system.xsd	Mon Dec 13 20:20:00 2010 +0000
@@ -39,6 +39,7 @@
 		</xs:sequence>
 		<xs:attribute name="id" type="xs:string" />
 		<xs:attribute name="name" type="xs:string" use="required"/>
+		<xs:attribute name="defaultArmySize" type="core:nonNegativeNonInfiniteDouble" default="0"/>
 		<xs:attribute name="warn" type="xs:boolean" default="false"/>
 		<xs:attribute name="allowAllies" type="xs:boolean" default="true"/>
 		<xs:anyAttribute processContents="lax"/>