Mercurial > repos > IBDev-IBBoard.WarFoundry.API
annotate API/WarFoundryHacks.cs @ 491:a41c2bc1683a
Re #410: M units for N parent models requirement
* Fix text string for requirement failure
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 02 Aug 2012 21:02:23 +0100 |
parents | e35fc85eda2b |
children |
rev | line source |
---|---|
435 | 1 // This file (WarFoundryHacks.cs) is a part of the IBBoard.WarFoundry.API 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 System.IO; | |
6 using IBBoard; | |
7 using IBBoard.WarFoundry.API.Factories.Requirement; | |
8 using IBBoard.WarFoundry.API.Factories.Xml; | |
9 using IBBoard.WarFoundry.API.Savers; | |
10 using IBBoard.WarFoundry.API.Savers.Xml; | |
483
4d6c92744254
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
481
diff
changeset
|
11 using IBBoard.WarFoundry.API.Loading; |
4d6c92744254
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
481
diff
changeset
|
12 using System.Reflection; |
435 | 13 |
14 namespace IBBoard.WarFoundry.API | |
15 { | |
16 /// <summary> | |
17 /// A collection of hacks and work-arounds to make things work correctly. | |
18 /// </summary> | |
19 public class WarFoundryHacks | |
20 { | |
21 public static void Initialise() | |
22 { | |
483
4d6c92744254
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
481
diff
changeset
|
23 //Load embedded files from resource |
4d6c92744254
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
481
diff
changeset
|
24 Assembly assm = Assembly.GetExecutingAssembly(); |
4d6c92744254
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
481
diff
changeset
|
25 LoadableObjectSourceResourceSet resSet = new LoadableObjectSourceResourceSet(assm, "IBBoard.WarFoundry.data.Empire.race", "IBBoard.WarFoundry.data.SampleSystem.system"); |
4d6c92744254
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
481
diff
changeset
|
26 WarFoundryLoader.GetDefault().AddLoadSource(resSet); |
435 | 27 //Make sure we have at least one loader - should be controlled by plugins |
28 WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory()); | |
29 //Make sure we have a way to save files - should be controlled by plugins | |
30 WarFoundrySaver.SetFileSaver(new WarFoundryXmlFileSaver()); | |
31 //Make sure we have the requirement factories - should be controlled by plugins | |
32 WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresAtLeastNUnitsRequirementFactory()); | |
33 WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresNoMoreThanNOfUnitTypeRequirementFactory()); | |
449
ba6c762cdfc3
* Add missing line to Hacks class to add third factory
IBBoard <dev@ibboard.co.uk>
parents:
435
diff
changeset
|
34 WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresNUnitsForMUnitsRequirementFactory()); |
490
e35fc85eda2b
Re #410: Create "N units per M models in parent unit" requirement
IBBoard <dev@ibboard.co.uk>
parents:
483
diff
changeset
|
35 WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresNParentModelsForMUnitsRequirementFactory()); |
435 | 36 } |
37 } | |
38 } | |
39 |