changeset 168:8e7bbea333d8

Re #198: Add slots with counts to units * Add starts of updated API and updated DTD to handle both numeric and ratio limits
author IBBoard <dev@ibboard.co.uk>
date Tue, 06 Oct 2009 15:44:04 +0000
parents 9ba56a8e5096
children ae7915c94747
files IBBoard.WarFoundry.API.csproj api/Objects/AbstractUnitEquipmentSlot.cs api/Objects/DefaultUnitEquipmentSlot.cs api/Objects/NumericLimitUnitEquipmentSlot.cs api/Objects/RatioLimitUnitEquipmentSlot.cs dtds/race.xsd
diffstat 6 files changed, 106 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/IBBoard.WarFoundry.API.csproj	Tue Oct 06 14:59:54 2009 +0000
+++ b/IBBoard.WarFoundry.API.csproj	Tue Oct 06 15:44:04 2009 +0000
@@ -95,6 +95,9 @@
     <Compile Include="api\Objects\Army.cs" />
     <Compile Include="api\Objects\ArmyCategory.cs" />
     <Compile Include="api\Objects\Category.cs" />
+    <Compile Include="api\Objects\RatioLimitUnitEquipmentSlot.cs" />
+    <Compile Include="api\Objects\NumericLimitUnitEquipmentSlot.cs" />
+    <Compile Include="api\Objects\DefaultUnitEquipmentSlot.cs" />
     <Compile Include="api\Objects\DuplicateItemException.cs" />
     <Compile Include="api\Objects\EquipmentItem.cs" />
     <Compile Include="api\Objects\GameSystem.cs" />
@@ -108,6 +111,7 @@
     <Compile Include="api\Objects\SystemStats.cs" />
     <Compile Include="api\Objects\Unit.cs" />
     <Compile Include="api\Objects\UnitEquipmentItem.cs" />
+    <Compile Include="api\Objects\UnitEquipmentSlot.cs" />
     <Compile Include="api\Objects\UnitType.cs" />
     <Compile Include="api\Objects\WarFoundryObject.cs" />
     <Compile Include="api\Objects\WarFoundryStagedLoadingObject.cs" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Objects/AbstractUnitEquipmentSlot.cs	Tue Oct 06 15:44:04 2009 +0000
@@ -0,0 +1,41 @@
+// This file (UnitEquipmentSlot.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard.
+//
+// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace IBBoard.WarFoundry.API.Objects
+{
+	/// <summary>
+	/// An abstract base implementation of an equipment slot for a unit
+	/// </summary>
+	public abstract class AbstractUnitEquipmentSlot
+	{
+		private string name;
+		private double limit;
+
+		public AbstractUnitEquipmentSlot(string slotName, double slotLimit)
+		{
+			name = slotName;
+			limit = slotLimit;
+		}
+
+		public string Name
+		{
+			get
+			{
+				return name;
+			}
+		}
+
+		public double Limit
+		{
+			get
+			{
+				return limit;
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Objects/DefaultUnitEquipmentSlot.cs	Tue Oct 06 15:44:04 2009 +0000
@@ -0,0 +1,17 @@
+// This file (DefaultUnitEquipmentSlot.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard.
+//
+// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace IBBoard.WarFoundry.API.Objects
+{
+	public class DefaultUnitEquipmentSlot : AbstractUnitEquipmentSlot
+	{
+		public DefaultUnitEquipmentSlot() : base("", WarFoundryCore.INFINITY)
+		{
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Objects/NumericLimitUnitEquipmentSlot.cs	Tue Oct 06 15:44:04 2009 +0000
@@ -0,0 +1,18 @@
+// This file (NumericLimitUnitEquipmentSlot.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard.
+//
+// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace IBBoard.WarFoundry.API.Objects
+{
+	public class NumericLimitUnitEquipmentSlot : AbstractUnitEquipmentSlot
+	{
+		public NumericLimitUnitEquipmentSlot(string slotName, int ratioLimit)
+			: base("", ratioLimit)
+		{
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Objects/RatioLimitUnitEquipmentSlot.cs	Tue Oct 06 15:44:04 2009 +0000
@@ -0,0 +1,24 @@
+// This file (RatioLimitUnitEquipmentSlot.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard.
+//
+// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
+
+using System;
+using IBBoard.Lang;
+
+namespace IBBoard.WarFoundry.API.Objects
+{
+	public class RatioLimitUnitEquipmentSlot : AbstractUnitEquipmentSlot
+	{
+		private RoundType roundDir;
+
+		public RatioLimitUnitEquipmentSlot(string slotName, double ratioLimit, RoundType roundDirection) : base(slotName, ratioLimit)
+		{
+			roundDir = roundDirection;
+		}
+
+		public RoundType RoundType
+		{
+			get { return roundDir; }
+		}
+	}
+}
--- a/dtds/race.xsd	Tue Oct 06 14:59:54 2009 +0000
+++ b/dtds/race.xsd	Tue Oct 06 15:44:04 2009 +0000
@@ -36,7 +36,8 @@
 														<xs:simpleContent>
 															<xs:extension base="xs:string">
 																<xs:attribute name="name" type="xs:string" use="required"/>
-																<xs:attribute name="limit" type="xs:positiveInteger" use="required"/>
+																<xs:attribute name="limit" type="xs:integer" default="0"/>
+																<xs:attribute name="isPercentage" type="xs:boolean" default="false"/>
 																<xs:anyAttribute/>
 															</xs:extension>
 														</xs:simpleContent>