Mercurial > repos > IBDev-IBBoard.WarFoundry.API
annotate api/Requirements/AbstractArmyRequirement.cs @ 236:ca2905c9b225
Fixes #252: Remove need for text in zip file comments
* Made checks work on just content rather than zip comment to determine what file type it is
* Remove public static strings with comment strings in them
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 20 Feb 2010 20:57:13 +0000 |
parents | 2f3cafb69799 |
children |
rev | line source |
---|---|
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
1 // This file (AbstractArmyRequirement.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 IBBoard. |
0 | 2 // |
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
3 // 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. |
0 | 4 |
5 using System; | |
6 using System.Collections.Generic; | |
7 using IBBoard.WarFoundry.API.Objects; | |
8 | |
9 | |
10 namespace IBBoard.WarFoundry.API.Requirements | |
11 { | |
12 /// <summary> | |
13 /// Abstract class for any requirement for adding an object to an army, e.g. adding units. | |
14 /// </summary> | |
15 public abstract class AbstractArmyRequirement : AbstractRequirement | |
16 { | |
17 protected abstract AbstractFailedRequirement CanAddToArmy(Army army); | |
18 protected abstract AbstractFailedRequirement CanRemoveFromArmy(Army army); | |
19 | |
20 public override AbstractFailedRequirement CanAddToWarFoundryObject (WarFoundryObject obj) | |
21 { | |
22 AbstractFailedRequirement fail = null; | |
23 | |
24 if (obj is Army) | |
25 { | |
26 fail = CanAddToArmy((Army)obj); | |
27 } | |
28 else | |
29 { | |
30 fail = new FailedRequirement(this); | |
31 } | |
32 | |
33 return fail; | |
34 } | |
35 | |
36 public override AbstractFailedRequirement CanRemoveFromWarFoundryObject (WarFoundryObject obj) | |
37 { | |
38 AbstractFailedRequirement fail = null; | |
39 | |
40 if (obj is Army) | |
41 { | |
42 fail = CanRemoveFromArmy((Army)obj); | |
43 } | |
44 else | |
45 { | |
46 fail = new FailedRequirement(this); | |
47 } | |
48 | |
49 return fail; | |
50 } | |
51 } | |
52 } |