Mercurial > repos > IBBoard.WarFoundry.API
view API/WarFoundryHacks.cs @ 453:dace3b7779ca
Re #379: Fix validation of requirements to check for unit
* Restructure all validation messages to a common base system that will translate better
* Update "No More Than" texts to differentiate two contexts (adding and validating)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 29 Jan 2012 20:05:25 +0000 |
parents | ba6c762cdfc3 |
children | 81e130f3b85e |
line wrap: on
line source
// This file (WarFoundryHacks.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 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.IO; using IBBoard; using IBBoard.WarFoundry.API.Factories.Requirement; using IBBoard.WarFoundry.API.Factories.Xml; using IBBoard.WarFoundry.API.Savers; using IBBoard.WarFoundry.API.Savers.Xml; namespace IBBoard.WarFoundry.API { /// <summary> /// A collection of hacks and work-arounds to make things work correctly. /// </summary> public class WarFoundryHacks { public static void Initialise() { //Set default data path - should be a preference WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Path.Combine(Constants.ExecutablePath, "data"))); //Make sure we have at least one loader - should be controlled by plugins WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory()); //Make sure we have a way to save files - should be controlled by plugins WarFoundrySaver.SetFileSaver(new WarFoundryXmlFileSaver()); //Make sure we have the requirement factories - should be controlled by plugins WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresAtLeastNUnitsRequirementFactory()); WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresNoMoreThanNOfUnitTypeRequirementFactory()); WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresNUnitsForMUnitsRequirementFactory()); } } }