Mercurial > repos > IBDev-IBBoard.WarFoundry.API
annotate API/Objects/Requirement/UnitCountRequirementData.cs @ 397:5733e3b957cc Ticket341-DefaultArmySize
Re #341: Default army size of 0
* Set sensible defaults in GameSystem
Also:
* Setup .hgignore
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 21 Aug 2011 20:42:23 +0100 |
parents | 51cccccf3669 |
children | 0922851f6125 |
rev | line source |
---|---|
356 | 1 // This file (UnitCountRequirementData.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard |
2 // | |
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. | |
4 using System; | |
5 using IBBoard.WarFoundry.API.Objects; | |
6 | |
7 namespace IBBoard.WarFoundry.API.Objects.Requirement | |
8 { | |
9 public class UnitCountRequirementData | |
10 { | |
11 private UnitType unitType; | |
12 private int count; | |
13 | |
14 public UnitCountRequirementData(UnitType unitType, int count) | |
15 { | |
16 this.unitType = unitType; | |
17 this.count = count; | |
18 } | |
19 | |
20 public UnitType UnitType | |
21 { | |
22 get { return unitType; } | |
23 } | |
24 | |
25 public int Count | |
26 { | |
27 get { return count; } | |
28 } | |
29 | |
30 public override bool Equals (object obj) | |
31 { | |
32 if (obj == null) | |
33 { | |
34 return false; | |
35 } | |
36 else if (!(obj is UnitCountRequirementData)) | |
37 { | |
38 return false; | |
39 } | |
40 else | |
41 { | |
42 UnitCountRequirementData other = (UnitCountRequirementData)obj; | |
43 return UnitType.Equals(other.UnitType) && Count == other.Count; | |
44 } | |
337
3c4a6403a88c
* Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
45 } |
3c4a6403a88c
* Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
46 |
356 | 47 public override int GetHashCode() |
337
3c4a6403a88c
* Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
48 { |
356 | 49 return UnitType.GetHashCode() + Count; |
337
3c4a6403a88c
* Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
50 } |
356 | 51 } |
52 } | |
53 |