changeset 349:12a56786120c

Re #27: Unit requirements * Implement getting all requirements from unit types of race
author IBBoard <dev@ibboard.co.uk>
date Sat, 09 Apr 2011 19:14:11 +0000
parents d34ae0057a39
children 6c0404277cad
files API/Objects/Race.cs
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/API/Objects/Race.cs	Sat Apr 09 16:01:02 2011 +0000
     1.2 +++ b/API/Objects/Race.cs	Sat Apr 09 19:14:11 2011 +0000
     1.3 @@ -1,7 +1,6 @@
     1.4  // This file (Race.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard.
     1.5  //
     1.6  // 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.
     1.7 -
     1.8  using System;
     1.9  using System.Collections.Generic;
    1.10  using System.IO;
    1.11 @@ -306,9 +305,18 @@
    1.12  			}
    1.13  		}
    1.14  
    1.15 -		public ICollection<IRequirement> GetRequirements ()
    1.16 +		public ICollection<IRequirement> GetRequirements()
    1.17  		{
    1.18  			ICollection<IRequirement> reqs = new List<IRequirement>();
    1.19 +
    1.20 +			foreach (UnitType unitType in unitTypes.Values)
    1.21 +			{
    1.22 +				foreach (IRequirement requirement in unitType.GetRequirements())
    1.23 +				{
    1.24 +					reqs.Add(requirement);
    1.25 +				}
    1.26 +			}
    1.27 +			
    1.28  			return reqs;
    1.29  		}
    1.30  	}