annotate api/WarFoundryCore.cs @ 104:2f3cafb69799

Re #121: Migrate to AGPL license * Update all API files to AGPL license * Include AGPL license and remove GPL/LGPL documents * Fix copyright dates where they're known
author IBBoard <dev@ibboard.co.uk>
date Sat, 15 Aug 2009 10:36:50 +0000
parents 3ea0ab04352b
children 52cacdbcb001
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104
2f3cafb69799 Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents: 82
diff changeset
1 // This file (WarFoundryCore.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard.
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
104
2f3cafb69799 Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents: 82
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
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using IBBoard.Logging;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using IBBoard.WarFoundry.API.Objects;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 namespace IBBoard.WarFoundry.API
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 public class WarFoundryCore
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 {
38
548cfc776f54 Fixes #34 - Remove "Choices" and "Base/Increment" from Category
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
13 public static readonly int INFINITY = -1;
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
14 public static event GameSystemChangedDelegate GameSystemChanged;
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 public static event ArmyChangedDelegate ArmyChanged;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 private static GameSystem system;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 private static Army currentArmy;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
20 public static GameSystem CurrentGameSystem
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
21 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
22 get { return system; }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
23 set
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
24 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
25 if (system==null || !system.Equals(value))
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 {
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
27 GameSystem oldSystem = system;
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 system = value;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 if (system==null)
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 LogNotifier.Debug(typeof(WarFoundryCore), "Game system set to null");
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 else
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 LogNotifier.DebugFormat(typeof(WarFoundryCore), "Game system set to {0} with ID {1}", system.Name, system.ID);
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
37 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
38
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
39 if (GameSystemChanged!=null)
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
40 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
41 GameSystemChanged(oldSystem, system);
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 //If we've changed the game system then we can't keep the current army
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
45 CurrentArmy = null;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
46 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
47 }
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
50 public static Army CurrentArmy
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
51 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
52 get { return currentArmy; }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
53 set
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
54 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
55 if (currentArmy==null || !currentArmy.Equals(value))
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
56 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
57 /*if (currentArmy!=null)
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
58 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
59 currentArmy.UnitAdded-= UnitAddedMethod;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
60 currentArmy.UnitRemoved-= UnitRemovedMethod;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
61 currentArmy.PointsValueChanged-= PointsValueChangedMethod;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
62 currentArmy.FailedRequirement-=FailedUnitRequirementMethod;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
63 }*/
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
64 Army oldArmy = currentArmy;
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65 currentArmy = value;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67 if (currentArmy!=null)
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69 CurrentGameSystem = currentArmy.GameSystem; //Set the game system in case the new army is from a different system
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
70 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
71
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
72 /*if (currentArmy!=null)
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
73 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
74 currentArmy.UnitAdded+= UnitAddedMethod;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
75 currentArmy.UnitRemoved+= UnitRemovedMethod;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
76 currentArmy.PointsValueChanged+= PointsValueChangedMethod;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
77 currentArmy.FailedRequirement+=FailedUnitRequirementMethod;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
78 }*/
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
79
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
80 if (ArmyChanged!=null)
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
81 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
82 ArmyChanged(oldArmy, currentArmy);
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
83 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
84 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 38
diff changeset
85 }
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
86 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
87 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
88 }